This commit was manufactured by cvs2svn to create branch cagney_offbyone-20030303-branchpoint
authornobody <>
Mon, 3 Mar 2003 20:50:21 +0000 (20:50 +0000)
committernobody <>
Mon, 3 Mar 2003 20:50:21 +0000 (20:50 +0000)
'cagney_offbyone-20030303-branch'.

Sprout from interps-20030202-branch 2003-02-02 23:00:07 UTC nobody 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from master 2003-03-03 20:50:20 UTC Andrew Cagney <cagney@redhat.com> '2003-03-03  Andrew Cagney  <cagney@redhat.com>':
    ChangeLog
    Makefile.def
    Makefile.in
    Makefile.tpl
    bfd/ChangeLog
    bfd/Makefile.am
    bfd/Makefile.in
    bfd/archures.c
    bfd/bfd-in.h
    bfd/bfd-in2.h
    bfd/bfd.c
    bfd/coff-h8300.c
    bfd/coff-ppc.c
    bfd/coffcode.h
    bfd/config.bfd
    bfd/cpu-arm.c
    bfd/doc/ChangeLog
    bfd/doc/bfd.texinfo
    bfd/doc/fdl.texi
    bfd/ecoff.c
    bfd/elf-bfd.h
    bfd/elf-eh-frame.c
    bfd/elf.c
    bfd/elf32-arm.h
    bfd/elf32-cris.c
    bfd/elf32-hppa.c
    bfd/elf32-i386.c
    bfd/elf32-m68k.c
    bfd/elf32-mips.c
    bfd/elf32-ppc.c
    bfd/elf32-ppc.h
    bfd/elf32-s390.c
    bfd/elf32-sh.c
    bfd/elf32-sparc.c
    bfd/elf32-vax.c
    bfd/elf64-alpha.c
    bfd/elf64-hppa.c
    bfd/elf64-mips.c
    bfd/elf64-mmix.c
    bfd/elf64-ppc.c
    bfd/elf64-ppc.h
    bfd/elf64-s390.c
    bfd/elf64-sparc.c
    bfd/elf64-x86-64.c
    bfd/elfcore.h
    bfd/elflink.c
    bfd/elflink.h
    bfd/elfn32-mips.c
    bfd/elfxx-ia64.c
    bfd/elfxx-mips.c
    bfd/format.c
    bfd/ieee.c
    bfd/libbfd.h
    bfd/libcoff.h
    bfd/mmo.c
    bfd/oasys.c
    bfd/po/da.po
    bfd/reloc.c
    bfd/section.c
    bfd/syms.c
    bfd/targets.c
    bfd/version.h
    config.guess
    config.sub
    configure
    configure.in
    gdb/ChangeLog
    gdb/MAINTAINERS
    gdb/Makefile.in
    gdb/NEWS
    gdb/PROBLEMS
    gdb/TODO
    gdb/acinclude.m4
    gdb/aclocal.m4
    gdb/ada-exp.y
    gdb/ada-lang.c
    gdb/ada-lang.h
    gdb/ada-typeprint.c
    gdb/alpha-tdep.c
    gdb/arch-utils.c
    gdb/arm-linux-tdep.c
    gdb/arm-tdep.c
    gdb/avr-tdep.c
    gdb/ax-gdb.c
    gdb/block.c
    gdb/block.h
    gdb/blockframe.c
    gdb/breakpoint.c
    gdb/breakpoint.h
    gdb/buildsym.c
    gdb/buildsym.h
    gdb/c-exp.y
    gdb/c-valprint.c
    gdb/cli-out.c
    gdb/cli-out.h
    gdb/cli/cli-cmds.c
    gdb/cli/cli-decode.c
    gdb/cli/cli-dump.c
    gdb/cli/cli-interp.c
    gdb/cli/cli-script.c
    gdb/cli/cli-setshow.c
    gdb/coff-pe-read.c
    gdb/coff-pe-read.h
    gdb/coffread.c
    gdb/config.in
    gdb/config/djgpp/fnchange.lst
    gdb/config/h8500/h8500.mt
    gdb/config/h8500/tm-h8500.h
    gdb/config/i386/nm-i386.h
    gdb/config/i386/nm-i386sco5.h
    gdb/config/i386/nm-i386sol2.h
    gdb/config/i386/tm-ptx.h
    gdb/config/ia64/tm-ia64.h
    gdb/config/m32r/m32r.mt
    gdb/config/m32r/tm-m32r.h
    gdb/config/mn10200/mn10200.mt
    gdb/config/mn10200/tm-mn10200.h
    gdb/config/pa/tm-hppa.h
    gdb/config/pa/tm-hppa64.h
    gdb/config/s390/nm-linux.h
    gdb/config/sparc/nm-sun4sol2.h
    gdb/config/sparc/tm-sp64.h
    gdb/config/sparc/tm-sparc.h
    gdb/config/z8k/tm-z8k.h
    gdb/config/z8k/z8k.mt
    gdb/configure
    gdb/configure.host
    gdb/configure.in
    gdb/configure.tgt
    gdb/cp-valprint.c
    gdb/cris-tdep.c
    gdb/d10v-tdep.c
    gdb/dbxread.c
    gdb/defs.h
    gdb/disasm.c
    gdb/doc/ChangeLog
    gdb/doc/Makefile.in
    gdb/doc/gdb.texinfo
    gdb/doc/gdbint.texinfo
    gdb/doublest.c
    gdb/dwarf2cfi.c
    gdb/dwarf2expr.c
    gdb/dwarf2expr.h
    gdb/dwarf2loc.c
    gdb/dwarf2loc.h
    gdb/dwarf2read.c
    gdb/dwarfread.c
    gdb/elfread.c
    gdb/event-top.c
    gdb/event-top.h
    gdb/expprint.c
    gdb/f-exp.y
    gdb/f-lang.c
    gdb/f-valprint.c
    gdb/findvar.c
    gdb/frame.c
    gdb/frame.h
    gdb/frv-tdep.c
    gdb/gdb.c
    gdb/gdb_mbuild.sh
    gdb/gdb_thread_db.h
    gdb/gdbarch.c
    gdb/gdbarch.h
    gdb/gdbarch.sh
    gdb/gdbtypes.c
    gdb/gdbtypes.h
    gdb/gnu-v2-abi.c
    gdb/h8300-tdep.c
    gdb/h8500-tdep.c
    gdb/hppa-tdep.c
    gdb/hpread.c
    gdb/hpux-thread.c
    gdb/i386-interix-tdep.c
    gdb/i386-linux-tdep.c
    gdb/i386-tdep.c
    gdb/i386bsd-tdep.c
    gdb/ia64-linux-nat.c
    gdb/ia64-tdep.c
    gdb/infcmd.c
    gdb/inflow.c
    gdb/inflow.h
    gdb/infptrace.c
    gdb/infrun.c
    gdb/inftarg.c
    gdb/infttrace.c
    gdb/interps.c
    gdb/interps.h
    gdb/jv-exp.y
    gdb/jv-lang.c
    gdb/jv-typeprint.c
    gdb/jv-valprint.c
    gdb/linespec.c
    gdb/linux-proc.c
    gdb/lynx-nat.c
    gdb/m2-exp.y
    gdb/m32r-rom.c
    gdb/m32r-stub.c
    gdb/m32r-tdep.c
    gdb/m68hc11-tdep.c
    gdb/m68k-tdep.c
    gdb/main.c
    gdb/main.h
    gdb/maint.c
    gdb/mcore-tdep.c
    gdb/mdebugread.c
    gdb/mi/ChangeLog
    gdb/mi/gdbmi.texinfo
    gdb/mi/mi-cmd-env.c
    gdb/mi/mi-cmd-stack.c
    gdb/mi/mi-cmds.c
    gdb/mi/mi-cmds.h
    gdb/mi/mi-console.c
    gdb/mi/mi-console.h
    gdb/mi/mi-interp.c
    gdb/mi/mi-main.c
    gdb/mi/mi-main.h
    gdb/minsyms.c
    gdb/mips-tdep.c
    gdb/mipsread.c
    gdb/mn10200-tdep.c
    gdb/mn10300-tdep.c
    gdb/monitor.c
    gdb/nlmread.c
    gdb/ns32k-tdep.c
    gdb/objc-exp.y
    gdb/objc-lang.c
    gdb/objc-lang.h
    gdb/objfiles.c
    gdb/objfiles.h
    gdb/observer.c
    gdb/observer.h
    gdb/osabi.c
    gdb/p-exp.y
    gdb/p-valprint.c
    gdb/parse.c
    gdb/parser-defs.h
    gdb/ppc-linux-nat.c
    gdb/ppc-linux-tdep.c
    gdb/printcmd.c
    gdb/proc-api.c
    gdb/procfs.c
    gdb/rdi-share/ardi.c
    gdb/regcache.c
    gdb/regcache.h
    gdb/remote-e7000.c
    gdb/remote-sim.c
    gdb/remote.c
    gdb/rs6000-tdep.c
    gdb/s390-tdep.c
    gdb/sh-tdep.c
    gdb/sol-thread.c
    gdb/solib-sunos.c
    gdb/solib.c
    gdb/solist.h
    gdb/somread.c
    gdb/somsolib.c
    gdb/sparc-nat.c
    gdb/sparc-tdep.c
    gdb/stabsread.c
    gdb/stack.c
    gdb/symfile.c
    gdb/symfile.h
    gdb/symm-nat.c
    gdb/symmisc.c
    gdb/symtab.c
    gdb/symtab.h
    gdb/target.c
    gdb/target.h
    gdb/testsuite/ChangeLog
    gdb/testsuite/Makefile.in
    gdb/testsuite/configure.in
    gdb/testsuite/gdb.base/advance.c
    gdb/testsuite/gdb.base/advance.exp
    gdb/testsuite/gdb.base/dump.exp
    gdb/testsuite/gdb.base/exprs.exp
    gdb/testsuite/gdb.base/funcargs.exp
    gdb/testsuite/gdb.base/list.exp
    gdb/testsuite/gdb.base/maint.exp
    gdb/testsuite/gdb.base/ptype.exp
    gdb/testsuite/gdb.base/restore.c
    gdb/testsuite/gdb.base/until.exp
    gdb/testsuite/gdb.base/watchpoint.exp
    gdb/testsuite/gdb.c++/anon-union.exp
    gdb/testsuite/gdb.c++/classes.exp
    gdb/testsuite/gdb.c++/cplusfuncs.exp
    gdb/testsuite/gdb.c++/inherit.exp
    gdb/testsuite/gdb.c++/local.cc
    gdb/testsuite/gdb.c++/local.exp
    gdb/testsuite/gdb.c++/overload.cc
    gdb/testsuite/gdb.c++/overload.exp
    gdb/testsuite/gdb.c++/ovldbreak.exp
    gdb/testsuite/gdb.c++/pr-1023.cc
    gdb/testsuite/gdb.c++/pr-1023.exp
    gdb/testsuite/gdb.c++/templates.exp
    gdb/testsuite/gdb.c++/virtfunc.exp
    gdb/testsuite/gdb.disasm/Makefile.in
    gdb/testsuite/gdb.disasm/mn10200.exp
    gdb/testsuite/gdb.mi/ChangeLog
    gdb/testsuite/gdb.mi/mi-cli.exp
    gdb/testsuite/gdb.mi/mi-syn-frame.c
    gdb/testsuite/gdb.mi/mi-syn-frame.exp
    gdb/testsuite/gdb.trace/Makefile.in
    gdb/testsuite/lib/gdb.exp
    gdb/thread.c
    gdb/top.c
    gdb/tracepoint.c
    gdb/tui/ChangeLog
    gdb/tui/tui-hooks.c
    gdb/tui/tui-interp.c
    gdb/tui/tui.c
    gdb/tui/tuiData.h
    gdb/tui/tuiIO.c
    gdb/typeprint.c
    gdb/ui-out.c
    gdb/ui-out.h
    gdb/utils.c
    gdb/v850-tdep.c
    gdb/valops.c
    gdb/value.h
    gdb/values.c
    gdb/vax-tdep.c
    gdb/version.in
    gdb/win32-nat.c
    gdb/wrapper.h
    gdb/x86-64-linux-nat.c
    gdb/x86-64-tdep.c
    gdb/xcoffread.c
    gdb/xstormy16-tdep.c
    gdb/z8k-tdep.c
    include/ChangeLog
    include/elf/ChangeLog
    include/elf/arm.h
    include/elf/ia64.h
    include/elf/ppc.h
    include/elf/ppc64.h
    include/gdb/ChangeLog
    include/gdb/remote-sim.h
    include/libiberty.h
    include/opcode/ChangeLog
    include/opcode/h8300.h
    libiberty/ChangeLog
    libiberty/Makefile.in
    libiberty/acconfig.h
    libiberty/aclocal.m4
    libiberty/config.in
    libiberty/configure
    libiberty/configure.in
    libiberty/cplus-dem.c
    libiberty/functions.texi
    libiberty/libiberty.texi
    libiberty/lrealpath.c
    libiberty/make-relative-prefix.c
    libiberty/physmem.c
    libtool.m4
    ltcf-cxx.sh
    ltcf-gcj.sh
    ltconfig
    opcodes/ChangeLog
    opcodes/fr30-desc.c
    opcodes/hppa-dis.c
    opcodes/i386-dis.c
    opcodes/mips-dis.c
    readline/ChangeLog.gdb
    readline/Makefile.in
    readline/aclocal.m4
    readline/config.h.in
    readline/configure
    readline/rlmbutil.h
    readline/shlib/Makefile.in
    sim/ChangeLog
    sim/arm/ChangeLog
    sim/arm/armos.c
    sim/arm/wrapper.c
    sim/common/ChangeLog
    sim/common/Make-common.in
    sim/common/nrun.c
    sim/common/sim-base.h
    sim/common/sim-engine.c
    sim/common/sim-engine.h
    sim/common/sim-hload.c
    sim/common/sim-module.c
    sim/common/sim-utils.h
    sim/d10v/ChangeLog
    sim/d10v/interp.c
    sim/erc32/ChangeLog
    sim/erc32/interf.c
    sim/h8300/ChangeLog
    sim/h8300/compile.c
    sim/h8500/ChangeLog
    sim/h8500/compile.c
    sim/i960/ChangeLog
    sim/i960/sim-if.c
    sim/m32r/ChangeLog
    sim/m32r/sim-if.c
    sim/m68hc11/ChangeLog
    sim/m68hc11/Makefile.in
    sim/m68hc11/interp.c
    sim/mcore/ChangeLog
    sim/mcore/interp.c
    sim/mips/ChangeLog
    sim/mips/interp.c
    sim/mn10200/ChangeLog
    sim/mn10200/interp.c
    sim/mn10300/ChangeLog
    sim/mn10300/am33.igen
    sim/mn10300/dv-mn103tim.c
    sim/mn10300/interp.c
    sim/ppc/ChangeLog
    sim/ppc/sim_calls.c
    sim/sh/ChangeLog
    sim/sh/gencode.c
    sim/sh/interp.c
    sim/v850/ChangeLog
    sim/v850/interp.c
    sim/z8k/ChangeLog
    sim/z8k/iface.c
Delete:
    gdb/config/i386/gdbserve.mt
    gdb/config/i386/i386sco5.mt
    gdb/config/i386/i386v4.mt
    gdb/config/i386/i386v42mp.mt
    gdb/config/m68k/nm-apollo68b.h
    gdb/config/m68k/nm-hp300bsd.h
    gdb/config/m68k/tm-apollo68b.h
    gdb/config/m68k/tm-es1800.h
    gdb/config/m68k/tm-hp300bsd.h
    gdb/config/m68k/tm-mac.h
    gdb/config/m68k/xm-apollo68b.h
    gdb/config/pa/hpux1020.mt
    gdb/config/pa/hpux11.mt
    gdb/config/pa/hpux11w.mt
    gdb/config/powerpc/gdbserve.mt
    gdb/config/powerpc/ppcle-eabi.mt
    gdb/config/powerpc/ppcle-sim.mt
    gdb/config/powerpc/tm-ppc-sim.h
    gdb/config/sparc/sp64sim.mt
    gdb/config/sparc/tm-sp64sim.h
    sim/common/sim-break.c
    sim/common/sim-break.h

434 files changed:
ChangeLog
Makefile.def
Makefile.in
Makefile.tpl
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/archures.c
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/bfd.c
bfd/coff-h8300.c
bfd/coff-ppc.c
bfd/coffcode.h
bfd/config.bfd
bfd/cpu-arm.c
bfd/doc/ChangeLog
bfd/doc/bfd.texinfo
bfd/doc/fdl.texi [new file with mode: 0644]
bfd/ecoff.c
bfd/elf-bfd.h
bfd/elf-eh-frame.c
bfd/elf.c
bfd/elf32-arm.h
bfd/elf32-cris.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-m68k.c
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf32-ppc.h [new file with mode: 0644]
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-sparc.c
bfd/elf32-vax.c
bfd/elf64-alpha.c
bfd/elf64-hppa.c
bfd/elf64-mips.c
bfd/elf64-mmix.c
bfd/elf64-ppc.c
bfd/elf64-ppc.h
bfd/elf64-s390.c
bfd/elf64-sparc.c
bfd/elf64-x86-64.c
bfd/elfcore.h
bfd/elflink.c
bfd/elflink.h
bfd/elfn32-mips.c
bfd/elfxx-ia64.c
bfd/elfxx-mips.c
bfd/format.c
bfd/ieee.c
bfd/libbfd.h
bfd/libcoff.h
bfd/mmo.c
bfd/oasys.c
bfd/po/da.po
bfd/reloc.c
bfd/section.c
bfd/syms.c
bfd/targets.c
bfd/version.h
config.guess
config.sub
configure
configure.in
gdb/ChangeLog
gdb/MAINTAINERS
gdb/Makefile.in
gdb/NEWS
gdb/PROBLEMS
gdb/TODO
gdb/acinclude.m4
gdb/aclocal.m4
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-lang.h
gdb/ada-typeprint.c
gdb/alpha-tdep.c
gdb/arch-utils.c
gdb/arm-linux-tdep.c
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/ax-gdb.c
gdb/block.c [new file with mode: 0644]
gdb/block.h [new file with mode: 0644]
gdb/blockframe.c
gdb/breakpoint.c
gdb/breakpoint.h
gdb/buildsym.c
gdb/buildsym.h
gdb/c-exp.y
gdb/c-valprint.c
gdb/cli-out.c
gdb/cli-out.h
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-dump.c
gdb/cli/cli-interp.c [new file with mode: 0644]
gdb/cli/cli-script.c
gdb/cli/cli-setshow.c
gdb/coff-pe-read.c [new file with mode: 0644]
gdb/coff-pe-read.h [moved from gdb/config/m68k/tm-mac.h with 60% similarity]
gdb/coffread.c
gdb/config.in
gdb/config/djgpp/fnchange.lst
gdb/config/h8500/h8500.mt
gdb/config/h8500/tm-h8500.h
gdb/config/i386/gdbserve.mt [deleted file]
gdb/config/i386/i386sco5.mt [deleted file]
gdb/config/i386/i386v4.mt [deleted file]
gdb/config/i386/i386v42mp.mt [deleted file]
gdb/config/i386/nm-i386.h
gdb/config/i386/nm-i386sco5.h
gdb/config/i386/nm-i386sol2.h
gdb/config/i386/tm-ptx.h
gdb/config/ia64/tm-ia64.h
gdb/config/m32r/m32r.mt
gdb/config/m32r/tm-m32r.h
gdb/config/m68k/nm-hp300bsd.h [deleted file]
gdb/config/m68k/tm-apollo68b.h [deleted file]
gdb/config/m68k/tm-es1800.h [deleted file]
gdb/config/m68k/tm-hp300bsd.h [deleted file]
gdb/config/mn10200/mn10200.mt
gdb/config/mn10200/tm-mn10200.h
gdb/config/pa/hpux1020.mt [deleted file]
gdb/config/pa/hpux11.mt [deleted file]
gdb/config/pa/hpux11w.mt [deleted file]
gdb/config/pa/tm-hppa.h
gdb/config/pa/tm-hppa64.h
gdb/config/powerpc/gdbserve.mt [deleted file]
gdb/config/powerpc/ppcle-eabi.mt [deleted file]
gdb/config/powerpc/ppcle-sim.mt [deleted file]
gdb/config/s390/nm-linux.h
gdb/config/sparc/nm-sun4sol2.h
gdb/config/sparc/sp64sim.mt [deleted file]
gdb/config/sparc/tm-sp64.h
gdb/config/sparc/tm-sp64sim.h [deleted file]
gdb/config/sparc/tm-sparc.h
gdb/config/z8k/tm-z8k.h
gdb/config/z8k/z8k.mt
gdb/configure
gdb/configure.host
gdb/configure.in
gdb/configure.tgt
gdb/cp-valprint.c
gdb/cris-tdep.c
gdb/d10v-tdep.c
gdb/dbxread.c
gdb/defs.h
gdb/disasm.c
gdb/doc/ChangeLog
gdb/doc/Makefile.in
gdb/doc/gdb.texinfo
gdb/doc/gdbint.texinfo
gdb/doublest.c
gdb/dwarf2cfi.c
gdb/dwarf2expr.c [new file with mode: 0644]
gdb/dwarf2expr.h [new file with mode: 0644]
gdb/dwarf2loc.c [new file with mode: 0644]
gdb/dwarf2loc.h [moved from gdb/config/m68k/nm-apollo68b.h with 52% similarity]
gdb/dwarf2read.c
gdb/dwarfread.c
gdb/elfread.c
gdb/event-top.c
gdb/event-top.h
gdb/expprint.c
gdb/f-exp.y
gdb/f-lang.c
gdb/f-valprint.c
gdb/findvar.c
gdb/frame.c
gdb/frame.h
gdb/frv-tdep.c
gdb/gdb.c
gdb/gdb_mbuild.sh
gdb/gdb_thread_db.h
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v2-abi.c
gdb/h8300-tdep.c
gdb/h8500-tdep.c
gdb/hppa-tdep.c
gdb/hpread.c
gdb/hpux-thread.c
gdb/i386-interix-tdep.c
gdb/i386-linux-tdep.c
gdb/i386-tdep.c
gdb/i386bsd-tdep.c
gdb/ia64-linux-nat.c
gdb/ia64-tdep.c
gdb/infcmd.c
gdb/inflow.c
gdb/inflow.h [new file with mode: 0644]
gdb/infptrace.c
gdb/infrun.c
gdb/inftarg.c
gdb/infttrace.c
gdb/interps.c [new file with mode: 0644]
gdb/interps.h [new file with mode: 0644]
gdb/jv-exp.y
gdb/jv-lang.c
gdb/jv-typeprint.c
gdb/jv-valprint.c
gdb/linespec.c
gdb/linux-proc.c
gdb/lynx-nat.c
gdb/m2-exp.y
gdb/m32r-rom.c
gdb/m32r-stub.c
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/main.c
gdb/main.h
gdb/maint.c
gdb/mcore-tdep.c
gdb/mdebugread.c
gdb/mi/ChangeLog
gdb/mi/gdbmi.texinfo
gdb/mi/mi-cmd-env.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-cmds.c
gdb/mi/mi-cmds.h
gdb/mi/mi-console.c
gdb/mi/mi-console.h
gdb/mi/mi-interp.c [new file with mode: 0644]
gdb/mi/mi-main.c
gdb/mi/mi-main.h [moved from gdb/config/powerpc/tm-ppc-sim.h with 65% similarity]
gdb/minsyms.c
gdb/mips-tdep.c
gdb/mipsread.c
gdb/mn10200-tdep.c
gdb/mn10300-tdep.c
gdb/monitor.c
gdb/nlmread.c
gdb/ns32k-tdep.c
gdb/objc-exp.y
gdb/objc-lang.c
gdb/objc-lang.h
gdb/objfiles.c
gdb/objfiles.h
gdb/observer.c [new file with mode: 0644]
gdb/observer.h [moved from gdb/config/m68k/xm-apollo68b.h with 62% similarity]
gdb/osabi.c
gdb/p-exp.y
gdb/p-valprint.c
gdb/parse.c
gdb/parser-defs.h
gdb/ppc-linux-nat.c
gdb/ppc-linux-tdep.c
gdb/printcmd.c
gdb/proc-api.c
gdb/procfs.c
gdb/rdi-share/ardi.c
gdb/regcache.c
gdb/regcache.h
gdb/remote-e7000.c
gdb/remote-sim.c
gdb/remote.c
gdb/rs6000-tdep.c
gdb/s390-tdep.c
gdb/sh-tdep.c
gdb/sol-thread.c
gdb/solib-sunos.c
gdb/solib.c
gdb/solist.h
gdb/somread.c
gdb/somsolib.c
gdb/sparc-nat.c
gdb/sparc-tdep.c
gdb/stabsread.c
gdb/stack.c
gdb/symfile.c
gdb/symfile.h
gdb/symm-nat.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/target.c
gdb/target.h
gdb/testsuite/ChangeLog
gdb/testsuite/Makefile.in
gdb/testsuite/configure.in
gdb/testsuite/gdb.base/advance.c
gdb/testsuite/gdb.base/advance.exp
gdb/testsuite/gdb.base/dump.exp
gdb/testsuite/gdb.base/exprs.exp
gdb/testsuite/gdb.base/funcargs.exp
gdb/testsuite/gdb.base/list.exp
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/gdb.base/ptype.exp
gdb/testsuite/gdb.base/restore.c
gdb/testsuite/gdb.base/until.exp
gdb/testsuite/gdb.base/watchpoint.exp
gdb/testsuite/gdb.c++/anon-union.exp
gdb/testsuite/gdb.c++/classes.exp
gdb/testsuite/gdb.c++/cplusfuncs.exp
gdb/testsuite/gdb.c++/inherit.exp
gdb/testsuite/gdb.c++/local.cc
gdb/testsuite/gdb.c++/local.exp
gdb/testsuite/gdb.c++/overload.cc
gdb/testsuite/gdb.c++/overload.exp
gdb/testsuite/gdb.c++/ovldbreak.exp
gdb/testsuite/gdb.c++/pr-1023.cc [new file with mode: 0644]
gdb/testsuite/gdb.c++/pr-1023.exp [new file with mode: 0644]
gdb/testsuite/gdb.c++/templates.exp
gdb/testsuite/gdb.c++/virtfunc.exp
gdb/testsuite/gdb.disasm/Makefile.in
gdb/testsuite/gdb.disasm/mn10200.exp
gdb/testsuite/gdb.mi/ChangeLog
gdb/testsuite/gdb.mi/mi-cli.exp [new file with mode: 0644]
gdb/testsuite/gdb.mi/mi-syn-frame.c
gdb/testsuite/gdb.mi/mi-syn-frame.exp
gdb/testsuite/gdb.trace/Makefile.in
gdb/testsuite/lib/gdb.exp
gdb/thread.c
gdb/top.c
gdb/tracepoint.c
gdb/tui/ChangeLog
gdb/tui/tui-hooks.c
gdb/tui/tui-interp.c [new file with mode: 0644]
gdb/tui/tui.c
gdb/tui/tuiData.h
gdb/tui/tuiIO.c
gdb/typeprint.c
gdb/ui-out.c
gdb/ui-out.h
gdb/utils.c
gdb/v850-tdep.c
gdb/valops.c
gdb/value.h
gdb/values.c
gdb/vax-tdep.c
gdb/version.in
gdb/win32-nat.c
gdb/wrapper.h
gdb/x86-64-linux-nat.c
gdb/x86-64-tdep.c
gdb/xcoffread.c
gdb/xstormy16-tdep.c
gdb/z8k-tdep.c
include/ChangeLog
include/elf/ChangeLog
include/elf/arm.h
include/elf/ia64.h
include/elf/ppc.h
include/elf/ppc64.h
include/gdb/ChangeLog
include/gdb/remote-sim.h
include/libiberty.h
include/opcode/ChangeLog
include/opcode/h8300.h
libiberty/ChangeLog
libiberty/Makefile.in
libiberty/acconfig.h [new file with mode: 0644]
libiberty/aclocal.m4
libiberty/config.in
libiberty/configure
libiberty/configure.in
libiberty/cplus-dem.c
libiberty/functions.texi
libiberty/libiberty.texi
libiberty/lrealpath.c [new file with mode: 0644]
libiberty/make-relative-prefix.c
libiberty/physmem.c [new file with mode: 0644]
libtool.m4
ltcf-cxx.sh
ltcf-gcj.sh
ltconfig
opcodes/ChangeLog
opcodes/fr30-desc.c
opcodes/hppa-dis.c
opcodes/i386-dis.c
opcodes/mips-dis.c
readline/ChangeLog.gdb
readline/Makefile.in
readline/aclocal.m4
readline/config.h.in
readline/configure
readline/rlmbutil.h
readline/shlib/Makefile.in
sim/ChangeLog
sim/arm/ChangeLog
sim/arm/armos.c
sim/arm/wrapper.c
sim/common/ChangeLog
sim/common/Make-common.in
sim/common/nrun.c
sim/common/sim-base.h
sim/common/sim-break.c [deleted file]
sim/common/sim-break.h [deleted file]
sim/common/sim-engine.c
sim/common/sim-engine.h
sim/common/sim-hload.c
sim/common/sim-module.c
sim/common/sim-utils.h
sim/d10v/ChangeLog
sim/d10v/interp.c
sim/erc32/ChangeLog
sim/erc32/interf.c
sim/h8300/ChangeLog
sim/h8300/compile.c
sim/h8500/ChangeLog
sim/h8500/compile.c
sim/i960/ChangeLog
sim/i960/sim-if.c
sim/m32r/ChangeLog
sim/m32r/sim-if.c
sim/m68hc11/ChangeLog
sim/m68hc11/Makefile.in
sim/m68hc11/interp.c
sim/mcore/ChangeLog
sim/mcore/interp.c
sim/mips/ChangeLog
sim/mips/interp.c
sim/mn10200/ChangeLog
sim/mn10200/interp.c
sim/mn10300/ChangeLog
sim/mn10300/am33.igen
sim/mn10300/dv-mn103tim.c
sim/mn10300/interp.c
sim/ppc/ChangeLog
sim/ppc/sim_calls.c
sim/sh/ChangeLog
sim/sh/gencode.c
sim/sh/interp.c
sim/v850/ChangeLog
sim/v850/interp.c
sim/z8k/ChangeLog
sim/z8k/iface.c

index 6c4d112..7ff6c0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,81 @@
+2003-02-28  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+       * Makefile.tpl: Rearrange.
+       * Makefile.in: Regenerate.
+
+2003-02-25  Nick Clifton  <nickc@redhat.com>
+
+       * configure: Remove site-file supprot - it is obsolete.
+
+2003-02-24  Uwe Stieber <uwe@wwws.de>
+
+       * configure.in: Add support for kaOS as cross build target system.
+       * configure: Regenerated.
+
+2003-02-20  Sean McNeil  <sean@blue.mcneil.com>
+
+       * Makefile.tpl: Add definition of CPPFLAGS to pass into
+       configure-target-* as some target builds may require additional
+       flags for preprocessor tests.
+       * Makefile.in: Regenerated.
+
+2003-02-19  Alexandre Oliva  <aoliva@redhat.com>
+
+       * libtool.m4 (LD): Append -melf* option to LD on IRIX with GNU ld.
+       * ltconfig: Handle it.
+       * ltcf-cxx.sh: Use with_gnu_ld passed as a shell variable instead of
+       auto-detecting it.
+
+2003-02-19  Alexandre Oliva  <aoliva@redhat.com>
+
+       * ltcf-cxx.sh: Replace $linker_flags with $compiler_flags wherever
+       it is used as argument to $CC.
+       * ltcf-gcj.sh: Likewise.
+
+2003-02-19  Alexandre Oliva  <aoliva@redhat.com>
+
+       * configure.in: Introduce --enable-maintainer-mode.
+       * configure: Rebuilt.
+       * Makefile.tpl (Makefile.in, configure): Enable dependencies only
+       for maintainer mode.
+       * Makefile.in: Rebuilt.
+
+2003-02-19  Andrew Cagney <ac131313@redhat.com>
+
+       * configure: Regenerate using autoconf 2.13.
+
+2003-02-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * config.guess: Import latest version.
+       * config.sub: Import latest version.
+
+2003-02-18  Jason Merrill  <jason@redhat.com>
+
+       * Makefile.tpl (check-c++): Allow parallelism.
+
+2003-02-17  Andrew Cagney  <ac131313@redhat.com>
+
+       * configure: Regenerate using autoconf 000227.
+
+2003-02-15  Geoffrey Keating  <geoffk@apple.com>
+
+       * configure.in (*-*-darwin*): Rename from powerpc*-*-darwin*,
+       don't configure target-libobjc.
+       * configure: Regenerate.
+
+2003-02-14  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * Makefile.tpl (RANLIB): Define.
+       * Makefile.in: Regenerate.
+
+2003-02-06  Keith R Seitz  <keiths@redhat.com>
+
+       * Makefile.def: Remove "snavigator", "grep", and "db" modules.
+       * Makefile.tpl: Remove "all-snavigator" and "all-grep".
+       * Makefile.in: Regenerated.
+       * configure.in: Remove all traces of snavigator, db, and grep.
+       * configure: Regenerated.
+
 2003-01-31  Frank Ch. Eigler  <fche@redhat.com>
 
        * Makefile.tpl (all-sid): Add libiberty/bfd/opcodes dependencies.
index 0096521..eab0330 100644 (file)
@@ -13,7 +13,6 @@ host_modules= { module= binutils; };
 host_modules= { module= bison; no_check_cross= true; };
 host_modules= { module= byacc; no_check_cross= true; };
 host_modules= { module= bzip2; };
-host_modules= { module= db; };
 host_modules= { module= dejagnu; };
 host_modules= { module= diff; };
 host_modules= { module= dosutils; no_check= true; };
@@ -28,7 +27,6 @@ host_modules= { module= gawk; };
 host_modules= { module= gettext; };
 host_modules= { module= gnuserv; };
 host_modules= { module= gprof; };
-host_modules= { module= grep; };
 host_modules= { module= gzip; };
 host_modules= { module= hello; };
 host_modules= { module= indent; };
@@ -54,7 +52,6 @@ host_modules= { module= send-pr; };
 host_modules= { module= shellutils; };
 host_modules= { module= sid; };
 host_modules= { module= sim; };
-host_modules= { module= snavigator; };
 host_modules= { module= tar; };
 host_modules= { module= texinfo; no_install= true; };
 host_modules= { module= textutils; };
index 453db17..6e5dc06 100644 (file)
@@ -3,7 +3,7 @@
 #
 # Makefile for directory with subdirs to build.
 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-#   1999, 2000, 2001, 2002 Free Software Foundation
+#   1999, 2000, 2001, 2002, 2003 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
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+# -------------------------------
+# Standard Autoconf-set variables
+# -------------------------------
 VPATH=@srcdir@
-links=@configlinks@
 
 build_alias=@build_alias@
 build_cpu=@build_cpu@
@@ -39,21 +41,13 @@ target_vendor=@target_vendor@
 target_os=@target_os@
 target_canonical=@target_cpu@-@target_vendor@-@target_os@
 
-enable_shared = @enable_shared@
-enable_threads = @enable_threads@
-enable_version_specific_runtime_libs = @enable_version_specific_runtime_libs@
-# The file containing GCC's version number.
-gcc_version_trigger = @gcc_version_trigger@
-gcc_version = @gcc_version@
-
-# The gcc driver likes to know the arguments it was configured with.
-TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
-
-srcdir = @srcdir@
+program_transform_name = @program_transform_name@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 
+srcdir = @srcdir@
+
 bindir = @bindir@
 sbindir = @sbindir@
 libexecdir = @libexecdir@
@@ -66,14 +60,6 @@ includedir = @includedir@
 oldincludedir = @oldincludedir@
 infodir = @infodir@
 mandir = @mandir@
-gxx_include_dir = @gxx_include_dir@
-libstdcxx_incdir = @libstdcxx_incdir@
-
-tooldir = @tooldir@
-build_tooldir = @build_tooldir@
-
-program_transform_name = @program_transform_name@
-
 man1dir = $(mandir)/man1
 man2dir = $(mandir)/man2
 man3dir = $(mandir)/man3
@@ -83,17 +69,6 @@ man6dir = $(mandir)/man6
 man7dir = $(mandir)/man7
 man8dir = $(mandir)/man8
 man9dir = $(mandir)/man9
-# Directory in which the compiler finds executables, libraries, etc.
-libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
-GDB_NLM_DEPS = 
-
-SHELL = @config_shell@
-
-# pwd command to use.  Allow user to override default by setting PWDCMD in
-# the environment to account for automounters.  The make variable must not
-# be called PWDCMD, otherwise the value set here is passed to make
-# subprocesses and overrides the setting from the user's environment.
-PWD = $${PWDCMD-pwd}
 
 # INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
 # cygwin host.
@@ -104,51 +79,92 @@ INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_ARGS)
 INSTALL_SCRIPT = $(INSTALL)
 INSTALL_DATA = $(INSTALL) -m 644
 
-AS = @AS@
-AR = @AR@
-AR_FLAGS = rc
-CC = @CC@
+# -------------------------------------------------
+# Miscellaneous non-standard autoconf-set variables
+# -------------------------------------------------
 
-# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
-# here so that they can be overridden by Makefile fragments.
-BUILD_CC = $(CC_FOR_BUILD)
-BUILD_PREFIX = @BUILD_PREFIX@
-BUILD_PREFIX_1 = @BUILD_PREFIX_1@
+links=@configlinks@
+enable_shared = @enable_shared@
+enable_threads = @enable_threads@
+enable_version_specific_runtime_libs = @enable_version_specific_runtime_libs@
+# The file containing GCC's version number.
+gcc_version_trigger = @gcc_version_trigger@
+gcc_version = @gcc_version@
 
-CFLAGS = @CFLAGS@
-CXXFLAGS = @CXXFLAGS@
+# The gcc driver likes to know the arguments it was configured with.
+TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
 
-LDFLAGS = 
-LIBCFLAGS = $(CFLAGS)
-CFLAGS_FOR_BUILD = $(CFLAGS)
-# During gcc bootstrap, if we use some random cc for stage1 then
-# CFLAGS will be just -g.  We want to ensure that TARGET libraries
-# (which we know are built with gcc) are built with optimizations so
-# prepend -O2 when setting CFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
-LDFLAGS_FOR_TARGET = 
-LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
-PICFLAG = 
-PICFLAG_FOR_TARGET = 
+gxx_include_dir = @gxx_include_dir@
+libstdcxx_incdir = @libstdcxx_incdir@
 
-CXX = @CXX@
+tooldir = @tooldir@
+build_tooldir = @build_tooldir@
 
-# Use -O2 to stress test the compiler.
-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
-LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
+# Directory in which the compiler finds executables, libraries, etc.
+libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
+GDB_NLM_DEPS = 
 
-DLLTOOL = @DLLTOOL@
-WINDRES = @WINDRES@
+# This is the name of the environment variable used for the path to
+# the libraries.
+RPATH_ENVVAR = @RPATH_ENVVAR@
 
-NM = @NM@
+# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
+# was used.
+SET_LIB_PATH = @SET_LIB_PATH@
 
-LD = @LD@
+# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
+# Some platforms don't like blank entries, so we remove duplicate,
+# leading and trailing colons.
+REALLY_SET_LIB_PATH = \
+  $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
-# These values are substituted by configure.
-DEFAULT_YACC = @DEFAULT_YACC@
-DEFAULT_LEX = @DEFAULT_LEX@
-DEFAULT_M4 = @DEFAULT_M4@
+# This is the list of directories to be built for the build system.
+BUILD_CONFIGDIRS = libiberty
+# Build programs are put under this directory.
+BUILD_SUBDIR = @build_subdir@
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the build system.
+BUILD_CONFIGARGS = @build_configargs@
+
+# This is the list of directories to built for the host system.
+SUBDIRS = @configdirs@
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the host system.
+HOST_CONFIGARGS = @host_configargs@
+
+# This is set by the configure script to the list of directories which
+# should be built using the target tools.
+TARGET_CONFIGDIRS = @target_configdirs@
+# Target libraries are put under this directory:
+TARGET_SUBDIR = @target_subdir@
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the target.
+TARGET_CONFIGARGS = @target_configargs@
+
+# ----------------------------------------------
+# Programs producing files for the BUILD machine
+# ----------------------------------------------
+
+SHELL = @config_shell@
+
+# pwd command to use.  Allow user to override default by setting PWDCMD in
+# the environment to account for automounters.  The make variable must not
+# be called PWDCMD, otherwise the value set here is passed to make
+# subprocesses and overrides the setting from the user's environment.
+PWD = $${PWDCMD-pwd}
+
+# compilers to use to create programs which must be run in the build
+# environment.
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS_FOR_BUILD = $(CFLAGS)
+
+CXX_FOR_BUILD = $(CXX)
+
+# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
+# here so that they can be overridden by Makefile fragments.
+BUILD_CC = $(CC_FOR_BUILD)
+BUILD_PREFIX = @BUILD_PREFIX@
+BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 
 BISON=@BISON@
 USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
@@ -157,6 +173,7 @@ USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
            echo bison ; \
         fi`
 
+DEFAULT_YACC = @DEFAULT_YACC@
 YACC=@YACC@
 USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
            echo $$r/bison/bison -y -L $$s/bison/ ; \
@@ -166,11 +183,13 @@ USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
            echo ${DEFAULT_YACC} ; \
        fi`
 
+DEFAULT_LEX = @DEFAULT_LEX@
 LEX=@LEX@
 USUAL_LEX = `if [ -f $$r/flex/flex ] ; \
        then echo $$r/flex/flex ; \
        else echo ${DEFAULT_LEX} ; fi`
 
+DEFAULT_M4 = @DEFAULT_M4@
 M4 = `if [ -f $$r/m4/m4 ] ; \
        then echo $$r/m4/m4 ; \
        else echo ${DEFAULT_M4} ; fi`
@@ -197,74 +216,61 @@ RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
        then echo $$s/dejagnu/runtest ; \
        else echo runtest ; fi`
 
+# ---------------------------------------------
+# Programs producing files for the HOST machine
+# ---------------------------------------------
 
-# compilers to use to create programs which must be run in the build
-# environment.
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CXX_FOR_BUILD = $(CXX)
+# This is the list of directories that may be needed in RPATH_ENVVAR
+# so that programs built for the host machine work.
+HOST_LIB_PATH = $$r/bfd:$$r/opcodes
 
-SUBDIRS = @configdirs@
+AS = @AS@
 
-# This is set by the configure script to the list of directories which
-# should be built using the target tools.
-TARGET_CONFIGDIRS = @target_configdirs@
+AR = @AR@
+AR_FLAGS = rc
 
-# Target libraries are put under this directory:
-# Changed by configure to $(target_alias) if cross.
-TARGET_SUBDIR = @target_subdir@
+CC = @CC@
+CFLAGS = @CFLAGS@
+LIBCFLAGS = $(CFLAGS)
 
-BUILD_CONFIGDIRS = libiberty
-BUILD_SUBDIR = @build_subdir@
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@
+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 
-# This is set by the configure script to the arguments to use when configuring
-# directories built for the build system.
-BUILD_CONFIGARGS = @build_configargs@
+DLLTOOL = @DLLTOOL@
 
-# This is set by the configure script to the arguments to use when configuring
-# directories built for the host system.
-HOST_CONFIGARGS = @host_configargs@
+NM = @NM@
 
-# This is set by the configure script to the arguments to use when configuring
-# directories built for the target.
-TARGET_CONFIGARGS = @target_configargs@
+LD = @LD@
+LDFLAGS = 
 
-# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
-# was used.
-SET_LIB_PATH = @SET_LIB_PATH@
+RANLIB = @RANLIB@
 
-# This is the name of the environment variable used for the path to
-# the libraries.  This may be changed by configure.in.
-RPATH_ENVVAR = @RPATH_ENVVAR@
+WINDRES = @WINDRES@
 
-# This is the list of directories that may be needed in RPATH_ENVVAR
-# so that programs built for the host machine work.
-HOST_LIB_PATH = $$r/bfd:$$r/opcodes
+PICFLAG = 
+
+# -----------------------------------------------
+# Programs producing files for the TARGET machine
+# -----------------------------------------------
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that prorgams built for the target machine work.
 TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
 
-# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
-# Some platforms don't like blank entries, so we remove duplicate,
-# leading and trailing colons.
-REALLY_SET_LIB_PATH = \
-  $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
-
-# Should be substed by configure.in
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
-CC_FOR_TARGET = @CC_FOR_TARGET@
-CXX_FOR_TARGET = @CXX_FOR_TARGET@
-RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
-CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
 
-# If GCC_FOR_TARGET is not overriden on the command line, then this
-# variable is passed down to the gcc Makefile, where it is used to
-# build libgcc2.a.  We define it here so that it can itself be
-# overridden on the command line.
-GCC_FOR_TARGET=@GCC_FOR_TARGET@
-USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
+AR_FOR_TARGET=@AR_FOR_TARGET@
+USUAL_AR_FOR_TARGET = ` \
+  if [ -f $$r/binutils/ar ] ; then \
+    echo $$r/binutils/ar ; \
+  else \
+    if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
+      echo $(AR); \
+    else \
+       echo ar | sed '$(program_transform_name)' ; \
+    fi; \
+  fi`
 
 AS_FOR_TARGET=@AS_FOR_TARGET@
 USUAL_AS_FOR_TARGET = ` \
@@ -280,19 +286,26 @@ USUAL_AS_FOR_TARGET = ` \
     fi; \
   fi`
 
-LD_FOR_TARGET=@LD_FOR_TARGET@
-USUAL_LD_FOR_TARGET = ` \
-  if [ -f $$r/ld/ld-new ] ; then \
-    echo $$r/ld/ld-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=ld ; \
-  else \
-    if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(LD); \
-    else \
-       echo ld | sed '$(program_transform_name)' ; \
-    fi; \
-  fi`
+CC_FOR_TARGET = @CC_FOR_TARGET@
+# During gcc bootstrap, if we use some random cc for stage1 then
+# CFLAGS will be just -g.  We want to ensure that TARGET libraries
+# (which we know are built with gcc) are built with optimizations so
+# prepend -O2 when setting CFLAGS_FOR_TARGET.
+CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
+# If GCC_FOR_TARGET is not overriden on the command line, then this
+# variable is passed down to the gcc Makefile, where it is used to
+# build libgcc2.a.  We define it here so that it can itself be
+# overridden on the command line.
+GCC_FOR_TARGET=@GCC_FOR_TARGET@
+USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
+LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
+
+CXX_FOR_TARGET = @CXX_FOR_TARGET@
+RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
+CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
+LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 USUAL_DLLTOOL_FOR_TARGET = ` \
@@ -306,27 +319,35 @@ USUAL_DLLTOOL_FOR_TARGET = ` \
     fi; \
   fi`
 
-WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
-USUAL_WINDRES_FOR_TARGET = ` \
-  if [ -f $$r/binutils/windres ] ; then \
-    echo $$r/binutils/windres ; \
+GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
+
+LD_FOR_TARGET=@LD_FOR_TARGET@
+USUAL_LD_FOR_TARGET = ` \
+  if [ -f $$r/ld/ld-new ] ; then \
+    echo $$r/ld/ld-new ; \
+  elif [ -f $$r/gcc/xgcc ]; then \
+    $(CC_FOR_TARGET) -print-prog-name=ld ; \
   else \
     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(WINDRES); \
+      echo $(LD); \
     else \
-       echo windres | sed '$(program_transform_name)' ; \
+       echo ld | sed '$(program_transform_name)' ; \
     fi; \
   fi`
 
-AR_FOR_TARGET=@AR_FOR_TARGET@
-USUAL_AR_FOR_TARGET = ` \
-  if [ -f $$r/binutils/ar ] ; then \
-    echo $$r/binutils/ar ; \
+LDFLAGS_FOR_TARGET = 
+
+NM_FOR_TARGET=@NM_FOR_TARGET@
+USUAL_NM_FOR_TARGET = ` \
+  if [ -f $$r/binutils/nm-new ] ; then \
+    echo $$r/binutils/nm-new ; \
+  elif [ -f $$r/gcc/xgcc ]; then \
+    $(CC_FOR_TARGET) -print-prog-name=nm ; \
   else \
     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(AR); \
+      echo $(NM); \
     else \
-       echo ar | sed '$(program_transform_name)' ; \
+       echo nm | sed '$(program_transform_name)' ; \
     fi; \
   fi`
 
@@ -346,20 +367,24 @@ USUAL_RANLIB_FOR_TARGET = ` \
     fi; \
   fi`
 
-NM_FOR_TARGET=@NM_FOR_TARGET@
-USUAL_NM_FOR_TARGET = ` \
-  if [ -f $$r/binutils/nm-new ] ; then \
-    echo $$r/binutils/nm-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=nm ; \
+WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
+USUAL_WINDRES_FOR_TARGET = ` \
+  if [ -f $$r/binutils/windres ] ; then \
+    echo $$r/binutils/windres ; \
   else \
     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(NM); \
+      echo $(WINDRES); \
     else \
-       echo nm | sed '$(program_transform_name)' ; \
+       echo windres | sed '$(program_transform_name)' ; \
     fi; \
   fi`
 
+PICFLAG_FOR_TARGET = 
+
+# ------------------------------------
+# Miscellaneous targets and flag lists
+# ------------------------------------
+
 # The first rule in the file had better be this one.  Don't put any above it.
 # This lives here to allow makefile fragments to contain dependencies.
 all: all.normal
@@ -543,7 +568,6 @@ CLEAN_MODULES = \
        clean-bison \
        clean-byacc \
        clean-bzip2 \
-       clean-db \
        clean-dejagnu \
        clean-diff \
        clean-dosutils \
@@ -558,7 +582,6 @@ CLEAN_MODULES = \
        clean-gettext \
        clean-gnuserv \
        clean-gprof \
-       clean-grep \
        clean-gzip \
        clean-hello \
        clean-indent \
@@ -584,7 +607,6 @@ CLEAN_MODULES = \
        clean-shellutils \
        clean-sid \
        clean-sim \
-       clean-snavigator \
        clean-tar \
        clean-texinfo \
        clean-textutils \
@@ -1984,73 +2006,6 @@ install-bzip2: installdirs
          (cd bzip2 && $(MAKE) $(FLAGS_TO_PASS) install)
 
 
-.PHONY: configure-db maybe-configure-db
-maybe-configure-db:
-configure-db:
-       @test ! -f db/Makefile || exit 0; \
-       [ -d db ] || mkdir db; \
-       r=`${PWD}`; export r; \
-       s=`cd $(srcdir); ${PWD}`; export s; \
-       CC="$(CC)"; export CC; \
-       CFLAGS="$(CFLAGS)"; export CFLAGS; \
-       CXX="$(CXX)"; export CXX; \
-       CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
-       if [ z$(build_canonical) !=  z$(host_canoncial) ] ; then \
-         AR="$(AR)"; export AR; \
-         AS="$(AS)"; export AS; \
-         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
-         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
-         LD="$(LD)"; export LD; \
-         NM="$(NM)"; export NM; \
-         RANLIB="$(RANLIB)"; export RANLIB; \
-         WINDRES="$(WINDRES)"; export WINDRES; \
-         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
-         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
-       fi; \
-       echo Configuring in db; \
-       cd db || exit 1; \
-       case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/db"; \
-           libsrcdir="$$s/db";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/db"; \
-           libsrcdir="$$s/db";; \
-       esac; \
-       $(SHELL) $${libsrcdir}/configure \
-         $(HOST_CONFIGARGS) $${srcdiroption} \
-         || exit 1
-
-.PHONY: all-db maybe-all-db
-maybe-all-db:
-all-db: configure-db
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd db && $(MAKE) $(FLAGS_TO_PASS) all)
-
-
-.PHONY: check-db
-check-db:
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd db && $(MAKE) $(FLAGS_TO_PASS) check)
-
-
-
-.PHONY: install-db maybe-install-db
-maybe-install-db:
-install-db: installdirs
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd db && $(MAKE) $(FLAGS_TO_PASS) install)
-
-
 .PHONY: configure-dejagnu maybe-configure-dejagnu
 maybe-configure-dejagnu:
 configure-dejagnu:
@@ -2991,73 +2946,6 @@ install-gprof: installdirs
          (cd gprof && $(MAKE) $(FLAGS_TO_PASS) install)
 
 
-.PHONY: configure-grep maybe-configure-grep
-maybe-configure-grep:
-configure-grep:
-       @test ! -f grep/Makefile || exit 0; \
-       [ -d grep ] || mkdir grep; \
-       r=`${PWD}`; export r; \
-       s=`cd $(srcdir); ${PWD}`; export s; \
-       CC="$(CC)"; export CC; \
-       CFLAGS="$(CFLAGS)"; export CFLAGS; \
-       CXX="$(CXX)"; export CXX; \
-       CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
-       if [ z$(build_canonical) !=  z$(host_canoncial) ] ; then \
-         AR="$(AR)"; export AR; \
-         AS="$(AS)"; export AS; \
-         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
-         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
-         LD="$(LD)"; export LD; \
-         NM="$(NM)"; export NM; \
-         RANLIB="$(RANLIB)"; export RANLIB; \
-         WINDRES="$(WINDRES)"; export WINDRES; \
-         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
-         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
-       fi; \
-       echo Configuring in grep; \
-       cd grep || exit 1; \
-       case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/grep"; \
-           libsrcdir="$$s/grep";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/grep"; \
-           libsrcdir="$$s/grep";; \
-       esac; \
-       $(SHELL) $${libsrcdir}/configure \
-         $(HOST_CONFIGARGS) $${srcdiroption} \
-         || exit 1
-
-.PHONY: all-grep maybe-all-grep
-maybe-all-grep:
-all-grep: configure-grep
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd grep && $(MAKE) $(FLAGS_TO_PASS) all)
-
-
-.PHONY: check-grep
-check-grep:
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd grep && $(MAKE) $(FLAGS_TO_PASS) check)
-
-
-
-.PHONY: install-grep maybe-install-grep
-maybe-install-grep:
-install-grep: installdirs
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd grep && $(MAKE) $(FLAGS_TO_PASS) install)
-
-
 .PHONY: configure-gzip maybe-configure-gzip
 maybe-configure-gzip:
 configure-gzip:
@@ -4721,73 +4609,6 @@ install-sim: installdirs
          (cd sim && $(MAKE) $(FLAGS_TO_PASS) install)
 
 
-.PHONY: configure-snavigator maybe-configure-snavigator
-maybe-configure-snavigator:
-configure-snavigator:
-       @test ! -f snavigator/Makefile || exit 0; \
-       [ -d snavigator ] || mkdir snavigator; \
-       r=`${PWD}`; export r; \
-       s=`cd $(srcdir); ${PWD}`; export s; \
-       CC="$(CC)"; export CC; \
-       CFLAGS="$(CFLAGS)"; export CFLAGS; \
-       CXX="$(CXX)"; export CXX; \
-       CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
-       if [ z$(build_canonical) !=  z$(host_canoncial) ] ; then \
-         AR="$(AR)"; export AR; \
-         AS="$(AS)"; export AS; \
-         CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
-         DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
-         LD="$(LD)"; export LD; \
-         NM="$(NM)"; export NM; \
-         RANLIB="$(RANLIB)"; export RANLIB; \
-         WINDRES="$(WINDRES)"; export WINDRES; \
-         OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
-         OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
-       fi; \
-       echo Configuring in snavigator; \
-       cd snavigator || exit 1; \
-       case $(srcdir) in \
-         \.) \
-           srcdiroption="--srcdir=."; \
-           libsrcdir=".";; \
-         /* | [A-Za-z]:[\\/]*) \
-           srcdiroption="--srcdir=$(srcdir)/snavigator"; \
-           libsrcdir="$$s/snavigator";; \
-         *) \
-           srcdiroption="--srcdir=../$(srcdir)/snavigator"; \
-           libsrcdir="$$s/snavigator";; \
-       esac; \
-       $(SHELL) $${libsrcdir}/configure \
-         $(HOST_CONFIGARGS) $${srcdiroption} \
-         || exit 1
-
-.PHONY: all-snavigator maybe-all-snavigator
-maybe-all-snavigator:
-all-snavigator: configure-snavigator
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd snavigator && $(MAKE) $(FLAGS_TO_PASS) all)
-
-
-.PHONY: check-snavigator
-check-snavigator:
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd snavigator && $(MAKE) $(FLAGS_TO_PASS) check)
-
-
-
-.PHONY: install-snavigator maybe-install-snavigator
-maybe-install-snavigator:
-install-snavigator: installdirs
-       @r=`${PWD}`; export r; \
-         s=`cd $(srcdir); ${PWD}`; export s; \
-         $(SET_LIB_PATH) \
-         (cd snavigator && $(MAKE) $(FLAGS_TO_PASS) install)
-
-
 .PHONY: configure-tar maybe-configure-tar
 maybe-configure-tar:
 configure-tar:
@@ -5802,6 +5623,7 @@ configure-target-libstdc++-v3: $(TARGET_SUBDIR)/libstdc++-v3/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
            CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
@@ -5902,6 +5724,7 @@ configure-target-newlib: $(TARGET_SUBDIR)/newlib/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6001,6 +5824,7 @@ configure-target-libf2c: $(TARGET_SUBDIR)/libf2c/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6100,6 +5924,7 @@ configure-target-libobjc: $(TARGET_SUBDIR)/libobjc/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6199,6 +6024,7 @@ configure-target-libtermcap: $(TARGET_SUBDIR)/libtermcap/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6294,6 +6120,7 @@ configure-target-winsup: $(TARGET_SUBDIR)/winsup/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6393,6 +6220,7 @@ configure-target-libgloss: $(TARGET_SUBDIR)/libgloss/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6488,6 +6316,7 @@ configure-target-libiberty: $(TARGET_SUBDIR)/libiberty/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6587,6 +6416,7 @@ configure-target-gperf: $(TARGET_SUBDIR)/gperf/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6686,6 +6516,7 @@ configure-target-examples: $(TARGET_SUBDIR)/examples/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6777,6 +6608,7 @@ configure-target-libffi: $(TARGET_SUBDIR)/libffi/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -6876,6 +6708,7 @@ configure-target-libjava: $(TARGET_SUBDIR)/libjava/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
            CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
@@ -6976,6 +6809,7 @@ configure-target-zlib: $(TARGET_SUBDIR)/zlib/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -7075,6 +6909,7 @@ configure-target-boehm-gc: $(TARGET_SUBDIR)/boehm-gc/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -7174,6 +7009,7 @@ configure-target-qthreads: $(TARGET_SUBDIR)/qthreads/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -7273,6 +7109,7 @@ configure-target-rda: $(TARGET_SUBDIR)/rda/multilib.out
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
            CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \
            CXX="$(CXX_FOR_TARGET)"; export CXX; \
            CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
            GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \
@@ -7496,7 +7333,8 @@ check-gcc-c++:
        fi
 
 .PHONY: check-c++
-check-c++: check-target-libstdc++-v3 check-gcc-c++
+check-c++:
+       $(MAKE) check-target-libstdc++-v3 check-gcc-c++ NOTPARALLEL=parallel-ok
 
 .PHONY: install-gcc maybe-install-gcc
 maybe-install-gcc:
@@ -7599,7 +7437,6 @@ all-diff: maybe-all-libiberty
 all-fastjar: maybe-all-zlib maybe-all-libiberty
 all-fileutils: maybe-all-libiberty
 all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc
-all-grep: maybe-all-libiberty
 all-gzip: maybe-all-libiberty
 all-hello: maybe-all-libiberty
 all-m4: maybe-all-libiberty maybe-all-texinfo
@@ -7609,7 +7446,6 @@ all-prms: maybe-all-libiberty
 all-recode: maybe-all-libiberty
 all-sed: maybe-all-libiberty
 all-send-pr: maybe-all-prms
-all-snavigator: maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-db maybe-all-grep maybe-all-libgui
 all-tar: maybe-all-libiberty
 all-uudecode: maybe-all-libiberty
 
@@ -7674,7 +7510,7 @@ multilib.out: maybe-all-gcc
 
 # Rebuilding Makefile.in, using autogen.
 AUTOGEN = autogen
-$(srcdir)/Makefile.in: # $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
+$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
        cd $(srcdir) && $(AUTOGEN) Makefile.def
 
 # Rebuilding Makefile.
@@ -7686,7 +7522,7 @@ config.status: configure $(gcc_version_trigger)
 
 # Rebuilding configure.
 AUTOCONF = autoconf
-$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/config/acx.m4
+$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
        cd $(srcdir) && $(AUTOCONF)
 #
 
index 9918494..316e7e4 100644 (file)
@@ -6,7 +6,7 @@ in
 #
 # Makefile for directory with subdirs to build.
 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-#   1999, 2000, 2001, 2002 Free Software Foundation
+#   1999, 2000, 2001, 2002, 2003 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
@@ -23,8 +23,10 @@ in
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+# -------------------------------
+# Standard Autoconf-set variables
+# -------------------------------
 VPATH=@srcdir@
-links=@configlinks@
 
 build_alias=@build_alias@
 build_cpu=@build_cpu@
@@ -42,21 +44,13 @@ target_vendor=@target_vendor@
 target_os=@target_os@
 target_canonical=@target_cpu@-@target_vendor@-@target_os@
 
-enable_shared = @enable_shared@
-enable_threads = @enable_threads@
-enable_version_specific_runtime_libs = @enable_version_specific_runtime_libs@
-# The file containing GCC's version number.
-gcc_version_trigger = @gcc_version_trigger@
-gcc_version = @gcc_version@
-
-# The gcc driver likes to know the arguments it was configured with.
-TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
-
-srcdir = @srcdir@
+program_transform_name = @program_transform_name@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 
+srcdir = @srcdir@
+
 bindir = @bindir@
 sbindir = @sbindir@
 libexecdir = @libexecdir@
@@ -69,14 +63,6 @@ includedir = @includedir@
 oldincludedir = @oldincludedir@
 infodir = @infodir@
 mandir = @mandir@
-gxx_include_dir = @gxx_include_dir@
-libstdcxx_incdir = @libstdcxx_incdir@
-
-tooldir = @tooldir@
-build_tooldir = @build_tooldir@
-
-program_transform_name = @program_transform_name@
-
 man1dir = $(mandir)/man1
 man2dir = $(mandir)/man2
 man3dir = $(mandir)/man3
@@ -86,17 +72,6 @@ man6dir = $(mandir)/man6
 man7dir = $(mandir)/man7
 man8dir = $(mandir)/man8
 man9dir = $(mandir)/man9
-# Directory in which the compiler finds executables, libraries, etc.
-libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
-GDB_NLM_DEPS = 
-
-SHELL = @config_shell@
-
-# pwd command to use.  Allow user to override default by setting PWDCMD in
-# the environment to account for automounters.  The make variable must not
-# be called PWDCMD, otherwise the value set here is passed to make
-# subprocesses and overrides the setting from the user's environment.
-PWD = $${PWDCMD-pwd}
 
 # INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
 # cygwin host.
@@ -107,51 +82,92 @@ INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_ARGS)
 INSTALL_SCRIPT = $(INSTALL)
 INSTALL_DATA = $(INSTALL) -m 644
 
-AS = @AS@
-AR = @AR@
-AR_FLAGS = rc
-CC = @CC@
+# -------------------------------------------------
+# Miscellaneous non-standard autoconf-set variables
+# -------------------------------------------------
 
-# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
-# here so that they can be overridden by Makefile fragments.
-BUILD_CC = $(CC_FOR_BUILD)
-BUILD_PREFIX = @BUILD_PREFIX@
-BUILD_PREFIX_1 = @BUILD_PREFIX_1@
+links=@configlinks@
+enable_shared = @enable_shared@
+enable_threads = @enable_threads@
+enable_version_specific_runtime_libs = @enable_version_specific_runtime_libs@
+# The file containing GCC's version number.
+gcc_version_trigger = @gcc_version_trigger@
+gcc_version = @gcc_version@
 
-CFLAGS = @CFLAGS@
-CXXFLAGS = @CXXFLAGS@
+# The gcc driver likes to know the arguments it was configured with.
+TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@
 
-LDFLAGS = 
-LIBCFLAGS = $(CFLAGS)
-CFLAGS_FOR_BUILD = $(CFLAGS)
-# During gcc bootstrap, if we use some random cc for stage1 then
-# CFLAGS will be just -g.  We want to ensure that TARGET libraries
-# (which we know are built with gcc) are built with optimizations so
-# prepend -O2 when setting CFLAGS_FOR_TARGET.
-CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
-LDFLAGS_FOR_TARGET = 
-LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
-PICFLAG = 
-PICFLAG_FOR_TARGET = 
+gxx_include_dir = @gxx_include_dir@
+libstdcxx_incdir = @libstdcxx_incdir@
 
-CXX = @CXX@
+tooldir = @tooldir@
+build_tooldir = @build_tooldir@
 
-# Use -O2 to stress test the compiler.
-LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
-LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
+# Directory in which the compiler finds executables, libraries, etc.
+libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
+GDB_NLM_DEPS = 
 
-DLLTOOL = @DLLTOOL@
-WINDRES = @WINDRES@
+# This is the name of the environment variable used for the path to
+# the libraries.
+RPATH_ENVVAR = @RPATH_ENVVAR@
 
-NM = @NM@
+# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
+# was used.
+SET_LIB_PATH = @SET_LIB_PATH@
 
-LD = @LD@
+# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
+# Some platforms don't like blank entries, so we remove duplicate,
+# leading and trailing colons.
+REALLY_SET_LIB_PATH = \
+  $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
 
-# These values are substituted by configure.
-DEFAULT_YACC = @DEFAULT_YACC@
-DEFAULT_LEX = @DEFAULT_LEX@
-DEFAULT_M4 = @DEFAULT_M4@
+# This is the list of directories to be built for the build system.
+BUILD_CONFIGDIRS = libiberty
+# Build programs are put under this directory.
+BUILD_SUBDIR = @build_subdir@
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the build system.
+BUILD_CONFIGARGS = @build_configargs@
+
+# This is the list of directories to built for the host system.
+SUBDIRS = @configdirs@
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the host system.
+HOST_CONFIGARGS = @host_configargs@
+
+# This is set by the configure script to the list of directories which
+# should be built using the target tools.
+TARGET_CONFIGDIRS = @target_configdirs@
+# Target libraries are put under this directory:
+TARGET_SUBDIR = @target_subdir@
+# This is set by the configure script to the arguments to use when configuring
+# directories built for the target.
+TARGET_CONFIGARGS = @target_configargs@
+
+# ----------------------------------------------
+# Programs producing files for the BUILD machine
+# ----------------------------------------------
+
+SHELL = @config_shell@
+
+# pwd command to use.  Allow user to override default by setting PWDCMD in
+# the environment to account for automounters.  The make variable must not
+# be called PWDCMD, otherwise the value set here is passed to make
+# subprocesses and overrides the setting from the user's environment.
+PWD = $${PWDCMD-pwd}
+
+# compilers to use to create programs which must be run in the build
+# environment.
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS_FOR_BUILD = $(CFLAGS)
+
+CXX_FOR_BUILD = $(CXX)
+
+# Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
+# here so that they can be overridden by Makefile fragments.
+BUILD_CC = $(CC_FOR_BUILD)
+BUILD_PREFIX = @BUILD_PREFIX@
+BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 
 BISON=@BISON@
 USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
@@ -160,6 +176,7 @@ USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
            echo bison ; \
         fi`
 
+DEFAULT_YACC = @DEFAULT_YACC@
 YACC=@YACC@
 USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
            echo $$r/bison/bison -y -L $$s/bison/ ; \
@@ -169,11 +186,13 @@ USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
            echo ${DEFAULT_YACC} ; \
        fi`
 
+DEFAULT_LEX = @DEFAULT_LEX@
 LEX=@LEX@
 USUAL_LEX = `if [ -f $$r/flex/flex ] ; \
        then echo $$r/flex/flex ; \
        else echo ${DEFAULT_LEX} ; fi`
 
+DEFAULT_M4 = @DEFAULT_M4@
 M4 = `if [ -f $$r/m4/m4 ] ; \
        then echo $$r/m4/m4 ; \
        else echo ${DEFAULT_M4} ; fi`
@@ -200,74 +219,61 @@ RUNTEST = `if [ -f $$s/dejagnu/runtest ] ; \
        then echo $$s/dejagnu/runtest ; \
        else echo runtest ; fi`
 
+# ---------------------------------------------
+# Programs producing files for the HOST machine
+# ---------------------------------------------
 
-# compilers to use to create programs which must be run in the build
-# environment.
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CXX_FOR_BUILD = $(CXX)
+# This is the list of directories that may be needed in RPATH_ENVVAR
+# so that programs built for the host machine work.
+HOST_LIB_PATH = $$r/bfd:$$r/opcodes
 
-SUBDIRS = @configdirs@
+AS = @AS@
 
-# This is set by the configure script to the list of directories which
-# should be built using the target tools.
-TARGET_CONFIGDIRS = @target_configdirs@
+AR = @AR@
+AR_FLAGS = rc
 
-# Target libraries are put under this directory:
-# Changed by configure to $(target_alias) if cross.
-TARGET_SUBDIR = @target_subdir@
+CC = @CC@
+CFLAGS = @CFLAGS@
+LIBCFLAGS = $(CFLAGS)
 
-BUILD_CONFIGDIRS = libiberty
-BUILD_SUBDIR = @build_subdir@
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@
+LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 
-# This is set by the configure script to the arguments to use when configuring
-# directories built for the build system.
-BUILD_CONFIGARGS = @build_configargs@
+DLLTOOL = @DLLTOOL@
 
-# This is set by the configure script to the arguments to use when configuring
-# directories built for the host system.
-HOST_CONFIGARGS = @host_configargs@
+NM = @NM@
 
-# This is set by the configure script to the arguments to use when configuring
-# directories built for the target.
-TARGET_CONFIGARGS = @target_configargs@
+LD = @LD@
+LDFLAGS = 
 
-# This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
-# was used.
-SET_LIB_PATH = @SET_LIB_PATH@
+RANLIB = @RANLIB@
 
-# This is the name of the environment variable used for the path to
-# the libraries.  This may be changed by configure.in.
-RPATH_ENVVAR = @RPATH_ENVVAR@
+WINDRES = @WINDRES@
 
-# This is the list of directories that may be needed in RPATH_ENVVAR
-# so that programs built for the host machine work.
-HOST_LIB_PATH = $$r/bfd:$$r/opcodes
+PICFLAG = 
+
+# -----------------------------------------------
+# Programs producing files for the TARGET machine
+# -----------------------------------------------
 
 # This is the list of directories that may be needed in RPATH_ENVVAR
 # so that prorgams built for the target machine work.
 TARGET_LIB_PATH = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
 
-# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
-# Some platforms don't like blank entries, so we remove duplicate,
-# leading and trailing colons.
-REALLY_SET_LIB_PATH = \
-  $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH):$(TARGET_LIB_PATH):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR);
-
-# Should be substed by configure.in
 FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
-CC_FOR_TARGET = @CC_FOR_TARGET@
-CXX_FOR_TARGET = @CXX_FOR_TARGET@
-RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
-CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
-GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
 
-# If GCC_FOR_TARGET is not overriden on the command line, then this
-# variable is passed down to the gcc Makefile, where it is used to
-# build libgcc2.a.  We define it here so that it can itself be
-# overridden on the command line.
-GCC_FOR_TARGET=@GCC_FOR_TARGET@
-USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
+AR_FOR_TARGET=@AR_FOR_TARGET@
+USUAL_AR_FOR_TARGET = ` \
+  if [ -f $$r/binutils/ar ] ; then \
+    echo $$r/binutils/ar ; \
+  else \
+    if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
+      echo $(AR); \
+    else \
+       echo ar | sed '$(program_transform_name)' ; \
+    fi; \
+  fi`
 
 AS_FOR_TARGET=@AS_FOR_TARGET@
 USUAL_AS_FOR_TARGET = ` \
@@ -283,19 +289,26 @@ USUAL_AS_FOR_TARGET = ` \
     fi; \
   fi`
 
-LD_FOR_TARGET=@LD_FOR_TARGET@
-USUAL_LD_FOR_TARGET = ` \
-  if [ -f $$r/ld/ld-new ] ; then \
-    echo $$r/ld/ld-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=ld ; \
-  else \
-    if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(LD); \
-    else \
-       echo ld | sed '$(program_transform_name)' ; \
-    fi; \
-  fi`
+CC_FOR_TARGET = @CC_FOR_TARGET@
+# During gcc bootstrap, if we use some random cc for stage1 then
+# CFLAGS will be just -g.  We want to ensure that TARGET libraries
+# (which we know are built with gcc) are built with optimizations so
+# prepend -O2 when setting CFLAGS_FOR_TARGET.
+CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
+# If GCC_FOR_TARGET is not overriden on the command line, then this
+# variable is passed down to the gcc Makefile, where it is used to
+# build libgcc2.a.  We define it here so that it can itself be
+# overridden on the command line.
+GCC_FOR_TARGET=@GCC_FOR_TARGET@
+USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
+LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
+
+CXX_FOR_TARGET = @CXX_FOR_TARGET@
+RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
+CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
+LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 
 DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
 USUAL_DLLTOOL_FOR_TARGET = ` \
@@ -309,27 +322,35 @@ USUAL_DLLTOOL_FOR_TARGET = ` \
     fi; \
   fi`
 
-WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
-USUAL_WINDRES_FOR_TARGET = ` \
-  if [ -f $$r/binutils/windres ] ; then \
-    echo $$r/binutils/windres ; \
+GCJ_FOR_TARGET = @GCJ_FOR_TARGET@
+
+LD_FOR_TARGET=@LD_FOR_TARGET@
+USUAL_LD_FOR_TARGET = ` \
+  if [ -f $$r/ld/ld-new ] ; then \
+    echo $$r/ld/ld-new ; \
+  elif [ -f $$r/gcc/xgcc ]; then \
+    $(CC_FOR_TARGET) -print-prog-name=ld ; \
   else \
     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(WINDRES); \
+      echo $(LD); \
     else \
-       echo windres | sed '$(program_transform_name)' ; \
+       echo ld | sed '$(program_transform_name)' ; \
     fi; \
   fi`
 
-AR_FOR_TARGET=@AR_FOR_TARGET@
-USUAL_AR_FOR_TARGET = ` \
-  if [ -f $$r/binutils/ar ] ; then \
-    echo $$r/binutils/ar ; \
+LDFLAGS_FOR_TARGET = 
+
+NM_FOR_TARGET=@NM_FOR_TARGET@
+USUAL_NM_FOR_TARGET = ` \
+  if [ -f $$r/binutils/nm-new ] ; then \
+    echo $$r/binutils/nm-new ; \
+  elif [ -f $$r/gcc/xgcc ]; then \
+    $(CC_FOR_TARGET) -print-prog-name=nm ; \
   else \
     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(AR); \
+      echo $(NM); \
     else \
-       echo ar | sed '$(program_transform_name)' ; \
+       echo nm | sed '$(program_transform_name)' ; \
     fi; \
   fi`
 
@@ -349,20 +370,24 @@ USUAL_RANLIB_FOR_TARGET = ` \
     fi; \
   fi`
 
-NM_FOR_TARGET=@NM_FOR_TARGET@
-USUAL_NM_FOR_TARGET = ` \
-  if [ -f $$r/binutils/nm-new ] ; then \
-    echo $$r/binutils/nm-new ; \
-  elif [ -f $$r/gcc/xgcc ]; then \
-    $(CC_FOR_TARGET) -print-prog-name=nm ; \
+WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
+USUAL_WINDRES_FOR_TARGET = ` \
+  if [ -f $$r/binutils/windres ] ; then \
+    echo $$r/binutils/windres ; \
   else \
     if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \
-      echo $(NM); \
+      echo $(WINDRES); \
     else \
-       echo nm | sed '$(program_transform_name)' ; \
+       echo windres | sed '$(program_transform_name)' ; \
     fi; \
   fi`
 
+PICFLAG_FOR_TARGET = 
+
+# ------------------------------------
+# Miscellaneous targets and flag lists
+# ------------------------------------
+
 # The first rule in the file had better be this one.  Don't put any above it.
 # This lives here to allow makefile fragments to contain dependencies.
 all: all.normal
@@ -986,7 +1011,8 @@ configure-target-[+module+]: $(TARGET_SUBDIR)/[+module+]/multilib.out
            AR="$(AR_FOR_TARGET)"; export AR; \
            AS="$(AS_FOR_TARGET)"; export AS; \
            CC="$(CC_FOR_TARGET)"; export CC; \
-           CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \[+ 
+           CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
+           CPPFLAGS="$(CFLAGS_FOR_TARGET)"; export CPPFLAGS; \[+ 
        IF raw_cxx +]
            CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
            CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \[+ 
@@ -1232,7 +1258,8 @@ check-gcc-c++:
        fi
 
 .PHONY: check-c++
-check-c++: check-target-libstdc++-v3 check-gcc-c++
+check-c++:
+       $(MAKE) check-target-libstdc++-v3 check-gcc-c++ NOTPARALLEL=parallel-ok
 
 .PHONY: install-gcc maybe-install-gcc
 maybe-install-gcc:
@@ -1335,7 +1362,6 @@ all-diff: maybe-all-libiberty
 all-fastjar: maybe-all-zlib maybe-all-libiberty
 all-fileutils: maybe-all-libiberty
 all-flex: maybe-all-libiberty maybe-all-bison maybe-all-byacc
-all-grep: maybe-all-libiberty
 all-gzip: maybe-all-libiberty
 all-hello: maybe-all-libiberty
 all-m4: maybe-all-libiberty maybe-all-texinfo
@@ -1345,7 +1371,6 @@ all-prms: maybe-all-libiberty
 all-recode: maybe-all-libiberty
 all-sed: maybe-all-libiberty
 all-send-pr: maybe-all-prms
-all-snavigator: maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-tix maybe-all-db maybe-all-grep maybe-all-libgui
 all-tar: maybe-all-libiberty
 all-uudecode: maybe-all-libiberty
 
@@ -1410,7 +1435,7 @@ multilib.out: maybe-all-gcc
 
 # Rebuilding Makefile.in, using autogen.
 AUTOGEN = autogen
-$(srcdir)/Makefile.in: # $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
+$(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
        cd $(srcdir) && $(AUTOGEN) Makefile.def
 
 # Rebuilding Makefile.
@@ -1422,7 +1447,7 @@ config.status: configure $(gcc_version_trigger)
 
 # Rebuilding configure.
 AUTOCONF = autoconf
-$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/config/acx.m4
+$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/config/acx.m4
        cd $(srcdir) && $(AUTOCONF)
 #
 
index ef1e407..393ab0f 100644 (file)
@@ -1,3 +1,513 @@
+2003-03-03  Nick Clifton  <nickc@redhat.com>
+
+       * po/da.po: Installed latest translation.
+
+2003-03-02  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+       * elf32-mips.c (elf_mips_howto_table_rel): Change definition of
+       R_MIPS_PC16 to rightshift 2.
+       (elf_reloc_map mips_reloc_map): Map to rightshifted BFD reloc.
+       (bfd_elf32_bfd_reloc_type_lookup): Support
+       BFD_RELOC_MIPSEMB_16_PCREL_S2.
+       * elf64-mips.c (mips_elf64_howto_table_rel): Change definition of
+       R_MIPS_PC16 to rightshift 2.
+       (mips_elf64_howto_table_rela): Likewise.
+       (mips_reloc_map): Map to rightshifted BFD reloc.
+       * elfn32-mips.c: The same as in elf64-mips.c.
+       * elfxx-mips.c (mips_elf_got_for_ibfd): Typo in comment.
+       (mips_elf_calculate_relocation): Handle rightshifted addends for
+       R_MIPS_PC16.
+       * reloc.c (BFD_RELOC_MIPSEMB_16_PCREL_S2): New BFD relocation for
+       MIPS Embedded PIC. Remove superfluous empty COMMENT.
+       * libbfd.h: Regenerate.
+       * bfd-in2.h: Regenerate.
+
+2003-02-28  Richard Henderson  <rth@redhat.com>
+
+       * elfxx-ia64.c (elfNN_ia64_relax_section): Correct bounds
+       for ltoff22x relaxation.
+
+2003-03-01  Alan Modra  <amodra@bigpond.net.au>
+
+       * bfd-in.h (_bfd): Don't define.
+       * bfd.c: Rename occurrences of "struct _bfd" to "struct bfd".
+       * syms.c: Likewise.
+       * bfd-in2.h: Regenerate.
+
+2003-02-27  Richard Henderson  <rth@redhat.com>
+
+       * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add want_gotx;
+       (elfNN_ia64_check_relocs): Set it.
+       (allocate_global_data_got): Check it.
+       (allocate_local_got): Likewise.
+       (allocate_dynrel_entries): Likewise.
+       (elfNN_ia64_relax_ldxmov): New.
+       (elfNN_ia64_relax_section): Handle LTOFF22X, LDXMOV.
+       (elfNN_ia64_choose_gp): Split out from ...
+       (elfNN_ia64_final_link): ... here.
+       
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * bfd.c (struct bfd): Rename "struct _bfd".
+       * bfd-in.h: Update copyright.
+       (struct bfd): Rename "struct _bfd".
+       (_bfd): Define for backward compatibility.
+       * bfd-in2.h: Regenerate.
+
+2003-02-25  Alan Modra  <amodra@bigpond.net.au>
+
+       * elflink.h (elf_bfd_final_link): Apportion reloc counts to rel_hdr
+       and rel_hdr2 when initially counting input relocs rather than after
+       creating output reloc sections.
+       (elf_link_read_relocs_from_section): Don't abort with wrong reloc
+       sizes.
+
+       * Makefile.am: Run "make dep-am".
+       * Makefile.in: Regenerate.
+
+2003-02-24  Kris Warkentin  <kewarken@qnx.com>
+
+       * elf.c (elfcore_read_notes): Add check for QNX style core file.
+       (elfcore_grog_nto_note): New function.
+       (elfcore_grog_nto_gregs): New function.
+       (elfcore_grog_nto_status): New function.
+
+2003-02-24  Alan Modra  <amodra@bigpond.net.au>
+
+       * elflink.c (_bfd_elf_create_got_section): Check existing .got
+       section flags before concluding that we've already been called.
+       Don't use register keyword.
+       (_bfd_elf_create_dynamic_sections): Don't use register keyword.
+       (_bfd_elf_create_linker_section): Formatting.
+
+2003-02-20  jmc  <jmc@prioris.mini.pw.edu.pl>
+
+       * coff-h8300.c: Fix typo: intial -> initial.
+       * coff-ppc.c: Likewise.
+
+2003-02-20  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-ppc.c: Formatting.
+       (allocate_dynrelocs): LD and GD relocs against the same sym need
+       separate GOT entries.
+       (ppc_elf_relocate_section): Correct GOT handling for multiple GOT
+       entries per symbol.
+
+2003-02-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Simplify dynamic reloc
+       removal.  Localize vars.  Remove unnecessary dynobj test.
+       * elf32-i386 (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead
+       of INFO.
+       (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
+       and optimize.
+       (elf_i386_relocate_section): Likewise.
+       (elf_i386_gc_sweep_hook): Simplify dyn reloc removal.  Localize vars.
+       * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
+       * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
+       * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
+       * elf32-sparc.c (elf32_sparc_gc_sweep_hook): Likewise.  Remove
+       local_dynrel for section too.  Don't touch HIPLT22, LOPLT10, PCPLT32
+       or PCPLT10 relocs.  Don't subtract twice on PLT32 relocs.
+       Formatting.
+
+       * elf64-ppc.c (ELIMINATE_COPY_RELOCS): Define.
+       (ppc64_elf_check_relocs): Use it.  Correct comment.  Move SEC_ALLOC
+       test.
+       (ppc64_elf_adjust_dynamic_symbol): Use ELIMINATE_COPY_RELOCS.
+       (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+       (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
+       and optimize.  Use ELIMINATE_COPY_RELOCS.
+       (ppc64_elf_relocate_section): Likewise.
+
+       * elf32-ppc.c (struct ppc_elf_dyn_relocs): Add pc_count field.
+       (ppc_elf_copy_indirect_symbol): Copy pc_count field.
+       (ELIMINATE_COPY_RELOCS): Define.
+       (ppc_elf_adjust_dynamic_symbol): Convert copy relocs to dynamic.
+       (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Pass SHARED instead of INFO.
+       (MUST_BE_DYN_RELOC): Define.
+       (allocate_dynrelocs): Adjust WILL_CALL_FINISH_DYNAMIC_SYMBOL uses,
+       and optimize.  Trim dyn_relocs.
+       (ppc_elf_check_relocs): Don't generate dyn_relocs when we know they'll
+       not be used.  Do generate dyn_relocs for copy reloc avoidance.  Keep
+       track of pc_rel dyn relocs.
+       (ppc_elf_relocate_section): Remove "will_become_local".  Adjust
+       WILL_CALL_FINISH_DYNAMIC_SYMBOL use.  Trim dyn relocs as per
+       allocate_dynrelocs.  Don't recalculate "sec".
+
+2003-02-18  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-ppc.c (ppc_elf_relocate_section): Remove unnecessary test.
+       * elf64-ppc.c (ppc64_elf_tls_optimize): Decrement tlsld_got.refcount
+       on invalid LD relocs.
+       (allocate_dynrelocs): Invalid LD relocs don't use tlsld_got entry.
+       (ppc64_elf_relocate_section): Unify new handling of LD relocs and
+       tlsld_got entry.  Use IS_PPC64_TLS_RELOC.
+
+       * elf32-ppc.h: New file.
+       * elf32-ppc.c: Include elf32-ppc.h.
+       (NOP, CROR_151515, CROR_313131, TP_OFFSET, DTP_OFFSET): Define.
+       (struct ppc_elf_link_hash_entry): Rename "root" to "elf".  Adjust uses.
+       Add "tls_mask" field.
+       (TLS_GD, TLS_LD, TLS_TPREL, TLS_DTPREL, TLS_TLS, TLS_TPRELGD): Define.
+       (struct ppc_elf_link_hash_table): Rename "root" to "elf".  Adjust uses.
+       Add got, relgot, plt, relplt, dynbss, relbss, dynsbss, relsbss,
+       sdata, sdata2, tls_sec, tls_get_addr, tlsld_got fields.
+       Make use of htab shortcuts throughout file.
+       (ppc_elf_link_hash_newfunc): Init tls_mask field.
+       (ppc_elf_link_hash_table_create): Init new fields.
+       (ppc_elf_copy_indirect_symbol): Copy tls_mask.
+       (ppc_elf_howto_raw): Add tls relocs.
+       (ppc_elf_reloc_type_lookup): Handle them.
+       (ppc_elf_unhandled_reloc): New function.
+       (ppc_elf_create_got): Stash got section pointer in hash table,
+       return status.  Make .rela.got too.
+       (ppc_elf_create_dynamic_sections): Stash section pointers in htab.
+       (ppc_elf_adjust_dynamic_symbol): Only set up copy relocs when
+       NON_GOT_REF set.  Don't allocate space in .plt here..
+       (allocate_dynrelocs): ..do so here instead, properly ref-counting and
+       not allocating plt entries unnecessarily.  Allocate got entries here.
+       (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+       (ppc_elf_size_dynamic_sections): Allocate local got entries.  Pass
+       "info" during allocate_dynrelocs hash traversal.  Use htab section
+       shortcuts rather than searching for named sections.  Get rid of
+       "plt" and "strip" booleans.
+       (update_local_sym_info, bad_shared_reloc): New functions.
+       (ppc_elf_check_relocs): Handle TLS relocs.  Move .rela.got creation to
+       ppc_elf_create_got.  Don't mark got or plt reloc syms dynamic, do so
+       in allocate_dynreloc.  Use update_local_sym_info and bad_shared_reloc.
+       Disallow R_PPC_EMB_RELSDA, R_PPC_EMB_NADDR32, R_PPC_EMB_NADDR16,
+       R_PPC_EMB_NADDR16_LO, R_PPC_EMB_NADDR16_HI and R_PPC_EMB_NADDR16_HA
+       in shared libs.  R_PPC_PLTREL32 is a plt reloc too.  Refcount all
+       relocs that might use a plt entry.  Set NON_GOT_REF too.
+       Enumerate all do-nothing relocs.
+       (ppc_elf_gc_sweep_hook): Simplify removal of dynrelocs.  Handle
+       tls relocs and all plt relocs.
+       (ppc_elf_tls_setup, ppc_elf_tls_optimize): New functions.
+       (ppc_elf_finish_dynamic_symbol): Don't build got entries here.
+       (ppc_elf_finish_dynamic_sections): Rewrite tag code using htab
+       shortcuts.
+       (ppc_elf_relocate_section): Tidy.  Handle TLS relocs.  Use
+       bfd_elf_local_sym_name.  Simplify unresolved reloc code.  Build got
+       entries and got relocs here.  Warn on non-zero got reloc addend.
+       Split out branch taken/not taken reloc code into a separate switch
+       and correct offset calculation. Allow BRTAKEN/BRNTAKEN dynamic relocs.
+       Split out HA reloc adjustments to separate switch statement.  Don't
+       warn on reloc overflow if we've already warned about undefined.
+       Don't rebuild sym name when reporting errors.  Report all possible
+       errors from _bfd_final_link_relocate.
+       (bfd_elf32_bfd_final_link): Don't define.
+
+2003-02-18  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (ppc64_elf_relocate_section): Don't init "r".  Don't
+       rebuild sym name when reporting errors.
+
+2003-02-17  Nick Clifton  <nickc@redhat.com>
+
+       * elflink.h (elf_link_output_extsym): Only check
+       allow_shlib_undefined for shared libraries.
+       * elf32-i386.c (elf_i386_relocate_section): Remove bogus check
+       of allow_shlib_undefined.
+       * elf32-cris.c (cris_elf_relocate_section): Likewise.
+       * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+       * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+       * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+       * elf32-s390.c (elf_s390_relocate_section): Likewise.
+       * elf32-sh.c (sh_elf_relocate_section): Likewise.
+       * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+       * elf32-vax.c (elf_vax_relocate_section): Likewise.
+       * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+       * elf64-hppa.c (elf64_hppa_relocate_section): Likewise.
+       * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+       * elf64-s390.c (elf_s390_relocate_section): Likewise.
+       * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+       * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+       * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+       * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise.
+
+2003-02-17  Nick Clifton  <nickc@redhat.com>
+
+       * elf.c (SEGMENT_AFTER_SEGMENT): Add third parameter - the
+       address field to use in the comparison.
+       (SEGMENT_OVERLAPS): Check that LMAs overlap as well.
+
+2003-02-14  Bob Wilson  <bob.wilson@acm.org>
+
+       * elfcore.h (elf_core_file_p): Compare alternate machine codes for ELF
+       backends when checking if the generic ELF target should be used.
+
+       * syms.c (_bfd_stab_section_find_nearest_line): For line number stabs
+       outside of functions, treat values as absolute addresses.
+
+       * bfd.c: Change embedded documentation to use consistent indentation
+       and to split up long lines.  Change informal style of description
+       for functions lacking real documentation.
+       * coffcode.h: Break up long lines in embedded documentation.
+       * format.c: Likewise.
+       * targets.c: Likewise.
+       * libcoff.h: Regenerate.
+       * bfd-in2.h: Regenerate.
+
+2003-02-14  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (ppc64_elf_link_hash_table_create): Init tls_get_addr.
+       (ppc64_elf_copy_indirect_symbol): Merge tls_mask too.
+       (ppc64_elf_gc_sweep_hook): Simplify removal of dyn_relocs.
+       (allocate_dynrelocs): Don't treat undefined and undefweak specially.
+       (ppc_size_one_stub): Fix warning, and tighten plt entry check.
+       (group_sections): Don't share a stub section if stubs are for a large
+       section.  Adjust comment.
+       (ppc64_elf_size_stubs): Roughly double the size left for stubs if
+       !stubs_always_before_branch.
+       (ppc64_elf_relocate_section): Initialize tlsld GOT entry once.  Don't
+       treat undefined and undefweak specially when processing dyn relocs.
+
+2003-02-13  Jakub Jelinek  <jakub@redhat.com>
+
+       * elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO.
+
+2003-02-13  Nick Clifton  <nickc@redhat.com>
+
+       * elf32-arm.h (elf32_thumb_to_arm_stub): Include section VMAs
+       in computation of offset to insert into BL instruction.
+
+2003-02-11  Uwe Stieber  <uwe@wwws.de>
+
+       * config.bfd: Add support for kaOS as cross build target system.
+
+2003-02-11  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (ppc64_elf_check_relocs): Match versioned
+       .__tls_get_addr too.
+       (ppc64_elf_tls_setup): Ensure cached tls_get_addr is not indirect.
+
+2003-02-10  Kaz kojima  <kkojima@rr.iij4u.or.jp>
+
+       * elf32-sh.c (elf_sh_dyn_relocs): Add tls_tpoff32 field.
+       (elf_sh_link_hash_entry): Remove tls_tpoff32 field.
+       (sh_elf_link_hash_newfunc): Remove the initialization of
+       tls_tpoff32 field.
+       (allocate_dynrelocs): Keep dyn_relocs if it includes the entry
+       for which tls_tpoff32 flag is set.
+       (sh_elf_relocate_section): Covert to LE only if the dyn_relocs
+       of the symbol includes the entry matched with the input_section
+       and having tls_tpoff32 flag on.  When linking statically, set
+       symbol index of R_SH_TLS_TPOFF32 relocation to zero if the symbol
+       is defined in this executable.
+       (sh_elf_check_relocs): Set tls_tpoff32 flag appropriately.
+
+2003-02-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf32-s390.c (elf_s390_size_dynamic_sections): Set relocs to TRUE
+       even if there is just non-empty .rela.plt.
+
+2003-02-10  Nick Clifton  <nickc@redhat.com>
+
+       * archures.c (bfd_mach_arm_ep9312): Define.
+       * bfd-in2.h: Regenerate.
+       * cpu-arm.c (processors[]): Add ep9312.
+       (bfd_arm_arch): Add ep9312.
+       * elf32-arm.h (elf32_arm_merge_private_data): Update error
+       messages and add test for Maverick floating point support.
+       (elf32_arm_print_private_bfd_data): Handle
+       EF_ARM_MAVERICK_FLOAT flag.
+       (elf32_arm_object_p): New function.
+       (elf_backend_object_p): Define.
+
+2003-02-10  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c: Rename assorted occurrences of tls_type and similar
+       variables, structure fields or function params to tls_mask or
+       similar to better reflect usage.
+       (struct got_entry): Comment.
+       (struct ppc_link_hash_entry):  Expand comment, and renumber TLS_*.
+       (get_tls_mask): Rename from get_tls_type.
+
+2003-02-09  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (TLS_GD_LD): Don't define..
+       (TLS_GD): ..define this instead and update all uses.
+       (TLS_TPRELGD): Define.
+       (ppc64_elf_link_hash_table_create): Tweak initialization of
+       init_refcount and init_offset.
+       (ppc64_elf_check_relocs): Add one extra element to t_symndx array.
+       Mark second slot of GD or LD toc entries.
+       (get_tls_type): Return an int.  Distinguish toc GD and LD entries
+       from other tls types.
+       (ppc64_elf_tls_setup): New function, split out from..
+       (ppc64_elf_tls_optimize): ..here.  Don't optimize when symbols are
+       defined in a dynamic object.  Fix LD optimization.  Don't set TLS_TPREL
+       on GD->IE optimization, use TLS_TPRELGD instead.  Use get_tls_type
+       return value to properly decide whether toc GD and LD entries can
+       optimize away __tls_get_addr call.  Check next reloc after DTPMOD64
+       to determine GD or LD rather than looking at TLS_LD flag.  Don't
+       attempt to adjust got entry tls_type here..
+       (allocate_dynrelocs): ..instead, adjust got entry tls_type here, and
+       look for possible merges.
+       (ppc64_elf_size_dynamic_sections): Adjust local got entries for
+       optimization.
+       (ppc64_elf_size_stubs): Tweak __tls_get_addr fudge.
+       (ppc64_elf_relocate_section): Rename some vars to better reflect usage.
+       Make use of return value from get_tls_type to properly detect GD and
+       LD optimizations.  Split tlsld/gd hi/ha from lo/ds case.  Don't
+       handle tls_get_addr removal when looking at REL24 relocs, do it when
+       looking at the previous reloc.  Check reloc after DTPMOD64 to determine
+       GD or LD.
+       * elf64-ppc.h (ppc64_elf_tls_setup): Declare.
+
+2003-02-08  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-hppa.c (group_sections): Don't share a stub section if
+       stubs are for a large section.
+
+       * elf32-hppa.c (elf32_hppa_size_stubs): Double the size left for
+       stubs if !stubs_always_before_branch.
+
+2003-02-07  Nick Clifton  <nickc@redhat.com>
+
+       * elf.c (swap_out_syms): Generate an error message if an
+       equivalent output section cannot be found for a symbol.
+
+2003-02-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf64-alpha.c (elf64_alpha_relax_section): Don't crash if
+       local_got_entries is NULL.
+
+2003-02-06  Andreas Schwab  <schwab@suse.de>
+
+       * elf-eh-frame.c (get_DW_EH_PE_signed): Define.
+       (read_value): Add parameter is_signed, use signed extraction if
+       the value is signed.
+       (_bfd_elf_write_section_eh_frame): Pass signed flag of the
+       encoding to read_value.
+
+2003-02-06  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy got and
+       plt info when called to transfer weak sym info.
+
+2003-02-05  Alan Modra  <amodra@bigpond.net.au>
+
+       * reloc.c: Add PPC and PPC64 TLS relocs.
+       * libbfd.h: Regenerate.
+       * bfd-in2.h: Regenerate.
+       * elf64-ppc.c (TP_OFFSET, DTP_OFFSET): Declare.
+       (ppc64_elf_howto_raw): Add TLS howto's.  Adjust R_PPC64_NONE to be
+       against a 32 bit field.
+       (ppc64_elf_reloc_type_lookup): Handle TLS relocs.
+       (_ppc64_elf_section_data): Add t_symndx and comments.
+       (ppc64_elf_section_data): Use elf_section_data macro.
+       (ppc64_elf_new_section_hook): American spelling.
+       (struct got_entry, struct plt_entry): New.
+       (MUST_BE_DYN_RELOC): Rename from IS_ABSOLUTE_RELOC.
+       (struct ppc_stub_hash_entry): Add "addend" field.
+       (struct ppc_link_hash_entry): Add "tls_type".
+       (TLS_TLS, TLS_GD_LD, TLS_LD, TLS_TPREL, TLS_DTPREL,
+       TLS_EXPLICIT): Define.
+       (struct ppc_link_hash_table): Add tls_sec, tls_get_addr, tlsld_got.
+       (link_hash_newfunc): Init new fields.
+       (ppc64_elf_link_hash_table_create): Likewise.  Set init_refcount and
+       init_offset to NULL.
+       (ppc64_elf_copy_indirect_symbol): Copy got and plt info.  Don't call
+       _bfd_elf_link_hash_copy_indirect, rather insert relevant code from
+       there.
+       (update_local_sym_info, update_plt_info): New functions.
+       (ppc64_elf_check_relocs): Use them.  Handle TLS relocs.  Adjust GOT
+       handling to use got.glist rather than got.refcount.  Likewise for PLT.
+       (ppc64_elf_gc_sweep_hook): Handle TLS relocs, new GOT and PLT lists.
+       (func_desc_adjust): Adjust for new PLT list.
+       (ppc64_elf_adjust_dynamic_symbol): Likewise.
+       (get_sym_h, get_tls_type): New functions.
+       (ppc64_elf_edit_opd): Remove unused variable.  Use get_sym_h.
+       (ppc64_elf_tls_optimize): New function.
+       (allocate_dynrelocs): Adjust for new PLT and GOT lists.  Allocate
+       TLS relocs.
+       (ppc64_elf_size_dynamic_sections): Likewise.
+       (ppc_type_of_stub): Adjust for new PLT list.
+       (ppc_build_one_stub): Likewise.
+       (ppc64_elf_size_stubs): Likewise.  Use get_sym_h.  Treat __tls_get_addr
+       calls specially.
+       (ppc64_elf_relocate_section): Adjust for new GOT and PLT lists.  Handle
+       TLS relocs.  Report local syms using bfd_elf_local_sym_name.  Don't
+       init GOT entries that have a reloc.  Generate GOT relocs here..
+       (ppc64_elf_finish_dynamic_symbol): ..not here.  Adjust for PLT list.
+       * elf64-ppc.h (ppc64_elf_tls_optimize): Declare.
+
+2003-02-04  Andreas Schwab  <schwab@suse.de>
+
+       * elf32-m68k.c (elf_m68k_hash_entry): Define.
+       (elf_m68k_link_hash_traverse): Remove.
+       (elf_m68k_link_hash_newfunc): Use struct bfd_hash_entry and
+       elf_m68k_hash_entry instead of struct elf_m68k_link_hash_entry to
+       reduce casting.
+       (elf_m68k_check_relocs): Use elf_m68k_hash_entry instead of
+       casting.
+       (elf_m68k_size_dynamic_sections): Use elf_link_hash_traverse
+       instead of elf_m68k_link_hash_traverse.
+       (elf_m68k_discard_copies): Change first parameter to pointer to
+       struct elf_link_hash_entry and use elf_m68k_hash_entry when struct
+       elf_m68k_link_hash_entry is needed.
+
+2003-02-04  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-bfd.h (struct got_entry, struct plt_entry): Forward declare.
+       (struct elf_link_hash_entry): Add "glist" and "plist" fields to
+       "got" union, and declare as gotplt_union.  Use gotplt_uinion for
+       "plt" field.
+       (struct elf_link_hash_table): Make "init_refcount" a gotplt_union.
+       Add "init_offset" field.
+       (struct elf_obj_tdata <local_got>): Add "struct got_entry **" to union.
+       (elf_local_got_ents): Declare.
+       * elf.c (_bfd_elf_link_hash_newfunc): Adjust initialization of "got"
+       and "plt".
+       (_bfd_elf_link_hash_hide_symbol): Use "init_offset".
+       (_bfd_elf_link_hash_table_init): Set "init_offset".
+       * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set init_refcount
+       from init_offset.
+       (elf_adjust_dynamic_symbol): Set plt and got offsets using init_offset.
+
+       * elf.c (bfd_elf_local_sym_name): Split out from..
+       (group_signature): ..here.
+       * elf-bfd.h (bfd_elf_local_sym_name): Declare.
+
+2003-02-04  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-bfd.h (enum elf_link_info_type): Remove.
+       (struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
+       to struct sec.  Remove linkonce_p field.
+       (elf_linkonce_p): Delete.
+       (elf_discarded_section): Update for sec_info_type change.
+       * section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
+       flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
+       (ELF_INFO_TYPE_NONE): Define.
+       (ELF_INFO_TYPE_STABS): Define.
+       (ELF_INFO_TYPE_MERGE): Define.
+       (ELF_INFO_TYPE_EH_FRAME): Define.
+       (ELF_INFO_TYPE_JUST_SYMS): Define.
+       (STD_SECTION): Update struct sec initializer.
+       * ecoff.c (bfd_debug_section): Likewise.
+       * elf.c: Likewise.  Update occurrences of sec_info_type and use_rela_p.
+       * elflink.h: Likewise.
+       * elf-eh-frame.c: Likewise.
+       * elf64-alpha.c: Likewise.
+       * elfxx-ia64.c: Likewise.
+       * elfxx-mips.c: Likewise.
+       * bfd-in2.h: Regenerate.
+
+       * elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
+       referring to used_by_bfd.
+       * elf64-sparc.c (sec_do_relax): Likewise.
+       * elf64-mmix.c (mmix_elf_section_data): Likewise.
+       * elfxx-mips.c (mips_elf_section_data): Likewise.
+       * ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
+       (ieee_get_section_contents): Likewise.
+       (ieee_new_section_hook): Formatting.
+       (ieee_canonicalize_reloc): Remove commented out code.
+       * mmo.c (mmo_section_data): Define.  Use throughout file.
+       * oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
+
 2003-01-31  Graydon Hoare <graydon@redhat.com>
 
        * Makefile.am (opncls.lo): Add dependency upon libiberty.h.
        * elf64-alpha.c (alpha_dynamic_entries_for_reloc): GOTTPREL and
        TPREL also get a reloc if shared.  Remove SREL support.
        (elf64_alpha_emit_dynrel): New.
-       (elf64_alpha_relocate_section): Use it.  Resolve dynamic TPREL 
+       (elf64_alpha_relocate_section): Use it.  Resolve dynamic TPREL
        and GOTTPREL relocs to local symbols against the tp base.
        (elf64_alpha_finish_dynamic_symbol): Use elf64_alpha_emit_dynrel.
 
 2003-01-20  Svein E. Seldal  <Svein.Seldal@solidas.com>
 
        * coffcode.h (coff_set_flags): Added get/set arch hooks.
-       
+
 2003-01-20  Fabio Alemagna  <falemagn@aros.org>
 
        * elf32-sh.c: Treat elfNN_bed like other macros defined in
          elfxx-target.h and #undef it before #define'ing it.
        * elf32-i386.c: Likewise.
-        * elf32-sh64.c: Likewise.
-        * elf64-alpha.c: Likewise.
-        * elf64-sh64.c: Likewise.
+       * elf32-sh64.c: Likewise.
+       * elf64-alpha.c: Likewise.
+       * elf64-sh64.c: Likewise.
 
 2003-01-20  Martin Schwidefsky  <schwidefsky@de.ibm.com>
 
        * Makefile.am (ALL_MACHINES): Use cpu-msp430.lo, not cpu-msp430.c.
        (BFD32_BACKENDS): Use elf32-msp430.lo, not elf32-msp430.c.
        * Makefile.in: Regenerate.
-       
+
 2003-01-08  Alexandre Oliva  <aoliva@redhat.com>
 
        * elfn32-mips.c (prev_reloc_section): New.
        (bfd_archures_list): Add bfd_iq2000_arch.
        * configure.in: Handle bfd_elf32_iq2000_vec.
        * configure: Regenerate.
-       * reloc.c: Add BFD_RELOC_IQ2000_OFFSET_16, BFD_RELOC_IQ2000_OFFSET_21, 
+       * reloc.c: Add BFD_RELOC_IQ2000_OFFSET_16, BFD_RELOC_IQ2000_OFFSET_21,
        and BFD_RELOC_IQ2000_UHI16.
        * targets.c (bfd_elf32_iq2000_vec): Declare.
        (bfd_target_vector): Add bfd_elf32_iq2000_vec.
        * archures.c (bfd_arch_get_compatible): Add third parameter
        'accept_unknowns'.  Only accept unknown format BFDs if
        accept_unknowns is true, or if the format is "binary".
-        * bfd-in2.h: Regenerate.
+       * bfd-in2.h: Regenerate.
 
 2002-12-21  Nick Clifton  <nickc@redhat.com>
 
        * bfd-in2.h: Regenerate.
        * elf32-xstormy16.c (xstormy16_elf_howto): Add R_XSTORMY16_12.
        (xstormy16_reloc_map): Add R_XSTORMY16_12.
-       
+
 2002-12-19  Kazu Hirata  <kazu@cs.umass.edu>
 
        * doc/bfdint.texi: Fix typos.
index 6f05319..401568f 100644 (file)
@@ -877,8 +877,8 @@ corefile.lo: corefile.c $(INCDIR)/filenames.h
 format.lo: format.c $(INCDIR)/filenames.h
 init.lo: init.c $(INCDIR)/filenames.h
 libbfd.lo: libbfd.c $(INCDIR)/filenames.h
-opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
-  $(INCDIR)/objalloc.h
+opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+  $(INCDIR)/libiberty.h
 reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
 section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
 syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
@@ -1250,7 +1250,7 @@ elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
 elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(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
+  elf32-ppc.h elf32-target.h
 elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
index e6a600f..a05b342 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -799,7 +799,7 @@ configure.in version.h
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = gtar
+TAR = tar
 GZIP_ENV = --best
 SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
 OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
@@ -1410,8 +1410,8 @@ corefile.lo: corefile.c $(INCDIR)/filenames.h
 format.lo: format.c $(INCDIR)/filenames.h
 init.lo: init.c $(INCDIR)/filenames.h
 libbfd.lo: libbfd.c $(INCDIR)/filenames.h
-opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \
-  $(INCDIR)/objalloc.h
+opncls.lo: opncls.c $(INCDIR)/filenames.h $(INCDIR)/objalloc.h \
+  $(INCDIR)/libiberty.h
 reloc.lo: reloc.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
 section.lo: section.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h
 syms.lo: syms.c $(INCDIR)/filenames.h $(INCDIR)/safe-ctype.h \
@@ -1783,7 +1783,7 @@ elf32-pj.lo: elf32-pj.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
 elf32-ppc.lo: elf32-ppc.c $(INCDIR)/filenames.h $(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
+  elf32-ppc.h elf32-target.h
 elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
   $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
   $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
index 08015f9..62edda1 100644 (file)
@@ -234,6 +234,7 @@ DESCRIPTION
 .#define bfd_mach_arm_5T       8
 .#define bfd_mach_arm_5TE      9
 .#define bfd_mach_arm_XScale   10
+.#define bfd_mach_arm_ep9312   11
 .  bfd_arch_ns32k,     {* National Semiconductors ns32000 *}
 .  bfd_arch_w65,       {* WDC 65816 *}
 .  bfd_arch_tic30,     {* Texas Instruments TMS320C30 *}
index 3b1f9ab..917b46f 100644 (file)
@@ -1,7 +1,8 @@
 /* Main header file for the bfd library -- portable access to object files.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
-   Free Software Foundation, Inc.
+
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -68,7 +69,7 @@ extern "C" {
 #endif
 
 /* Forward declaration.  */
-typedef struct _bfd bfd;
+typedef struct bfd bfd;
 
 /* Boolean type used in bfd.  Too many systems define their own
    versions of "boolean" for us to safely typedef a "boolean" of
index a079599..9540eeb 100644 (file)
@@ -6,9 +6,10 @@
    Run "make headers" in your build bfd/ to regenerate.  */
 
 /* Main header file for the bfd library -- portable access to object files.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
-   Free Software Foundation, Inc.
+
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -75,7 +76,7 @@ extern "C" {
 #endif
 
 /* Forward declaration.  */
-typedef struct _bfd bfd;
+typedef struct bfd bfd;
 
 /* Boolean type used in bfd.  Too many systems define their own
    versions of "boolean" for us to safely typedef a "boolean" of
@@ -1261,10 +1262,35 @@ typedef struct sec
   /* A mark flag used by some linker backends for garbage collection.  */
   unsigned int gc_mark : 1;
 
-  /* Used by the ELF code to mark sections which have been allocated
-     to segments.  */
+  /* The following flags are used by the ELF linker. */
+
+  /* Mark sections which have been allocated to segments.  */
   unsigned int segment_mark : 1;
 
+  /* Type of sec_info information.  */
+  unsigned int sec_info_type:3;
+#define ELF_INFO_TYPE_NONE      0
+#define ELF_INFO_TYPE_STABS     1
+#define ELF_INFO_TYPE_MERGE     2
+#define ELF_INFO_TYPE_EH_FRAME  3
+#define ELF_INFO_TYPE_JUST_SYMS 4
+
+  /* Nonzero if this section uses RELA relocations, rather than REL.  */
+  unsigned int use_rela_p:1;
+
+  /* Bits used by various backends.  */
+  unsigned int has_tls_reloc:1;
+
+  /* Usused bits.  */
+  unsigned int flag11:1;
+  unsigned int flag12:1;
+  unsigned int flag13:1;
+  unsigned int flag14:1;
+  unsigned int flag15:1;
+  unsigned int flag16:4;
+  unsigned int flag20:4;
+  unsigned int flag24:8;
+
   /* End of internal packed boolean fields.  */
 
   /*  The virtual memory address of the section - where it will be
@@ -1664,6 +1690,7 @@ enum bfd_architecture
 #define bfd_mach_arm_5T        8
 #define bfd_mach_arm_5TE       9
 #define bfd_mach_arm_XScale    10
+#define bfd_mach_arm_ep9312    11
   bfd_arch_ns32k,     /* National Semiconductors ns32000 */
   bfd_arch_w65,       /* WDC 65816 */
   bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
@@ -2304,6 +2331,9 @@ to compensate for the borrow when the low bits are added.  */
 /* Like BFD_RELOC_LO16, but PC relative.  */
   BFD_RELOC_PCREL_LO16,
 
+/* Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC.  */
+  BFD_RELOC_MIPSEMB_16_PCREL_S2,
+
 /* Relocation against a MIPS literal section.  */
   BFD_RELOC_MIPS_LITERAL,
 
@@ -2463,6 +2493,48 @@ to compensate for the borrow when the low bits are added.  */
   BFD_RELOC_PPC64_PLTGOT16_DS,
   BFD_RELOC_PPC64_PLTGOT16_LO_DS,
 
+/* PowerPC and PowerPC64 thread-local storage relocations.  */
+  BFD_RELOC_PPC_TLS,
+  BFD_RELOC_PPC_DTPMOD,
+  BFD_RELOC_PPC_TPREL16,
+  BFD_RELOC_PPC_TPREL16_LO,
+  BFD_RELOC_PPC_TPREL16_HI,
+  BFD_RELOC_PPC_TPREL16_HA,
+  BFD_RELOC_PPC_TPREL,
+  BFD_RELOC_PPC_DTPREL16,
+  BFD_RELOC_PPC_DTPREL16_LO,
+  BFD_RELOC_PPC_DTPREL16_HI,
+  BFD_RELOC_PPC_DTPREL16_HA,
+  BFD_RELOC_PPC_DTPREL,
+  BFD_RELOC_PPC_GOT_TLSGD16,
+  BFD_RELOC_PPC_GOT_TLSGD16_LO,
+  BFD_RELOC_PPC_GOT_TLSGD16_HI,
+  BFD_RELOC_PPC_GOT_TLSGD16_HA,
+  BFD_RELOC_PPC_GOT_TLSLD16,
+  BFD_RELOC_PPC_GOT_TLSLD16_LO,
+  BFD_RELOC_PPC_GOT_TLSLD16_HI,
+  BFD_RELOC_PPC_GOT_TLSLD16_HA,
+  BFD_RELOC_PPC_GOT_TPREL16,
+  BFD_RELOC_PPC_GOT_TPREL16_LO,
+  BFD_RELOC_PPC_GOT_TPREL16_HI,
+  BFD_RELOC_PPC_GOT_TPREL16_HA,
+  BFD_RELOC_PPC_GOT_DTPREL16,
+  BFD_RELOC_PPC_GOT_DTPREL16_LO,
+  BFD_RELOC_PPC_GOT_DTPREL16_HI,
+  BFD_RELOC_PPC_GOT_DTPREL16_HA,
+  BFD_RELOC_PPC64_TPREL16_DS,
+  BFD_RELOC_PPC64_TPREL16_LO_DS,
+  BFD_RELOC_PPC64_TPREL16_HIGHER,
+  BFD_RELOC_PPC64_TPREL16_HIGHERA,
+  BFD_RELOC_PPC64_TPREL16_HIGHEST,
+  BFD_RELOC_PPC64_TPREL16_HIGHESTA,
+  BFD_RELOC_PPC64_DTPREL16_DS,
+  BFD_RELOC_PPC64_DTPREL16_LO_DS,
+  BFD_RELOC_PPC64_DTPREL16_HIGHER,
+  BFD_RELOC_PPC64_DTPREL16_HIGHERA,
+  BFD_RELOC_PPC64_DTPREL16_HIGHEST,
+  BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
+
 /* IBM 370/390 relocations  */
   BFD_RELOC_I370_D12,
 
@@ -3376,7 +3448,7 @@ typedef struct symbol_cache_entry
      instead, except that some symbols point to the global sections
      bfd_{abs,com,und}_section.  This could be fixed by making
      these globals be per-bfd (or per-target-flavor).  FIXME.  */
-  struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
+  struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field.  */
 
   /* The text of the symbol. The name is left alone, and not copied; the
      application may not alter it.  */
@@ -3537,7 +3609,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb
                (ibfd, isymbol, obfd, osymbol))
 
 /* Extracted from bfd.c.  */
-struct _bfd
+struct bfd
 {
   /* A unique identifier of the BFD  */
   unsigned int id;
@@ -3568,7 +3640,7 @@ struct _bfd
 
   /* The caching routines use these to maintain a
      least-recently-used list of BFDs.  */
-  struct _bfd *lru_prev, *lru_next;
+  struct bfd *lru_prev, *lru_next;
 
   /* When a file is closed by the caching routines, BFD retains
      state information on the file here...  */
@@ -3642,13 +3714,13 @@ struct _bfd
 
   /* Stuff only useful for archives.  */
   PTR arelt_data;
-  struct _bfd *my_archive;     /* The containing archive BFD.  */
-  struct _bfd *next;           /* The next BFD in the archive.  */
-  struct _bfd *archive_head;   /* The first BFD in the archive.  */
+  struct bfd *my_archive;      /* The containing archive BFD.  */
+  struct bfd *next;            /* The next BFD in the archive.  */
+  struct bfd *archive_head;    /* The first BFD in the archive.  */
   bfd_boolean has_armap;
 
   /* A chain of BFD structures involved in a link.  */
-  struct _bfd *link_next;
+  struct bfd *link_next;
 
   /* A field used by _bfd_generic_link_add_archive_symbols.  This will
      be used only for archive elements.  */
@@ -3804,33 +3876,31 @@ bfd_boolean
 bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
 
 #define bfd_set_private_flags(abfd, flags) \
-     BFD_SEND (abfd, _bfd_set_private_flags, \
-               (abfd, flags))
+     BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
 #define bfd_sizeof_headers(abfd, reloc) \
-     BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+       BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
 
 #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
-     BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
+       BFD_SEND (abfd, _bfd_find_nearest_line, \
+                 (abfd, sec, syms, off, file, func, line))
 
-       /* Do these three do anything useful at all, for any back end?  */
 #define bfd_debug_info_start(abfd) \
-        BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+       BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
 
 #define bfd_debug_info_end(abfd) \
-        BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+       BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
 
 #define bfd_debug_info_accumulate(abfd, section) \
-        BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
+       BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
 
 #define bfd_stat_arch_elt(abfd, stat) \
-        BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+       BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
 
 #define bfd_update_armap_timestamp(abfd) \
-        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+       BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
 
 #define bfd_set_arch_mach(abfd, arch, mach)\
-        BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+       BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
 
 #define bfd_relax_section(abfd, section, link_info, again) \
        BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
@@ -4289,14 +4359,17 @@ const char **
 bfd_target_list PARAMS ((void));
 
 const bfd_target *
-bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
+bfd_search_for_target PARAMS ((int (* search_func)
+       (const bfd_target *, void *),
+    void *));
 
 /* Extracted from format.c.  */
 bfd_boolean
 bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
 
 bfd_boolean
-bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
+bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format,
+    char ***matching));
 
 bfd_boolean
 bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
index 1a332a8..3225082 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,6 +1,6 @@
 /* Generic BFD library interface and support routines.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -34,7 +34,7 @@ SECTION
 
 CODE_FRAGMENT
 .
-.struct _bfd
+.struct bfd
 .{
 .  {* A unique identifier of the BFD  *}
 .  unsigned int id;
@@ -65,7 +65,7 @@ CODE_FRAGMENT
 .
 .  {* The caching routines use these to maintain a
 .     least-recently-used list of BFDs.  *}
-.  struct _bfd *lru_prev, *lru_next;
+.  struct bfd *lru_prev, *lru_next;
 .
 .  {* When a file is closed by the caching routines, BFD retains
 .     state information on the file here...  *}
@@ -139,13 +139,13 @@ CODE_FRAGMENT
 .
 .  {* Stuff only useful for archives.  *}
 .  PTR arelt_data;
-.  struct _bfd *my_archive;     {* The containing archive BFD.  *}
-.  struct _bfd *next;           {* The next BFD in the archive.  *}
-.  struct _bfd *archive_head;   {* The first BFD in the archive.  *}
+.  struct bfd *my_archive;      {* The containing archive BFD.  *}
+.  struct bfd *next;            {* The next BFD in the archive.  *}
+.  struct bfd *archive_head;    {* The first BFD in the archive.  *}
 .  bfd_boolean has_armap;
 .
 .  {* A chain of BFD structures involved in a link.  *}
-.  struct _bfd *link_next;
+.  struct bfd *link_next;
 .
 .  {* A field used by _bfd_generic_link_add_archive_symbols.  This will
 .     be used only for archive elements.  *}
@@ -567,7 +567,7 @@ FUNCTION
        bfd_get_reloc_upper_bound
 
 SYNOPSIS
-       long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
+       long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
 
 DESCRIPTION
        Return the number of bytes required to store the
@@ -662,7 +662,7 @@ FUNCTION
        bfd_set_file_flags
 
 SYNOPSIS
-       bfd_boolean bfd_set_file_flags(bfd *abfd, flagword flags);
+       bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
 
 DESCRIPTION
        Set the flag word in the BFD @var{abfd} to the value @var{flags}.
@@ -813,7 +813,7 @@ FUNCTION
        bfd_set_start_address
 
 SYNOPSIS
-       bfd_boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
+       bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
 
 DESCRIPTION
        Make @var{vma} the entry point of output BFD @var{abfd}.
@@ -836,7 +836,7 @@ FUNCTION
        bfd_get_gp_size
 
 SYNOPSIS
-       unsigned int bfd_get_gp_size(bfd *abfd);
+       unsigned int bfd_get_gp_size (bfd *abfd);
 
 DESCRIPTION
        Return the maximum size of objects to be optimized using the GP
@@ -863,7 +863,7 @@ FUNCTION
        bfd_set_gp_size
 
 SYNOPSIS
-       void bfd_set_gp_size(bfd *abfd, unsigned int i);
+       void bfd_set_gp_size (bfd *abfd, unsigned int i);
 
 DESCRIPTION
        Set the maximum size of objects to be optimized using the GP
@@ -926,7 +926,7 @@ FUNCTION
        bfd_scan_vma
 
 SYNOPSIS
-       bfd_vma bfd_scan_vma(const char *string, const char **end, int base);
+       bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
 
 DESCRIPTION
        Convert, like <<strtoul>>, a numerical expression
@@ -1016,7 +1016,7 @@ FUNCTION
        bfd_copy_private_bfd_data
 
 SYNOPSIS
-       bfd_boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
+       bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
 
 DESCRIPTION
        Copy private BFD information from the BFD @var{ibfd} to the
@@ -1037,7 +1037,7 @@ FUNCTION
        bfd_merge_private_bfd_data
 
 SYNOPSIS
-       bfd_boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
+       bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
 
 DESCRIPTION
        Merge private BFD information from the BFD @var{ibfd} to the
@@ -1058,7 +1058,7 @@ FUNCTION
        bfd_set_private_flags
 
 SYNOPSIS
-       bfd_boolean bfd_set_private_flags(bfd *abfd, flagword flags);
+       bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
 
 DESCRIPTION
        Set private BFD flag information in the BFD @var{abfd}.
@@ -1069,43 +1069,41 @@ DESCRIPTION
        Not enough memory exists to create private data for @var{obfd}.
 
 .#define bfd_set_private_flags(abfd, flags) \
-.     BFD_SEND (abfd, _bfd_set_private_flags, \
-.              (abfd, flags))
+.     BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
 
 */
 
 /*
 FUNCTION
-       stuff
+       Other functions
 
 DESCRIPTION
-       Stuff which should be documented:
+       The following functions exist but have not yet been documented.
 
 .#define bfd_sizeof_headers(abfd, reloc) \
-.     BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
+.       BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
 .
 .#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
-.     BFD_SEND (abfd, _bfd_find_nearest_line,  (abfd, sec, syms, off, file, func, line))
+.       BFD_SEND (abfd, _bfd_find_nearest_line, \
+.                 (abfd, sec, syms, off, file, func, line))
 .
-.       {* Do these three do anything useful at all, for any back end?  *}
 .#define bfd_debug_info_start(abfd) \
-.        BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+.       BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
 .
 .#define bfd_debug_info_end(abfd) \
-.        BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+.       BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
 .
 .#define bfd_debug_info_accumulate(abfd, section) \
-.        BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-.
+.       BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
 .
 .#define bfd_stat_arch_elt(abfd, stat) \
-.        BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
+.       BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
 .
 .#define bfd_update_armap_timestamp(abfd) \
-.        BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+.       BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
 .
 .#define bfd_set_arch_mach(abfd, arch, mach)\
-.        BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+.       BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
 .
 .#define bfd_relax_section(abfd, section, link_info, again) \
 .       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
@@ -1265,7 +1263,7 @@ FUNCTION
        bfd_alt_mach_code
 
 SYNOPSIS
-       bfd_boolean bfd_alt_mach_code(bfd *abfd, int alternative);
+       bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
 
 DESCRIPTION
 
index e21c5b5..2c99af1 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for Hitachi H8/300 COFF binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Steve Chamberlain, <sac@cygnus.com>.
 
@@ -210,7 +210,7 @@ h8300_coff_link_hash_table_create (abfd)
   ret->vectors_sec = NULL;
   ret->funcvec_hash_table = NULL;
 
-  /* OK.  Everything's intialized, return the base pointer.  */
+  /* OK.  Everything's initialized, return the base pointer.  */
   return &ret->root.root;
 }
 
@@ -396,13 +396,9 @@ reloc_processing (relent, reloc, symbols, abfd, section)
   rtype2howto (relent, reloc);
 
   if (((int) reloc->r_symndx) > 0)
-    {
-      relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
-    }
+    relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
   else
-    {
-      relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
-    }
+    relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
 
   relent->addend = reloc->r_offset;
 
@@ -428,6 +424,7 @@ h8300_symbol_address_p (abfd, input_section, address)
   while (*s)
     {
       asymbol *p = *s;
+
       if (p->section == input_section
          && (input_section->output_section->vma
              + input_section->output_offset
@@ -472,8 +469,8 @@ h8300_reloc16_estimate (abfd, input_section, reloc, shrink, link_info)
   /* Only examine the relocs which might be relaxable.  */
   switch (reloc->howto->type)
     {
-    /* This is the 16/24 bit absolute branch which could become an 8 bit
-       pc-relative branch.  */
+      /* This is the 16/24 bit absolute branch which could become an 8 bit
+        pc-relative branch.  */
     case R_JMP1:
     case R_JMPL1:
       /* Get the address of the target of this branch.  */
@@ -720,7 +717,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
 
       /* Everything looks OK.  Apply the relocation and update the
         src/dst address appropriately.  */
-
       bfd_put_8 (abfd, gap, data + dst_address);
       dst_address++;
       src_address++;
@@ -752,7 +748,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
 
       /* Everything looks OK.  Apply the relocation and update the
         src/dst address appropriately.  */
-
       bfd_put_16 (abfd, (bfd_vma) gap, data + dst_address);
       dst_address += 2;
       src_address += 2;
@@ -773,7 +768,6 @@ h8300_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr,
        {
          /* Everything looks OK.  Apply the relocation and update the
             src/dst address appropriately.  */
-
          bfd_put_8 (abfd, value & 0xff, data + dst_address);
          dst_address += 1;
          src_address += 1;
index f0c82a6..067f2b6 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for PowerPC Microsoft Portable Executable files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    Original version pieced together by Kim Knuttila (krk@cygnus.com)
@@ -9,30 +9,29 @@
    coff files, in particular, those for the rs/6000, alpha, mips, and
    intel backends, and the PE work for the arm.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* Current State:
    - objdump works
    - relocs generated by gas
    - ld will link files, but they do not run.
    - dlltool will not produce correct output in some .reloc cases, and will
-     not produce the right glue code for dll function calls.
-*/
+     not produce the right glue code for dll function calls.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -58,15 +57,15 @@ extern bfd_boolean ppc_bfd_coff_final_link
   PARAMS ((bfd *, struct bfd_link_info *));
 extern void dump_toc PARAMS ((PTR));
 
-/* The toc is a set of bfd_vma fields. We use the fact that valid         */
-/* addresses are even (i.e. the bit representing "1" is off) to allow     */
-/* us to encode a little extra information in the field                   */
-/* - Unallocated addresses are intialized to 1.                           */
-/* - Allocated addresses are even numbers.                                */
-/* The first time we actually write a reference to the toc in the bfd,    */
-/* we want to record that fact in a fixup file (if it is asked for), so   */
-/* we keep track of whether or not an address has been written by marking */
-/* the low order bit with a "1" upon writing                              */
+/* The toc is a set of bfd_vma fields. We use the fact that valid
+   addresses are even (i.e. the bit representing "1" is off) to allow
+   us to encode a little extra information in the field
+   - Unallocated addresses are initialized to 1.
+   - Allocated addresses are even numbers.
+   The first time we actually write a reference to the toc in the bfd,
+   we want to record that fact in a fixup file (if it is asked for), so
+   we keep track of whether or not an address has been written by marking
+   the low order bit with a "1" upon writing.  */
 
 #define SET_UNALLOCATED(x)  ((x) = 1)
 #define IS_UNALLOCATED(x)   ((x) == 1)
@@ -75,10 +74,10 @@ extern void dump_toc PARAMS ((PTR));
 #define MARK_AS_WRITTEN(x)  ((x) |= 1)
 #define MAKE_ADDR_AGAIN(x)  ((x) &= ~1)
 
-/* Turn on this check if you suspect something amiss in the hash tables */
+/* Turn on this check if you suspect something amiss in the hash tables */
 #ifdef DEBUG_HASH
 
-/* Need a 7 char string for an eye catcher */
+/* Need a 7 char string for an eye catcher */
 #define EYE "krkjunk"
 
 #define HASH_CHECK_DCL char eye_catcher[8];
@@ -101,17 +100,17 @@ extern void dump_toc PARAMS ((PTR));
 #endif
 
 /* In order not to add an int to every hash table item for every coff
-   linker, we define our own hash table, derived from the coff one */
+   linker, we define our own hash table, derived from the coff one */
 
 /* PE linker hash table entries.  */
 
 struct ppc_coff_link_hash_entry
 {
-  struct coff_link_hash_entry root; /* First entry, as required  */
+  struct coff_link_hash_entry root; /* First entry, as required.  */
 
   /* As we wonder around the relocs, we'll keep the assigned toc_offset
-     here */
-  bfd_vma toc_offset;               /* Our addition, as required */
+     here */
+  bfd_vma toc_offset;               /* Our addition, as required */
   int symbol_is_glue;
   unsigned long int glue_insn;
 
@@ -122,7 +121,7 @@ struct ppc_coff_link_hash_entry
 
 struct ppc_coff_link_hash_table
 {
-  struct coff_link_hash_table root; /* First entry, as required */
+  struct coff_link_hash_table root; /* First entry, as required */
 };
 
 static struct bfd_hash_entry *ppc_coff_link_hash_newfunc
@@ -172,11 +171,11 @@ ppc_coff_link_hash_newfunc (entry, table, string)
   if (ret)
     {
       /* Initialize the local fields.  */
-      SET_UNALLOCATED(ret->toc_offset);
+      SET_UNALLOCATED (ret->toc_offset);
       ret->symbol_is_glue = 0;
       ret->glue_insn = 0;
 
-      HASH_CHECK_INIT(ret);
+      HASH_CHECK_INIT (ret);
     }
 
   return (struct bfd_hash_entry *) ret;
@@ -216,13 +215,13 @@ ppc_coff_link_hash_table_create (abfd)
   return &ret->root.root;
 }
 
-/* Now, tailor coffcode.h to use our hash stuff */
+/* Now, tailor coffcode.h to use our hash stuff */
 
 #define coff_bfd_link_hash_table_create ppc_coff_link_hash_table_create
 \f
-/* 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 */
-/* for this when we fix up loads displaced off the toc reg.           */
+/* 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
+   for this when we fix up loads displaced off the toc reg.  */
 #define TOC_LOAD_ADJUSTMENT (-32768)
 #define TOC_SECTION_NAME ".private.toc"
 
@@ -234,7 +233,7 @@ ppc_coff_link_hash_table_create (abfd)
    from smaller values.  Start with zero, widen, *then* decrement.  */
 #define MINUS_ONE      (((bfd_vma)0) - 1)
 
-/* these should definitely go in a header file somewhere...  */
+/* These should definitely go in a header file somewhere...  */
 
 /* NOP */
 #define IMAGE_REL_PPC_ABSOLUTE          0x0000
@@ -284,31 +283,31 @@ ppc_coff_link_hash_table_create (abfd)
 /* va of containing section (limited to 16 bits) */
 #define IMAGE_REL_PPC_SECREL16          0x000F
 
-/* stuff to handle immediate data when the number of bits in the */
-/* data is greater than the number of bits in the immediate field */
-/* We need to do (usually) 32 bit arithmetic on 16 bit chunks */
+/* Stuff to handle immediate data when the number of bits in the
+   data is greater than the number of bits in the immediate field
+   We need to do (usually) 32 bit arithmetic on 16 bit chunks.  */
 #define IMAGE_REL_PPC_REFHI             0x0010
 #define IMAGE_REL_PPC_REFLO             0x0011
 #define IMAGE_REL_PPC_PAIR              0x0012
 
-/* This is essentially the same as tocrel16, with TOCDEFN assumed */
+/* This is essentially the same as tocrel16, with TOCDEFN assumed */
 #define IMAGE_REL_PPC_TOCREL16_DEFN     0x0013
 
-/*  Flag bits in IMAGE_RELOCATION.TYPE */
+/* Flag bits in IMAGE_RELOCATION.TYPE.  */
 
-/* subtract reloc value rather than adding it */
+/* Subtract reloc value rather than adding it.  */
 #define IMAGE_REL_PPC_NEG               0x0100
 
-/* fix branch prediction bit to predict branch taken */
+/* Fix branch prediction bit to predict branch taken.  */
 #define IMAGE_REL_PPC_BRTAKEN           0x0200
 
-/* fix branch prediction bit to predict branch not taken */
+/* Fix branch prediction bit to predict branch not taken.  */
 #define IMAGE_REL_PPC_BRNTAKEN          0x0400
 
-/* toc slot defined in file (or, data in toc) */
+/* TOC slot defined in file (or, data in toc).  */
 #define IMAGE_REL_PPC_TOCDEFN           0x0800
 
-/* masks to isolate above values in IMAGE_RELOCATION.Type */
+/* Masks to isolate above values in IMAGE_RELOCATION.Type.  */
 #define IMAGE_REL_PPC_TYPEMASK          0x00FF
 #define IMAGE_REL_PPC_FLAGMASK          0x0F00
 
@@ -317,7 +316,7 @@ ppc_coff_link_hash_table_create (abfd)
 #define EXTRACT_JUNK(x)  \
            ((x) & ~(IMAGE_REL_PPC_TYPEMASK | IMAGE_REL_PPC_FLAGMASK))
 \f
-/* static helper functions to make relocation work */
+/* Static helper functions to make relocation work.  */
 /* (Work In Progress) */
 
 static bfd_reloc_status_type ppc_refhi_reloc PARAMS ((bfd *abfd,
@@ -389,41 +388,36 @@ static bfd_boolean in_reloc_p PARAMS((bfd *abfd, reloc_howto_type *howto));
 \f
 /* FIXME: It'll take a while to get through all of these. I only need a few to
    get us started, so those I'll make sure work. Those marked FIXME are either
-   completely unverified or have a specific unknown marked in the comment */
-
-/*---------------------------------------------------------------------------*/
-/*                                                                           */
-/* Relocation entries for Windows/NT on PowerPC.                             */
-/*                                                                           */
-/* From the document "" we find the following listed as used relocs:         */
-/*                                                                           */
-/*   ABSOLUTE       : The noop                                               */
-/*   ADDR[64|32|16] : fields that hold addresses in data fields or the       */
-/*                    16 bit displacement field on a load/store.             */
-/*   ADDR[24|14]    : fields that hold addresses in branch and cond          */
-/*                    branches. These represent [26|16] bit addresses.       */
-/*                    The low order 2 bits are preserved.                    */
-/*   REL[24|14]     : branches relative to the Instruction Address           */
-/*                    register. These represent [26|16] bit addresses,       */
-/*                    as before. The instruction field will be zero, and     */
-/*                    the address of the SYM will be inserted at link time.  */
-/*   TOCREL16       : 16 bit displacement field referring to a slot in       */
-/*                    toc.                                                   */
-/*   TOCREL14       : 16 bit displacement field, similar to REL14 or ADDR14.  */
-/*   ADDR32NB       : 32 bit address relative to the virtual origin.         */
-/*                    (On the alpha, this is always a linker generated thunk)*/
-/*                    (i.e. 32bit addr relative to the image base)           */
-/*   SECREL         : The value is relative to the start of the section      */
-/*                    containing the symbol.                                 */
-/*   SECTION        : access to the header containing the item. Supports the */
-/*                    codeview debugger.                                     */
-/*                                                                           */
-/* In particular, note that the document does not indicate that the          */
-/* relocations listed in the header file are used.                           */
-/*                                                                           */
-/*                                                                           */
-/*                                                                           */
-/*---------------------------------------------------------------------------*/
+   completely unverified or have a specific unknown marked in the comment.  */
+
+/* Relocation entries for Windows/NT on PowerPC.                             
+
+   From the document "" we find the following listed as used relocs:
+
+     ABSOLUTE       : The noop
+     ADDR[64|32|16] : fields that hold addresses in data fields or the
+                      16 bit displacement field on a load/store.
+     ADDR[24|14]    : fields that hold addresses in branch and cond
+                      branches. These represent [26|16] bit addresses.
+                      The low order 2 bits are preserved.
+     REL[24|14]     : branches relative to the Instruction Address
+                      register. These represent [26|16] bit addresses,
+                      as before. The instruction field will be zero, and
+                      the address of the SYM will be inserted at link time.
+     TOCREL16       : 16 bit displacement field referring to a slot in
+                      toc.
+     TOCREL14       : 16 bit displacement field, similar to REL14 or ADDR14.
+     ADDR32NB       : 32 bit address relative to the virtual origin.
+                      (On the alpha, this is always a linker generated thunk)
+                      (i.e. 32bit addr relative to the image base)
+     SECREL         : The value is relative to the start of the section
+                      containing the symbol.
+     SECTION        : access to the header containing the item. Supports the
+                      codeview debugger.
+
+   In particular, note that the document does not indicate that the
+   relocations listed in the header file are used.  */
+
 
 static reloc_howto_type ppc_coff_howto_table[] =
 {
@@ -767,7 +761,7 @@ static reloc_howto_type ppc_coff_howto_table[] =
 
 };
 \f
-/* Some really cheezy macros that can be turned on to test stderr :-) */
+/* Some really cheezy macros that can be turned on to test stderr :-)  */
 
 #ifdef DEBUG_RELOC
 #define UN_IMPL(x)                                           \
@@ -792,16 +786,14 @@ static reloc_howto_type ppc_coff_howto_table[] =
 
 #define n_name         _n._n_name
 #define n_zeroes       _n._n_n._n_zeroes
-#define n_offset       _n._n_n._n_offset
-
-*/
+#define n_offset       _n._n_n._n_offset  */
 
-#define DUMP_RELOC2(n,r)                     \
-{                                            \
-   fprintf (stderr,"%s sym %d, r_vaddr %d %s\n", \
-          n, r->r_symndx, r->r_vaddr,\
+#define DUMP_RELOC2(n,r)                               \
+{                                                      \
+   fprintf (stderr,"%s sym %d, r_vaddr %d %s\n",       \
+          n, r->r_symndx, r->r_vaddr,                  \
           (((r->r_type) & IMAGE_REL_PPC_TOCDEFN) == 0) \
-          ?" ":" TOCDEFN"  );      \
+          ?" ":" TOCDEFN"  );                          \
 }
 
 #else
@@ -810,14 +802,13 @@ static reloc_howto_type ppc_coff_howto_table[] =
 #define DUMP_RELOC2(n,r)
 #endif
 \f
-/* toc construction and management routines */
+/* TOC construction and management routines.  */
 
 /* This file is compiled twice, and these variables are defined in one
    of the compilations.  FIXME: This is confusing and weird.  Also,
    BFD should not use global variables.  */
-extern bfd* bfd_of_toc_owner;
+extern bfd *    bfd_of_toc_owner;
 extern long int global_toc_size;
-
 extern long int import_table_size;
 extern long int first_thunk_address;
 extern long int thunk_size;
@@ -858,7 +849,7 @@ record_toc (toc_section, our_toc_offset, cat, name)
      enum ref_category cat;
      const char *name;
 {
-  /* add this entry to our toc addr-offset-name list */
+  /* Add this entry to our toc addr-offset-name list.  */
   bfd_size_type amt = sizeof (struct list_ele);
   struct list_ele *t = (struct list_ele *) bfd_malloc (amt);
 
@@ -889,7 +880,7 @@ static bfd_boolean ppc_record_toc_entry
 static void ppc_mark_symbol_as_glue
   PARAMS ((bfd *, int, struct internal_reloc *));
 
-/* record a toc offset against a symbol */
+/* Record a toc offset against a symbol.  */
 static bfd_boolean
 ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
      bfd *abfd;
@@ -914,16 +905,19 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
   if (h == 0)
     {
       local_syms = obj_coff_local_toc_table(abfd);
+
       if (local_syms == 0)
        {
          unsigned int i;
          bfd_size_type amt;
+
          /* allocate a table */
          amt = (bfd_size_type) obj_raw_syment_count (abfd) * sizeof (int);
          local_syms = (int *) bfd_zalloc (abfd, amt);
          if (local_syms == 0)
            return FALSE;
          obj_coff_local_toc_table (abfd) = local_syms;
+
          for (i = 0; i < obj_raw_syment_count (abfd); ++i)
            {
              SET_UNALLOCATED (local_syms[i]);
@@ -935,7 +929,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
          local_syms[sym] = global_toc_size;
          global_toc_size += 4;
 
-         /* The size must fit in a 16bit displacment */
+         /* The size must fit in a 16bit displacment */
          if (global_toc_size > 65535)
            {
              (*_bfd_error_handler) (_("TOC overflow"));
@@ -948,14 +942,14 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
     {
       name = h->root.root.root.string;
 
-      /* check to see if there's a toc slot allocated. If not, do it
-        here. It will be used in relocate_section */
+      /* Check to see if there's a toc slot allocated. If not, do it
+        here. It will be used in relocate_section */
       if (IS_UNALLOCATED(h->toc_offset))
        {
          h->toc_offset = global_toc_size;
          global_toc_size += 4;
 
-         /* The size must fit in a 16bit displacment */
+         /* The size must fit in a 16bit displacment */
          if (global_toc_size >= 65535)
            {
              (*_bfd_error_handler) (_("TOC overflow"));
@@ -968,7 +962,7 @@ ppc_record_toc_entry(abfd, info, sec, sym, toc_kind)
   return TRUE;
 }
 
-/* record a toc offset against a symbol */
+/* Record a toc offset against a symbol.  */
 static void
 ppc_mark_symbol_as_glue(abfd, sym, rel)
      bfd *abfd;
@@ -1013,9 +1007,9 @@ static bfd_boolean in_reloc_p(abfd, howto)
 
 #if 0
 
-/* this function is in charge of performing all the ppc PE relocations */
-/* Don't yet know if we want to do this this particular way ... (krk)  */
-/* FIXME: (it is not yet enabled) */
+/* This function is in charge of performing all the ppc PE relocations
+   Don't yet know if we want to do this this particular way ... (krk).  */
+/* FIXME: (it is not yet enabled) */
 
 static bfd_reloc_status_type
 pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
@@ -1028,8 +1022,8 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
      bfd *output_bfd;
      char **error_message;
 {
-  /* the consth relocation comes in two parts, we have to remember
-     the state between calls, in these variables */
+  /* The consth relocation comes in two parts, we have to remember
+     the state between calls, in these variables */
   static bfd_boolean part1_consth_active = FALSE;
   static unsigned long part1_consth_value;
 
@@ -1041,7 +1035,7 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
 
   if (output_bfd)
     {
-      /* Partial linking - do nothing */
+      /* Partial linking - do nothing */
       reloc_entry->address += input_section->output_offset;
       return bfd_reloc_ok;
     }
@@ -1049,7 +1043,7 @@ pe_ppc_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
   if (symbol_in != NULL
       && bfd_is_und_section (symbol_in->section))
     {
-      /* Keep the state machine happy in case we're called again */
+      /* Keep the state machine happy in case we're called again */
       if (r_type == IMAGE_REL_PPC_REFHI)
        {
          part1_consth_active = TRUE;
@@ -1151,7 +1145,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
       sec = NULL;
       val = 0;
 
-      /* FIXME: PAIR unsupported in the following code */
+      /* FIXME: PAIR unsupported in the following code */
       if (h == NULL)
        {
          if (symndx == -1)
@@ -1189,7 +1183,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
 
       rstat = bfd_reloc_ok;
 
-      /* Each case must do its own relocation, setting rstat appropriately */
+      /* Each case must do its own relocation, setting rstat appropriately */
       switch (r_type)
        {
        default:
@@ -1217,16 +1211,15 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                  }
              }
 
-           /*
-            *  Amazing bit tricks present. As we may have seen earlier, we
-            *  use the 1 bit to tell us whether or not a toc offset has been
-            *  allocated. Now that they've all been allocated, we will use
-            *  the 1 bit to tell us if we've written this particular toc
-            *  entry out.
-            */
+           /* Amazing bit tricks present. As we may have seen earlier, we
+              use the 1 bit to tell us whether or not a toc offset has been
+              allocated. Now that they've all been allocated, we will use
+              the 1 bit to tell us if we've written this particular toc
+              entry out.  */
            fixit = FALSE;
            if (h == 0)
-             { /* it is a file local symbol */
+             {
+               /* It is a file local symbol.  */
                int *local_toc_table;
                const char *name;
 
@@ -1238,15 +1231,14 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
 
                if (IS_WRITTEN(our_toc_offset))
                  {
-                   /* if it has been written out, it is marked with the
+                   /* If it has been written out, it is marked with the
                       1 bit. Fix up our offset, but do not write it out
-                      again.
-                    */
+                      again.  */
                    MAKE_ADDR_AGAIN(our_toc_offset);
                  }
                else
                  {
-                   /* write out the toc entry */
+                   /* Write out the toc entry.  */
                    record_toc (toc_section, our_toc_offset, priv,
                                strdup (name));
 
@@ -1277,13 +1269,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                       Import Address Table is mapped immediately following
                       the toc, some trippy library code trying for speed on
                       dll linkage, takes advantage of that and considers
-                      the IAT to be part of the toc, thus saving a load.
-                   */
+                      the IAT to be part of the toc, thus saving a load.  */
 
                    our_toc_offset = val - (toc_section->output_section->vma
                                            + toc_section->output_offset);
 
-                   /* The size must still fit in a 16bit displacment */
+                   /* The size must still fit in a 16bit displacment */
                    if ((bfd_vma) our_toc_offset >= 65535)
                      {
                        (*_bfd_error_handler)
@@ -1297,12 +1288,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                    record_toc (toc_section, our_toc_offset, pub,
                                strdup (name));
                  }
-               else if (IS_WRITTEN(our_toc_offset))
+               else if (IS_WRITTEN (our_toc_offset))
                  {
-                   /* if it has been written out, it is marked with the
+                   /* If it has been written out, it is marked with the
                       1 bit. Fix up our offset, but do not write it out
-                      again.
-                    */
+                      again.  */
                    MAKE_ADDR_AGAIN(our_toc_offset);
                  }
                else
@@ -1310,13 +1300,13 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                    record_toc(toc_section, our_toc_offset, pub,
                               strdup (name));
 
-                   /* write out the toc entry */
+                   /* Write out the toc entry.  */
                    bfd_put_32 (output_bfd, val,
                               toc_section->contents + our_toc_offset);
 
                    MARK_AS_WRITTEN(h->toc_offset);
-                   /* The tricky part is that this is the address that */
-                   /* needs a .reloc entry for it */
+                   /* The tricky part is that this is the address that
+                      needs a .reloc entry for it.  */
                    fixit = TRUE;
                  }
              }
@@ -1324,22 +1314,21 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
            if (fixit && info->base_file)
              {
                /* So if this is non pcrelative, and is referenced
-                  to a section or a common symbol, then it needs a reloc */
+                  to a section or a common symbol, then it needs a reloc */
 
-               /* relocation to a symbol in a section which
+               /* Relocation to a symbol in a section which
                   isn't absolute - we output the address here
-                  to a file */
-
+                  to a file.  */
                bfd_vma addr = (toc_section->output_section->vma
                                + toc_section->output_offset + our_toc_offset);
 
-               if (coff_data(output_bfd)->pe)
+               if (coff_data (output_bfd)->pe)
                  addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
 
                fwrite (&addr, 1,4, (FILE *) info->base_file);
              }
 
-           /* FIXME: this test is conservative */
+           /* FIXME: this test is conservative */
            if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN
                && (bfd_vma) our_toc_offset > toc_section->_raw_size)
              {
@@ -1351,21 +1340,21 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                return FALSE;
              }
 
-           /* Now we know the relocation for this toc reference */
+           /* Now we know the relocation for this toc reference */
            relocation =  our_toc_offset + TOC_LOAD_ADJUSTMENT;
            rstat = _bfd_relocate_contents (howto, input_bfd, relocation, loc);
          }
          break;
        case IMAGE_REL_PPC_IFGLUE:
          {
-           /* To solve this, we need to know whether or not the symbol */
-           /* appearing on the call instruction is a glue function or not.  */
-           /* A glue function must announce itself via a IMGLUE reloc, and */
-           /* the reloc contains the required toc restore instruction */
-
+           /* To solve this, we need to know whether or not the symbol
+              appearing on the call instruction is a glue function or not.
+              A glue function must announce itself via a IMGLUE reloc, and 
+              the reloc contains the required toc restore instruction.  */
            bfd_vma x;
            const char *my_name;
-           DUMP_RELOC2(howto->name, rel);
+           
+           DUMP_RELOC2 (howto->name, rel);
 
            if (h != 0)
              {
@@ -1379,25 +1368,24 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
          }
          break;
        case IMAGE_REL_PPC_SECREL:
-         /* Unimplemented: codeview debugging information */
+         /* Unimplemented: codeview debugging information */
          /* For fast access to the header of the section
             containing the item.  */
          break;
        case IMAGE_REL_PPC_SECTION:
-         /* Unimplemented: codeview debugging information */
+         /* Unimplemented: codeview debugging information */
          /* Is used to indicate that the value should be relative
             to the beginning of the section that contains the
-            symbol */
+            symbol */
          break;
        case IMAGE_REL_PPC_ABSOLUTE:
          {
            const char *my_name;
+
            if (h == 0)
-               my_name = (syms+symndx)->_n._n_name;
+             my_name = (syms+symndx)->_n._n_name;
            else
-             {
-               my_name = h->root.root.root.string;
-             }
+             my_name = h->root.root.root.string;
 
            fprintf (stderr,
                    _("Warning: unsupported reloc %s <file %s, section %s>\n"),
@@ -1413,8 +1401,9 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
        case IMAGE_REL_PPC_IMGLUE:
          {
            /* There is nothing to do now. This reloc was noted in the first
-              pass over the relocs, and the glue instruction extracted */
+              pass over the relocs, and the glue instruction extracted */
            const char *my_name;
+
            if (h->symbol_is_glue == 1)
              break;
            my_name = h->root.root.root.string;
@@ -1429,13 +1418,15 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
        case IMAGE_REL_PPC_ADDR32NB:
          {
            const char *name = 0;
-           DUMP_RELOC2(howto->name, rel);
+
+           DUMP_RELOC2 (howto->name, rel);
 
            if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0)
              {
-               /* set magic values */
+               /* Set magic values.  */
                int idata5offset;
                struct coff_link_hash_entry *myh;
+
                myh = coff_link_hash_lookup (coff_hash_table (info),
                                             "__idata5_magic__",
                                             FALSE, FALSE, TRUE);
@@ -1457,7 +1448,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
              }
 
            if (h == 0)
-             { /* it is a file local symbol */
+             {
+               /* It is a file local symbol.  */
                sym = syms + symndx;
                name = sym->_n._n_name;
              }
@@ -1466,11 +1458,11 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                char *target = 0;
 
                name = h->root.root.root.string;
-               if (strcmp(".idata$2", name) == 0)
+               if (strcmp (".idata$2", name) == 0)
                  target = "__idata2_magic__";
-               else if (strcmp(".idata$4", name) == 0)
+               else if (strcmp (".idata$4", name) == 0)
                  target = "__idata4_magic__";
-               else if (strcmp(".idata$5", name) == 0)
+               else if (strcmp (".idata$5", name) == 0)
                  target = "__idata5_magic__";
 
                if (target != 0)
@@ -1514,10 +1506,10 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
              }
 
            rstat = _bfd_relocate_contents (howto,
-                             input_bfd,
-                             val -
-                             pe_data(output_bfd)->pe_opthdr.ImageBase,
-                             loc);
+                                           input_bfd,
+                                           val -
+                                           pe_data (output_bfd)->pe_opthdr.ImageBase,
+                                           loc);
          }
          break;
 
@@ -1542,24 +1534,23 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
          break;
        }
 
-      if ( info->base_file )
+      if (info->base_file)
        {
          /* So if this is non pcrelative, and is referenced
-            to a section or a common symbol, then it needs a reloc */
-         if (sym && pe_data(output_bfd)->in_reloc_p(output_bfd, howto))
+            to a section or a common symbol, then it needs a reloc */
+         if (sym && pe_data(output_bfd)->in_reloc_p (output_bfd, howto))
            {
-             /* relocation to a symbol in a section which
+             /* Relocation to a symbol in a section which
                 isn't absolute - we output the address here
-                to a file */
+                to a file */
              bfd_vma addr = rel->r_vaddr
                - input_section->vma
                + input_section->output_offset
                  + input_section->output_section->vma;
 
-             if (coff_data(output_bfd)->pe)
-               {
-                 addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
-               }
+             if (coff_data (output_bfd)->pe)
+               addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
+
              fwrite (&addr, 1,4, (FILE *) info->base_file);
            }
        }
@@ -1595,12 +1586,9 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section,
                   (info, name, howto->name,
                    (bfd_vma) 0, input_bfd,
                    input_section, rel->r_vaddr - input_section->vma)))
-             {
-               return FALSE;
-             }
+             return FALSE;
          }
        }
-
     }
 
   return TRUE;
@@ -1686,21 +1674,17 @@ ppc_allocate_toc_section (info)
   bfd_size_type amt;
   static char test_char = '1';
 
-  if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble? */
+  if ( global_toc_size == 0 ) /* FIXME: does this get me in trouble?  */
     return TRUE;
 
   if (bfd_of_toc_owner == 0)
-    {
-      /* No toc owner? Something is very wrong.  */
-      abort ();
-    }
+    /* No toc owner? Something is very wrong.  */
+    abort ();
 
   s = bfd_get_section_by_name ( bfd_of_toc_owner , TOC_SECTION_NAME);
   if (s == NULL)
-    {
-      /* No toc section? Something is very wrong.  */
-      abort ();
-    }
+    /* No toc section? Something is very wrong.  */
+    abort ();
 
   amt = global_toc_size;
   foo = (bfd_byte *) bfd_alloc (bfd_of_toc_owner, amt);
@@ -1720,58 +1704,55 @@ ppc_process_before_allocation (abfd, info)
   asection *sec;
   struct internal_reloc *i, *rel;
 
-  /* here we have a bfd that is to be included on the link. We have a hook
+  /* Here we have a bfd that is to be included on the link. We have a hook
      to do reloc rummaging, before section sizes are nailed down.  */
+  _bfd_coff_get_external_symbols (abfd);
 
-  _bfd_coff_get_external_symbols(abfd);
-
-  /* rummage around all the relocs and map the toc */
+  /* Rummage around all the relocs and map the toc.  */
   sec = abfd->sections;
 
   if (sec == 0)
-    {
-      return TRUE;
-    }
+    return TRUE;
 
   for (; sec != 0; sec = sec->next)
-  {
-    if (sec->reloc_count == 0)
-      continue;
+    {
+      if (sec->reloc_count == 0)
+       continue;
 
-    /* load the relocs */
-    /* FIXME: there may be a storage leak here */
-    i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
+      /* load the relocs */
+      /* FIXME: there may be a storage leak here */
+      i=_bfd_coff_read_internal_relocs(abfd,sec,1,0,0,0);
 
-    if (i == 0)
-      abort ();
+      if (i == 0)
+       abort ();
 
-    for (rel=i;rel<i+sec->reloc_count;++rel)
-      {
-       unsigned short r_type  = EXTRACT_TYPE (rel->r_type);
-       unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
-       bfd_boolean ok = TRUE;
+      for (rel = i; rel < i + sec->reloc_count; ++rel)
+       {
+         unsigned short r_type  = EXTRACT_TYPE  (rel->r_type);
+         unsigned short r_flags = EXTRACT_FLAGS (rel->r_type);
+         bfd_boolean ok = TRUE;
 
-       DUMP_RELOC2(ppc_coff_howto_table[r_type].name, rel);
+         DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, rel);
 
-       switch(r_type)
-         {
-         case IMAGE_REL_PPC_TOCREL16:
-           /* if TOCDEFN is on, ignore as someone else has allocated the
-              toc entry */
-           if ( (r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN )
-             ok = ppc_record_toc_entry(abfd, info, sec,
-                                       rel->r_symndx, default_toc);
-           if (!ok)
-             return FALSE;
-           break;
-         case IMAGE_REL_PPC_IMGLUE:
-           ppc_mark_symbol_as_glue(abfd, rel->r_symndx, rel);
-           break;
-         default:
-           break;
-         }
-      }
-  }
+         switch(r_type)
+           {
+           case IMAGE_REL_PPC_TOCREL16:
+             /* If TOCDEFN is on, ignore as someone else has allocated the
+                toc entry.  */
+             if ((r_flags & IMAGE_REL_PPC_TOCDEFN) != IMAGE_REL_PPC_TOCDEFN)
+               ok = ppc_record_toc_entry(abfd, info, sec,
+                                         rel->r_symndx, default_toc);
+             if (!ok)
+               return FALSE;
+             break;
+           case IMAGE_REL_PPC_IMGLUE:
+             ppc_mark_symbol_as_glue (abfd, rel->r_symndx, rel);
+             break;
+           default:
+             break;
+           }
+       }
+    }
 
   return TRUE;
 }
@@ -1779,13 +1760,8 @@ ppc_process_before_allocation (abfd, info)
 #endif
 
 static bfd_reloc_status_type
-ppc_refhi_reloc (abfd,
-                reloc_entry,
-                symbol,
-                data,
-                input_section,
-                output_bfd,
-                error_message)
+ppc_refhi_reloc (abfd, reloc_entry, symbol, data,
+                input_section, output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1806,13 +1782,8 @@ ppc_refhi_reloc (abfd,
 #if 0
 
 static bfd_reloc_status_type
-ppc_reflo_reloc (abfd,
-                reloc_entry,
-                symbol,
-                data,
-                input_section,
-                output_bfd,
-                error_message)
+ppc_reflo_reloc (abfd, reloc_entry, symbol, data,
+                input_section, output_bfd, error_message)
      bfd *abfd;
      arelent *reloc_entry;
      asymbol *symbol;
@@ -1833,13 +1804,8 @@ ppc_reflo_reloc (abfd,
 #endif
 
 static bfd_reloc_status_type
-ppc_pair_reloc (abfd,
-               reloc_entry,
-               symbol,
-               data,
-               input_section,
-               output_bfd,
-               error_message)
+ppc_pair_reloc (abfd, reloc_entry, symbol, data,
+               input_section, output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1858,13 +1824,8 @@ ppc_pair_reloc (abfd,
 }
 \f
 static bfd_reloc_status_type
-ppc_toc16_reloc (abfd,
-                reloc_entry,
-                symbol,
-                data,
-                input_section,
-                output_bfd,
-                error_message)
+ppc_toc16_reloc (abfd, reloc_entry, symbol, data,
+                input_section, output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1873,33 +1834,24 @@ ppc_toc16_reloc (abfd,
      bfd *output_bfd;
      char **error_message ATTRIBUTE_UNUSED;
 {
-  UN_IMPL("TOCREL16");
-  DUMP_RELOC("TOCREL16",reloc_entry);
+  UN_IMPL ("TOCREL16");
+  DUMP_RELOC ("TOCREL16",reloc_entry);
 
   if (output_bfd == (bfd *) NULL)
-    {
-      return bfd_reloc_continue;
-    }
+    return bfd_reloc_continue;
 
   return bfd_reloc_ok;
 }
 
 #if 0
 
-/* ADDR32NB : 32 bit address relative to the virtual origin.         */
-/*            (On the alpha, this is always a linker generated thunk)*/
-/*            (i.e. 32bit addr relative to the image base)           */
-/*                                                                   */
-/*                                                                   */
+/* ADDR32NB : 32 bit address relative to the virtual origin.
+              (On the alpha, this is always a linker generated thunk)
+              (i.e. 32bit addr relative to the image base).  */
 
 static bfd_reloc_status_type
-ppc_addr32nb_reloc (abfd,
-                   reloc_entry,
-                   symbol,
-                   data,
-                   input_section,
-                   output_bfd,
-                   error_message)
+ppc_addr32nb_reloc (abfd, reloc_entry, symbol, data,
+                   input_section, output_bfd, error_message)
      bfd *abfd;
      arelent *reloc_entry;
      asymbol *symbol;
@@ -1917,13 +1869,8 @@ ppc_addr32nb_reloc (abfd,
 #endif
 
 static bfd_reloc_status_type
-ppc_secrel_reloc (abfd,
-                 reloc_entry,
-                 symbol,
-                 data,
-                 input_section,
-                 output_bfd,
-                 error_message)
+ppc_secrel_reloc (abfd, reloc_entry, symbol, data,
+                 input_section, output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1942,13 +1889,8 @@ ppc_secrel_reloc (abfd,
 }
 
 static bfd_reloc_status_type
-ppc_section_reloc (abfd,
-                  reloc_entry,
-                  symbol,
-                  data,
-                  input_section,
-                  output_bfd,
-                  error_message)
+ppc_section_reloc (abfd, reloc_entry, symbol, data,
+                  input_section, output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1967,13 +1909,8 @@ ppc_section_reloc (abfd,
 }
 
 static bfd_reloc_status_type
-ppc_imglue_reloc (abfd,
-                 reloc_entry,
-                 symbol,
-                 data,
-                 input_section,
-                 output_bfd,
-                 error_message)
+ppc_imglue_reloc (abfd, reloc_entry, symbol, data,
+                 input_section, output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry ATTRIBUTE_UNUSED;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -1996,17 +1933,14 @@ ppc_imglue_reloc (abfd,
 
 /* FIXME: There is a possiblity that when we read in a reloc from a file,
           that there are some bits encoded in the upper portion of the
-         type field. Not yet implemented.
-*/
-static void ppc_coff_rtype2howto PARAMS ((arelent *relent,
-                                         struct internal_reloc *internal));
+         type field. Not yet implemented.  */
+static void ppc_coff_rtype2howto PARAMS ((arelent *, struct internal_reloc *));
 
 static void
 ppc_coff_rtype2howto (relent, internal)
      arelent *relent;
      struct internal_reloc *internal;
 {
-
   /* We can encode one of three things in the type field, aside from the
      type:
      1. IMAGE_REL_PPC_NEG - indicates the value field is a subtraction
@@ -2015,19 +1949,18 @@ ppc_coff_rtype2howto (relent, internal)
         the branch is expected to be taken or not.
      3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
      For now, we just strip this stuff to find the type, and ignore it other
-     than that.
-  */
+     than that.  */
   reloc_howto_type *howto;
   unsigned short r_type  = EXTRACT_TYPE (internal->r_type);
   unsigned short r_flags = EXTRACT_FLAGS(internal->r_type);
   unsigned short junk    = EXTRACT_JUNK (internal->r_type);
 
-  /* the masking process only slices off the bottom byte for r_type.  */
+  /* The masking process only slices off the bottom byte for r_type.  */
   if ( r_type > MAX_RELOC_INDEX )
     abort ();
 
-  /* check for absolute crap */
-  if ( junk != 0 )
+  /* Check for absolute crap.  */
+  if (junk != 0)
     abort ();
 
   switch(r_type)
@@ -2040,15 +1973,15 @@ ppc_coff_rtype2howto (relent, internal)
     case IMAGE_REL_PPC_ADDR32NB:
     case IMAGE_REL_PPC_SECTION:
     case IMAGE_REL_PPC_SECREL:
-      DUMP_RELOC2(ppc_coff_howto_table[r_type].name, internal);
+      DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
       howto = ppc_coff_howto_table + r_type;
       break;
     case IMAGE_REL_PPC_IMGLUE:
-      DUMP_RELOC2(ppc_coff_howto_table[r_type].name, internal);
+      DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
       howto = ppc_coff_howto_table + r_type;
       break;
     case IMAGE_REL_PPC_TOCREL16:
-      DUMP_RELOC2(ppc_coff_howto_table[r_type].name, internal);
+      DUMP_RELOC2 (ppc_coff_howto_table[r_type].name, internal);
       if (r_flags & IMAGE_REL_PPC_TOCDEFN)
        howto = ppc_coff_howto_table + IMAGE_REL_PPC_TOCREL16_DEFN;
       else
@@ -2064,7 +1997,6 @@ ppc_coff_rtype2howto (relent, internal)
     }
 
   relent->howto = howto;
-
 }
 
 static reloc_howto_type *
@@ -2086,19 +2018,18 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
         the branch is expected to be taken or not.
      3. IMAGE_REL_PPC_TOCDEFN - toc slot definition in the file
      For now, we just strip this stuff to find the type, and ignore it other
-     than that.
-  */
+     than that.  */
 
-  unsigned short r_type  = EXTRACT_TYPE (rel->r_type);
-  unsigned short r_flags = EXTRACT_FLAGS(rel->r_type);
-  unsigned short junk    = EXTRACT_JUNK (rel->r_type);
+  unsigned short r_type  = EXTRACT_TYPE  (rel->r_type);
+  unsigned short r_flags = EXTRACT_FLAGS (rel->r_type);
+  unsigned short junk    = EXTRACT_JUNK  (rel->r_type);
 
-  /* the masking process only slices off the bottom byte for r_type.  */
-  if ( r_type > MAX_RELOC_INDEX )
+  /* The masking process only slices off the bottom byte for r_type.  */
+  if (r_type > MAX_RELOC_INDEX)
     abort ();
 
-  /* check for absolute crap */
-  if ( junk != 0 )
+  /* Check for absolute crap.  */
+  if (junk != 0)
     abort ();
 
   switch(r_type)
@@ -2141,7 +2072,7 @@ coff_ppc_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
   return howto;
 }
 
-/* a cheesy little macro to make the code a little more readable */
+/* A cheesy little macro to make the code a little more readable.  */
 #define HOW2MAP(bfd_rtype,ppc_rtype)  \
  case bfd_rtype: return &ppc_coff_howto_table[ppc_rtype]
 
@@ -2167,7 +2098,6 @@ ppc_coff_reloc_type_lookup (abfd, code)
     default:
       return NULL;
     }
-  /*NOTREACHED*/
 }
 
 #undef HOW2MAP
@@ -2229,8 +2159,7 @@ ppc_coff_reloc_type_lookup (abfd, code)
    2. It's not clear to me that being the last bfd read necessarily means
       that you are the last bfd closed.
    3. Doing it on a "swap in" hook depends on when the "swap in" is called,
-      and how often, etc. It's not clear to me that there isn't a hole here.
-*/
+      and how often, etc. It's not clear to me that there isn't a hole here.  */
 static void ppc_coff_swap_sym_in_hook PARAMS ((bfd *, PTR, PTR));
 
 static void
@@ -2239,21 +2168,19 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
      PTR ext1 ATTRIBUTE_UNUSED;
      PTR in1;
 {
-  struct internal_syment      *in = (struct internal_syment *)in1;
+  struct internal_syment in = (struct internal_syment *)in1;
 
-  if (bfd_of_toc_owner != 0) /* we already have a toc, so go home */
+  if (bfd_of_toc_owner != 0) /* We already have a toc, so go home.  */
     return;
 
-  if (strcmp(in->_n._n_name, ".toc") == 0)
+  if (strcmp (in->_n._n_name, ".toc") == 0)
     {
       flagword flags;
       register asection *s;
 
-      s = bfd_get_section_by_name ( abfd , TOC_SECTION_NAME);
+      s = bfd_get_section_by_name (abfd, TOC_SECTION_NAME);
       if (s != NULL)
-       {
-         return;
-       }
+       return;
 
       flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY ;
 
@@ -2262,12 +2189,10 @@ ppc_coff_swap_sym_in_hook (abfd, ext1, in1)
       if (s == NULL
          || !bfd_set_section_flags (abfd, s, flags)
          || !bfd_set_section_alignment (abfd, s, 2))
-       {
-         /* FIXME: set appropriate bfd error */
-         abort ();
-       }
+       /* FIXME: set appropriate bfd error.  */
+       abort ();
 
-      /* save the bfd for later allocation */
+      /* Save the bfd for later allocation.  */
       bfd_of_toc_owner = abfd;
     }
 
@@ -2297,7 +2222,7 @@ ppc_get_last()
   return bfd_of_toc_owner;
 }
 
-/* this piece of machinery exists only to guarantee that the bfd that holds
+/* This piece of machinery exists only to guarantee that the bfd that holds
    the toc section is written last.
 
    This does depend on bfd_make_section attaching a new section to the
@@ -2306,8 +2231,7 @@ ppc_get_last()
    This is otherwise intended to be functionally the same as
    cofflink.c:_bfd_coff_final_link(). It is specifically different only
    where the POWERPC_LE_PE macro modifies the code. It is left in as a
-   precise form of comment. krk@cygnus.com
-*/
+   precise form of comment. krk@cygnus.com  */
 
 /* Do the final link step.  */
 
@@ -2382,9 +2306,9 @@ ppc_bfd_coff_final_link (abfd, info)
     {
       o->reloc_count = 0;
       o->lineno_count = 0;
+
       for (p = o->link_order_head; p != NULL; p = p->next)
        {
-
          if (p->type == bfd_indirect_link_order)
            {
              asection *sec;
@@ -2437,8 +2361,10 @@ ppc_bfd_coff_final_link (abfd, info)
       amt = abfd->section_count + 1;
       amt *= sizeof (struct coff_link_section_info);
       finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
+
       if (finfo.section_info == NULL)
        goto error_return;
+
       for (i = 0; i <= abfd->section_count; i++)
        {
          finfo.section_info[i].relocs = NULL;
@@ -2451,6 +2377,7 @@ ppc_bfd_coff_final_link (abfd, info)
   line_filepos = rel_filepos;
   linesz = bfd_coff_linesz (abfd);
   max_output_reloc_count = 0;
+
   for (o = abfd->sections; o != NULL; o = o->next)
     {
       if (o->lineno_count == 0)
@@ -2605,7 +2532,6 @@ ppc_bfd_coff_final_link (abfd, info)
 #endif
 
   /* Free up the buffers used by _bfd_coff_link_input_bfd.  */
-
   coff_debug_merge_hash_table_free (&finfo.debug_merge);
   debug_merge_allocated = FALSE;
 
index 7ce60db..ee50a10 100644 (file)
@@ -1,24 +1,24 @@
 /* Support for the generic parts of most COFF variants, for BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /*
 Most of this hacked by  Steve Chamberlain,
@@ -225,7 +225,7 @@ SUBSUBSECTION
        This routine runs though the provided symbol table and uses
        the offsets generated by the previous pass and the pointers
        generated when the symbol table was read in to create the
-       structured hierachy required by coff. It changes each pointer
+       structured hierarchy required by coff. It changes each pointer
        to a symbol into the index into the symbol table of the asymbol.
 
        o <<coff_write_symbols>>
@@ -558,15 +558,15 @@ sec_to_styp_flags (sec_name, sec_flags)
 
   /* 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 */
+     are retained in pei_section_data(abfd, section)->pe_flags */
 
-  styp_flags |= IMAGE_SCN_MEM_READ;       /* always readable.  */
+  styp_flags |= IMAGE_SCN_MEM_READ;       /* Always readable.  */
   if ((sec_flags & SEC_READONLY) == 0)
-    styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write */
+    styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write */
   if (sec_flags & SEC_CODE)
-    styp_flags |= IMAGE_SCN_MEM_EXECUTE;  /* CODE->EXECUTE */
+    styp_flags |= IMAGE_SCN_MEM_EXECUTE;  /* CODE->EXECUTE */
   if (sec_flags & SEC_SHARED)
-    styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful */
+    styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful */
 
   return styp_flags;
 }
@@ -693,12 +693,12 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
   else
     sec_flags |= SEC_ALLOC | SEC_LOAD;
 
-#ifdef STYP_LIT                        /* A29k readonly text/data section type */
+#ifdef STYP_LIT                        /* A29k readonly text/data section type */
   if ((styp_flags & STYP_LIT) == STYP_LIT)
     sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY);
 #endif /* STYP_LIT */
 
-#ifdef STYP_OTHER_LOAD         /* Other loaded sections */
+#ifdef STYP_OTHER_LOAD         /* Other loaded sections */
   if (styp_flags & STYP_OTHER_LOAD)
     sec_flags = (SEC_LOAD | SEC_ALLOC);
 #endif /* STYP_SDATA */
@@ -802,7 +802,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
             gas-generated, and look for <something> (whatever
             follows the $) as the comdat symbol.  */
 
-         /* All 3 branches use this */
+         /* All 3 branches use this */
          symname = _bfd_coff_internal_syment_name (abfd, &isym, buf);
 
          if (symname == NULL)
@@ -930,7 +930,7 @@ handle_COMDAT (abfd, sec_flags, hdr, name, section)
 #ifndef TARGET_UNDERSCORE
 #define TARGET_UNDERSCORE 0
 #endif
-             /* Is this the name we're looking for? */
+             /* Is this the name we're looking for ?  */
              if (strcmp (target_name,
                          symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0)
                {
@@ -1344,7 +1344,8 @@ Special entry points for gdb to swap in coff symbol table parts:
 .#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
 .  ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
 .#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
-.  ((coff_backend_info (abfd)->_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, section, flags_ptr)\
 .  ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
@@ -1369,7 +1370,8 @@ Special entry points for gdb to swap in coff symbol table parts:
 .  ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
 .   (abfd, file, base, symbol, aux, indaux))
 .
-.#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
+.#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
+.                                     reloc, data, src_ptr, dst_ptr)\
 .  ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
 .   (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
 .
@@ -1397,7 +1399,8 @@ Special entry points for gdb to swap in coff symbol table parts:
 .#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
 .  ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
 .   (obfd, info, ibfd, sec, rel, adjustedp))
-.#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
+.#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
+.                                     value, string, cp, coll, hashp)\
 .  ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
 .   (info, abfd, name, flags, section, value, string, cp, coll, hashp))
 .
@@ -1420,14 +1423,13 @@ coff_bad_format_hook (abfd, filehdr)
   if (BADMAG (*internal_f))
     return FALSE;
 
-  /* if the optional header is NULL or not the correct size then
+  /* If the optional header is NULL or not the correct size then
      quit; the only difference I can see between m88k dgux headers (MC88DMAGIC)
      and Intel 960 readwrite headers (I960WRMAGIC) is that the
      optional header is of a different size.
 
      But the mips keeps extra stuff in it's opthdr, so dont check
-     when doing that
-     */
+     when doing that.  */
 
 #if defined(M88) || defined(I960)
   if (internal_f->f_opthdr != 0 && bfd_coff_aoutsz (abfd) != internal_f->f_opthdr)
@@ -1453,6 +1455,7 @@ coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
   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,
@@ -1566,13 +1569,13 @@ coff_set_alignment_hook (abfd, section, scnhdr)
   unsigned int i;
 
 #ifdef I960
-  /* Extract ALIGN from 2**ALIGN stored in section header */
+  /* Extract ALIGN from 2**ALIGN stored in section header */
   for (i = 0; i < 32; i++)
     if ((1 << i) >= hdr->s_align)
       break;
 #endif
 #ifdef TIC80COFF
-  /* TI tools puts the alignment power in bits 8-11 */
+  /* TI tools puts the alignment power in bits 8-11 */
   i = (hdr->s_flags >> 8) & 0xF ;
 #endif
 #ifdef COFF_DECODE_ALIGNMENT
@@ -1588,7 +1591,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
 #else /* ! COFF_ALIGN_IN_SECTION_HEADER */
 #ifdef COFF_WITH_PE
 
-/* a couple of macros to help setting the alignment power field */
+/* A couple of macros to help setting the alignment power field.  */
 #define ALIGN_SET(field,x,y) \
   if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\
   {\
@@ -1649,7 +1652,7 @@ coff_set_alignment_hook (abfd, section, scnhdr)
 
   section->lma = hdr->s_vaddr;
 
-  /* check for extended relocs */
+  /* Check for extended relocs.  */
   if (hdr->s_flags & IMAGE_SCN_LNK_NRELOC_OVFL)
     {
       struct external_reloc dst;
@@ -1745,6 +1748,7 @@ coff_mkobject (abfd)
 #endif
 
 /* Create the COFF backend specific information.  */
+
 #ifndef coff_mkobject_hook
 static PTR
 coff_mkobject_hook (abfd, filehdr, aouthdr)
@@ -2125,7 +2129,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
 
 #ifdef TICOFF0MAGIC
 #ifdef TICOFF_TARGET_ARCH
-      /* this TI COFF section should be used by all new TI COFF v0 targets */
+      /* This TI COFF section should be used by all new TI COFF v0 targets.  */
     case TICOFF0MAGIC:
       arch = TICOFF_TARGET_ARCH;
       machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags);
@@ -2134,8 +2138,8 @@ coff_set_arch_mach_hook (abfd, filehdr)
 #endif
 
 #ifdef TICOFF1MAGIC
-      /* this TI COFF section should be used by all new TI COFF v1/2 targets */
-      /* TI COFF1 and COFF2 use the target_id field to specify which arch */
+      /* This TI COFF section should be used by all new TI COFF v1/2 targets.  */
+      /* TI COFF1 and COFF2 use the target_id field to specify which arch */
     case TICOFF1MAGIC:
     case TICOFF2MAGIC:
       switch (internal_f->f_target_id)
@@ -2174,7 +2178,7 @@ coff_set_arch_mach_hook (abfd, filehdr)
       break;
 #endif
 
-    default:                   /* Unreadable input file type */
+    default:                   /* Unreadable input file type */
       arch = bfd_arch_obscure;
       break;
     }
@@ -2215,7 +2219,6 @@ static bfd_boolean coff_pointerize_aux_hook
   PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
           unsigned int, combined_entry_type *));
 
-/*ARGSUSED*/
 static bfd_boolean
 coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -2255,7 +2258,6 @@ static bfd_boolean coff_pointerize_aux_hook
   PARAMS ((bfd *, combined_entry_type *, combined_entry_type *,
           unsigned int, combined_entry_type *));
 
-/*ARGSUSED*/
 static bfd_boolean
 coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -2360,7 +2362,7 @@ SUBSUBSECTION
 
 static int compare_arelent_ptr PARAMS ((const PTR, const PTR));
 
-/* AUX's ld wants relocations to be sorted */
+/* AUX's ld wants relocations to be sorted */
 static int
 compare_arelent_ptr (x, y)
      const PTR x;
@@ -2393,7 +2395,7 @@ coff_write_relocs (abfd, first_undef)
       p = s->orelocation;
 #else
       {
-       /* sort relocations before we write them out */
+       /* Sort relocations before we write them out.  */
        bfd_size_type amt;
 
        amt = s->reloc_count;
@@ -2412,10 +2414,11 @@ coff_write_relocs (abfd, first_undef)
 #ifdef COFF_WITH_PE
       if (obj_pe (abfd) && s->reloc_count >= 0xffff)
        {
-         /* encode real count here as first reloc */
+         /* Encode real count here as first reloc.  */
          struct internal_reloc n;
+
          memset ((PTR) & n, 0, sizeof (n));
-         /* add one to count *this* reloc (grr) */
+         /* Add one to count *this* reloc (grr).  */
          n.r_vaddr = s->reloc_count + 1;
          coff_swap_reloc_out (abfd, &n, &dst);
          if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
@@ -2428,6 +2431,7 @@ coff_write_relocs (abfd, first_undef)
        {
          struct internal_reloc n;
          arelent *q = p[i];
+
          memset ((PTR) & n, 0, sizeof (n));
 
          /* Now we've renumbered the symbols we know where the
@@ -2445,11 +2449,13 @@ coff_write_relocs (abfd, first_undef)
              int j;
              const char *sname = q->sym_ptr_ptr[0]->name;
              asymbol **outsyms = abfd->outsymbols;
+
              for (j = first_undef; outsyms[j]; j++)
                {
                  const char *intable = outsyms[j]->name;
+
                  if (strcmp (intable, sname) == 0) {
-                   /* got a hit, so repoint the reloc */
+                   /* Got a hit, so repoint the reloc.  */
                    q->sym_ptr_ptr = outsyms + j;
                    break;
                  }
@@ -2492,12 +2498,13 @@ coff_write_relocs (abfd, first_undef)
 #endif
 
 #ifdef SELECT_RELOC
-         /* Work out reloc type from what is required */
+         /* Work out reloc type from what is required */
          SELECT_RELOC (n, q->howto);
 #else
          n.r_type = q->howto->type;
 #endif
          coff_swap_reloc_out (abfd, &n, &dst);
+
          if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd),
                         abfd) != bfd_coff_relsz (abfd))
            return FALSE;
@@ -2593,12 +2600,12 @@ coff_set_flags (abfd, magicp, flagsp)
 
 #ifdef TICOFF_DEFAULT_MAGIC
     case TICOFF_TARGET_ARCH:
-      /* if there's no indication of which version we want, use the default */
+      /* If there's no indication of which version we want, use the default.  */
       if (!abfd->xvec )
         *magicp = TICOFF_DEFAULT_MAGIC;
       else
         {
-          /* we may want to output in a different COFF version */
+          /* We may want to output in a different COFF version.  */
           switch (abfd->xvec->name[4])
             {
             case '0':
@@ -3091,8 +3098,8 @@ coff_compute_section_file_positions (abfd)
 #ifdef ALIGN_SECTIONS_IN_FILE
       if ((abfd->flags & EXEC_P) != 0)
        {
-         /* make sure this section is aligned on the right boundary - by
-            padding the previous section up if necessary */
+         /* Make sure this section is aligned on the right boundary - by
+            padding the previous section up if necessary */
 
          old_sofar = sofar;
 #ifdef RS6000COFF_C
@@ -3128,9 +3135,7 @@ coff_compute_section_file_positions (abfd)
            }
 #endif
          if (previous != (asection *) NULL)
-           {
-             previous->_raw_size += sofar - old_sofar;
-           }
+           previous->_raw_size += sofar - old_sofar;
        }
 
 #endif
@@ -3152,7 +3157,7 @@ coff_compute_section_file_positions (abfd)
       sofar += current->_raw_size;
 
 #ifdef ALIGN_SECTIONS_IN_FILE
-      /* make sure that this section is of the right size too */
+      /* Make sure that this section is of the right size too.  */
       if ((abfd->flags & EXEC_P) == 0)
        {
          bfd_size_type old_size;
@@ -3241,10 +3246,11 @@ coff_add_missing_symbols (abfd)
     {
       coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]);
       const char *name;
+
       if (csym)
        {
-         /* only do this if there is a coff representation of the input
-          symbol */
+         /* Only do this if there is a coff representation of the input
+            symbol.  */
          if (csym->native && csym->native->u.syment.n_sclass == C_FILE)
            {
              need_file = 0;
@@ -3278,11 +3284,11 @@ coff_add_missing_symbols (abfd)
   if (!sympp2)
     return FALSE;
   memcpy (sympp2, sympp, i * sizeof (asymbol *));
+
   if (need_file)
-    {
-      /* @@ Generate fake .file symbol, in sympp2[i], and increment i.  */
-      abort ();
-    }
+    /* @@ Generate fake .file symbol, in sympp2[i], and increment i.  */
+    abort ();
+
   if (need_text)
     sympp2[i++] = coff_section_symbol (abfd, _TEXT);
   if (need_data)
@@ -3419,7 +3425,7 @@ coff_write_object_contents (abfd)
   bfd_set_error (bfd_error_system_call);
 
   /* Make a pass through the symbol table to count line number entries and
-     put them into the correct asections */
+     put them into the correct asections */
 
   lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd);
 
@@ -3431,13 +3437,13 @@ coff_write_object_contents (abfd)
 
   reloc_base = obj_relocbase (abfd);
 
-  /* Work out the size of the reloc and linno areas */
+  /* Work out the size of the reloc and linno areas */
 
   for (current = abfd->sections; current != NULL; current =
        current->next)
     {
 #ifdef COFF_WITH_PE
-      /* we store the actual reloc count in the first reloc's addr */
+      /* We store the actual reloc count in the first reloc's addr.  */
       if (obj_pe (abfd) && current->reloc_count >= 0xffff)
        reloc_count ++;
 #endif
@@ -3449,7 +3455,7 @@ coff_write_object_contents (abfd)
   lineno_base = reloc_base + reloc_size;
   sym_base = lineno_base + lnno_size;
 
-  /* Indicate in each section->line_filepos its actual file address */
+  /* Indicate in each section->line_filepos its actual file address */
   for (current = abfd->sections; current != NULL; current =
        current->next)
     {
@@ -3468,7 +3474,7 @@ coff_write_object_contents (abfd)
          current->rel_filepos = reloc_base;
          reloc_base += current->reloc_count * bfd_coff_relsz (abfd);
 #ifdef COFF_WITH_PE
-         /* extra reloc to hold real count */
+         /* Extra reloc to hold real count.  */
          if (obj_pe (abfd) && current->reloc_count >= 0xffff)
            reloc_base += bfd_coff_relsz (abfd);
 #endif
@@ -3564,19 +3570,14 @@ coff_write_object_contents (abfd)
        section.s_paddr = 0;
 #endif
 
-      /*
-        If this section has no size or is unloadable then the scnptr
-        will be 0 too
-        */
+      /* If this section has no size or is unloadable then the scnptr
+        will be 0 too.  */
       if (current->_raw_size == 0 ||
          (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
-       {
-         section.s_scnptr = 0;
-       }
+       section.s_scnptr = 0;
       else
-       {
-         section.s_scnptr = current->filepos;
-       }
+       section.s_scnptr = current->filepos;
+
       section.s_relptr = current->rel_filepos;
       section.s_lnnoptr = current->line_filepos;
       section.s_nreloc = current->reloc_count;
@@ -3606,17 +3607,11 @@ coff_write_object_contents (abfd)
       section.s_flags = sec_to_styp_flags (current->name, current->flags);
 
       if (!strcmp (current->name, _TEXT))
-       {
-         text_sec = current;
-       }
+       text_sec = current;
       else if (!strcmp (current->name, _DATA))
-       {
-         data_sec = current;
-       }
+       data_sec = current;
       else if (!strcmp (current->name, _BSS))
-       {
-         bss_sec = current;
-       }
+       bss_sec = current;
 
 #ifdef I960
       section.s_align = (current->alignment_power
@@ -3624,7 +3619,7 @@ coff_write_object_contents (abfd)
                         : 0);
 #endif
 #ifdef TIC80COFF
-      /* TI COFF puts the alignment power in bits 8-11 of the flags */
+      /* TI COFF puts the alignment power in bits 8-11 of the flags */
       section.s_flags |= (current->alignment_power & 0xF) << 8;
 #endif
 #ifdef COFF_ENCODE_ALIGNMENT
@@ -3781,14 +3776,11 @@ coff_write_object_contents (abfd)
 
   /* Don't include the internal abs section in the section count */
 
-  /*
-     We will NOT put a fucking timestamp in the header here. Every time you
+  /* We will NOT put a fucking timestamp in the header here. Every time you
      put it back, I will come in and take it out again.  I'm sorry.  This
      field does not belong here.  We fill it with a 0 so it compares the
-     same but is not a reasonable time. -- gnu@cygnus.com
-     */
+     same but is not a reasonable time. -- gnu@cygnus.com  */
   internal_f.f_timdat = 0;
-
   internal_f.f_flags = 0;
 
   if (abfd->flags & EXEC_P)
@@ -3825,18 +3817,16 @@ coff_write_object_contents (abfd)
 #endif
 
 #ifdef TI_TARGET_ID
-  /* target id is used in TI COFF v1 and later; COFF0 won't use this field,
-     but it doesn't hurt to set it internally */
+  /* Target id is used in TI COFF v1 and later; COFF0 won't use this field,
+     but it doesn't hurt to set it internally */
   internal_f.f_target_id = TI_TARGET_ID;
 #endif
 #ifdef TIC80_TARGET_ID
   internal_f.f_target_id = TIC80_TARGET_ID;
 #endif
 
-  /*
-     FIXME, should do something about the other byte orders and
-     architectures.
-     */
+  /* FIXME, should do something about the other byte orders and
+     architectures.  */
 
 #ifdef RS6000COFF_C
   if ((abfd->flags & DYNAMIC) != 0)
@@ -3847,11 +3837,11 @@ coff_write_object_contents (abfd)
 
   memset (&internal_a, 0, sizeof internal_a);
 
-  /* Set up architecture-dependent stuff */
-
+  /* Set up architecture-dependent stuff.  */
   {
     unsigned int magic = 0;
     unsigned short flags = 0;
+
     coff_set_flags (abfd, &magic, &flags);
     internal_f.f_magic = magic;
     internal_f.f_flags |= flags;
@@ -3860,14 +3850,13 @@ coff_write_object_contents (abfd)
 #ifdef A29K
 #ifdef ULTRA3                  /* NYU's machine */
     /* FIXME: This is a bogus check.  I really want to see if there
-     * is a .shbss or a .shdata section, if so then set the magic
-     * number to indicate a shared data executable.
-     */
+       is a .shbss or a .shdata section, if so then set the magic
+       number to indicate a shared data executable.  */
     if (internal_f.f_nscns >= 7)
-      internal_a.magic = SHMAGIC; /* Shared magic */
+      internal_a.magic = SHMAGIC; /* Shared magic */
     else
 #endif /* ULTRA3 */
-      internal_a.magic = NMAGIC; /* Assume separate i/d */
+      internal_a.magic = NMAGIC; /* Assume separate i/d */
 #define __A_MAGIC_SET__
 #endif /* A29K */
 #ifdef TICOFF_AOUT_MAGIC
@@ -3982,7 +3971,7 @@ coff_write_object_contents (abfd)
   /* FIXME: Does anybody ever set this to another value?  */
   internal_a.vstamp = 0;
 
-  /* Now should write relocs, strings, syms */
+  /* Now should write relocs, strings, syms */
   obj_sym_filepos (abfd) = sym_base;
 
   if (bfd_get_symcount (abfd) != 0)
@@ -4165,7 +4154,7 @@ coff_write_object_contents (abfd)
   if (abfd->flags & EXEC_P)
     {
       /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
-        include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */
+        include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */
       char * buff;
       bfd_size_type amount = bfd_coff_aoutsz (abfd);
 
@@ -4214,7 +4203,7 @@ coff_set_section_contents (abfd, section, location, offset, count)
      file_ptr offset;
      bfd_size_type count;
 {
-  if (! abfd->output_has_begun)        /* set by bfd.c handler */
+  if (! abfd->output_has_begun)        /* Set by bfd.c handler.  */
     {
       if (! coff_compute_section_file_positions (abfd))
        return FALSE;
@@ -4241,7 +4230,7 @@ coff_set_section_contents (abfd, section, location, offset, count)
       code has been tested on ISC 4.1 by me, and on SCO by Robert Lipe
       <robertl@arnet.com> (Thanks!).
 
-      Gvran Uddeborg <gvran@uddeborg.pp.se> */
+      Gvran Uddeborg <gvran@uddeborg.pp.se> */
 
     if (strcmp (section->name, _LIB) == 0)
       {
@@ -4365,6 +4354,7 @@ coff_slurp_line_table (abfd, asect)
       while (counter < asect->lineno_count)
        {
          struct internal_lineno dst;
+
          bfd_coff_swap_lineno_in (abfd, src, &dst);
          cache_ptr->line_number = dst.l_lnno;
 
@@ -4430,19 +4420,16 @@ coff_slurp_symbol_table (abfd)
   coff_symbol_type *cached_area;
   unsigned int *table_ptr;
   bfd_size_type amt;
-
   unsigned int number_of_symbols = 0;
 
   if (obj_symbols (abfd))
     return TRUE;
 
-  /* Read in the symbol table */
+  /* Read in the symbol table */
   if ((native_symbols = coff_get_normalized_symtab (abfd)) == NULL)
-    {
-      return FALSE;
-    }                          /* on error */
+    return FALSE;
 
-  /* Allocate enough room for all the symbols in cached form */
+  /* Allocate enough room for all the symbols in cached form */
   amt = obj_raw_syment_count (abfd);
   amt *= sizeof (coff_symbol_type);
   cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
@@ -4460,6 +4447,7 @@ coff_slurp_symbol_table (abfd)
       coff_symbol_type *dst = cached_area;
       unsigned int last_native_index = obj_raw_syment_count (abfd);
       unsigned int this_index = 0;
+
       while (this_index < last_native_index)
        {
          combined_entry_type *src = native_symbols + this_index;
@@ -4483,8 +4471,7 @@ coff_slurp_symbol_table (abfd)
              dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL;
              dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
 #endif
-             /* Fall through to next case */
-
+             /* Fall through to next case.  */
 #endif
 
            case C_EXT:
@@ -4497,10 +4484,10 @@ coff_slurp_symbol_table (abfd)
            case C_HIDEXT:
 #endif
 #ifdef C_SYSTEM
-           case C_SYSTEM:      /* System Wide variable */
+           case C_SYSTEM:      /* System Wide variable */
 #endif
 #ifdef COFF_WITH_PE
-            /* In PE, 0x68 (104) denotes a section symbol */
+            /* In PE, 0x68 (104) denotes a section symbol */
             case C_SECTION:
            /* In PE, 0x69 (105) denotes a weak external symbol.  */
            case C_NT_WEAK:
@@ -4574,16 +4561,16 @@ coff_slurp_symbol_table (abfd)
 
              break;
 
-           case C_STAT:        /* static                        */
+           case C_STAT:         /* Static.  */
 #ifdef I960
-           case C_LEAFSTAT:    /* static leaf procedure        */
+           case C_LEAFSTAT:     /* Static leaf procedure.  */
 #endif
 #if defined ARM
-            case C_THUMBSTAT:   /* Thumb static                  */
-            case C_THUMBLABEL:  /* Thumb label                   */
-            case C_THUMBSTATFUNC:/* Thumb static function        */
+            case C_THUMBSTAT:    /* Thumb static.  */
+            case C_THUMBLABEL:   /* Thumb label.  */
+            case C_THUMBSTATFUNC:/* Thumb static function.  */
 #endif
-           case C_LABEL:       /* label                         */
+           case C_LABEL:        /* Label.  */
              if (src->u.syment.n_scnum == N_DEBUG)
                dst->symbol.flags = BSF_DEBUGGING;
              else
@@ -4606,35 +4593,35 @@ coff_slurp_symbol_table (abfd)
                dst->symbol.value = src->u.syment.n_value;
              break;
 
-           case C_MOS: /* member of structure   */
-           case C_EOS: /* end of structure              */
-#ifdef NOTDEF                  /* C_AUTOARG has the same value */
+           case C_MOS:         /* Member of structure.  */
+           case C_EOS:         /* End of structure.  */
+#ifdef NOTDEF                  /* C_AUTOARG has the same value */
 #ifdef C_GLBLREG
-           case C_GLBLREG:     /* A29k-specific storage class */
+           case C_GLBLREG:     /* A29k-specific storage class */
 #endif
 #endif
-           case C_REGPARM:     /* register parameter            */
-           case C_REG: /* register variable             */
-              /* C_AUTOARG conflictes with TI COFF C_UEXT */
+           case C_REGPARM:     /* Register parameter.  */
+           case C_REG:         /* register variable.  */
+              /* C_AUTOARG conflictes with TI COFF C_UEXT */
 #if !defined (TIC80COFF) && !defined (TICOFF)
 #ifdef C_AUTOARG
-           case C_AUTOARG:     /* 960-specific storage class */
+           case C_AUTOARG:     /* 960-specific storage class */
 #endif
 #endif
-           case C_TPDEF:       /* type definition               */
+           case C_TPDEF:       /* Type definition.  */
            case C_ARG:
-           case C_AUTO:        /* automatic variable */
-           case C_FIELD:       /* bit field */
-           case C_ENTAG:       /* enumeration tag               */
-           case C_MOE: /* member of enumeration         */
-           case C_MOU: /* member of union               */
-           case C_UNTAG:       /* union tag                     */
+           case C_AUTO:        /* Automatic variable.  */
+           case C_FIELD:       /* Bit field.  */
+           case C_ENTAG:       /* Enumeration tag.  */
+           case C_MOE:         /* Member of enumeration.  */
+           case C_MOU:         /* Member of union.  */
+           case C_UNTAG:       /* Union tag.  */
              dst->symbol.flags = BSF_DEBUGGING;
              dst->symbol.value = (src->u.syment.n_value);
              break;
 
-           case C_FILE:        /* file name                     */
-           case C_STRTAG:      /* structure tag                 */
+           case C_FILE:        /* File name.  */
+           case C_STRTAG:      /* Structure tag.  */
 #ifdef RS6000COFF_C
            case C_GSYM:
            case C_LSYM:
@@ -4654,8 +4641,8 @@ coff_slurp_symbol_table (abfd)
              break;
 
 #ifdef RS6000COFF_C
-           case C_BINCL:       /* beginning of include file     */
-           case C_EINCL:       /* ending of include file        */
+           case C_BINCL:       /* Beginning of include file.  */
+           case C_EINCL:       /* Ending of include file.  */
              /* The value is actually a pointer into the line numbers
                  of the file.  We locate the line number entry, and
                  set the section to the section which contains it, and
@@ -4696,9 +4683,9 @@ coff_slurp_symbol_table (abfd)
              break;
 #endif
 
-           case C_BLOCK:       /* ".bb" or ".eb"                */
-           case C_FCN:         /* ".bf" or ".ef" (or PE ".lf")  */
-           case C_EFCN:        /* physical end of function      */
+           case C_BLOCK:       /* ".bb" or ".eb".  */
+           case C_FCN:         /* ".bf" or ".ef" (or PE ".lf").  */
+           case C_EFCN:        /* Physical end of function.  */
 #if defined COFF_WITH_PE
              /* PE sets the symbol to a value relative to the start
                 of the section.  */
@@ -4720,7 +4707,7 @@ coff_slurp_symbol_table (abfd)
 #endif
              break;
 
-           case C_STATLAB:     /* Static load time label */
+           case C_STATLAB:     /* Static load time label */
               dst->symbol.value = src->u.syment.n_value;
               dst->symbol.flags = BSF_GLOBAL;
               break;
@@ -4733,22 +4720,22 @@ coff_slurp_symbol_table (abfd)
                  && src->u.syment.n_scnum == 0)
                break;
              /* Fall through.  */
-           case C_EXTDEF:      /* external definition           */
-           case C_ULABEL:      /* undefined label               */
-           case C_USTATIC:     /* undefined static              */
+           case C_EXTDEF:      /* External definition.  */
+           case C_ULABEL:      /* Undefined label.  */
+           case C_USTATIC:     /* Undefined static.  */
 #ifndef COFF_WITH_PE
             /* C_LINE in regular coff is 0x68.  NT has taken over this storage
-               class to represent a section symbol */
-           case C_LINE:        /* line # reformatted as symbol table entry */
+               class to represent a section symbol */
+           case C_LINE:        /* line # reformatted as symbol table entry */
              /* NT uses 0x67 for a weak symbol, not C_ALIAS.  */
-           case C_ALIAS:       /* duplicate tag                 */
+           case C_ALIAS:       /* Duplicate tag.  */
 #endif
-             /* New storage classes for TI COFF */
+             /* New storage classes for TI COFF */
 #if defined(TIC80COFF) || defined(TICOFF)
-           case C_UEXT:        /* Tentative external definition */
+           case C_UEXT:        /* Tentative external definition */
 #endif
-           case C_EXTLAB:      /* External load time label */
-           case C_HIDDEN:      /* ext symbol in dmert public lib */
+           case C_EXTLAB:      /* External load time label */
+           case C_HIDDEN:      /* Ext symbol in dmert public lib.  */
            default:
              (*_bfd_error_handler)
                (_("%s: Unrecognized storage class %d for %s symbol `%s'"),
@@ -4768,17 +4755,18 @@ coff_slurp_symbol_table (abfd)
          this_index += (src->u.syment.n_numaux) + 1;
          dst++;
          number_of_symbols++;
-       }                       /* walk the native symtab */
-    }                          /* bfdize the native symtab */
+       }
+    }
 
   obj_symbols (abfd) = cached_area;
   obj_raw_syments (abfd) = native_symbols;
 
   bfd_get_symcount (abfd) = number_of_symbols;
   obj_convert (abfd) = table_ptr;
-  /* Slurp the line tables for each section too */
+  /* Slurp the line tables for each section too */
   {
     asection *p;
+
     p = abfd->sections;
     while (p)
       {
@@ -4786,6 +4774,7 @@ coff_slurp_symbol_table (abfd)
        p = p->next;
       }
   }
+
   return TRUE;
 }                              /* coff_slurp_symbol_table() */
 
@@ -5012,15 +5001,15 @@ coff_slurp_reloc_table (abfd, asect, symbols)
         refering to the symbols in the raw data have not been
         modified, so we have to have a negative addend to compensate.
 
-        Note that symbols which used to be common must be left alone */
+        Note that symbols which used to be common must be left alone */
 
-      /* Calculate any reloc addend by looking at the symbol */
+      /* Calculate any reloc addend by looking at the symbol */
       CALC_ADDEND (abfd, ptr, dst, cache_ptr);
 
       cache_ptr->address -= asect->vma;
 /* !!     cache_ptr->section = (asection *) NULL;*/
 
-      /* Fill in the cache_ptr->howto field from dst.r_type */
+      /* Fill in the cache_ptr->howto field from dst.r_type */
       RTYPE2HOWTO (cache_ptr, &dst);
 #endif /* RELOC_PROCESSING */
 
@@ -5088,16 +5077,16 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols)
 
   if (section->flags & SEC_CONSTRUCTOR)
     {
-      /* this section has relocs made up by us, they are not in the
-       file, so take them out of their chain and place them into
-       the data area provided */
+      /* This section has relocs made up by us, they are not in the
+        file, so take them out of their chain and place them into
+        the data area provided.  */
       arelent_chain *chain = section->constructor_chain;
+
       for (count = 0; count < section->reloc_count; count++)
        {
          *relptr++ = &chain->relent;
          chain = chain->next;
        }
-
     }
   else
     {
index 96d4765..c678496 100644 (file)
@@ -189,6 +189,10 @@ case "${targ}" in
     targ_defvec=bfd_elf32_bigarm_vec
     targ_selvecs=bfd_elf32_littlearm_vec
     ;;
+  arm-*-kaos* | strongarm-*-kaos*)
+    targ_defvec=bfd_elf32_littlearm_vec
+    targ_selvecs=bfd_elf32_bigarm_vec
+    ;;
   arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux*)
     targ_defvec=bfd_elf32_littlearm_vec
     targ_selvecs=bfd_elf32_bigarm_vec
@@ -370,6 +374,10 @@ case "${targ}" in
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs=i386coff_vec
     ;;
+  i[3456]86-*-kaos*)
+    targ_defvec=bfd_elf32_i386_vec
+    targ_selvecs=bfd_elf32_i386_vec
+    ;;
   i[3456]86-*-nto*)
     targ_defvec=bfd_elf32_i386_vec
     targ_selvecs=i386coff_vec
@@ -901,6 +909,11 @@ case "${targ}" in
     targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
     targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
     ;;
+  powerpc-*-kaos*)
+    targ_defvec=bfd_elf32_powerpc_vec
+    targ_selvecs="bfd_elf32_powerpcle_vec ppcboot_vec"
+    targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+    ;;
   powerpc-*-darwin* | powerpc-*-macos10* | powerpc-*-rhapsody*)
     targ_defvec=mach_o_be_vec
     targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
@@ -1025,7 +1038,7 @@ case "${targ}" in
     targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
     ;;
 
-  shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf*)
+  shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf* | shl*-*-kaos*)
     targ_defvec=bfd_elf32_shl_vec
     targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec"
 #ifdef BFD64
@@ -1033,7 +1046,7 @@ case "${targ}" in
 #endif
     targ_underscore=yes
     ;;
-  sh-*-elf* | sh[1234]*-elf* | sh-*-rtemself*)
+  sh-*-elf* | sh[1234]*-elf* | sh-*-rtemself* | sh-*-kaos*)
     targ_defvec=bfd_elf32_sh_vec
     targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
 #ifdef BFD64
index cd4bf14..923c250 100644 (file)
@@ -95,7 +95,8 @@ processors[] =
   { bfd_mach_arm_4,  "strongarm"},
   { bfd_mach_arm_4,  "strongarm110" },
   { bfd_mach_arm_4,  "strongarm1100" },
-  { bfd_mach_arm_XScale, "xscale" }
+  { bfd_mach_arm_XScale, "xscale" },
+  { bfd_mach_arm_ep9312, "ep9312" }
 };
 
 static bfd_boolean
@@ -140,7 +141,8 @@ static const bfd_arch_info_type arch_info_struct[] =
   N (bfd_mach_arm_5,      "armv5",   FALSE, & arch_info_struct[7]),
   N (bfd_mach_arm_5T,     "armv5t",  FALSE, & arch_info_struct[8]),
   N (bfd_mach_arm_5TE,    "armv5te", FALSE, & arch_info_struct[9]),
-  N (bfd_mach_arm_XScale, "xscale",  FALSE, NULL)
+  N (bfd_mach_arm_XScale, "xscale",  FALSE, & arch_info_struct[10]),
+  N (bfd_mach_arm_ep9312, "ep9312",  FALSE, NULL)
 };
 
 const bfd_arch_info_type bfd_arm_arch =
index 2af10b0..b133991 100644 (file)
@@ -1,3 +1,10 @@
+2003-02-12  Bob Wilson  <bob.wilson@acm.org>
+
+       * bfd.texinfo: Fix quotes for texinfo.  Make section title
+       capitalization more consistent.  Use @example instead of @lisp.
+       Replace FDL appendix with include of fdl.texi.
+       * fdl.texi: New file.
+
 2002-11-18  Klee Dienes  <kdienes@apple.com>
 
        * Makefile.am (DOCFILES): Add bfdwin.texi, bfdio.texi.
@@ -172,43 +179,43 @@ Wed May 24 12:03:25 2000  Hans-Peter Nilsson  <hp@axis.com>
 
        * bfdint.texi (BFD_JUMP_TABLE macros): Fix typo.
 
-Fri Apr  7 17:54:38 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+2000-04-07  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * Makefile.in: Rebuild with current autoconf/automake.
 
-Thu Feb  4 23:21:36 1999  Ian Lance Taylor  <ian@cygnus.com>
+1999-02-04  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in: Rebuild with current autoconf/automake.
 
-Thu Jul 23 09:36:44 1998  Nick Clifton  <nickc@cygnus.com>
+1998-07-23  Nick Clifton  <nickc@cygnus.com>
 
        * bfdint.texi (BFD ELF processor required): Add paragraph
        describing the necessity to create "include/elf/CPU.h".
 
-Thu May  7 14:45:43 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-05-07  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.am (chew.o): Add -I options for intl srcdir and
        objdir.
        * Makefile.in: Rebuild.
 
-Mon Apr 27 20:19:24 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-04-27  Ian Lance Taylor  <ian@cygnus.com>
 
        * bfdint.texi: New file.
        * Makefile.am (noinst_TEXINFOS): New variable.
        * Makefile.in: Rebuild.
 
-Mon Apr 13 16:48:56 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-04-13  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in: Rebuild.
 
-Mon Apr  6 14:06:55 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-04-06  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.am (STAGESTUFF): Remove variable.
        (CLEANFILES): Don't remove $(STAGESTUFF).
        (DISTCLEANFILES, MAINTAINERCLEANFILES): New variables.
        * Makefile.in: Rebuild.
 
-Fri Mar 27 16:25:25 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-03-27  Ian Lance Taylor  <ian@cygnus.com>
 
        * chew.c (skip_white_and_starts): Remove unused declaration.
        (skip_white_and_stars): Add casts to avoid warnings.
@@ -223,12 +230,12 @@ Fri Mar 27 16:25:25 1998  Ian Lance Taylor  <ian@cygnus.com>
        (print): Change printf format string.
        (main): Call usage for an unrecognized option.
 
-Fri Feb 13 14:37:14 1998  Ian Lance Taylor  <ian@cygnus.com>
+1998-02-13  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.am (AUTOMAKE_OPTIONS): Define.
        * Makefile.in: Rebuild.
 
-Mon Jan 26 15:38:36 1998  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+1998-01-26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * doc.str (bodytext): Don't output @* at the end.
        * chew.c (kill_bogus_lines): Make sure that a period at the
@@ -238,45 +245,45 @@ Mon Jan 26 15:38:36 1998  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.
        * Makefile.am (s-reloc, s-syms): Depend on doc.str.
        * Makefile.in: Rebuild.
 
-Wed Oct  1 14:41:28 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-10-01  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.am (libbfd.h): Don't use cpu-h8300.c, cpu-i960.c, or
        elfcode.h as input files; they don't contribute anything.
        * Makefile.in: Rebuild.
 
-Fri Aug 15 04:55:15 1997  Doug Evans  <dje@canuck.cygnus.com>
+1997-08-15  Doug Evans  <dje@canuck.cygnus.com>
 
        * Makefile.am (libbfd.h, libcoff.h): Invoke $(MKDOC) as ./$(MKDOC).
        * Makefile.in: Rebuild.
 
-Fri Aug  1 12:59:58 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-08-01  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.am (CC_FOR_BUILD): Don't set explicitly.
        * Makefile.in: Rebuild.
 
-Thu Jul 31 20:00:12 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-07-31  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.am: New file, based on old Makefile.in.
        * Makefile.in: Now built with automake.
 
-Tue Jul 22 14:44:00 1997  Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
+1997-07-22  Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
 
        * Makefile.in: Change stamp-* files to s-* files.  Use bfdt.texi
        rather than bfd.texi.
        (DOCFILES): Change bfd.texi to bfdt.texi.
        * bfd.texinfo: Include bfdt.texi, not bfd.texi.
 
-Mon Jun 16 15:33:15 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-06-16  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in (CC, CFLAGS): Substitute from configure script.
        From Jeff Makey <jeff@cts.com>.
 
-Tue Apr 15 12:37:41 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-04-15  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in (install-info): Use mkinstalldirs to build
        $(infodir).
 
-Tue Apr  8 12:49:46 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-04-08  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in (install-info): Permit info files to be in srcdir.
        (stamp-*): Add a stamp-X target for each X.texi target.
@@ -285,61 +292,61 @@ Tue Apr  8 12:49:46 1997  Ian Lance Taylor  <ian@cygnus.com>
        (distclean): Depend upon mostlyclean.  Remove stamp-*.  Don't
        remove $(DOCFILES).
 
-Mon Apr  7 15:23:26 1997  Ian Lance Taylor  <ian@cygnus.com>
+1997-04-07  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in (distclean): Don't remove *.info files.
 
-Thu Feb 13 20:50:02 1997  Klaus Kaempf  (kkaempf@progis.de)
+1997-02-13  Klaus Kaempf  (kkaempf@progis.de)
 
        * makefile.vms: New file.
 
-Tue Jun 18 18:32:28 1996  Ian Lance Taylor  <ian@cygnus.com>
+1996-06-18  Ian Lance Taylor  <ian@cygnus.com>
 
        * chew.c (kill_bogus_lines): Reset sl when not at the start of a
        line.  From Uwe Ohse <uwe@tirka.gun.de>.
 
-Tue Jan 30 14:10:46 1996  Ian Lance Taylor  <ian@cygnus.com>
+1996-01-30  Ian Lance Taylor  <ian@cygnus.com>
 
        From Ronald F. Guilmette <rfg@monkeys.com>:
        * Makefile.in (libbfd.h): Depend upon proto.str.
        (libcoff.h, bfd.h): Likewise.
 
-Fri Nov  3 14:46:48 1995  Fred Fish  <fnf@cygnus.com>
+1995-11-03  Fred Fish  <fnf@cygnus.com>
 
        * Makefile.in (SRCDOC, SRCPROT, core.texi, bfd.h):  Use corefile.c,
        renamed from core.c.
 
-Wed Nov  1 14:28:23 1995  Manfred Hollstein KS/EF4A 60/1F/110 #40283  <manfred@lts.sel.alcatel.de>
+1995-11-01  Manfred Hollstein KS/EF4A 60/1F/110 #40283  <manfred@lts.sel.alcatel.de>
 
        * chew.c: Include <ctype.h>.
 
-Fri Oct  6 16:23:34 1995  Ken Raeburn  <raeburn@cygnus.com>
+1995-10-06  Ken Raeburn  <raeburn@cygnus.com>
 
        Mon Sep 25 22:49:32 1995  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * Makefile.in (Makefile): Only remake this Makefile.
 
-Wed Oct  4 15:51:05 1995  Ken Raeburn  <raeburn@cygnus.com>
+1995-10-04  Ken Raeburn  <raeburn@cygnus.com>
 
        * chew.c: Include <stdio.h>.
 
-Tue Sep 12 18:14:50 1995  Ian Lance Taylor  <ian@cygnus.com>
+1995-09-12  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in (maintainer-clean): New target.
 
-Thu Aug 31 12:18:43 1995  Ian Lance Taylor  <ian@cygnus.com>
+1995-08-31  Ian Lance Taylor  <ian@cygnus.com>
 
        * Makefile.in (bfd.h): Add additional #endif at end of bfd.h if
        __cplusplus is defined.
 
-Tue Nov 29 16:13:34 1994  Doug Evans  <dje@canuck.cygnus.com>
+1994-11-29  Doug Evans  <dje@canuck.cygnus.com>
 
        * chew.c (write_buffer): New argument `f', all callers changed.
        (stdout, stderr, print, drop, idrop): New forth words.
        * proto.str (COMMENT): New command.
        * doc.str (COMMENT): Likewise.
 
-Mon Sep 12 11:44:17 1994  Ian Lance Taylor  (ian@sanguine.cygnus.com)
+1994-09-12  Ian Lance Taylor  (ian@sanguine.cygnus.com)
 
        * Makefile.in (DOCFILES): Remove ctor.texi.
        (IPROTOS): Remove ctor.ip.
@@ -349,7 +356,7 @@ Mon Sep 12 11:44:17 1994  Ian Lance Taylor  (ian@sanguine.cygnus.com)
        $(MKDOC) run on $(srcdir)/../ctor.c.
        * bfd.texinfo (Constructors): Remove section.
 
-Fri Sep  2 13:33:44 1994  Ken Raeburn  (raeburn@cujo.cygnus.com)
+1994-09-02  Ken Raeburn  (raeburn@cujo.cygnus.com)
 
        * chew.c: Include assert.h.  Added prototypes for most functions.
        Changed most uses of int to long.  Do bounds checking on the
@@ -371,46 +378,46 @@ Fri Sep  2 13:33:44 1994  Ken Raeburn  (raeburn@cujo.cygnus.com)
        * doc.str, proto.str: Handle new commands SENUM, ENUM, ENUMX,
        ENUMEQ, ENUMEQX, ENUMDOC.
 
-Wed Jan 12 18:37:12 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
+1994-01-12  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
        * bfd.texinfo: Added Linker Functions node.
        * Makefile.in (DOCFILES): Added linker.texi.
        (SRCDOC): Added linker.c.
        (linker.texi): New target.
 
-Tue Jan  4 10:52:56 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
+1994-01-04  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
        * chew.c: Don't rely on a correct declaration of exit.
        (chew_exit): New function which just calls exit.
        (main): Use it.
 
-Mon Jan  3 11:40:40 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
+1994-01-03  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
        * bfd.texinfo: Added Hash Tables node.
        * Makefile.in (DOCFILES): Added hash.texi.
        (SRCDOC): Added hash.c.
        (hash.texi): New target.
 
-Thu Dec 30 16:57:04 1993  Ken Raeburn  (raeburn@cujo.cygnus.com)
+1993-12-30  Ken Raeburn  (raeburn@cujo.cygnus.com)
 
        * Makefile.in: Delete all references to seclet.c, since it's just
        been deleted.  Don't mention hash.c, linker.c, or genlink.h yet,
        since they don't contain documentation yet (hint, hint!).
 
-Fri Nov  5 10:58:53 1993  David J. Mackenzie  (djm@thepub.cygnus.com)
+1993-11-05  David J. Mackenzie  (djm@thepub.cygnus.com)
 
        * bfd.texinfo: Small cleanups.
 
-Fri Nov 19 03:46:11 1993  Ken Raeburn  (raeburn@cambridge.cygnus.com)
+1993-11-19  Ken Raeburn  (raeburn@cambridge.cygnus.com)
 
        * Makefile.in (archures.texi): Depends on $(MKDOC).
 
-Tue Aug 10 14:22:39 1993  Ken Raeburn  (raeburn@cambridge.cygnus.com)
+1993-08-10  Ken Raeburn  (raeburn@cambridge.cygnus.com)
 
        * bfd.texinfo (BFD back end): Don't include elfcode.texi, since
        it's empty now and that triggers a makeinfo bug.
 
-Mon Aug  9 16:27:30 1993  Ken Raeburn  (raeburn@cambridge.cygnus.com)
+1993-08-09  Ken Raeburn  (raeburn@cambridge.cygnus.com)
 
        * bfd.texinfo (BFD back end): New section on ELF, includes
        elf.texi and elfcode.texi.
@@ -418,74 +425,74 @@ Mon Aug  9 16:27:30 1993  Ken Raeburn  (raeburn@cambridge.cygnus.com)
        (SRCDOC): Include elfcode.h, elf.c.
        (elf.texi, elfcode.texi): New intermediate targets.
 
-Thu Jun 24 13:48:13 1993  David J. Mackenzie  (djm@thepub.cygnus.com)
+1993-06-24  David J. Mackenzie  (djm@thepub.cygnus.com)
 
        * Makefile.in (.c.o, chew.o): Put CFLAGS last.
        * bfdsumm.texi: New file, broken out of bfd.texinfo, to share
        with ld.texinfo.
 
-Mon Jun 14 12:07:07 1993  david d `zoo' zuhn  (zoo at rtl.cygnus.com)
+1993-06-14  david d `zoo' zuhn  (zoo at rtl.cygnus.com)
 
        * Makefile.in (install-info): remove parentdir cruft,
 
-Wed Jun  9 16:00:32 1993  Jim Kingdon  (kingdon@cygnus.com)
+1993-06-09  Jim Kingdon  (kingdon@cygnus.com)
 
        * Makefile.in (mostlyclean): Remove chew.o.
 
-Tue May 25 14:46:58 1993  Ken Raeburn  (raeburn@cambridge.cygnus.com)
+1993-05-25  Ken Raeburn  (raeburn@cambridge.cygnus.com)
 
        * Makefile.in (libbfd.h): Use elfcode.h, not elf32.c.
 
-Mon May 24 15:50:07 1993  Ken Raeburn  (raeburn@cygnus.com)
+1993-05-24  Ken Raeburn  (raeburn@cygnus.com)
 
        * chew.c (compile): Add a couple of missing casts.
 
-Wed May 12 14:45:14 1993  Ian Lance Taylor  (ian@cygnus.com)
+1993-05-12  Ian Lance Taylor  (ian@cygnus.com)
 
        * Makefile.in (CC_FOR_BUILD): New variable, define to be $(CC).
        (chew.o, $(MKDOC)): Build using CC_FOR_BUILD rather than CC, since
        it must run on the build machine.
 
-Tue Apr  6 22:38:10 1993  John Gilmore  (gnu@cygnus.com)
+1993-04-07  John Gilmore  (gnu@cygnus.com)
 
        * Makefile.in (chew):  Don't compile from .c to executable in a
        single step; it puts a temporary .o filename into the executable,
        which makes multi-stage comparisons fail.  Compile chew.c to
        chew.o, and link that, which makes identical executables every time.
 
-Wed Mar 24 17:26:29 1993  david d `zoo' zuhn  (zoo at poseidon.cygnus.com)
+1993-03-24  david d `zoo' zuhn  (zoo at poseidon.cygnus.com)
 
        * Makefile.in: fix typo (bfd.texinfo not bfd.texino)
 
-Fri Mar 19 01:13:00 1993  Ken Raeburn  (raeburn@kr-pc.cygnus.com)
+1993-03-19  Ken Raeburn  (raeburn@kr-pc.cygnus.com)
 
        * bfd.texinfo: Since BFD version number has been bumped, do same
        to "version number" on title page, and elsewhere.  Should be
        fixed to extract real version number.
 
-Tue Mar 16 12:15:13 1993  Per Bothner  (bothner@rtl.cygnus.com)
+1993-03-16  Per Bothner  (bothner@rtl.cygnus.com)
 
        * Makefile.in:  Add *clean rules.
 
-Mon Jan 11 18:43:56 1993  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
+1993-01-11  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
        * Makefile.in (libbfd.h): Removed duplicate init.c and libbfd.c.
        Added seclet.c.
        (bfd.h): Added dependency on bfd.c and seclet.c.  Added seclet.c
        to build.
 
-Thu Dec 17 19:35:43 1992  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
+1992-12-17  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
 
        * Makefile.in: added dvi target, define and use $(TEXI2DVI)
 
-Thu Dec  3 17:42:48 1992  Ken Raeburn  (raeburn@cambridge.cygnus.com)
+1992-12-03  Ken Raeburn  (raeburn@cambridge.cygnus.com)
 
        * Makefile.in (TEXIDIR): New variable.
        (bfd.dvi): Look for bfd.texinfo in $(srcdir).  Generate index.
 
        * bfd.texinfo: Minor doc fixes.
 
-Thu Nov  5 03:13:55 1992  John Gilmore  (gnu@cygnus.com)
+1992-11-05  John Gilmore  (gnu@cygnus.com)
 
        Cleanup:  Replace all uses of EXFUN in the BFD sources, with PARAMS.
 
@@ -493,70 +500,70 @@ Thu Nov  5 03:13:55 1992  John Gilmore  (gnu@cygnus.com)
        (paramstuff):  Replace exfunstuff with function to generate PARAMS.
        * proto.str:  Use paramstuff rather than exfunstuff.
 
-Mon Aug 17 12:40:32 1992  Steve Chamberlain  (sac@thepub.cygnus.com)
+1992-08-17  Steve Chamberlain  (sac@thepub.cygnus.com)
 
        * chew.c: various patches provided by Howard Chu.
 
-Fri Jun 19 18:59:54 1992  John Gilmore  (gnu at cygnus.com)
+1992-06-19  John Gilmore  (gnu at cygnus.com)
 
        * Makefile.in (libbfd.h):  Add elf.c as a source of prototypes.
 
-Mon May 11 18:55:59 1992  John Gilmore  (gnu at cygnus.com)
+1992-05-11  John Gilmore  (gnu at cygnus.com)
 
        * chew.c:  exit() should be declared by config files, not by
        portable source code.  Its type could be int or void function.
 
-Mon May  4 13:45:57 1992  K. Richard Pixley  (rich@rtl.cygnus.com)
+1992-05-04  K. Richard Pixley  (rich@rtl.cygnus.com)
 
        * Makefile.in: another CFLAGS correction.
 
-Tue Apr 28 10:21:32 1992  K. Richard Pixley  (rich@rtl.cygnus.com)
+1992-04-28  K. Richard Pixley  (rich@rtl.cygnus.com)
 
        * Makefile.in: Do the CFLAGS thing.
 
-Fri Apr 10 22:34:52 1992  Fred Fish  (fnf@cygnus.com)
+1992-04-11  Fred Fish  (fnf@cygnus.com)
 
        * Makefile.in (MINUS_G):  Add macro and default to -g.
 
-Fri Mar  6 18:53:18 1992  Steve Chamberlain  (sac@thepub.cygnus.com)
+1992-03-06  Steve Chamberlain  (sac@thepub.cygnus.com)
 
        * chew.c: now has -w switch turn on warnings
 
-Wed Feb 26 18:04:40 1992  K. Richard Pixley  (rich@cygnus.com)
+1992-02-26  K. Richard Pixley  (rich@cygnus.com)
 
        * Makefile.in, configure.in: removed traces of namesubdir,
          -subdirs, $(subdir), $(unsubdir), some rcs triggers.  Forced
          copyrights to '92, changed some from Cygnus to FSF.
 
-Tue Dec 10 22:11:05 1991  K. Richard Pixley  (rich at rtl.cygnus.com)
+1991-12-10  K. Richard Pixley  (rich at rtl.cygnus.com)
 
        * Makefile.in: build chew into the current directory.  Complete
          the MKDOC macro transition.
 
-Tue Dec 10 08:26:28 1991  Steve Chamberlain  (sac at rtl.cygnus.com)
+1991-12-10  Steve Chamberlain  (sac at rtl.cygnus.com)
 
        * chew.c: don't core dump when can't open file
        * Makefile.in: get proto.str from the right place when built in
        odd directories
 
-Tue Dec 10 04:07:25 1991  K. Richard Pixley  (rich at rtl.cygnus.com)
+1991-12-10  K. Richard Pixley  (rich at rtl.cygnus.com)
 
        * Makefile.in: infodir belongs in datadir.
 
-Sat Dec  7 17:01:23 1991  Steve Chamberlain  (sac at rtl.cygnus.com)
+1991-12-07  Steve Chamberlain  (sac at rtl.cygnus.com)
 
        * chew.c: Much modified
        * proto.str, doc.str: New files for extracting to product
        prototypes and documents respectively.
 
 
-Fri Dec  6 22:57:12 1991  K. Richard Pixley  (rich at rtl.cygnus.com)
+1991-12-06  K. Richard Pixley  (rich at rtl.cygnus.com)
 
        * Makefile.in: added standards.text support, host/site/target
          inclusion hooks, install using INSTALL_DATA rather than cp,
          don't echo on install.
 
-Thu Dec  5 22:46:17 1991  K. Richard Pixley  (rich at rtl.cygnus.com)
+1991-12-05  K. Richard Pixley  (rich at rtl.cygnus.com)
 
        * Makefile.in: idestdir and ddestdir go away.  Added copyrights
          and shift gpl to v2.  Added ChangeLog if it didn't exist. docdir
index f12222e..d6a427f 100644 (file)
@@ -1,6 +1,6 @@
 \input texinfo.tex
 @setfilename bfd.info
-@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000
+@c Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1997, 2000, 2003
 @c Free Software Foundation, Inc.
 @c 
 @tex
@@ -30,14 +30,14 @@ END-INFO-DIR-ENTRY
 @ifinfo
 This file documents the BFD library.
 
-Copyright (C) 1991, 2000, 2001 Free Software Foundation, Inc.
+Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.1
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, with no Front-Cover Texts, and with no
       Back-Cover Texts.  A copy of the license is included in the
-      section entitled "GNU Free Documentation License".
+      section entitled ``GNU Free Documentation License''.
 
 @ignore
 Permission is granted to process this file through Tex and print the
@@ -75,14 +75,14 @@ notice identical to this one except for the removal of this paragraph
 @end tex
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1991, 2001 Free Software Foundation, Inc.
+Copyright @copyright{} 1991, 2001, 2003 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.1
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, with no Front-Cover Texts, and with no
       Back-Cover Texts.  A copy of the license is included in the
-      section entitled "GNU Free Documentation License".
+      section entitled ``GNU Free Documentation License''.
 
 @end titlepage
 @end iftex
@@ -170,17 +170,17 @@ For example, this sequence does what you would probably expect:
 return the number of sections in an object file attached to a BFD
 @code{abfd}. 
 
-@lisp
+@example
 @c @cartouche
 #include "bfd.h"
 
-unsigned int number_of_sections(abfd)
+unsigned int number_of_sections (abfd)
 bfd *abfd;
 @{
-  return bfd_count_sections(abfd);
+  return bfd_count_sections (abfd);
 @}
 @c @end cartouche
-@end lisp
+@end example
 
 The abstraction used within BFD is that an object file has:
 
@@ -205,7 +205,7 @@ IEEE-695.
 @include bfdsumm.texi
 
 @node BFD front end, BFD back ends, Overview, Top
-@chapter BFD front end
+@chapter BFD Front End
 @include bfdt.texi
 @include bfdio.texi
 
@@ -228,7 +228,7 @@ IEEE-695.
 @end menu
 
 @node Memory Usage, Initialization, BFD front end, BFD front end
-@section Memory usage
+@section Memory Usage
 BFD keeps all of its internal structures in obstacks. There is one obstack
 per open BFD file, into which the current state is stored. When a BFD is
 closed, the obstack is deleted, and so everything which has been
@@ -324,370 +324,9 @@ All of BFD lives in one directory.
 @include  mmo.texi
 
 @node GNU Free Documentation License, Index, BFD back ends, Top
-@chapter GNU Free Documentation License
-@cindex GNU Free Documentation License
-
-                GNU Free Documentation License
-                
-                   Version 1.1, March 2000
-
- Copyright (C) 2000  Free Software Foundation, Inc.
-  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-     
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-0. PREAMBLE
-
-The purpose of this License is to make a manual, textbook, or other
-written document "free" in the sense of freedom: to assure everyone
-the effective freedom to copy and redistribute it, with or without
-modifying it, either commercially or noncommercially.  Secondarily,
-this License preserves for the author and publisher a way to get
-credit for their work, while not being considered responsible for
-modifications made by others.
-
-This License is a kind of "copyleft", which means that derivative
-works of the document must themselves be free in the same sense.  It
-complements the GNU General Public License, which is a copyleft
-license designed for free software.
-
-We have designed this License in order to use it for manuals for free
-software, because free software needs free documentation: a free
-program should come with manuals providing the same freedoms that the
-software does.  But this License is not limited to software manuals;
-it can be used for any textual work, regardless of subject matter or
-whether it is published as a printed book.  We recommend this License
-principally for works whose purpose is instruction or reference.
-
-
-1. APPLICABILITY AND DEFINITIONS
-
-This License applies to any manual or other work that contains a
-notice placed by the copyright holder saying it can be distributed
-under the terms of this License.  The "Document", below, refers to any
-such manual or work.  Any member of the public is a licensee, and is
-addressed as "you".
-
-A "Modified Version" of the Document means any work containing the
-Document or a portion of it, either copied verbatim, or with
-modifications and/or translated into another language.
-
-A "Secondary Section" is a named appendix or a front-matter section of
-the Document that deals exclusively with the relationship of the
-publishers or authors of the Document to the Document's overall subject
-(or to related matters) and contains nothing that could fall directly
-within that overall subject.  (For example, if the Document is in part a
-textbook of mathematics, a Secondary Section may not explain any
-mathematics.)  The relationship could be a matter of historical
-connection with the subject or with related matters, or of legal,
-commercial, philosophical, ethical or political position regarding
-them.
-
-The "Invariant Sections" are certain Secondary Sections whose titles
-are designated, as being those of Invariant Sections, in the notice
-that says that the Document is released under this License.
-
-The "Cover Texts" are certain short passages of text that are listed,
-as Front-Cover Texts or Back-Cover Texts, in the notice that says that
-the Document is released under this License.
-
-A "Transparent" copy of the Document means a machine-readable copy,
-represented in a format whose specification is available to the
-general public, whose contents can be viewed and edited directly and
-straightforwardly with generic text editors or (for images composed of
-pixels) generic paint programs or (for drawings) some widely available
-drawing editor, and that is suitable for input to text formatters or
-for automatic translation to a variety of formats suitable for input
-to text formatters.  A copy made in an otherwise Transparent file
-format whose markup has been designed to thwart or discourage
-subsequent modification by readers is not Transparent.  A copy that is
-not "Transparent" is called "Opaque".
-
-Examples of suitable formats for Transparent copies include plain
-ASCII without markup, Texinfo input format, LaTeX input format, SGML
-or XML using a publicly available DTD, and standard-conforming simple
-HTML designed for human modification.  Opaque formats include
-PostScript, PDF, proprietary formats that can be read and edited only
-by proprietary word processors, SGML or XML for which the DTD and/or
-processing tools are not generally available, and the
-machine-generated HTML produced by some word processors for output
-purposes only.
-
-The "Title Page" means, for a printed book, the title page itself,
-plus such following pages as are needed to hold, legibly, the material
-this License requires to appear in the title page.  For works in
-formats which do not have any title page as such, "Title Page" means
-the text near the most prominent appearance of the work's title,
-preceding the beginning of the body of the text.
-
-
-2. VERBATIM COPYING
-
-You may copy and distribute the Document in any medium, either
-commercially or noncommercially, provided that this License, the
-copyright notices, and the license notice saying this License applies
-to the Document are reproduced in all copies, and that you add no other
-conditions whatsoever to those of this License.  You may not use
-technical measures to obstruct or control the reading or further
-copying of the copies you make or distribute.  However, you may accept
-compensation in exchange for copies.  If you distribute a large enough
-number of copies you must also follow the conditions in section 3.
-
-You may also lend copies, under the same conditions stated above, and
-you may publicly display copies.
-
-
-3. COPYING IN QUANTITY
-
-If you publish printed copies of the Document numbering more than 100,
-and the Document's license notice requires Cover Texts, you must enclose
-the copies in covers that carry, clearly and legibly, all these Cover
-Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
-the back cover.  Both covers must also clearly and legibly identify
-you as the publisher of these copies.  The front cover must present
-the full title with all words of the title equally prominent and
-visible.  You may add other material on the covers in addition.
-Copying with changes limited to the covers, as long as they preserve
-the title of the Document and satisfy these conditions, can be treated
-as verbatim copying in other respects.
-
-If the required texts for either cover are too voluminous to fit
-legibly, you should put the first ones listed (as many as fit
-reasonably) on the actual cover, and continue the rest onto adjacent
-pages.
-
-If you publish or distribute Opaque copies of the Document numbering
-more than 100, you must either include a machine-readable Transparent
-copy along with each Opaque copy, or state in or with each Opaque copy
-a publicly-accessible computer-network location containing a complete
-Transparent copy of the Document, free of added material, which the
-general network-using public has access to download anonymously at no
-charge using public-standard network protocols.  If you use the latter
-option, you must take reasonably prudent steps, when you begin
-distribution of Opaque copies in quantity, to ensure that this
-Transparent copy will remain thus accessible at the stated location
-until at least one year after the last time you distribute an Opaque
-copy (directly or through your agents or retailers) of that edition to
-the public.
-
-It is requested, but not required, that you contact the authors of the
-Document well before redistributing any large number of copies, to give
-them a chance to provide you with an updated version of the Document.
-
-
-4. MODIFICATIONS
-
-You may copy and distribute a Modified Version of the Document under
-the conditions of sections 2 and 3 above, provided that you release
-the Modified Version under precisely this License, with the Modified
-Version filling the role of the Document, thus licensing distribution
-and modification of the Modified Version to whoever possesses a copy
-of it.  In addition, you must do these things in the Modified Version:
-
-A. Use in the Title Page (and on the covers, if any) a title distinct
-   from that of the Document, and from those of previous versions
-   (which should, if there were any, be listed in the History section
-   of the Document).  You may use the same title as a previous version
-   if the original publisher of that version gives permission.
-B. List on the Title Page, as authors, one or more persons or entities
-   responsible for authorship of the modifications in the Modified
-   Version, together with at least five of the principal authors of the
-   Document (all of its principal authors, if it has less than five).
-C. State on the Title page the name of the publisher of the
-   Modified Version, as the publisher.
-D. Preserve all the copyright notices of the Document.
-E. Add an appropriate copyright notice for your modifications
-   adjacent to the other copyright notices.
-F. Include, immediately after the copyright notices, a license notice
-   giving the public permission to use the Modified Version under the
-   terms of this License, in the form shown in the Addendum below.
-G. Preserve in that license notice the full lists of Invariant Sections
-   and required Cover Texts given in the Document's license notice.
-H. Include an unaltered copy of this License.
-I. Preserve the section entitled "History", and its title, and add to
-   it an item stating at least the title, year, new authors, and
-   publisher of the Modified Version as given on the Title Page.  If
-   there is no section entitled "History" in the Document, create one
-   stating the title, year, authors, and publisher of the Document as
-   given on its Title Page, then add an item describing the Modified
-   Version as stated in the previous sentence.
-J. Preserve the network location, if any, given in the Document for
-   public access to a Transparent copy of the Document, and likewise
-   the network locations given in the Document for previous versions
-   it was based on.  These may be placed in the "History" section.
-   You may omit a network location for a work that was published at
-   least four years before the Document itself, or if the original
-   publisher of the version it refers to gives permission.
-K. In any section entitled "Acknowledgements" or "Dedications",
-   preserve the section's title, and preserve in the section all the
-   substance and tone of each of the contributor acknowledgements
-   and/or dedications given therein.
-L. Preserve all the Invariant Sections of the Document,
-   unaltered in their text and in their titles.  Section numbers
-   or the equivalent are not considered part of the section titles.
-M. Delete any section entitled "Endorsements".  Such a section
-   may not be included in the Modified Version.
-N. Do not retitle any existing section as "Endorsements"
-   or to conflict in title with any Invariant Section.
-
-If the Modified Version includes new front-matter sections or
-appendices that qualify as Secondary Sections and contain no material
-copied from the Document, you may at your option designate some or all
-of these sections as invariant.  To do this, add their titles to the
-list of Invariant Sections in the Modified Version's license notice.
-These titles must be distinct from any other section titles.
-
-You may add a section entitled "Endorsements", provided it contains
-nothing but endorsements of your Modified Version by various
-parties--for example, statements of peer review or that the text has
-been approved by an organization as the authoritative definition of a
-standard.
-
-You may add a passage of up to five words as a Front-Cover Text, and a
-passage of up to 25 words as a Back-Cover Text, to the end of the list
-of Cover Texts in the Modified Version.  Only one passage of
-Front-Cover Text and one of Back-Cover Text may be added by (or
-through arrangements made by) any one entity.  If the Document already
-includes a cover text for the same cover, previously added by you or
-by arrangement made by the same entity you are acting on behalf of,
-you may not add another; but you may replace the old one, on explicit
-permission from the previous publisher that added the old one.
-
-The author(s) and publisher(s) of the Document do not by this License
-give permission to use their names for publicity for or to assert or
-imply endorsement of any Modified Version.
-
-
-5. COMBINING DOCUMENTS
-
-You may combine the Document with other documents released under this
-License, under the terms defined in section 4 above for modified
-versions, provided that you include in the combination all of the
-Invariant Sections of all of the original documents, unmodified, and
-list them all as Invariant Sections of your combined work in its
-license notice.
-
-The combined work need only contain one copy of this License, and
-multiple identical Invariant Sections may be replaced with a single
-copy.  If there are multiple Invariant Sections with the same name but
-different contents, make the title of each such section unique by
-adding at the end of it, in parentheses, the name of the original
-author or publisher of that section if known, or else a unique number.
-Make the same adjustment to the section titles in the list of
-Invariant Sections in the license notice of the combined work.
-
-In the combination, you must combine any sections entitled "History"
-in the various original documents, forming one section entitled
-"History"; likewise combine any sections entitled "Acknowledgements",
-and any sections entitled "Dedications".  You must delete all sections
-entitled "Endorsements."
-
-
-6. COLLECTIONS OF DOCUMENTS
-
-You may make a collection consisting of the Document and other documents
-released under this License, and replace the individual copies of this
-License in the various documents with a single copy that is included in
-the collection, provided that you follow the rules of this License for
-verbatim copying of each of the documents in all other respects.
-
-You may extract a single document from such a collection, and distribute
-it individually under this License, provided you insert a copy of this
-License into the extracted document, and follow this License in all
-other respects regarding verbatim copying of that document.
-
-
-7. AGGREGATION WITH INDEPENDENT WORKS
-
-A compilation of the Document or its derivatives with other separate
-and independent documents or works, in or on a volume of a storage or
-distribution medium, does not as a whole count as a Modified Version
-of the Document, provided no compilation copyright is claimed for the
-compilation.  Such a compilation is called an "aggregate", and this
-License does not apply to the other self-contained works thus compiled
-with the Document, on account of their being thus compiled, if they
-are not themselves derivative works of the Document.
-
-If the Cover Text requirement of section 3 is applicable to these
-copies of the Document, then if the Document is less than one quarter
-of the entire aggregate, the Document's Cover Texts may be placed on
-covers that surround only the Document within the aggregate.
-Otherwise they must appear on covers around the whole aggregate.
-
-
-8. TRANSLATION
-
-Translation is considered a kind of modification, so you may
-distribute translations of the Document under the terms of section 4.
-Replacing Invariant Sections with translations requires special
-permission from their copyright holders, but you may include
-translations of some or all Invariant Sections in addition to the
-original versions of these Invariant Sections.  You may include a
-translation of this License provided that you also include the
-original English version of this License.  In case of a disagreement
-between the translation and the original English version of this
-License, the original English version will prevail.
-
-
-9. TERMINATION
-
-You may not copy, modify, sublicense, or distribute the Document except
-as expressly provided for under this License.  Any other attempt to
-copy, modify, sublicense or distribute the Document is void, and will
-automatically terminate your rights under this License.  However,
-parties who have received copies, or rights, from you under this
-License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-
-10. FUTURE REVISIONS OF THIS LICENSE
-
-The Free Software Foundation may publish new, revised versions
-of the GNU Free Documentation License from time to time.  Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.  See
-http://www.gnu.org/copyleft/.
-
-Each version of the License is given a distinguishing version number.
-If the Document specifies that a particular numbered version of this
-License "or any later version" applies to it, you have the option of
-following the terms and conditions either of that specified version or
-of any later version that has been published (not as a draft) by the
-Free Software Foundation.  If the Document does not specify a version
-number of this License, you may choose any version ever published (not
-as a draft) by the Free Software Foundation.
-
-
-ADDENDUM: How to use this License for your documents
-
-To use this License in a document you have written, include a copy of
-the License in the document and put the following copyright and
-license notices just after the title page:
-
-@smallexample
-    Copyright (c)  YEAR  YOUR NAME.
-    Permission is granted to copy, distribute and/or modify this document
-    under the terms of the GNU Free Documentation License, Version 1.1
-    or any later version published by the Free Software Foundation;
-    with the Invariant Sections being LIST THEIR TITLES, with the
-    Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
-    A copy of the license is included in the section entitled "GNU
-    Free Documentation License".
-@end smallexample
-
-If you have no Invariant Sections, write "with no Invariant Sections"
-instead of saying which ones are invariant.  If you have no
-Front-Cover Texts, write "no Front-Cover Texts" instead of
-"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
-
-If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of
-free software license, such as the GNU General Public License,
-to permit their use in free software.
-
-@node Index,  , GNU Free Documentation License , Top
+@include fdl.texi
+
+@node Index,  , GNU Free Documentation License, Top
 @unnumbered Index
 @printindex cp
 
diff --git a/bfd/doc/fdl.texi b/bfd/doc/fdl.texi
new file mode 100644 (file)
index 0000000..176233c
--- /dev/null
@@ -0,0 +1,366 @@
+@c -*-texinfo-*-
+@appendix GNU Free Documentation License
+@center Version 1.1, March 2000
+
+@display
+Copyright (C) 2000, Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+@sp 1
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+written document ``free'' in the sense of freedom: to assure everyone
+the effective freedom to copy and redistribute it, with or without
+modifying it, either commercially or noncommercially.  Secondarily,
+this License preserves for the author and publisher a way to get
+credit for their work, while not being considered responsible for
+modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@sp 1
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work that contains a
+notice placed by the copyright holder saying it can be distributed
+under the terms of this License.  The ``Document'', below, refers to any
+such manual or work.  Any member of the public is a licensee, and is
+addressed as ``you.''
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section of
+the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall subject
+(or to related matters) and contains nothing that could fall directly
+within that overall subject.  (For example, if the Document is in part a
+textbook of mathematics, a Secondary Section may not explain any
+mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, whose contents can be viewed and edited directly and
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters.  A copy made in an otherwise Transparent file
+format whose markup has been designed to thwart or discourage
+subsequent modification by readers is not Transparent.  A copy that is
+not ``Transparent'' is called ``Opaque.''
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, LaTeX input format, SGML
+or XML using a publicly available DTD, and standard-conforming simple
+HTML designed for human modification.  Opaque formats include
+PostScript, PDF, proprietary formats that can be read and edited only
+by proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the
+machine-generated HTML produced by some word processors for output
+purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page.  For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+@sp 1
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License.  You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute.  However, you may accept
+compensation in exchange for copies.  If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+@sp 1
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies of the Document numbering more than 100,
+and the Document's license notice requires Cover Texts, you must enclose
+the copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover.  Both covers must also clearly and legibly identify
+you as the publisher of these copies.  The front cover must present
+the full title with all words of the title equally prominent and
+visible.  You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a publicly-accessible computer-network location containing a complete
+Transparent copy of the Document, free of added material, which the
+general network-using public has access to download anonymously at no
+charge using public-standard network protocols.  If you use the latter
+option, you must take reasonably prudent steps, when you begin
+distribution of Opaque copies in quantity, to ensure that this
+Transparent copy will remain thus accessible at the stated location
+until at least one year after the last time you distribute an Opaque
+copy (directly or through your agents or retailers) of that edition to
+the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+@sp 1
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it.  In addition, you must do these things in the Modified Version:
+
+A. Use in the Title Page (and on the covers, if any) a title distinct
+   from that of the Document, and from those of previous versions
+   (which should, if there were any, be listed in the History section
+   of the Document).  You may use the same title as a previous version
+   if the original publisher of that version gives permission.@*
+B. List on the Title Page, as authors, one or more persons or entities
+   responsible for authorship of the modifications in the Modified
+   Version, together with at least five of the principal authors of the
+   Document (all of its principal authors, if it has less than five).@*
+C. State on the Title page the name of the publisher of the
+   Modified Version, as the publisher.@*
+D. Preserve all the copyright notices of the Document.@*
+E. Add an appropriate copyright notice for your modifications
+   adjacent to the other copyright notices.@*
+F. Include, immediately after the copyright notices, a license notice
+   giving the public permission to use the Modified Version under the
+   terms of this License, in the form shown in the Addendum below.@*
+G. Preserve in that license notice the full lists of Invariant Sections
+   and required Cover Texts given in the Document's license notice.@*
+H. Include an unaltered copy of this License.@*
+I. Preserve the section entitled ``History'', and its title, and add to
+   it an item stating at least the title, year, new authors, and
+   publisher of the Modified Version as given on the Title Page.  If
+   there is no section entitled ``History'' in the Document, create one
+   stating the title, year, authors, and publisher of the Document as
+   given on its Title Page, then add an item describing the Modified
+   Version as stated in the previous sentence.@*
+J. Preserve the network location, if any, given in the Document for
+   public access to a Transparent copy of the Document, and likewise
+   the network locations given in the Document for previous versions
+   it was based on.  These may be placed in the ``History'' section.
+   You may omit a network location for a work that was published at
+   least four years before the Document itself, or if the original
+   publisher of the version it refers to gives permission.@*
+K. In any section entitled ``Acknowledgements'' or ``Dedications'',
+   preserve the section's title, and preserve in the section all the
+   substance and tone of each of the contributor acknowledgements
+   and/or dedications given therein.@*
+L. Preserve all the Invariant Sections of the Document,
+   unaltered in their text and in their titles.  Section numbers
+   or the equivalent are not considered part of the section titles.@*
+M. Delete any section entitled ``Endorsements.''  Such a section
+   may not be included in the Modified Version.@*
+N. Do not retitle any existing section as ``Endorsements''
+   or to conflict in title with any Invariant Section.@*
+@sp 1
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant.  To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties--for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version.  Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity.  If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+@sp 1
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy.  If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections entitled ``History''
+in the various original documents, forming one section entitled
+``History''; likewise combine any sections entitled ``Acknowledgements'',
+and any sections entitled ``Dedications.''  You must delete all sections
+entitled ``Endorsements.''
+@sp 1
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+@sp 1
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, does not as a whole count as a Modified Version
+of the Document, provided no compilation copyright is claimed for the
+compilation.  Such a compilation is called an ``aggregate'', and this
+License does not apply to the other self-contained works thus compiled
+with the Document, on account of their being thus compiled, if they
+are not themselves derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one quarter
+of the entire aggregate, the Document's Cover Texts may be placed on
+covers that surround only the Document within the aggregate.
+Otherwise they must appear on covers around the whole aggregate.
+@sp 1
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections.  You may include a
+translation of this License provided that you also include the
+original English version of this License.  In case of a disagreement
+between the translation and the original English version of this
+License, the original English version will prevail.
+@sp 1
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License.  Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License.  However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+@sp 1
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time.  Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.  See
+http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation.  If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+
+@end enumerate
+
+@unnumberedsec ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+Copyright (C)  @var{year}  @var{your name}.
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1
+or any later version published by the Free Software Foundation;
+with the Invariant Sections being @var{list their titles}, with the
+Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}.
+A copy of the license is included in the section entitled "GNU
+Free Documentation License."
+@end group
+@end smallexample
+
+If you have no Invariant Sections, write ``with no Invariant Sections''
+instead of saying which ones are invariant.  If you have no
+Front-Cover Texts, write ``no Front-Cover Texts'' instead of
+``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
index 752752f..1ba7d56 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic ECOFF (Extended-COFF) routines.
-   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-   Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+   2002, 2003 Free Software Foundation, Inc.
    Original version by Per Bothner.
    Full support added by Ian Lance Taylor, ian@cygnus.com.
 
@@ -81,6 +81,10 @@ static asection bfd_debug_section =
   "*DEBUG*", 0,   0,     NULL, 0,     0,            0,
   /* linker_mark, linker_has_input, gc_mark, segment_mark,         */
      0,           0,                0,       0,
+  /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12,     */
+     0,                    0,          0,             0,      0,
+  /* flag13, flag14, flag15, flag16, flag20, flag24,               */
+     0,      0,      0,      0,      0,             0,
   /* vma, lma, _cooked_size, _raw_size,                            */
      0,   0,   0,            0,
   /* output_offset, output_section, alignment_power,               */
index 394f70c..2e5587c 100644 (file)
@@ -80,6 +80,8 @@ typedef struct
 } elf_symbol_type;
 \f
 struct elf_strtab_hash;
+struct got_entry;
+struct plt_entry;
 
 /* ELF linker hash table entries.  */
 
@@ -146,23 +148,23 @@ struct elf_link_hash_entry
 
   /* If this symbol requires an entry in the global offset table, the
      processor specific backend uses this field to track usage and
-     final offset.  We use a union and two names primarily to document
-     the intent of any particular piece of code.  The field should be
-     used as a count until size_dynamic_sections, at which point the
-     contents of the .got is fixed.  Afterward, if this field is -1,
-     then the symbol does not require a global offset table entry.  */
-  union
+     final offset.  Two schemes are supported:  The first assumes that
+     a symbol may only have one GOT entry, and uses REFCOUNT until
+     size_dynamic_sections, at which point the contents of the .got is
+     fixed.  Afterward, if OFFSET is -1, then the symbol does not
+     require a global offset table entry.  The second scheme allows
+     multiple GOT entries per symbol, managed via a linked list
+     pointed to by GLIST.  */
+  union gotplt_union
     {
       bfd_signed_vma refcount;
       bfd_vma offset;
+      struct got_entry *glist;
+      struct plt_entry *plist;
     } got;
 
   /* Same, but tracks a procedure linkage table entry.  */
-  union
-    {
-      bfd_signed_vma refcount;
-      bfd_vma offset;
-    } plt;
+  union gotplt_union plt;
 
   /* Symbol size.  */
   bfd_size_type size;
@@ -229,16 +231,6 @@ struct elf_link_loaded_list
   bfd *abfd;
 };
 
-enum elf_link_info_type
-{
-  ELF_INFO_TYPE_NONE,
-  ELF_INFO_TYPE_STABS,
-  ELF_INFO_TYPE_MERGE,
-  ELF_INFO_TYPE_EH_FRAME,
-  ELF_INFO_TYPE_JUST_SYMS,
-  ELF_INFO_TYPE_LAST
-};
-
 /* Structures used by the eh_frame optimization code.  */
 struct cie_header
 {
@@ -333,9 +325,13 @@ struct elf_link_hash_table
 
   /* The value to use when initialising got.refcount/offset and
      plt.refcount/offset in an elf_link_hash_entry.  Set to zero when
-     the values are refcounts.  Set to -1 in size_dynamic_sections
-     when the values may be offsets.  */
-  bfd_signed_vma init_refcount;
+     the values are refcounts.  Set to init_offset in
+     size_dynamic_sections when the values may be offsets.  */
+  union gotplt_union init_refcount;
+
+  /* The value to use for got.refcount/offset and plt.refcount/offset
+     when the values may be offsets.  Normally (bfd_vma) -1.  */
+  union gotplt_union init_offset;
 
   /* The number of symbols found in the link which must be put into
      the .dynsym section.  */
@@ -989,29 +985,19 @@ struct bfd_elf_section_data
 
   /* A pointer used for various section optimizations.  */
   PTR sec_info;
-
-  /* Type of sec_info information.  */
-  enum elf_link_info_type sec_info_type;
-
-  /* Nonzero if this section uses RELA relocations, rather than REL.  */
-  unsigned int use_rela_p:1;
-
-  /* Nonzero when a group is COMDAT.  */
-  unsigned int linkonce_p:1;
 };
 
 #define elf_section_data(sec)  ((struct bfd_elf_section_data*)sec->used_by_bfd)
 #define elf_group_name(sec)    (elf_section_data(sec)->group.name)
 #define elf_group_id(sec)      (elf_section_data(sec)->group.id)
 #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
-#define elf_linkonce_p(sec)    (elf_section_data(sec)->linkonce_p)
 
 /* Return TRUE if section has been discarded.  */
-#define elf_discarded_section(sec)                                     \
-  (!bfd_is_abs_section(sec)                                            \
-   && bfd_is_abs_section((sec)->output_section)                                \
-   && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE     \
-   && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
+#define elf_discarded_section(sec)                             \
+  (!bfd_is_abs_section (sec)                                   \
+   && bfd_is_abs_section ((sec)->output_section)               \
+   && sec->sec_info_type != ELF_INFO_TYPE_MERGE                        \
+   && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
 
 #define get_elf_backend_data(abfd) \
   ((struct elf_backend_data *) (abfd)->xvec->backend_data)
@@ -1119,17 +1105,14 @@ struct elf_obj_tdata
      minus the sh_info field of the symbol table header.  */
   struct elf_link_hash_entry **sym_hashes;
 
-  /* A mapping from local symbols to offsets into the global offset
-     table, used when linking.  This is indexed by the symbol index.
-     Like for the globals, we use a union and two names primarily to
-     document the intent of any particular piece of code.  The field
-     should be used as a count until size_dynamic_sections, at which
-     point the contents of the .got is fixed.  Afterward, if an entry
-     is -1, then the symbol does not require a global offset table entry.  */
+  /* Track usage and final offsets of GOT entries for local symbols.
+     This array is indexed by symbol index.  Elements are used
+     identically to "got" in struct elf_link_hash_entry.  */
   union
     {
       bfd_signed_vma *refcounts;
       bfd_vma *offsets;
+      struct got_entry **ents;
     } local_got;
 
   /* A mapping from local symbols to offsets into the various linker
@@ -1236,6 +1219,7 @@ struct elf_obj_tdata
 #define elf_sym_hashes(bfd)    (elf_tdata(bfd) -> sym_hashes)
 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
+#define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
 #define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
 #define elf_dt_name(bfd)       (elf_tdata(bfd) -> dt_name)
 #define elf_dt_soname(bfd)     (elf_tdata(bfd) -> dt_soname)
@@ -1273,6 +1257,8 @@ extern char *bfd_elf_get_str_section
 extern Elf_Internal_Sym *bfd_elf_get_elf_syms
   PARAMS ((bfd *, Elf_Internal_Shdr *, size_t, size_t,
           Elf_Internal_Sym *, PTR, Elf_External_Sym_Shndx *));
+extern const char *bfd_elf_local_sym_name
+  PARAMS ((bfd *, Elf_Internal_Sym *));
 
 extern bfd_boolean _bfd_elf_copy_private_bfd_data
   PARAMS ((bfd *, bfd *));
index 7c12674..7764074 100644 (file)
@@ -1,5 +1,5 @@
 /* .eh_frame section optimization.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -33,7 +33,7 @@ static bfd_signed_vma read_signed_leb128
 static int get_DW_EH_PE_width
   PARAMS ((int, int));
 static bfd_vma read_value
-  PARAMS ((bfd *, bfd_byte *, int));
+  PARAMS ((bfd *, bfd_byte *, int, int));
 static void write_value
   PARAMS ((bfd *, bfd_byte *, bfd_vma, int));
 static int cie_compare
@@ -141,22 +141,42 @@ int get_DW_EH_PE_width (encoding, ptr_size)
   return 0;
 }
 
+#define get_DW_EH_PE_signed(encoding) (((encoding) & DW_EH_PE_signed) != 0)
+
 /* Read a width sized value from memory.  */
 
 static bfd_vma
-read_value (abfd, buf, width)
+read_value (abfd, buf, width, is_signed)
      bfd *abfd;
      bfd_byte *buf;
      int width;
+     int is_signed;
 {
   bfd_vma value;
 
   switch (width)
     {
-    case 2: value = bfd_get_16 (abfd, buf); break;
-    case 4: value = bfd_get_32 (abfd, buf); break;
-    case 8: value = bfd_get_64 (abfd, buf); break;
-    default: BFD_FAIL (); return 0;
+    case 2:
+      if (is_signed)
+       value = bfd_get_signed_16 (abfd, buf);
+      else
+       value = bfd_get_16 (abfd, buf);
+      break;
+    case 4:
+      if (is_signed)
+       value = bfd_get_signed_32 (abfd, buf);
+      else
+       value = bfd_get_32 (abfd, buf);
+      break;
+    case 8:
+      if (is_signed)
+       value = bfd_get_signed_64 (abfd, buf);
+      else
+       value = bfd_get_64 (abfd, buf);
+      break;
+    default:
+      BFD_FAIL ();
+      return 0;
     }
 
   return value;
@@ -605,7 +625,7 @@ _bfd_elf_discard_section_eh_frame (abfd, info, sec,
     }
 
   elf_section_data (sec)->sec_info = sec_info;
-  elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
+  sec->sec_info_type = ELF_INFO_TYPE_EH_FRAME;
 
   /* Ok, now we can assign new offsets.  */
   offset = 0;
@@ -758,7 +778,7 @@ _bfd_elf_eh_frame_section_offset (output_bfd, sec, offset)
   struct eh_frame_sec_info *sec_info;
   unsigned int lo, hi, mid;
 
-  if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+  if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
     return offset;
   sec_info = (struct eh_frame_sec_info *)
             elf_section_data (sec)->sec_info;
@@ -828,7 +848,7 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents)
   ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
              == ELFCLASS64) ? 8 : 4;
 
-  if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+  if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
     return bfd_set_section_contents (abfd, sec->output_section,
                                     contents,
                                     (file_ptr) sec->output_offset,
@@ -925,7 +945,9 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents)
                      {
                        bfd_vma value;
 
-                       value = read_value (abfd, buf, per_width);
+                       value = read_value (abfd, buf, per_width,
+                                           get_DW_EH_PE_signed
+                                           (per_encoding));
                        value += (sec_info->entry[i].offset
                                  - sec_info->entry[i].new_offset);
                        write_value (abfd, buf, value, per_width);
@@ -961,7 +983,9 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents)
          buf += 4;
          width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding,
                                      ptr_size);
-         address = value = read_value (abfd, buf, width);
+         address = value = read_value (abfd, buf, width,
+                                       get_DW_EH_PE_signed
+                                       (sec_info->entry[i].fde_encoding));
          if (value)
            {
              switch (sec_info->entry[i].fde_encoding & 0xf0)
@@ -1005,7 +1029,9 @@ _bfd_elf_write_section_eh_frame (abfd, info, sec, contents)
              buf += sec_info->entry[i].lsda_offset;
              width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding,
                                          ptr_size);
-             value = read_value (abfd, buf, width);
+             value = read_value (abfd, buf, width,
+                                 get_DW_EH_PE_signed
+                                 (sec_info->entry[i].lsda_encoding));
              if (value)
                {
                  if ((sec_info->entry[i].lsda_encoding & 0xf0)
index 7c20971..0331f3d 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -97,6 +97,12 @@ static bfd_boolean elfcore_grok_netbsd_procinfo
   PARAMS ((bfd *, Elf_Internal_Note *));
 static bfd_boolean elfcore_grok_netbsd_note
   PARAMS ((bfd *, Elf_Internal_Note *));
+static bfd_boolean elfcore_grok_nto_gregs
+  PARAMS ((bfd *, Elf_Internal_Note *, pid_t));
+static bfd_boolean elfcore_grok_nto_status
+  PARAMS ((bfd *, Elf_Internal_Note *, pid_t *));
+static bfd_boolean elfcore_grok_nto_note
+  PARAMS ((bfd *, Elf_Internal_Note *));
 
 /* Swap version information in and out.  The version information is
    currently size independent.  If that ever changes, this code will
@@ -476,6 +482,23 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset,
   return intsym_buf;
 }
 
+/* Look up a symbol name.  */
+const char *
+bfd_elf_local_sym_name (abfd, isym)
+     bfd *abfd;
+     Elf_Internal_Sym *isym;
+{
+  unsigned int iname = isym->st_name;
+  unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link;
+  if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION)
+    {
+      iname = elf_elfsections (abfd)[isym->st_shndx]->sh_name;
+      shindex = elf_elfheader (abfd)->e_shstrndx;
+    }
+
+  return bfd_elf_string_from_elf_section (abfd, shindex, iname);
+}
+
 /* Elf_Internal_Shdr->contents is an array of these for SHT_GROUP
    sections.  The first element is the flags, the rest are section
    pointers.  */
@@ -497,8 +520,6 @@ group_signature (abfd, ghdr)
   unsigned char esym[sizeof (Elf64_External_Sym)];
   Elf_External_Sym_Shndx eshndx;
   Elf_Internal_Sym isym;
-  unsigned int iname;
-  unsigned int shindex;
 
   /* First we need to ensure the symbol table is available.  */
   if (! bfd_section_from_shdr (abfd, ghdr->sh_link))
@@ -510,16 +531,7 @@ group_signature (abfd, ghdr)
                            &isym, esym, &eshndx) == NULL)
     return NULL;
 
-  /* Look up the symbol name.  */
-  iname = isym.st_name;
-  shindex = hdr->sh_link;
-  if (iname == 0 && ELF_ST_TYPE (isym.st_info) == STT_SECTION)
-    {
-      iname = elf_elfsections (abfd)[isym.st_shndx]->sh_name;
-      shindex = elf_elfheader (abfd)->e_shstrndx;
-    }
-
-  return bfd_elf_string_from_elf_section (abfd, shindex, iname);
+  return bfd_elf_local_sym_name (abfd, &isym);
 }
 
 /* Set next_in_group list pointer, and group name for NEWSECT.  */
@@ -969,11 +981,8 @@ merge_sections_remove_hook (abfd, sec)
      bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
 {
-  struct bfd_elf_section_data *sec_data;
-
-  sec_data = elf_section_data (sec);
-  BFD_ASSERT (sec_data->sec_info_type == ELF_INFO_TYPE_MERGE);
-  sec_data->sec_info_type = ELF_INFO_TYPE_NONE;
+  BFD_ASSERT (sec->sec_info_type == ELF_INFO_TYPE_MERGE);
+  sec->sec_info_type = ELF_INFO_TYPE_NONE;
 }
 
 /* Finish SHF_MERGE section merging.  */
@@ -1001,7 +1010,7 @@ _bfd_elf_link_just_syms (sec, info)
   if (!is_elf_hash_table (info))
     return;
 
-  elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
+  sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
 }
 \f
 /* Copy the program header and other data from one object module to
@@ -1423,8 +1432,8 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
       ret->vtable_entries_size = 0;
       ret->vtable_entries_used = NULL;
       ret->vtable_parent = NULL;
-      ret->got.refcount = htab->init_refcount;
-      ret->plt.refcount = htab->init_refcount;
+      ret->got = htab->init_refcount;
+      ret->plt = htab->init_refcount;
       ret->size = 0;
       ret->type = STT_NOTYPE;
       ret->other = 0;
@@ -1499,7 +1508,7 @@ _bfd_elf_link_hash_hide_symbol (info, h, force_local)
      struct elf_link_hash_entry *h;
      bfd_boolean force_local;
 {
-  h->plt.offset = (bfd_vma) -1;
+  h->plt = elf_hash_table (info)->init_offset;
   h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
   if (force_local)
     {
@@ -1529,8 +1538,9 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc)
   table->dynobj = NULL;
   /* Make sure can_refcount is extended to the width and signedness of
      init_refcount before we subtract one from it.  */
-  table->init_refcount = get_elf_backend_data (abfd)->can_refcount;
-  --table->init_refcount;
+  table->init_refcount.refcount = get_elf_backend_data (abfd)->can_refcount;
+  table->init_refcount.refcount -= 1;
+  table->init_offset.offset = -(bfd_vma) 1;
   /* The first dynamic symbol is a dummy.  */
   table->dynsymcount = 1;
   table->dynstr = NULL;
@@ -2007,8 +2017,7 @@ bfd_section_from_shdr (abfd, shindex)
        /* In the section to which the relocations apply, mark whether
           its relocations are of the REL or RELA variety.  */
        if (hdr->sh_size != 0)
-         elf_section_data (target_sect)->use_rela_p
-           = (hdr->sh_type == SHT_RELA);
+         target_sect->use_rela_p = hdr->sh_type == SHT_RELA;
        abfd->flags |= HAS_RELOC;
        return TRUE;
       }
@@ -2148,8 +2157,7 @@ _bfd_elf_new_section_hook (abfd, sec)
     }
 
   /* Indicate whether or not this section should use RELA relocations.  */
-  sdata->use_rela_p
-    = get_elf_backend_data (abfd)->default_use_rela_p;
+  sec->use_rela_p = get_elf_backend_data (abfd)->default_use_rela_p;
 
   return TRUE;
 }
@@ -2507,7 +2515,7 @@ elf_fake_sections (abfd, asect, failedptrarg)
       && !_bfd_elf_init_reloc_shdr (abfd,
                                    &elf_section_data (asect)->rel_hdr,
                                    asect,
-                                   elf_section_data (asect)->use_rela_p))
+                                   asect->use_rela_p))
     *failedptr = TRUE;
 }
 
@@ -3540,7 +3548,7 @@ elf_sort_sections (arg1, arg2)
 
   /* Put !SEC_LOAD sections after SEC_LOAD ones.  */
 
-#define TOEND(x) (((x)->flags & (SEC_LOAD|SEC_THREAD_LOCAL)) == 0)
+#define TOEND(x) (((x)->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0)
 
   if (TOEND (sec1))
     {
@@ -4654,13 +4662,20 @@ copy_private_bfd_data (ibfd, obfd)
    && ! section->segment_mark)
 
   /* Returns TRUE iff seg1 starts after the end of seg2.  */
-#define SEGMENT_AFTER_SEGMENT(seg1, seg2)                              \
-  (seg1->p_vaddr >= SEGMENT_END (seg2, seg2->p_vaddr))
-
-  /* Returns TRUE iff seg1 and seg2 overlap.  */
+#define SEGMENT_AFTER_SEGMENT(seg1, seg2, field)                       \
+  (seg1->field >= SEGMENT_END (seg2, seg2->field))
+
+  /* Returns TRUE iff seg1 and seg2 overlap. Segments overlap iff both
+     their VMA address ranges and their LMA address ranges overlap.
+     It is possible to have overlapping VMA ranges without overlapping LMA
+     ranges.  RedBoot images for example can have both .data and .bss mapped
+     to the same VMA range, but with the .data section mapped to a different
+     LMA.  */
 #define SEGMENT_OVERLAPS(seg1, seg2)                                   \
-  (!(SEGMENT_AFTER_SEGMENT (seg1, seg2)                                        \
-     || SEGMENT_AFTER_SEGMENT (seg2, seg1)))
+  (   !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_vaddr)                    \
+        || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_vaddr))                \
+   && !(SEGMENT_AFTER_SEGMENT (seg1, seg2, p_paddr)                    \
+        || SEGMENT_AFTER_SEGMENT (seg2, seg1, p_paddr)))
 
   /* Initialise the segment mark field.  */
   for (section = ibfd->sections; section != NULL; section = section->next)
@@ -4758,13 +4773,14 @@ copy_private_bfd_data (ibfd, obfd)
        continue;
 
       /* Compute how many sections might be placed into this segment.  */
-      section_count = 0;
-      for (section = ibfd->sections; section != NULL; section = section->next)
+      for (section = ibfd->sections, section_count = 0;
+          section != NULL;
+          section = section->next)
        if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed))
          ++section_count;
-
-      /* Allocate a segment map big enough to contain all of the
-        sections we have selected.  */
+      /* Allocate a segment map big enough to contain
+        all of the sections we have selected.  */
       amt = sizeof (struct elf_segment_map);
       amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
       map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
@@ -4836,7 +4852,7 @@ copy_private_bfd_data (ibfd, obfd)
            and possibly its LMA changed, and a new segment or segments will
            have to be created to contain the other sections.
 
-        4. The sections have been moved, but not be the same amount.
+        4. The sections have been moved, but not by the same amount.
            In this case we can change the segment's LMA to match the LMA
            of the first section and we will have to create a new segment
            or segments to contain the other sections.
@@ -5080,10 +5096,8 @@ copy_private_bfd_data (ibfd, obfd)
     if (map->p_paddr != 0)
       break;
   if (map == NULL)
-    {
-      for (map = map_first; map != NULL; map = map->next)
-       map->p_paddr_valid = 0;
-    }
+    for (map = map_first; map != NULL; map = map->next)
+      map->p_paddr_valid = 0;
 
   elf_tdata (obfd)->segment_map = map_first;
 
@@ -5190,8 +5204,7 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
   elf_next_in_group (osec) = elf_next_in_group (isec);
   elf_group_name (osec) = elf_group_name (isec);
 
-  elf_section_data (osec)->use_rela_p
-    = elf_section_data (isec)->use_rela_p;
+  osec->use_rela_p = isec->use_rela_p;
 
   return TRUE;
 }
@@ -5308,7 +5321,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
       symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx);
     }
 
-  /* now generate the data (for "contents") */
+  /* Now generate the data (for "contents").  */
   {
     /* Fill in zeroth symbol and swap it out.  */
     Elf_Internal_Sym sym;
@@ -5374,6 +5387,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
              value += sec->output_offset;
              sec = sec->output_section;
            }
+
          /* Don't add in the section vma for relocatable output.  */
          if (! relocatable_p)
            value += sec->vma;
@@ -5425,7 +5439,16 @@ swap_out_syms (abfd, sttp, relocatable_p)
                     section of a symbol to be a section that is
                     actually in the output file.  */
                  sec2 = bfd_get_section_by_name (abfd, sec->name);
-                 BFD_ASSERT (sec2 != 0);
+                 if (sec2 == NULL)
+                   {
+                     _bfd_error_handler (_("\
+Unable to find equivalent output section for symbol '%s' from section '%s'"),
+                                         syms[idx]->name ? syms[idx]->name : "<Local sym>",
+                                         sec->name);
+                     bfd_set_error (bfd_error_invalid_operation);      
+                     return FALSE;
+                   }
+  
                  shndx = _bfd_elf_section_from_bfd_section (abfd, sec2);
                  BFD_ASSERT (shndx != -1);
                }
@@ -5446,7 +5469,7 @@ swap_out_syms (abfd, sttp, relocatable_p)
       if (syms[idx]->section->flags & SEC_THREAD_LOCAL)
        type = STT_TLS;
 
-      /* Processor-specific types */
+      /* Processor-specific types */
       if (type_ptr != NULL
          && bed->elf_backend_get_symbol_type)
        type = ((*bed->elf_backend_get_symbol_type)
@@ -6950,6 +6973,104 @@ elfcore_grok_netbsd_note (abfd, note)
     /* NOTREACHED */
 }
 
+static bfd_boolean
+elfcore_grok_nto_status (abfd, note, tid)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+     pid_t *tid;
+{
+  void *ddata = note->descdata;
+  char buf[100];
+  char *name;
+  asection *sect;
+
+  /* nto_procfs_status 'pid' field is at offset 0.  */
+  elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, (bfd_byte *) ddata);
+
+  /* nto_procfs_status 'tid' field is at offset 4.  */
+  elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, (bfd_byte *) ddata + 4);
+
+  /* nto_procfs_status 'what' field is at offset 14.  */
+  elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, (bfd_byte *) ddata + 14);
+
+  /* Pass tid back.  */
+  *tid = elf_tdata (abfd)->core_lwpid;
+
+  /* Make a ".qnx_core_status/%d" section.  */
+  sprintf (buf, ".qnx_core_status/%d", *tid);
+
+  name = bfd_alloc (abfd, (bfd_size_type) 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;
+
+  return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect));
+}
+
+static bfd_boolean
+elfcore_grok_nto_gregs (abfd, note, tid)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+     pid_t tid;
+{
+  char buf[100];
+  char *name;
+  asection *sect;
+
+  /* Make a ".reg/%d" section.  */
+  sprintf (buf, ".reg/%d", tid);
+
+  name = bfd_alloc (abfd, (bfd_size_type) 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;
+
+  return elfcore_maybe_make_sect (abfd, ".reg", sect);
+}
+
+#define BFD_QNT_CORE_INFO      7
+#define BFD_QNT_CORE_STATUS    8
+#define BFD_QNT_CORE_GREG      9
+#define BFD_QNT_CORE_FPREG     10
+
+static bfd_boolean
+elfcore_grok_nto_note (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  /* Every GREG section has a STATUS section before it.  Store the
+     tid from the previous call to pass down to the next gregs 
+     function.  */
+  static pid_t tid = 1;
+
+  switch (note->type)
+    {
+    case BFD_QNT_CORE_INFO:   return elfcore_make_note_pseudosection (abfd, ".qnx_core_info", note);
+    case BFD_QNT_CORE_STATUS: return elfcore_grok_nto_status (abfd, note, &tid);
+    case BFD_QNT_CORE_GREG:   return elfcore_grok_nto_gregs (abfd, note, tid);
+    case BFD_QNT_CORE_FPREG:  return elfcore_grok_prfpreg (abfd, note);
+    default:                  return TRUE;
+    }
+}
+
 /* Function: elfcore_write_note
 
    Inputs:
@@ -7189,6 +7310,11 @@ elfcore_read_notes (abfd, offset, size)
           if (! elfcore_grok_netbsd_note (abfd, &in))
             goto error;
         }
+      else if (strncmp (in.namedata, "QNX", 3) == 0)
+       {
+         if (! elfcore_grok_nto_note (abfd, &in))
+           goto error;
+       }
       else
         {
           if (! elfcore_grok_note (abfd, &in))
@@ -7336,7 +7462,7 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel)
                + sym->st_value);
   if ((sec->flags & SEC_MERGE)
       && ELF_ST_TYPE (sym->st_info) == STT_SECTION
-      && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+      && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
     {
       asection *msec;
 
@@ -7361,7 +7487,7 @@ _bfd_elf_rel_local_sym (abfd, sym, psec, addend)
 {
   asection *sec = *psec;
 
-  if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+  if (sec->sec_info_type != ELF_INFO_TYPE_MERGE)
     return sym->st_value + addend;
 
   return _bfd_merged_section_offset (abfd, psec,
@@ -7379,7 +7505,7 @@ _bfd_elf_section_offset (abfd, info, sec, offset)
   struct bfd_elf_section_data *sec_data;
 
   sec_data = elf_section_data (sec);
-  switch (sec_data->sec_info_type)
+  switch (sec->sec_info_type)
     {
     case ELF_INFO_TYPE_STABS:
       return _bfd_stab_section_offset (abfd,
index 48eb873..509b481 100644 (file)
@@ -1,5 +1,5 @@
 /* 32-bit ELF support for ARM
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -86,6 +86,8 @@ static void arm_add_to_rel
 #endif
 static enum elf_reloc_type_class elf32_arm_reloc_type_class
   PARAMS ((const Elf_Internal_Rela *));
+static bfd_boolean elf32_arm_object_p
+  PARAMS ((bfd *));
 
 #ifndef ELFARM_NABI_C_INCLUDED
 static void record_arm_to_thumb_glue
@@ -927,13 +929,16 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
 
   BFD_ASSERT (my_offset <= globals->thumb_glue_size);
 
-  /* Now go back and fix up the original BL insn to point
-     to here.  */
-  ret_offset = (s->output_offset
-               + my_offset
-               - (input_section->output_offset
-                  + offset + addend)
-               - 8);
+  /* Now go back and fix up the original BL insn to point to here.  */
+  ret_offset =
+    /* Address of where the stub is located.  */
+    (s->output_section->vma + s->output_offset + my_offset)
+     /* Address of where the BL is located.  */
+    - (input_section->output_section->vma + input_section->output_offset + offset)
+    /* Addend in the relocation.  */
+    - addend
+    /* Biassing for PC-relative addressing.  */
+    - 8;
 
   tmp = bfd_get_32 (input_bfd, hit_data
                    - input_section->vma);
@@ -2108,6 +2113,20 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
   return TRUE;
 }
 
+/* Set the right machine number.  */
+
+static bfd_boolean
+elf32_arm_object_p (abfd)
+     bfd *abfd;
+{
+  /* XXX - we ought to examine a .note section here.  */
+
+  if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
+    bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
+
+  return TRUE;
+}
+
 /* Function to keep ARM specific flags in the ELF header.  */
 static bfd_boolean
 elf32_arm_set_private_flags (abfd, flags)
@@ -2310,12 +2329,28 @@ ERROR: %s passes floats in integer registers, whereas %s passes them in float re
        {
          if (in_flags & EF_ARM_VFP_FLOAT)
            _bfd_error_handler (_("\
-ERROR: %s uses VFP instructions, whereas %s uses FPA instructions"),
+ERROR: %s uses VFP instructions, whereas %s does not"),
+                               bfd_archive_filename (ibfd),
+                               bfd_get_filename (obfd));
+         else
+           _bfd_error_handler (_("\
+ERROR: %s uses FPA instructions, whereas %s does not"),
+                               bfd_archive_filename (ibfd),
+                               bfd_get_filename (obfd));
+
+         flags_compatible = FALSE;
+       }
+
+      if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT))
+       {
+         if (in_flags & EF_ARM_MAVERICK_FLOAT)
+           _bfd_error_handler (_("\
+ERROR: %s uses Maverick instructions, whereas %s does not"),
                                bfd_archive_filename (ibfd),
                                bfd_get_filename (obfd));
          else
            _bfd_error_handler (_("\
-ERROR: %s uses FPA instructions, whereas %s uses VFP instructions"),
+ERROR: %s uses Maverick instructions, whereas %s does not"),
                                bfd_archive_filename (ibfd),
                                bfd_get_filename (obfd));
 
@@ -2410,6 +2445,8 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
 
       if (flags & EF_ARM_VFP_FLOAT)
        fprintf (file, _(" [VFP float format]"));
+      else if (flags & EF_ARM_MAVERICK_FLOAT)
+       fprintf (file, _(" [Maverick float format]"));
       else
        fprintf (file, _(" [FPA float format]"));
 
@@ -2430,7 +2467,8 @@ elf32_arm_print_private_bfd_data (abfd, ptr)
 
       flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT
                 | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI
-                | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT);
+                | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT
+                | EF_ARM_MAVERICK_FLOAT);
       break;
 
     case EF_ARM_EABI_VER1:
@@ -3622,7 +3660,6 @@ elf32_arm_reloc_type_class (rela)
     }
 }
 
-
 #define ELF_ARCH                       bfd_arch_arm
 #define ELF_MACHINE_CODE               EM_ARM
 #define ELF_MAXPAGESIZE                        0x8000
@@ -3647,6 +3684,7 @@ elf32_arm_reloc_type_class (rela)
 #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_reloc_type_class           elf32_arm_reloc_type_class
+#define elf_backend_object_p                   elf32_arm_object_p
 
 #define elf_backend_can_gc_sections 1
 #define elf_backend_plt_readonly    1
index 6b6c906..40327b6 100644 (file)
@@ -1,24 +1,24 @@
 /* CRIS-specific support for 32-bit ELF.
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Axis Communications AB.
    Written by Hans-Peter Nilsson, based on elf32-fr30.c
    PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -940,7 +940,6 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
index 2646f3d..b204c57 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for HP PA-RISC ELF files.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
-   2002 Free Software Foundation, Inc.
+   2002, 2003 Free Software Foundation, Inc.
 
    Original code by
        Center for Software Science
@@ -8,21 +8,21 @@
        University of Utah
    Largely rewritten by Alan Modra <alan@linuxcare.com.au>
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -111,7 +111,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    :           ldw -24(%sp),%rp                ; restore the original rp
    :           ldsid (%rp),%r1
    :           mtsp %r1,%sr0
-   :           be,n 0(%sr0,%rp)                ; inter-space return  */
+   :           be,n 0(%sr0,%rp)                ; inter-space return.  */
 
 #define PLT_ENTRY_SIZE 8
 #define GOT_ENTRY_SIZE 4
@@ -1685,10 +1685,6 @@ elf32_hppa_gc_sweep_hook (abfd, info, sec, relocs)
   bfd_signed_vma *local_got_refcounts;
   bfd_signed_vma *local_plt_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  struct elf_link_hash_entry *h;
-  struct elf32_hppa_link_hash_table *htab;
-  bfd *dynobj;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
@@ -1698,112 +1694,81 @@ elf32_hppa_gc_sweep_hook (abfd, info, sec, relocs)
   local_plt_refcounts = local_got_refcounts;
   if (local_plt_refcounts != NULL)
     local_plt_refcounts += symtab_hdr->sh_info;
-  htab = hppa_link_hash_table (info);
-  dynobj = htab->elf.dynobj;
-  if (dynobj == NULL)
-    return TRUE;
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
-    switch ((unsigned int) ELF32_R_TYPE (rel->r_info))
-      {
-      case R_PARISC_DLTIND14F:
-      case R_PARISC_DLTIND14R:
-      case R_PARISC_DLTIND21L:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->got.refcount > 0)
-             h->got.refcount -= 1;
-         }
-       else if (local_got_refcounts != NULL)
-         {
-           if (local_got_refcounts[r_symndx] > 0)
-             local_got_refcounts[r_symndx] -= 1;
-         }
-       break;
-
-      case R_PARISC_PCREL12F:
-      case R_PARISC_PCREL17C:
-      case R_PARISC_PCREL17F:
-      case R_PARISC_PCREL22F:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->plt.refcount > 0)
-             h->plt.refcount -= 1;
-         }
-       break;
-
-      case R_PARISC_PLABEL14R:
-      case R_PARISC_PLABEL21L:
-      case R_PARISC_PLABEL32:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           struct elf32_hppa_link_hash_entry *eh;
-           struct elf32_hppa_dyn_reloc_entry **pp;
-           struct elf32_hppa_dyn_reloc_entry *p;
-
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-
-           if (h->plt.refcount > 0)
-             h->plt.refcount -= 1;
+    {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
 
-           eh = (struct elf32_hppa_link_hash_entry *) h;
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct elf32_hppa_link_hash_entry *eh;
+         struct elf32_hppa_dyn_reloc_entry **pp;
+         struct elf32_hppa_dyn_reloc_entry *p;
 
-           for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-             if (p->sec == sec)
-               {
-#if RELATIVE_DYNRELOCS
-                 if (!IS_ABSOLUTE_RELOC (rtype))
-                   p->relative_count -= 1;
-#endif
-                 p->count -= 1;
-                 if (p->count == 0)
-                   *pp = p->next;
-                 break;
-               }
-         }
-       else if (local_plt_refcounts != NULL)
-         {
-           if (local_plt_refcounts[r_symndx] > 0)
-             local_plt_refcounts[r_symndx] -= 1;
-         }
-       break;
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct elf32_hppa_link_hash_entry *) h;
 
-      case R_PARISC_DIR32:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           struct elf32_hppa_link_hash_entry *eh;
-           struct elf32_hppa_dyn_reloc_entry **pp;
-           struct elf32_hppa_dyn_reloc_entry *p;
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
 
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+      r_type = ELF32_R_TYPE (rel->r_info);
+      switch (r_type)
+       {
+       case R_PARISC_DLTIND14F:
+       case R_PARISC_DLTIND14R:
+       case R_PARISC_DLTIND21L:
+         if (h != NULL)
+           {
+             if (h->got.refcount > 0)
+               h->got.refcount -= 1;
+           }
+         else if (local_got_refcounts != NULL)
+           {
+             if (local_got_refcounts[r_symndx] > 0)
+               local_got_refcounts[r_symndx] -= 1;
+           }
+         break;
 
-           eh = (struct elf32_hppa_link_hash_entry *) h;
+       case R_PARISC_PCREL12F:
+       case R_PARISC_PCREL17C:
+       case R_PARISC_PCREL17F:
+       case R_PARISC_PCREL22F:
+         if (h != NULL)
+           {
+             if (h->plt.refcount > 0)
+               h->plt.refcount -= 1;
+           }
+         break;
 
-           for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-             if (p->sec == sec)
-               {
-#if RELATIVE_DYNRELOCS
-                 if (!IS_ABSOLUTE_RELOC (R_PARISC_DIR32))
-                   p->relative_count -= 1;
-#endif
-                 p->count -= 1;
-                 if (p->count == 0)
-                   *pp = p->next;
-                 break;
-               }
-         }
-       break;
+       case R_PARISC_PLABEL14R:
+       case R_PARISC_PLABEL21L:
+       case R_PARISC_PLABEL32:
+         if (h != NULL)
+           {
+             if (h->plt.refcount > 0)
+               h->plt.refcount -= 1;
+           }
+         else if (local_plt_refcounts != NULL)
+           {
+             if (local_plt_refcounts[r_symndx] > 0)
+               local_plt_refcounts[r_symndx] -= 1;
+           }
+         break;
 
-      default:
-       break;
-      }
+       default:
+         break;
+       }
+    }
 
   return TRUE;
 }
@@ -2686,12 +2651,15 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
          asection *curr;
          asection *prev;
          bfd_size_type total;
+         bfd_boolean big_sec;
 
          curr = tail;
          if (tail->_cooked_size)
            total = tail->_cooked_size;
          else
            total = tail->_raw_size;
+         big_sec = total >= stub_group_size;
+
          while ((prev = PREV_SEC (curr)) != NULL
                 && ((total += curr->output_offset - prev->output_offset)
                     < stub_group_size))
@@ -2719,8 +2687,11 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
          while (tail != curr && (tail = prev) != NULL);
 
          /* But wait, there's more!  Input sections up to 240000
-            bytes before the stub section can be handled by it too.  */
-         if (!stubs_always_before_branch)
+            bytes before the stub section can be handled by it too.
+            Don't do this if we have a really large section after the
+            stubs, as adding more stubs increases the chance that
+            branches may not reach into the stub section.  */
+         if (!stubs_always_before_branch && !big_sec)
            {
              total = 0;
              while (prev != NULL
@@ -2901,11 +2872,22 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
   if (stub_group_size == 1)
     {
       /* Default values.  */
-      stub_group_size = 7680000;
-      if (htab->has_17bit_branch || htab->multi_subspace)
-       stub_group_size = 240000;
-      if (htab->has_12bit_branch)
-       stub_group_size = 7500;
+      if (stubs_always_before_branch)
+       {
+         stub_group_size = 7680000;
+         if (htab->has_17bit_branch || htab->multi_subspace)
+           stub_group_size = 240000;
+         if (htab->has_12bit_branch)
+           stub_group_size = 7500;
+       }
+      else
+       {
+         stub_group_size = 6971392;
+         if (htab->has_17bit_branch || htab->multi_subspace)
+           stub_group_size = 217856;
+         if (htab->has_12bit_branch)
+           stub_group_size = 6808;
+       }
     }
 
   group_sections (htab, stub_group_size, stubs_always_before_branch);
@@ -3688,14 +3670,11 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
                   && ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
                   && h->elf.type != STT_PARISC_MILLI)
            {
-             if (info->symbolic && !info->allow_shlib_undefined)
-               {
-                 if (!((*info->callbacks->undefined_symbol)
-                       (info, h->elf.root.root.string, input_bfd,
-                        input_section, rel->r_offset, FALSE)))
-                   return FALSE;
-                 warned_undef = TRUE;
-               }
+             if (!((*info->callbacks->undefined_symbol)
+                   (info, h->elf.root.root.string, input_bfd,
+                    input_section, rel->r_offset, FALSE)))
+               return FALSE;
+             warned_undef = TRUE;
            }
          else
            {
index 69292da..a751d98 100644 (file)
@@ -1279,9 +1279,6 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  int r_type;
-  struct elf_link_hash_entry *h;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
@@ -1291,85 +1288,74 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs)
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
-    switch ((r_type = elf_i386_tls_transition (info,
-                                              ELF32_R_TYPE (rel->r_info),
-                                              ELF32_R_SYM (rel->r_info)
-                                              >= symtab_hdr->sh_info)))
-      {
-      case R_386_TLS_LDM:
-       if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
-         elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
-       break;
-
-      case R_386_TLS_GD:
-      case R_386_TLS_IE_32:
-      case R_386_TLS_IE:
-      case R_386_TLS_GOTIE:
-      case R_386_GOT32:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->got.refcount > 0)
-             h->got.refcount -= 1;
-         }
-       else if (local_got_refcounts != NULL)
-         {
-           if (local_got_refcounts[r_symndx] > 0)
-             local_got_refcounts[r_symndx] -= 1;
-         }
-       if (r_type != R_386_TLS_IE)
-         break;
-       /* Fall through */
+    {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
 
-      case R_386_TLS_LE_32:
-      case R_386_TLS_LE:
-        if (!info->shared)
-         break;
-       /* Fall through */
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct elf_i386_link_hash_entry *eh;
+         struct elf_i386_dyn_relocs **pp;
+         struct elf_i386_dyn_relocs *p;
 
-      case R_386_32:
-      case R_386_PC32:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           struct elf_i386_link_hash_entry *eh;
-           struct elf_i386_dyn_relocs **pp;
-           struct elf_i386_dyn_relocs *p;
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct elf_i386_link_hash_entry *) h;
 
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
 
-           if (!info->shared && h->plt.refcount > 0)
-             h->plt.refcount -= 1;
+      r_type = ELF32_R_TYPE (rel->r_info);
+      r_type = elf_i386_tls_transition (info, r_type, h != NULL);
+      switch (r_type)
+       {
+       case R_386_TLS_LDM:
+         if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0)
+           elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1;
+         break;
 
-           eh = (struct elf_i386_link_hash_entry *) h;
+       case R_386_TLS_GD:
+       case R_386_TLS_IE_32:
+       case R_386_TLS_IE:
+       case R_386_TLS_GOTIE:
+       case R_386_GOT32:
+         if (h != NULL)
+           {
+             if (h->got.refcount > 0)
+               h->got.refcount -= 1;
+           }
+         else if (local_got_refcounts != NULL)
+           {
+             if (local_got_refcounts[r_symndx] > 0)
+               local_got_refcounts[r_symndx] -= 1;
+           }
+         break;
 
-           for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-             if (p->sec == sec)
-               {
-                 if (ELF32_R_TYPE (rel->r_info) == R_386_PC32)
-                   p->pc_count -= 1;
-                 p->count -= 1;
-                 if (p->count == 0)
-                   *pp = p->next;
-                 break;
-               }
-         }
-       break;
+       case R_386_32:
+       case R_386_PC32:
+         if (info->shared)
+           break;
+         /* Fall through */
 
-      case R_386_PLT32:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->plt.refcount > 0)
-             h->plt.refcount -= 1;
-         }
-       break;
+       case R_386_PLT32:
+         if (h != NULL)
+           {
+             if (h->plt.refcount > 0)
+               h->plt.refcount -= 1;
+           }
+         break;
 
-      default:
-       break;
-      }
+       default:
+         break;
+       }
+    }
 
   return TRUE;
 }
@@ -1523,9 +1509,9 @@ elf_i386_adjust_dynamic_symbol (info, h)
    will be called from elflink.h.  If elflink.h doesn't call our
    finish_dynamic_symbol routine, we'll need to do something about
    initializing any .plt and .got entries in elf_i386_relocate_section.  */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
   ((DYN)                                                               \
-   && ((INFO)->shared                                                  \
+   && ((SHARED)                                                                \
        || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)     \
    && ((H)->dynindx != -1                                              \
        || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
@@ -1567,7 +1553,8 @@ allocate_dynrelocs (h, inf)
            return FALSE;
        }
 
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+      if (info->shared
+         || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
        {
          asection *s = htab->splt;
 
@@ -1653,7 +1640,8 @@ allocate_dynrelocs (h, inf)
        htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
       else if (tls_type == GOT_TLS_GD)
        htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel);
-      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+      else if (info->shared
+              || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
        htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
     }
   else
@@ -2261,7 +2249,6 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            ;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            ;
@@ -2290,7 +2277,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
 
              off = h->got.offset;
              dyn = htab->elf.dynamic_sections_created;
-             if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
+             if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
                  || (info->shared
                      && (info->symbolic
                          || h->dynindx == -1
@@ -2627,7 +2614,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                      BFD_ASSERT (rel->r_offset >= 2);
                      type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
                      switch (type)
-                       {
+                       {
                        case 0x8b:
                          /* movl */
                          BFD_ASSERT ((val & 0xc7) == 0x05);
@@ -2649,7 +2636,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                        default:
                          BFD_FAIL ();
                          break;
-                       }
+                       }
                    }
                  bfd_put_32 (output_bfd, -tpoff (info, relocation),
                              contents + rel->r_offset);
@@ -2724,7 +2711,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
 
          if ((off & 1) != 0)
            off &= ~1;
-          else
+         else
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
index 2f49dad..19a2ce8 100644 (file)
@@ -2,21 +2,21 @@
    Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -46,6 +46,8 @@ static bfd_boolean elf_m68k_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 static bfd_boolean elf_m68k_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_boolean elf_m68k_discard_copies
+  PARAMS ((struct elf_link_hash_entry *, PTR));
 static bfd_boolean elf_m68k_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
           Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@@ -88,7 +90,7 @@ static reloc_howto_type howto_table[] = {
   HOWTO(R_68K_GLOB_DAT,   0, 2,32, FALSE,0, complain_overflow_dont,     bfd_elf_generic_reloc, "R_68K_GLOB_DAT",  FALSE, 0, 0xffffffff,FALSE),
   HOWTO(R_68K_JMP_SLOT,   0, 2,32, FALSE,0, complain_overflow_dont,     bfd_elf_generic_reloc, "R_68K_JMP_SLOT",  FALSE, 0, 0xffffffff,FALSE),
   HOWTO(R_68K_RELATIVE,   0, 2,32, FALSE,0, complain_overflow_dont,     bfd_elf_generic_reloc, "R_68K_RELATIVE",  FALSE, 0, 0xffffffff,FALSE),
-  /* GNU extension to record C++ vtable hierarchy */
+  /* GNU extension to record C++ vtable hierarchy */
   HOWTO (R_68K_GNU_VTINHERIT,  /* type */
         0,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
@@ -102,7 +104,7 @@ static reloc_howto_type howto_table[] = {
         0,                     /* src_mask */
         0,                     /* dst_mask */
         FALSE),
-  /* GNU extension to record C++ vtable member usage */
+  /* GNU extension to record C++ vtable member usage */
   HOWTO (R_68K_GNU_VTENTRY,    /* type */
         0,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
@@ -179,7 +181,6 @@ reloc_type_lookup (abfd, code)
 
 #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
 #define ELF_ARCH bfd_arch_m68k
-/* end code generated by elf.el */
 \f
 /* Functions for the m68k ELF linker.  */
 
@@ -272,6 +273,8 @@ struct elf_m68k_link_hash_entry
   struct elf_m68k_pcrel_relocs_copied *pcrel_relocs_copied;
 };
 
+#define elf_m68k_hash_entry(ent) ((struct elf_m68k_link_hash_entry *) (ent))
+
 /* m68k ELF linker hash table.  */
 
 struct elf_m68k_link_hash_table
@@ -282,19 +285,6 @@ struct elf_m68k_link_hash_table
   struct sym_sec_cache sym_sec;
 };
 
-/* Declare this now that the above structures are defined.  */
-
-static bfd_boolean elf_m68k_discard_copies
-  PARAMS ((struct elf_m68k_link_hash_entry *, PTR));
-
-/* Traverse an m68k ELF linker hash table.  */
-
-#define elf_m68k_link_hash_traverse(table, func, info)                 \
-  (elf_link_hash_traverse                                              \
-   (&(table)->root,                                                    \
-    (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
-    (info)))
-
 /* Get the m68k ELF linker hash table from a link_info structure.  */
 
 #define elf_m68k_hash_table(p) \
@@ -308,28 +298,22 @@ elf_m68k_link_hash_newfunc (entry, table, string)
      struct bfd_hash_table *table;
      const char *string;
 {
-  struct elf_m68k_link_hash_entry *ret =
-    (struct elf_m68k_link_hash_entry *) entry;
+  struct bfd_hash_entry *ret = entry;
 
   /* Allocate the structure if it has not already been allocated by a
      subclass.  */
-  if (ret == (struct elf_m68k_link_hash_entry *) NULL)
-    ret = ((struct elf_m68k_link_hash_entry *)
-          bfd_hash_allocate (table,
-                             sizeof (struct elf_m68k_link_hash_entry)));
-  if (ret == (struct elf_m68k_link_hash_entry *) NULL)
-    return (struct bfd_hash_entry *) ret;
+  if (ret == NULL)
+    ret = bfd_hash_allocate (table,
+                            sizeof (struct elf_m68k_link_hash_entry));
+  if (ret == NULL)
+    return ret;
 
   /* Call the allocation method of the superclass.  */
-  ret = ((struct elf_m68k_link_hash_entry *)
-        _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
-                                    table, string));
-  if (ret != (struct elf_m68k_link_hash_entry *) NULL)
-    {
-      ret->pcrel_relocs_copied = NULL;
-    }
+  ret = _bfd_elf_link_hash_newfunc (ret, table, string);
+  if (ret != NULL)
+    elf_m68k_hash_entry (ret)->pcrel_relocs_copied = NULL;
 
-  return (struct bfd_hash_entry *) ret;
+  return ret;
 }
 
 /* Create an m68k ELF linker hash table.  */
@@ -357,7 +341,7 @@ elf_m68k_link_hash_table_create (abfd)
   return &ret->root.root;
 }
 
-/* Keep m68k-specific flags in the ELF header */
+/* Keep m68k-specific flags in the ELF header */
 static bfd_boolean
 elf32_m68k_set_private_flags (abfd, flags)
      bfd *abfd;
@@ -394,7 +378,7 @@ elf32_m68k_merge_private_bfd_data (ibfd, obfd)
   return TRUE;
 }
 
-/* Display the flags field */
+/* Display the flags field */
 static bfd_boolean
 elf32_m68k_print_private_bfd_data (abfd, ptr)
      bfd *abfd;
@@ -719,7 +703,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
                  if (h != NULL)
                    {
                      struct elf_m68k_link_hash_entry *eh
-                       = (struct elf_m68k_link_hash_entry *) h;
+                       = elf_m68k_hash_entry (h);
                      head = &eh->pcrel_relocs_copied;
                    }
                  else
@@ -1023,13 +1007,11 @@ elf_m68k_adjust_dynamic_symbol (info, h)
 
       /* We also need to make an entry in the .got.plt section, which
         will be placed in the .got section by the linker script.  */
-
       s = bfd_get_section_by_name (dynobj, ".got.plt");
       BFD_ASSERT (s != NULL);
       s->_raw_size += 4;
 
       /* We also need to make an entry in the .rela.plt section.  */
-
       s = bfd_get_section_by_name (dynobj, ".rela.plt");
       BFD_ASSERT (s != NULL);
       s->_raw_size += sizeof (Elf32_External_Rela);
@@ -1160,9 +1142,9 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
      We allocated space for them in the check_relocs routine, but we
      will not fill them in in the relocate_section routine.  */
   if (info->shared)
-    elf_m68k_link_hash_traverse (elf_m68k_hash_table (info),
-                                elf_m68k_discard_copies,
-                                (PTR) info);
+    elf_link_hash_traverse (elf_hash_table (info),
+                           elf_m68k_discard_copies,
+                           (PTR) info);
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
@@ -1288,7 +1270,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
   return TRUE;
 }
 
-/* This function is called via elf_m68k_link_hash_traverse if we are
+/* This function is called via elf_link_hash_traverse if we are
    creating a shared object.  In the -Bsymbolic case it discards the
    space allocated to copy PC relative relocs against symbols which
    are defined in regular objects.  For the normal shared case, it
@@ -1303,33 +1285,38 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
 
 static bfd_boolean
 elf_m68k_discard_copies (h, inf)
-     struct elf_m68k_link_hash_entry *h;
+     struct elf_link_hash_entry *h;
      PTR inf;
 {
   struct bfd_link_info *info = (struct bfd_link_info *) inf;
   struct elf_m68k_pcrel_relocs_copied *s;
 
-  if (h->root.root.type == bfd_link_hash_warning)
-    h = (struct elf_m68k_link_hash_entry *) h->root.root.u.i.link;
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
-  if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
+  if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
       || (!info->symbolic
-         && (h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0))
+         && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0))
     {
       if ((info->flags & DF_TEXTREL) == 0)
        {
          /* Look for relocations against read-only sections.  */
-         for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
+         for (s = elf_m68k_hash_entry (h)->pcrel_relocs_copied;
+              s != NULL;
+              s = s->next)
            if ((s->section->flags & SEC_READONLY) != 0)
              {
                info->flags |= DF_TEXTREL;
                break;
              }
        }
+
       return TRUE;
     }
 
-  for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
+  for (s = elf_m68k_hash_entry (h)->pcrel_relocs_copied;
+       s != NULL;
+       s = s->next)
     s->section->_raw_size -= s->count * sizeof (Elf32_External_Rela);
 
   return TRUE;
@@ -1466,7 +1453,6 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
index 1399f00..cf705d5 100644 (file)
@@ -261,9 +261,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -1401,7 +1403,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
   { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
   { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
-  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
   { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
   { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
@@ -1458,7 +1460,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
       return &elf_mips_gnu_rel_hi16;
     case BFD_RELOC_PCREL_LO16:
       return &elf_mips_gnu_rel_lo16;
-    case BFD_RELOC_16_PCREL_S2:
+    case BFD_RELOC_MIPSEMB_16_PCREL_S2:
       return &elf_mips_gnu_rel16_s2;
     case BFD_RELOC_64_PCREL:
       return &elf_mips_gnu_pcrel64;
index acd9d84..9947af8 100644 (file)
@@ -3,21 +3,21 @@
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This file is based on a preliminary PowerPC ELF ABI.  The
    information may not match the final PowerPC ELF ABI.  It includes
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/ppc.h"
+#include "elf32-ppc.h"
 
 /* RELA relocations are used here.  */
 
@@ -53,6 +54,8 @@ static bfd_boolean ppc_elf_relax_section
   PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
 static bfd_reloc_status_type ppc_elf_addr16_ha_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type ppc_elf_unhandled_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static bfd_boolean ppc_elf_object_p
   PARAMS ((bfd *));
 static bfd_boolean ppc_elf_set_private_flags
@@ -63,7 +66,7 @@ static int ppc_elf_additional_program_headers
   PARAMS ((bfd *));
 static bfd_boolean ppc_elf_modify_segment_map
   PARAMS ((bfd *));
-static asection *ppc_elf_create_got
+static bfd_boolean ppc_elf_create_got
   PARAMS ((bfd *, struct bfd_link_info *));
 static bfd_boolean ppc_elf_create_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
@@ -74,10 +77,14 @@ static bfd_boolean ppc_elf_fake_sections
 static elf_linker_section_t *ppc_elf_create_linker_section
   PARAMS ((bfd *abfd, struct bfd_link_info *info,
           enum elf_linker_section_enum));
+static bfd_boolean update_local_sym_info
+  PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned long, int));
+static void bad_shared_reloc
+  PARAMS ((bfd *, enum elf_ppc_reloc_type));
 static bfd_boolean ppc_elf_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
-static asection * ppc_elf_gc_mark_hook
+static asection *ppc_elf_gc_mark_hook
   PARAMS ((asection *sec, struct bfd_link_info *info, Elf_Internal_Rela *rel,
           struct elf_link_hash_entry *h, Elf_Internal_Sym *sym));
 static bfd_boolean ppc_elf_gc_sweep_hook
@@ -110,13 +117,15 @@ static bfd_boolean ppc_elf_grok_prstatus
 static bfd_boolean ppc_elf_grok_psinfo
   PARAMS ((bfd *abfd, Elf_Internal_Note *note));
 
-#define BRANCH_PREDICT_BIT 0x200000            /* branch prediction bit for branch taken relocs */
-#define RA_REGISTER_MASK 0x001f0000            /* mask to set RA in memory instructions */
-#define RA_REGISTER_SHIFT 16                   /* value to shift register by to insert RA */
+/* Branch prediction bit for branch taken relocs.  */
+#define BRANCH_PREDICT_BIT 0x200000
+/* Mask to set RA in memory instructions.  */
+#define RA_REGISTER_MASK 0x001f0000
+/* Value to shift register by to insert RA.  */
+#define RA_REGISTER_SHIFT 16
 
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
-
 #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1"
 
 /* The size in bytes of an entry in the procedure linkage table.  */
@@ -128,6 +137,15 @@ static bfd_boolean ppc_elf_grok_psinfo
 /* The number of single-slot PLT entries (the rest use two slots).  */
 #define PLT_NUM_SINGLE_ENTRIES 8192
 
+/* Some nop instructions.  */
+#define NOP            0x60000000
+#define CROR_151515    0x4def7b82
+#define CROR_313131    0x4ffffb82
+
+/* Offset of tp and dtp pointers from start of TLS block.  */
+#define TP_OFFSET      0x7000
+#define DTP_OFFSET     0x8000
+
 /* Will references to this symbol always reference the symbol
    in this object?  */
 #define SYMBOL_REFERENCES_LOCAL(INFO, H)                               \
@@ -161,16 +179,32 @@ struct ppc_elf_dyn_relocs
 
   /* Total number of relocs copied for the input section.  */
   bfd_size_type count;
+
+  /* Number of pc-relative relocs copied for the input section.  */
+  bfd_size_type pc_count;
 };
 
 /* PPC ELF linker hash entry.  */
 
 struct ppc_elf_link_hash_entry
 {
-  struct elf_link_hash_entry root;
+  struct elf_link_hash_entry elf;
 
   /* Track dynamic relocs copied for this symbol.  */
   struct ppc_elf_dyn_relocs *dyn_relocs;
+
+  /* Contexts in which symbol is used in the GOT (or TOC).
+     TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the
+     corresponding relocs are encountered during check_relocs.
+     tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to
+     indicate the corresponding GOT entry type is not needed.  */
+#define TLS_GD          1      /* GD reloc. */
+#define TLS_LD          2      /* LD reloc. */
+#define TLS_TPREL       4      /* TPREL reloc, => IE. */
+#define TLS_DTPREL      8      /* DTPREL reloc, => LD. */
+#define TLS_TLS                16      /* Any TLS reloc.  */
+#define TLS_TPRELGD    32      /* TPREL reloc resulting from GD->IE. */
+  char tls_mask;
 };
 
 #define ppc_elf_hash_entry(ent) ((struct ppc_elf_link_hash_entry *) (ent))
@@ -179,7 +213,31 @@ struct ppc_elf_link_hash_entry
 
 struct ppc_elf_link_hash_table
 {
-  struct elf_link_hash_table root;
+  struct elf_link_hash_table elf;
+
+  /* Short-cuts to get to dynamic linker sections.  */
+  asection *got;
+  asection *relgot;
+  asection *plt;
+  asection *relplt;
+  asection *dynbss;
+  asection *relbss;
+  asection *dynsbss;
+  asection *relsbss;
+  elf_linker_section_t *sdata;
+  elf_linker_section_t *sdata2;
+
+  /* Short-cut to first output tls section.  */
+  asection *tls_sec;
+
+  /* Shortcut to .__tls_get_addr.  */
+  struct elf_link_hash_entry *tls_get_addr;
+
+  /* TLS local dynamic got entry handling.  */
+  union {
+    bfd_signed_vma refcount;
+    bfd_vma offset;
+  } tlsld_got;
 
   /* Small local sym to section mapping cache.  */
   struct sym_sec_cache sym_sec;
@@ -211,7 +269,10 @@ ppc_elf_link_hash_newfunc (entry, table, string)
   /* Call the allocation method of the superclass.  */
   entry = _bfd_elf_link_hash_newfunc (entry, table, string);
   if (entry != NULL)
-    ppc_elf_hash_entry (entry)->dyn_relocs = NULL;
+    {
+      ppc_elf_hash_entry (entry)->dyn_relocs = NULL;
+      ppc_elf_hash_entry (entry)->tls_mask = 0;
+    }
 
   return entry;
 }
@@ -229,16 +290,29 @@ ppc_elf_link_hash_table_create (abfd)
   if (ret == NULL)
     return NULL;
 
-  if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
+  if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd,
                                       ppc_elf_link_hash_newfunc))
     {
       free (ret);
       return NULL;
     }
 
+  ret->got = NULL;
+  ret->relgot = NULL;
+  ret->plt = NULL;
+  ret->relplt = NULL;
+  ret->dynbss = NULL;
+  ret->relbss = NULL;
+  ret->dynsbss = NULL;
+  ret->relsbss = NULL;
+  ret->sdata = NULL;
+  ret->sdata2 = NULL;
+  ret->tls_sec = NULL;
+  ret->tls_get_addr = NULL;
+  ret->tlsld_got.refcount = 0;
   ret->sym_sec.abfd = NULL;
 
-  return &ret->root.root;
+  return &ret->elf.root;
 }
 
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
@@ -272,6 +346,7 @@ ppc_elf_copy_indirect_symbol (bed, dir, ind)
              for (q = edir->dyn_relocs; q != NULL; q = q->next)
                if (q->sec == p->sec)
                  {
+                   q->pc_count += p->pc_count;
                    q->count += p->count;
                    *pp = p->next;
                    break;
@@ -286,6 +361,8 @@ ppc_elf_copy_indirect_symbol (bed, dir, ind)
       eind->dyn_relocs = NULL;
     }
 
+  edir->tls_mask |= eind->tls_mask;
+
   _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 \f
@@ -878,259 +955,688 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* The remaining relocs are from the Embedded ELF ABI, and are not
-     in the SVR4 ELF ABI.  */
-
-  /* 32 bit value resulting from the addend minus the symbol */
-  HOWTO (R_PPC_EMB_NADDR32,    /* type */
+  /* Marker reloc for TLS.  */
+  HOWTO (R_PPC_TLS,
         0,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         32,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
-        complain_overflow_bitfield, /* complain_on_overflow */
+        complain_overflow_dont, /* complain_on_overflow */
         bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_EMB_NADDR32",   /* name */
+        "R_PPC_TLS",           /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Computes the load module index of the load module that contains the
+     definition of its TLS sym.  */
+  HOWTO (R_PPC_DTPMOD32,
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_DTPMOD32",      /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit value resulting from the addend minus the symbol */
-  HOWTO (R_PPC_EMB_NADDR16,    /* type */
+  /* Computes a dtv-relative displacement, the difference between the value
+     of sym+add and the base address of the thread-local storage block that
+     contains the definition of sym, minus 0x8000.  */
+  HOWTO (R_PPC_DTPREL32,
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_DTPREL32",      /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* A 16 bit dtprel reloc.  */
+  HOWTO (R_PPC_DTPREL16,
         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_PPC_EMB_NADDR16",   /* name */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_DTPREL16",      /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit value resulting from the addend minus the symbol */
-  HOWTO (R_PPC_EMB_NADDR16_LO, /* type */
+  /* Like DTPREL16, but no overflow.  */
+  HOWTO (R_PPC_DTPREL16_LO,
         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_PPC_EMB_ADDR16_LO", /* name */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_DTPREL16_LO",   /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* The high order 16 bits of the addend minus the symbol */
-  HOWTO (R_PPC_EMB_NADDR16_HI, /* type */
+  /* Like DTPREL16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC_DTPREL16_HI,
         16,                    /* 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_PPC_EMB_NADDR16_HI", /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_DTPREL16_HI",   /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* The high order 16 bits of the result of the addend minus the address,
-     plus 1 if the contents of the low 16 bits, treated as a signed number,
-     is negative.  */
-  HOWTO (R_PPC_EMB_NADDR16_HA, /* type */
+  /* Like DTPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC_DTPREL16_HA,
         16,                    /* rightshift */
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
-        ppc_elf_addr16_ha_reloc, /* special_function */
-        "R_PPC_EMB_NADDR16_HA", /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_DTPREL16_HA",   /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit value resulting from allocating a 4 byte word to hold an
-     address in the .sdata section, and returning the offset from
-     _SDA_BASE_ for that relocation */
-  HOWTO (R_PPC_EMB_SDAI16,     /* type */
+  /* Computes a tp-relative displacement, the difference between the value of
+     sym+add and the value of the thread pointer (r13).  */
+  HOWTO (R_PPC_TPREL32,
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_TPREL32",       /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* A 16 bit tprel reloc.  */
+  HOWTO (R_PPC_TPREL16,
         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_PPC_EMB_SDAI16",    /* name */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_TPREL16",       /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit value resulting from allocating a 4 byte word to hold an
-     address in the .sdata2 section, and returning the offset from
-     _SDA2_BASE_ for that relocation */
-  HOWTO (R_PPC_EMB_SDA2I16,    /* type */
+  /* Like TPREL16, but no overflow.  */
+  HOWTO (R_PPC_TPREL16_LO,
         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_PPC_EMB_SDA2I16",   /* name */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_TPREL16_LO",    /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
-     small data items.  */
-  HOWTO (R_PPC_EMB_SDA2REL,    /* type */
+  /* Like TPREL16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC_TPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_TPREL16_HI",    /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC_TPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_TPREL16_HA",    /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+     with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
+     to the first entry.  */
+  HOWTO (R_PPC_GOT_TLSGD16,
         0,                     /* rightshift */
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_signed, /* complain_on_overflow */
-        bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_EMB_SDA2REL",   /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSGD16",   /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
-     signed offset from the appropriate base, and filling in the register
-     field with the appropriate register (0, 2, or 13).  */
-  HOWTO (R_PPC_EMB_SDA21,      /* type */
+  /* Like GOT_TLSGD16, but no overflow.  */
+  HOWTO (R_PPC_GOT_TLSGD16_LO,
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
-        complain_overflow_signed, /* complain_on_overflow */
-        bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_EMB_SDA21",     /* name */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSGD16_LO", /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* Relocation not handled: R_PPC_EMB_MRKREF */
-  /* Relocation not handled: R_PPC_EMB_RELSEC16 */
-  /* Relocation not handled: R_PPC_EMB_RELST_LO */
-  /* Relocation not handled: R_PPC_EMB_RELST_HI */
-  /* Relocation not handled: R_PPC_EMB_RELST_HA */
-  /* Relocation not handled: R_PPC_EMB_BIT_FLD */
+  /* Like GOT_TLSGD16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC_GOT_TLSGD16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSGD16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-  /* PC relative relocation against either _SDA_BASE_ or _SDA2_BASE_, filling
-     in the 16 bit signed offset from the appropriate base, and filling in the
-     register field with the appropriate register (0, 2, or 13).  */
-  HOWTO (R_PPC_EMB_RELSDA,     /* type */
+  /* Like GOT_TLSGD16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC_GOT_TLSGD16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSGD16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+     with values (sym+add)@dtpmod and zero, and computes the offset to the
+     first entry.  */
+  HOWTO (R_PPC_GOT_TLSLD16,
         0,                     /* rightshift */
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
-        TRUE,                  /* pc_relative */
+        FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_signed, /* complain_on_overflow */
-        bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_EMB_RELSDA",    /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSLD16",   /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* GNU extension to record C++ vtable hierarchy */
-  HOWTO (R_PPC_GNU_VTINHERIT,  /* type */
+  /* Like GOT_TLSLD16, but no overflow.  */
+  HOWTO (R_PPC_GOT_TLSLD16_LO,
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
-        0,                     /* bitsize */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
-        NULL,                  /* special_function */
-        "R_PPC_GNU_VTINHERIT", /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSLD16_LO", /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
-        0,                     /* dst_mask */
+        0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* GNU extension to record C++ vtable member usage */
-  HOWTO (R_PPC_GNU_VTENTRY,    /* type */
-        0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
-        0,                     /* bitsize */
+  /* Like GOT_TLSLD16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC_GOT_TLSLD16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
-        NULL,                  /* special_function */
-        "R_PPC_GNU_VTENTRY",   /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSLD16_HI", /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
-        0,                     /* dst_mask */
+        0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* Phony reloc to handle AIX style TOC entries */
-  HOWTO (R_PPC_TOC16,          /* type */
+  /* Like GOT_TLSLD16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC_GOT_TLSLD16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TLSLD16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
+     the offset to the entry.  */
+  HOWTO (R_PPC_GOT_DTPREL16,
         0,                     /* rightshift */
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_signed, /* complain_on_overflow */
-        bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_TOC16",         /* name */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_DTPREL16",  /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
-};
-\f
-/* Initialize the ppc_elf_howto_table, so that linear accesses can be done.  */
-
-static void
-ppc_elf_howto_init ()
-{
-  unsigned int i, type;
 
-  for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++)
-    {
-      type = ppc_elf_howto_raw[i].type;
-      BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0]));
-      ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
-    }
-}
-\f
-/* This function handles relaxing for the PPC with option --mpc860c0[=<n>].
+  /* Like GOT_DTPREL16, but no overflow.  */
+  HOWTO (R_PPC_GOT_DTPREL16_LO,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_DTPREL16_LO", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-   The MPC860, revision C0 or earlier contains a bug in the die.
-   If all of the following conditions are true, the next instruction
-   to be executed *may* be treated as a no-op.
-   1/ A forward branch is executed.
-   2/ The branch is predicted as not taken.
-   3/ The branch is taken.
-   4/ The branch is located in the last 5 words of a page.
-      (The EOP limit is 5 by default but may be specified as any value from 1-10.)
+  /* Like GOT_DTPREL16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC_GOT_DTPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_DTPREL16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-   Our software solution is to detect these problematic branches in a
-   linker pass and modify them as follows:
-   1/ Unconditional branches - Since these are always predicted taken,
-      there is no problem and no action is required.
-   2/ Conditional backward branches - No problem, no action required.
-   3/ Conditional forward branches - Ensure that the "inverse prediction
-      bit" is set (ensure it is predicted taken).
-   4/ Conditional register branches - Ensure that the "y bit" is set
-      (ensure it is predicted taken).
-*/
+  /* Like GOT_DTPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC_GOT_DTPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_DTPREL16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
+     offset to the entry.  */
+  HOWTO (R_PPC_GOT_TPREL16,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TPREL16",   /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TPREL16, but no overflow.  */
+  HOWTO (R_PPC_GOT_TPREL16_LO,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TPREL16_LO", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TPREL16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC_GOT_TPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TPREL16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC_GOT_TPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_unhandled_reloc, /* special_function */
+        "R_PPC_GOT_TPREL16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* The remaining relocs are from the Embedded ELF ABI, and are not
+     in the SVR4 ELF ABI.  */
+
+  /* 32 bit value resulting from the addend minus the symbol.  */
+  HOWTO (R_PPC_EMB_NADDR32,    /* 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_PPC_EMB_NADDR32",   /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* 16 bit value resulting from the addend minus the symbol.  */
+  HOWTO (R_PPC_EMB_NADDR16,    /* 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_PPC_EMB_NADDR16",   /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* 16 bit value resulting from the addend minus the symbol.  */
+  HOWTO (R_PPC_EMB_NADDR16_LO, /* 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_PPC_EMB_ADDR16_LO", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* The high order 16 bits of the addend minus the symbol.  */
+  HOWTO (R_PPC_EMB_NADDR16_HI, /* type */
+        16,                    /* 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_PPC_EMB_NADDR16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* The high order 16 bits of the result of the addend minus the address,
+     plus 1 if the contents of the low 16 bits, treated as a signed number,
+     is negative.  */
+  HOWTO (R_PPC_EMB_NADDR16_HA, /* type */
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc_elf_addr16_ha_reloc, /* special_function */
+        "R_PPC_EMB_NADDR16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* 16 bit value resulting from allocating a 4 byte word to hold an
+     address in the .sdata section, and returning the offset from
+     _SDA_BASE_ for that relocation.  */
+  HOWTO (R_PPC_EMB_SDAI16,     /* 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_PPC_EMB_SDAI16",    /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* 16 bit value resulting from allocating a 4 byte word to hold an
+     address in the .sdata2 section, and returning the offset from
+     _SDA2_BASE_ for that relocation.  */
+  HOWTO (R_PPC_EMB_SDA2I16,    /* 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_PPC_EMB_SDA2I16",   /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* A sign-extended 16 bit value relative to _SDA2_BASE_, for use with
+     small data items.  */
+  HOWTO (R_PPC_EMB_SDA2REL,    /* type */
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_PPC_EMB_SDA2REL",   /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Relocate against either _SDA_BASE_ or _SDA2_BASE_, filling in the 16 bit
+     signed offset from the appropriate base, and filling in the register
+     field with the appropriate register (0, 2, or 13).  */
+  HOWTO (R_PPC_EMB_SDA21,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_PPC_EMB_SDA21",     /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Relocation not handled: R_PPC_EMB_MRKREF */
+  /* Relocation not handled: R_PPC_EMB_RELSEC16 */
+  /* Relocation not handled: R_PPC_EMB_RELST_LO */
+  /* Relocation not handled: R_PPC_EMB_RELST_HI */
+  /* Relocation not handled: R_PPC_EMB_RELST_HA */
+  /* Relocation not handled: R_PPC_EMB_BIT_FLD */
+
+  /* PC relative relocation against either _SDA_BASE_ or _SDA2_BASE_, filling
+     in the 16 bit signed offset from the appropriate base, and filling in the
+     register field with the appropriate register (0, 2, or 13).  */
+  HOWTO (R_PPC_EMB_RELSDA,     /* type */
+        0,                     /* rightshift */
+        1,                     /* 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_PPC_EMB_RELSDA",    /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* GNU extension to record C++ vtable hierarchy.  */
+  HOWTO (R_PPC_GNU_VTINHERIT,  /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        NULL,                  /* special_function */
+        "R_PPC_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_PPC_GNU_VTENTRY,    /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        NULL,                  /* special_function */
+        "R_PPC_GNU_VTENTRY",   /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Phony reloc to handle AIX style TOC entries.  */
+  HOWTO (R_PPC_TOC16,          /* type */
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_PPC_TOC16",         /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+};
+\f
+/* Initialize the ppc_elf_howto_table, so that linear accesses can be done.  */
+
+static void
+ppc_elf_howto_init ()
+{
+  unsigned int i, type;
+
+  for (i = 0; i < sizeof (ppc_elf_howto_raw) / sizeof (ppc_elf_howto_raw[0]); i++)
+    {
+      type = ppc_elf_howto_raw[i].type;
+      BFD_ASSERT (type < sizeof (ppc_elf_howto_table) / sizeof (ppc_elf_howto_table[0]));
+      ppc_elf_howto_table[type] = &ppc_elf_howto_raw[i];
+    }
+}
+\f
+/* This function handles relaxing for the PPC with option --mpc860c0[=<n>].
+
+   The MPC860, revision C0 or earlier contains a bug in the die.
+   If all of the following conditions are true, the next instruction
+   to be executed *may* be treated as a no-op.
+   1/ A forward branch is executed.
+   2/ The branch is predicted as not taken.
+   3/ The branch is taken.
+   4/ The branch is located in the last 5 words of a page.
+      (The EOP limit is 5 by default but may be specified as any value from 1-10.)
+
+   Our software solution is to detect these problematic branches in a
+   linker pass and modify them as follows:
+   1/ Unconditional branches - Since these are always predicted taken,
+      there is no problem and no action is required.
+   2/ Conditional backward branches - No problem, no action required.
+   3/ Conditional forward branches - Ensure that the "inverse prediction
+      bit" is set (ensure it is predicted taken).
+   4/ Conditional register branches - Ensure that the "y bit" is set
+      (ensure it is predicted taken).  */
 
 /* Sort sections by address.  */
 
@@ -1167,7 +1673,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
 
   /* If needed, initialize this section's cooked size.  */
   if (isec->_cooked_size == 0)
-      isec->_cooked_size = isec->_raw_size;
+    isec->_cooked_size = isec->_raw_size;
 
   /* We're only interested in text sections which overlap the
      troublesome area at the end of a page.  */
@@ -1179,7 +1685,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
       /* Get the section contents.  */
       /* Get cached copy if it exists.  */
       if (elf_section_data (isec)->this_hdr.contents != NULL)
-         contents = elf_section_data (isec)->this_hdr.contents;
+       contents = elf_section_data (isec)->this_hdr.contents;
       else
        {
          /* Go get them off disk.  */
@@ -1197,55 +1703,58 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
       comb_count = 0;
       if (isec->reloc_count)
        {
-          unsigned n;
+         unsigned n;
          bfd_size_type amt;
 
-          /* Get a copy of the native relocations.  */
-          internal_relocs = _bfd_elf32_link_read_relocs (
-           abfd, isec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
-           link_info->keep_memory);
-          if (internal_relocs == NULL)
-             goto error_return;
-          if (! link_info->keep_memory)
-             free_relocs = internal_relocs;
+         /* Get a copy of the native relocations.  */
+         internal_relocs
+           = _bfd_elf32_link_read_relocs (abfd, isec, (PTR) NULL,
+                                          (Elf_Internal_Rela *) NULL,
+                                          link_info->keep_memory);
+         if (internal_relocs == NULL)
+           goto error_return;
+         if (! link_info->keep_memory)
+           free_relocs = internal_relocs;
 
-          /* Setup a faster access method for the reloc info we need.  */
+         /* Setup a faster access method for the reloc info we need.  */
          amt = isec->reloc_count;
          amt *= sizeof (Elf_Internal_Rela*);
-          rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt);
-          if (rela_comb == NULL)
-              goto error_return;
-          for (n = 0; n < isec->reloc_count; ++n)
-            {
-              long r_type;
-
-              r_type = ELF32_R_TYPE (internal_relocs[n].r_info);
-              if (r_type < 0 || r_type >= (int) R_PPC_max)
-                  goto error_return;
-
-              /* Prologue constants are sometimes present in the ".text"
-              sections and they can be identified by their associated relocation.
-              We don't want to process those words and some others which
-              can also be identified by their relocations.  However, not all
-              conditional branches will have a relocation so we will
-              only ignore words that 1) have a reloc, and 2) the reloc
-              is not applicable to a conditional branch.
-              The array rela_comb is built here for use in the EOP scan loop.  */
-              switch (r_type)
-                {
-                case R_PPC_ADDR14_BRNTAKEN:     /* absolute, predicted not taken */
-                case R_PPC_REL14:               /* relative cond. br.  */
-                case R_PPC_REL14_BRNTAKEN:      /* rel. cond. br., predicted not taken */
-                  /* We should check the instruction.  */
-                  break;
-                default:
-                  /* The word is not a conditional branch - ignore it.  */
-                  rela_comb[comb_count++] = &internal_relocs[n];
-                  break;
-                }
-            }
-          if (comb_count > 1)
-           qsort (rela_comb, (size_t) comb_count, sizeof (int), ppc_elf_sort_rela);
+         rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt);
+         if (rela_comb == NULL)
+           goto error_return;
+         for (n = 0; n < isec->reloc_count; ++n)
+           {
+             long r_type;
+
+             r_type = ELF32_R_TYPE (internal_relocs[n].r_info);
+             if (r_type < 0 || r_type >= (int) R_PPC_max)
+               goto error_return;
+
+             /* Prologue constants are sometimes present in the ".text"
+                sections and they can be identified by their associated
+                relocation.  We don't want to process those words and
+                some others which can also be identified by their
+                relocations.  However, not all conditional branches will
+                have a relocation so we will only ignore words that
+                1) have a reloc, and 2) the reloc is not applicable to a
+                conditional branch.  The array rela_comb is built here
+                for use in the EOP scan loop.  */
+             switch (r_type)
+               {
+               case R_PPC_ADDR14_BRNTAKEN:
+               case R_PPC_REL14:
+               case R_PPC_REL14_BRNTAKEN:
+                 /* We should check the instruction.  */
+                 break;
+               default:
+                 /* The word is not a conditional branch - ignore it.  */
+                 rela_comb[comb_count++] = &internal_relocs[n];
+                 break;
+               }
+           }
+         if (comb_count > 1)
+           qsort (rela_comb, (size_t) comb_count, sizeof (int),
+                  ppc_elf_sort_rela);
        }
 
       /* Enumerate each EOP region that overlaps this section.  */
@@ -1253,99 +1762,104 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
       dot = end_page = (isec->vma | (PAGESIZE - 1)) + 1;
       dot -= link_info->mpc860c0;
       section_modified = FALSE;
-      if (dot < isec->vma)      /* Increment the start position if this section */
-          dot = isec->vma;      /* begins in the middle of its first EOP region.  */
+      /* Increment the start position if this section begins in the
+        middle of its first EOP region.  */
+      if (dot < isec->vma)
+       dot = isec->vma;
       for (;
-           dot < end_section;
-           dot += PAGESIZE, end_page += PAGESIZE)
-        {
-
-          /* Check each word in this EOP region.  */
-          for (; dot < end_page; dot += 4)
-            {
-              bfd_vma isec_offset;
-              unsigned long insn;
-              bfd_boolean skip, modified;
-
-              /* Don't process this word if there is a relocation for it and
-              the relocation indicates the word is not a conditional branch.  */
-              skip = FALSE;
-              isec_offset = dot - isec->vma;
-              for (; comb_curr<comb_count; ++comb_curr)
-                {
-                  bfd_vma r_offset;
-
-                  r_offset = rela_comb[comb_curr]->r_offset;
-                  if (r_offset >= isec_offset)
-                    {
-                      if (r_offset == isec_offset) skip = TRUE;
-                      break;
-                    }
-                }
-              if (skip) continue;
-
-              /* Check the current word for a problematic conditional branch.  */
+          dot < end_section;
+          dot += PAGESIZE, end_page += PAGESIZE)
+       {
+         /* Check each word in this EOP region.  */
+         for (; dot < end_page; dot += 4)
+           {
+             bfd_vma isec_offset;
+             unsigned long insn;
+             bfd_boolean skip, modified;
+
+             /* Don't process this word if there is a relocation for it
+                and the relocation indicates the word is not a
+                conditional branch.  */
+             skip = FALSE;
+             isec_offset = dot - isec->vma;
+             for (; comb_curr<comb_count; ++comb_curr)
+               {
+                 bfd_vma r_offset;
+
+                 r_offset = rela_comb[comb_curr]->r_offset;
+                 if (r_offset >= isec_offset)
+                   {
+                     if (r_offset == isec_offset) skip = TRUE;
+                     break;
+                   }
+               }
+             if (skip) continue;
+
+             /* Check the current word for a problematic conditional
+                branch.  */
 #define BO0(insn) ((insn) & 0x02000000)
 #define BO2(insn) ((insn) & 0x00800000)
 #define BO4(insn) ((insn) & 0x00200000)
-              insn = (unsigned long) bfd_get_32 (abfd, contents + isec_offset);
-              modified = FALSE;
-              if ((insn & 0xFc000000) == 0x40000000)
-                {
-                  /* Instruction is BCx */
-                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
-                    {
-                      bfd_vma target;
-                      /* This branch is predicted as "normal".
-                      If this is a forward branch, it is problematic.  */
-
-                      target = insn & 0x0000Fffc;               /*extract*/
-                      target = (target ^ 0x8000) - 0x8000;      /*sign extend*/
-                      if ((insn & 0x00000002) == 0)
-                          target += dot;                        /*convert to abs*/
-                      if (target > dot)
-                        {
-                          insn |= 0x00200000;   /* set the prediction bit */
-                          modified = TRUE;
-                        }
-                    }
-                }
-              else if ((insn & 0xFc00Fffe) == 0x4c000420)
-                {
-                  /* Instruction is BCCTRx */
-                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
+             insn = (unsigned long) bfd_get_32 (abfd, contents + isec_offset);
+             modified = FALSE;
+             if ((insn & 0xFc000000) == 0x40000000)
+               {
+                 /* Instruction is BCx */
+                 if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
+                   {
+                     bfd_vma target;
+
+                     /* This branch is predicted as "normal".
+                        If this is a forward branch, it is problematic.  */
+                     target = insn & 0x0000Fffc;
+                     target = (target ^ 0x8000) - 0x8000;
+                     if ((insn & 0x00000002) == 0)
+                       /* Convert to abs.  */
+                       target += dot;
+                     if (target > dot)
+                       {
+                         /* Set the prediction bit.  */
+                         insn |= 0x00200000;
+                         modified = TRUE;
+                       }
+                   }
+               }
+             else if ((insn & 0xFc00Fffe) == 0x4c000420)
+               {
+                 /* Instruction is BCCTRx.  */
+                 if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
                    {
                      /* This branch is predicted as not-taken.
-                     If this is a forward branch, it is problematic.
-                      Since we can't tell statically if it will branch forward,
-                      always set the prediction bit.  */
-                      insn |= 0x00200000;   /* set the prediction bit */
-                      modified = TRUE;
+                        If this is a forward branch, it is problematic.
+                        Since we can't tell statically if it will branch
+                        forward, always set the prediction bit.  */
+                     insn |= 0x00200000;
+                     modified = TRUE;
                    }
-                }
-              else if ((insn & 0xFc00Fffe) == 0x4c000020)
-                {
-                  /* Instruction is BCLRx */
-                  if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
+               }
+             else if ((insn & 0xFc00Fffe) == 0x4c000020)
+               {
+                 /* Instruction is BCLRx */
+                 if ((!BO0(insn) || !BO2(insn)) && !BO4(insn))
                    {
                      /* This branch is predicted as not-taken.
-                     If this is a forward branch, it is problematic.
-                      Since we can't tell statically if it will branch forward,
-                      always set the prediction bit.  */
-                      insn |= 0x00200000;   /* set the prediction bit */
-                      modified = TRUE;
+                        If this is a forward branch, it is problematic.
+                        Since we can't tell statically if it will branch
+                        forward, always set the prediction bit.  */
+                     insn |= 0x00200000;
+                     modified = TRUE;
                    }
-                }
+               }
 #undef BO0
 #undef BO2
 #undef BO4
-              if (modified)
-               {
-                  bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset);
+             if (modified)
+               {
+                 bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset);
                  section_modified = TRUE;
-               }
-            }
-        }
+               }
+           }
+       }
       if (section_modified)
        {
          elf_section_data (isec)->this_hdr.contents = contents;
@@ -1379,7 +1893,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again)
 
   return TRUE;
 
-error_return:
+ error_return:
   if (rela_comb != NULL)
     free (rela_comb);
   if (free_relocs != NULL)
@@ -1394,7 +1908,7 @@ ppc_elf_reloc_type_lookup (abfd, code)
      bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
-  enum elf_ppc_reloc_type ppc_reloc = R_PPC_NONE;
+  enum elf_ppc_reloc_type r;
 
   if (!ppc_elf_howto_table[R_PPC_ADDR32])
     /* Initialize howto table if needed.  */
@@ -1405,62 +1919,90 @@ ppc_elf_reloc_type_lookup (abfd, code)
     default:
       return (reloc_howto_type *) NULL;
 
-    case BFD_RELOC_NONE:               ppc_reloc = R_PPC_NONE;                 break;
-    case BFD_RELOC_32:                 ppc_reloc = R_PPC_ADDR32;               break;
-    case BFD_RELOC_PPC_BA26:           ppc_reloc = R_PPC_ADDR24;               break;
-    case BFD_RELOC_16:                 ppc_reloc = R_PPC_ADDR16;               break;
-    case BFD_RELOC_LO16:               ppc_reloc = R_PPC_ADDR16_LO;            break;
-    case BFD_RELOC_HI16:               ppc_reloc = R_PPC_ADDR16_HI;            break;
-    case BFD_RELOC_HI16_S:             ppc_reloc = R_PPC_ADDR16_HA;            break;
-    case BFD_RELOC_PPC_BA16:           ppc_reloc = R_PPC_ADDR14;               break;
-    case BFD_RELOC_PPC_BA16_BRTAKEN:   ppc_reloc = R_PPC_ADDR14_BRTAKEN;       break;
-    case BFD_RELOC_PPC_BA16_BRNTAKEN:  ppc_reloc = R_PPC_ADDR14_BRNTAKEN;      break;
-    case BFD_RELOC_PPC_B26:            ppc_reloc = R_PPC_REL24;                break;
-    case BFD_RELOC_PPC_B16:            ppc_reloc = R_PPC_REL14;                break;
-    case BFD_RELOC_PPC_B16_BRTAKEN:    ppc_reloc = R_PPC_REL14_BRTAKEN;        break;
-    case BFD_RELOC_PPC_B16_BRNTAKEN:   ppc_reloc = R_PPC_REL14_BRNTAKEN;       break;
-    case BFD_RELOC_16_GOTOFF:          ppc_reloc = R_PPC_GOT16;                break;
-    case BFD_RELOC_LO16_GOTOFF:                ppc_reloc = R_PPC_GOT16_LO;             break;
-    case BFD_RELOC_HI16_GOTOFF:                ppc_reloc = R_PPC_GOT16_HI;             break;
-    case BFD_RELOC_HI16_S_GOTOFF:      ppc_reloc = R_PPC_GOT16_HA;             break;
-    case BFD_RELOC_24_PLT_PCREL:       ppc_reloc = R_PPC_PLTREL24;             break;
-    case BFD_RELOC_PPC_COPY:           ppc_reloc = R_PPC_COPY;                 break;
-    case BFD_RELOC_PPC_GLOB_DAT:       ppc_reloc = R_PPC_GLOB_DAT;             break;
-    case BFD_RELOC_PPC_LOCAL24PC:      ppc_reloc = R_PPC_LOCAL24PC;            break;
-    case BFD_RELOC_32_PCREL:           ppc_reloc = R_PPC_REL32;                break;
-    case BFD_RELOC_32_PLTOFF:          ppc_reloc = R_PPC_PLT32;                break;
-    case BFD_RELOC_32_PLT_PCREL:       ppc_reloc = R_PPC_PLTREL32;             break;
-    case BFD_RELOC_LO16_PLTOFF:                ppc_reloc = R_PPC_PLT16_LO;             break;
-    case BFD_RELOC_HI16_PLTOFF:                ppc_reloc = R_PPC_PLT16_HI;             break;
-    case BFD_RELOC_HI16_S_PLTOFF:      ppc_reloc = R_PPC_PLT16_HA;             break;
-    case BFD_RELOC_GPREL16:            ppc_reloc = R_PPC_SDAREL16;             break;
-    case BFD_RELOC_16_BASEREL:         ppc_reloc = R_PPC_SECTOFF;              break;
-    case BFD_RELOC_LO16_BASEREL:       ppc_reloc = R_PPC_SECTOFF_LO;           break;
-    case BFD_RELOC_HI16_BASEREL:       ppc_reloc = R_PPC_SECTOFF_HI;           break;
-    case BFD_RELOC_HI16_S_BASEREL:     ppc_reloc = R_PPC_SECTOFF_HA;           break;
-    case BFD_RELOC_CTOR:               ppc_reloc = R_PPC_ADDR32;               break;
-    case BFD_RELOC_PPC_TOC16:          ppc_reloc = R_PPC_TOC16;                break;
-    case BFD_RELOC_PPC_EMB_NADDR32:    ppc_reloc = R_PPC_EMB_NADDR32;          break;
-    case BFD_RELOC_PPC_EMB_NADDR16:    ppc_reloc = R_PPC_EMB_NADDR16;          break;
-    case BFD_RELOC_PPC_EMB_NADDR16_LO: ppc_reloc = R_PPC_EMB_NADDR16_LO;       break;
-    case BFD_RELOC_PPC_EMB_NADDR16_HI: ppc_reloc = R_PPC_EMB_NADDR16_HI;       break;
-    case BFD_RELOC_PPC_EMB_NADDR16_HA: ppc_reloc = R_PPC_EMB_NADDR16_HA;       break;
-    case BFD_RELOC_PPC_EMB_SDAI16:     ppc_reloc = R_PPC_EMB_SDAI16;           break;
-    case BFD_RELOC_PPC_EMB_SDA2I16:    ppc_reloc = R_PPC_EMB_SDA2I16;          break;
-    case BFD_RELOC_PPC_EMB_SDA2REL:    ppc_reloc = R_PPC_EMB_SDA2REL;          break;
-    case BFD_RELOC_PPC_EMB_SDA21:      ppc_reloc = R_PPC_EMB_SDA21;            break;
-    case BFD_RELOC_PPC_EMB_MRKREF:     ppc_reloc = R_PPC_EMB_MRKREF;           break;
-    case BFD_RELOC_PPC_EMB_RELSEC16:   ppc_reloc = R_PPC_EMB_RELSEC16;         break;
-    case BFD_RELOC_PPC_EMB_RELST_LO:   ppc_reloc = R_PPC_EMB_RELST_LO;         break;
-    case BFD_RELOC_PPC_EMB_RELST_HI:   ppc_reloc = R_PPC_EMB_RELST_HI;         break;
-    case BFD_RELOC_PPC_EMB_RELST_HA:   ppc_reloc = R_PPC_EMB_RELST_HA;         break;
-    case BFD_RELOC_PPC_EMB_BIT_FLD:    ppc_reloc = R_PPC_EMB_BIT_FLD;          break;
-    case BFD_RELOC_PPC_EMB_RELSDA:     ppc_reloc = R_PPC_EMB_RELSDA;           break;
-    case BFD_RELOC_VTABLE_INHERIT:     ppc_reloc = R_PPC_GNU_VTINHERIT;        break;
-    case BFD_RELOC_VTABLE_ENTRY:       ppc_reloc = R_PPC_GNU_VTENTRY;          break;
+    case BFD_RELOC_NONE:               r = R_PPC_NONE;                 break;
+    case BFD_RELOC_32:                 r = R_PPC_ADDR32;               break;
+    case BFD_RELOC_PPC_BA26:           r = R_PPC_ADDR24;               break;
+    case BFD_RELOC_16:                 r = R_PPC_ADDR16;               break;
+    case BFD_RELOC_LO16:               r = R_PPC_ADDR16_LO;            break;
+    case BFD_RELOC_HI16:               r = R_PPC_ADDR16_HI;            break;
+    case BFD_RELOC_HI16_S:             r = R_PPC_ADDR16_HA;            break;
+    case BFD_RELOC_PPC_BA16:           r = R_PPC_ADDR14;               break;
+    case BFD_RELOC_PPC_BA16_BRTAKEN:   r = R_PPC_ADDR14_BRTAKEN;       break;
+    case BFD_RELOC_PPC_BA16_BRNTAKEN:  r = R_PPC_ADDR14_BRNTAKEN;      break;
+    case BFD_RELOC_PPC_B26:            r = R_PPC_REL24;                break;
+    case BFD_RELOC_PPC_B16:            r = R_PPC_REL14;                break;
+    case BFD_RELOC_PPC_B16_BRTAKEN:    r = R_PPC_REL14_BRTAKEN;        break;
+    case BFD_RELOC_PPC_B16_BRNTAKEN:   r = R_PPC_REL14_BRNTAKEN;       break;
+    case BFD_RELOC_16_GOTOFF:          r = R_PPC_GOT16;                break;
+    case BFD_RELOC_LO16_GOTOFF:                r = R_PPC_GOT16_LO;             break;
+    case BFD_RELOC_HI16_GOTOFF:                r = R_PPC_GOT16_HI;             break;
+    case BFD_RELOC_HI16_S_GOTOFF:      r = R_PPC_GOT16_HA;             break;
+    case BFD_RELOC_24_PLT_PCREL:       r = R_PPC_PLTREL24;             break;
+    case BFD_RELOC_PPC_COPY:           r = R_PPC_COPY;                 break;
+    case BFD_RELOC_PPC_GLOB_DAT:       r = R_PPC_GLOB_DAT;             break;
+    case BFD_RELOC_PPC_LOCAL24PC:      r = R_PPC_LOCAL24PC;            break;
+    case BFD_RELOC_32_PCREL:           r = R_PPC_REL32;                break;
+    case BFD_RELOC_32_PLTOFF:          r = R_PPC_PLT32;                break;
+    case BFD_RELOC_32_PLT_PCREL:       r = R_PPC_PLTREL32;             break;
+    case BFD_RELOC_LO16_PLTOFF:                r = R_PPC_PLT16_LO;             break;
+    case BFD_RELOC_HI16_PLTOFF:                r = R_PPC_PLT16_HI;             break;
+    case BFD_RELOC_HI16_S_PLTOFF:      r = R_PPC_PLT16_HA;             break;
+    case BFD_RELOC_GPREL16:            r = R_PPC_SDAREL16;             break;
+    case BFD_RELOC_16_BASEREL:         r = R_PPC_SECTOFF;              break;
+    case BFD_RELOC_LO16_BASEREL:       r = R_PPC_SECTOFF_LO;           break;
+    case BFD_RELOC_HI16_BASEREL:       r = R_PPC_SECTOFF_HI;           break;
+    case BFD_RELOC_HI16_S_BASEREL:     r = R_PPC_SECTOFF_HA;           break;
+    case BFD_RELOC_CTOR:               r = R_PPC_ADDR32;               break;
+    case BFD_RELOC_PPC_TOC16:          r = R_PPC_TOC16;                break;
+    case BFD_RELOC_PPC_TLS:            r = R_PPC_TLS;                  break;
+    case BFD_RELOC_PPC_DTPMOD:         r = R_PPC_DTPMOD32;             break;
+    case BFD_RELOC_PPC_TPREL16:                r = R_PPC_TPREL16;              break;
+    case BFD_RELOC_PPC_TPREL16_LO:     r = R_PPC_TPREL16_LO;           break;
+    case BFD_RELOC_PPC_TPREL16_HI:     r = R_PPC_TPREL16_HI;           break;
+    case BFD_RELOC_PPC_TPREL16_HA:     r = R_PPC_TPREL16_HA;           break;
+    case BFD_RELOC_PPC_TPREL:          r = R_PPC_TPREL32;              break;
+    case BFD_RELOC_PPC_DTPREL16:       r = R_PPC_DTPREL16;             break;
+    case BFD_RELOC_PPC_DTPREL16_LO:    r = R_PPC_DTPREL16_LO;          break;
+    case BFD_RELOC_PPC_DTPREL16_HI:    r = R_PPC_DTPREL16_HI;          break;
+    case BFD_RELOC_PPC_DTPREL16_HA:    r = R_PPC_DTPREL16_HA;          break;
+    case BFD_RELOC_PPC_DTPREL:         r = R_PPC_DTPREL32;             break;
+    case BFD_RELOC_PPC_GOT_TLSGD16:    r = R_PPC_GOT_TLSGD16;          break;
+    case BFD_RELOC_PPC_GOT_TLSGD16_LO: r = R_PPC_GOT_TLSGD16_LO;       break;
+    case BFD_RELOC_PPC_GOT_TLSGD16_HI: r = R_PPC_GOT_TLSGD16_HI;       break;
+    case BFD_RELOC_PPC_GOT_TLSGD16_HA: r = R_PPC_GOT_TLSGD16_HA;       break;
+    case BFD_RELOC_PPC_GOT_TLSLD16:    r = R_PPC_GOT_TLSLD16;          break;
+    case BFD_RELOC_PPC_GOT_TLSLD16_LO: r = R_PPC_GOT_TLSLD16_LO;       break;
+    case BFD_RELOC_PPC_GOT_TLSLD16_HI: r = R_PPC_GOT_TLSLD16_HI;       break;
+    case BFD_RELOC_PPC_GOT_TLSLD16_HA: r = R_PPC_GOT_TLSLD16_HA;       break;
+    case BFD_RELOC_PPC_GOT_TPREL16:    r = R_PPC_GOT_TPREL16;          break;
+    case BFD_RELOC_PPC_GOT_TPREL16_LO: r = R_PPC_GOT_TPREL16_LO;       break;
+    case BFD_RELOC_PPC_GOT_TPREL16_HI: r = R_PPC_GOT_TPREL16_HI;       break;
+    case BFD_RELOC_PPC_GOT_TPREL16_HA: r = R_PPC_GOT_TPREL16_HA;       break;
+    case BFD_RELOC_PPC_GOT_DTPREL16:   r = R_PPC_GOT_DTPREL16;         break;
+    case BFD_RELOC_PPC_GOT_DTPREL16_LO:        r = R_PPC_GOT_DTPREL16_LO;      break;
+    case BFD_RELOC_PPC_GOT_DTPREL16_HI:        r = R_PPC_GOT_DTPREL16_HI;      break;
+    case BFD_RELOC_PPC_GOT_DTPREL16_HA:        r = R_PPC_GOT_DTPREL16_HA;      break;
+    case BFD_RELOC_PPC_EMB_NADDR32:    r = R_PPC_EMB_NADDR32;          break;
+    case BFD_RELOC_PPC_EMB_NADDR16:    r = R_PPC_EMB_NADDR16;          break;
+    case BFD_RELOC_PPC_EMB_NADDR16_LO: r = R_PPC_EMB_NADDR16_LO;       break;
+    case BFD_RELOC_PPC_EMB_NADDR16_HI: r = R_PPC_EMB_NADDR16_HI;       break;
+    case BFD_RELOC_PPC_EMB_NADDR16_HA: r = R_PPC_EMB_NADDR16_HA;       break;
+    case BFD_RELOC_PPC_EMB_SDAI16:     r = R_PPC_EMB_SDAI16;           break;
+    case BFD_RELOC_PPC_EMB_SDA2I16:    r = R_PPC_EMB_SDA2I16;          break;
+    case BFD_RELOC_PPC_EMB_SDA2REL:    r = R_PPC_EMB_SDA2REL;          break;
+    case BFD_RELOC_PPC_EMB_SDA21:      r = R_PPC_EMB_SDA21;            break;
+    case BFD_RELOC_PPC_EMB_MRKREF:     r = R_PPC_EMB_MRKREF;           break;
+    case BFD_RELOC_PPC_EMB_RELSEC16:   r = R_PPC_EMB_RELSEC16;         break;
+    case BFD_RELOC_PPC_EMB_RELST_LO:   r = R_PPC_EMB_RELST_LO;         break;
+    case BFD_RELOC_PPC_EMB_RELST_HI:   r = R_PPC_EMB_RELST_HI;         break;
+    case BFD_RELOC_PPC_EMB_RELST_HA:   r = R_PPC_EMB_RELST_HA;         break;
+    case BFD_RELOC_PPC_EMB_BIT_FLD:    r = R_PPC_EMB_BIT_FLD;          break;
+    case BFD_RELOC_PPC_EMB_RELSDA:     r = R_PPC_EMB_RELSDA;           break;
+    case BFD_RELOC_VTABLE_INHERIT:     r = R_PPC_GNU_VTINHERIT;        break;
+    case BFD_RELOC_VTABLE_ENTRY:       r = R_PPC_GNU_VTENTRY;          break;
     }
 
-  return ppc_elf_howto_table[(int) ppc_reloc];
+  return ppc_elf_howto_table[(int) r];
 };
 
 /* Set the howto pointer for a PowerPC ELF reloc.  */
@@ -1517,6 +2059,34 @@ ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section,
   return bfd_reloc_continue;
 }
 
+static bfd_reloc_status_type
+ppc_elf_unhandled_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;
+{
+  /* If this is a relocatable link (output_bfd test tells us), just
+     call the generic function.  Any adjustment will be done at final
+     link time.  */
+  if (output_bfd != NULL)
+    return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+                                 input_section, output_bfd, error_message);
+
+  if (error_message != NULL)
+    {
+      static char buf[60];
+      sprintf (buf, "generic linker can't handle %s",
+              reloc_entry->howto->name);
+      *error_message = buf;
+    }
+  return bfd_reloc_dangerous;
+}
+
 /* Fix bad default arch selected for a 32 bit input bfd when the
    default is 64 bit.  */
 
@@ -1554,7 +2124,8 @@ ppc_elf_set_private_flags (abfd, flags)
 }
 
 /* Merge backend specific data from an object file to the output
-   object file when linking */
+   object file when linking.  */
+
 static bfd_boolean
 ppc_elf_merge_private_bfd_data (ibfd, obfd)
      bfd *ibfd;
@@ -1564,7 +2135,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
   flagword new_flags;
   bfd_boolean error;
 
-  /* Check if we have the same endianess */
+  /* Check if we have the same endianess */
   if (! _bfd_generic_verify_endian_match (ibfd, obfd))
     return FALSE;
 
@@ -1574,19 +2145,22 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
 
   new_flags = elf_elfheader (ibfd)->e_flags;
   old_flags = elf_elfheader (obfd)->e_flags;
-  if (!elf_flags_init (obfd))  /* First call, no flags set */
+  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 */
+  /* Compatible flags are ok.  */
+  else if (new_flags == old_flags)
     ;
 
-  else                                 /* Incompatible flags */
+  /* Incompatible flags.  */
+  else
     {
-      /* Warn about -mrelocatable mismatch.  Allow -mrelocatable-lib to be linked
-         with either.  */
+      /* Warn about -mrelocatable mismatch.  Allow -mrelocatable-lib
+        to be linked with either.  */
       error = FALSE;
       if ((new_flags & EF_PPC_RELOCATABLE) != 0
          && (old_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0)
@@ -1610,19 +2184,20 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
        elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB;
 
       /* The output is -mrelocatable iff it can't be -mrelocatable-lib,
-         but each input file is either -mrelocatable or -mrelocatable-lib.  */
+        but each input file is either -mrelocatable or -mrelocatable-lib.  */
       if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB)
          && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))
          && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)))
        elf_elfheader (obfd)->e_flags |= EF_PPC_RELOCATABLE;
 
-      /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if any module uses it */
+      /* Do not warn about eabi vs. V.4 mismatch, just or in the bit if
+        any module uses it.  */
       elf_elfheader (obfd)->e_flags |= (new_flags & EF_PPC_EMB);
 
-      new_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
-      old_flags &= ~ (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
+      new_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
+      old_flags &= ~(EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB | EF_PPC_EMB);
 
-      /* Warn about any other mismatches */
+      /* Warn about any other mismatches */
       if (new_flags != old_flags)
        {
          error = TRUE;
@@ -1695,11 +2270,11 @@ ppc_elf_create_linker_section (abfd, info, which)
   bfd *dynobj = elf_hash_table (info)->dynobj;
   elf_linker_section_t *lsect;
 
-  /* Record the first bfd section that needs the special section */
+  /* 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 */
+  /* If this is the first time, create the section */
   lsect = elf_linker_section (dynobj, which);
   if (!lsect)
     {
@@ -1794,26 +2369,38 @@ ppc_elf_modify_segment_map (abfd)
 \f
 /* The powerpc .got has a blrl instruction in it.  Mark it executable.  */
 
-static asection *
+static bfd_boolean
 ppc_elf_create_got (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  register asection *s;
+  struct ppc_elf_link_hash_table *htab;
+  asection *s;
   flagword flags;
 
   if (!_bfd_elf_create_got_section (abfd, info))
-    return NULL;
+    return FALSE;
 
-  s = bfd_get_section_by_name (abfd, ".got");
+  htab = ppc_elf_hash_table (info);
+  htab->got = s = bfd_get_section_by_name (abfd, ".got");
   if (s == NULL)
     abort ();
 
   flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY
           | SEC_LINKER_CREATED);
   if (!bfd_set_section_flags (abfd, s, flags))
-    return NULL;
-  return s;
+    return FALSE;
+
+  htab->relgot = bfd_make_section (abfd, ".rela.got");
+  if (!htab->relgot
+      || ! bfd_set_section_flags (abfd, htab->relgot,
+                                 (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+                                  | SEC_IN_MEMORY | SEC_LINKER_CREATED
+                                  | SEC_READONLY))
+      || ! bfd_set_section_alignment (abfd, htab->relgot, 2))
+    return FALSE;
+
+  return TRUE;
 }
 
 /* We have to create .dynsbss and .rela.sbss here so that they get mapped
@@ -1825,7 +2412,8 @@ ppc_elf_create_dynamic_sections (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  register asection *s;
+  struct ppc_elf_link_hash_table *htab;
+  asection *s;
   flagword flags;
 
   if (!ppc_elf_create_got (abfd, info))
@@ -1837,21 +2425,25 @@ ppc_elf_create_dynamic_sections (abfd, info)
   flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
           | SEC_LINKER_CREATED);
 
-  s = bfd_make_section (abfd, ".dynsbss");
+  htab = ppc_elf_hash_table (info);
+  htab->dynbss = bfd_get_section_by_name (abfd, ".dynbss");
+  htab->dynsbss = 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");
+      htab->relbss = bfd_get_section_by_name (abfd, ".rela.bss");
+      htab->relsbss = 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;
     }
 
-  s = bfd_get_section_by_name (abfd, ".plt");
+  htab->relplt = bfd_get_section_by_name (abfd, ".rela.plt");
+  htab->plt = s = bfd_get_section_by_name (abfd, ".plt");
   if (s == NULL)
     abort ();
 
@@ -1859,6 +2451,12 @@ ppc_elf_create_dynamic_sections (abfd, info)
   return bfd_set_section_flags (abfd, s, flags);
 }
 
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+   copying dynamic variables from a shared lib into an app's dynbss
+   section, and instead use a dynamic relocation to point into the
+   shared lib.  */
+#define ELIMINATE_COPY_RELOCS 1
+
 /* Adjust a symbol defined by a dynamic object and referenced by a
    regular object.  The current definition is in some section of the
    dynamic object, but we're not including those sections.  We have to
@@ -1870,17 +2468,18 @@ ppc_elf_adjust_dynamic_symbol (info, h)
      struct bfd_link_info *info;
      struct elf_link_hash_entry *h;
 {
-  bfd *dynobj = elf_hash_table (info)->dynobj;
+  struct ppc_elf_link_hash_table *htab;
   asection *s;
   unsigned int power_of_two;
-  bfd_vma plt_offset;
 
 #ifdef DEBUG
-  fprintf (stderr, "ppc_elf_adjust_dynamic_symbol called for %s\n", h->root.root.string);
+  fprintf (stderr, "ppc_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
+  htab = ppc_elf_hash_table (info);
+  BFD_ASSERT (htab->elf.dynobj != NULL
              && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
                  || h->weakdef != NULL
                  || ((h->elf_link_hash_flags
@@ -1890,85 +2489,28 @@ ppc_elf_adjust_dynamic_symbol (info, h)
                      && (h->elf_link_hash_flags
                          & ELF_LINK_HASH_DEF_REGULAR) == 0)));
 
-  /* If this is a function, put it in the procedure linkage table.  We
-     will fill in the contents of the procedure linkage table later,
-     when we know the address of the .got section.  */
+  /* Deal with function syms.  */
   if (h->type == STT_FUNC
       || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
-      if (! elf_hash_table (info)->dynamic_sections_created
+      /* Clear procedure linkage table information for any symbol that
+        won't need a .plt entry.  */
+      if (! htab->elf.dynamic_sections_created
          || SYMBOL_CALLS_LOCAL (info, h)
-         || (info->shared && h->plt.refcount <= 0))
+         || h->plt.refcount <= 0)
        {
          /* A PLT entry is not required/allowed when:
 
-            1. We are not using ld.so; because then the PLT entry
-            can't be set up, so we can't use one.
+         1. We are not using ld.so; because then the PLT entry
+         can't be set up, so we can't use one.
 
-            2. We know for certain that a call to this symbol
-            will go to this object.
+         2. We know for certain that a call to this symbol
+         will go to this object.
 
-            3. GC has rendered the entry unused.
-            Note, however, that in an executable all references to the
-            symbol go to the PLT, so we can't turn it off in that case.
-            ??? The correct thing to do here is to reference count
-            all uses of the symbol, not just those to the GOT or PLT.  */
+         3. GC has rendered the entry unused.  */
          h->plt.offset = (bfd_vma) -1;
          h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
-         return TRUE;
        }
-
-      /* Make sure this symbol is output as a dynamic symbol.  */
-      if (h->dynindx == -1)
-       {
-         if (! bfd_elf32_link_record_dynamic_symbol (info, h))
-           return FALSE;
-       }
-      BFD_ASSERT (h->dynindx != -1);
-
-      s = bfd_get_section_by_name (dynobj, ".plt");
-      BFD_ASSERT (s != NULL);
-
-      /* If this is the first .plt entry, make room for the special
-        first entry.  */
-      if (s->_raw_size == 0)
-       s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
-
-      /* The PowerPC PLT is actually composed of two parts, the first part
-        is 2 words (for a load and a jump), and then there is a remaining
-        word available at the end.  */
-      plt_offset = (PLT_INITIAL_ENTRY_SIZE
-                   + (PLT_SLOT_SIZE
-                      * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE)
-                         / PLT_ENTRY_SIZE)));
-
-      /* If this symbol is not defined in a regular file, and we are
-        not generating a shared library, then set the symbol to this
-        location in the .plt.  This is required to make function
-        pointers compare as equal between the normal executable and
-        the shared library.  */
-      if (! info->shared
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-       {
-         h->root.u.def.section = s;
-         h->root.u.def.value = plt_offset;
-       }
-
-      h->plt.offset = plt_offset;
-
-      /* Make room for this entry.  After the 8192nd entry, room
-         for two entries is allocated.  */
-      if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
-         >= PLT_NUM_SINGLE_ENTRIES)
-       s->_raw_size += 2 * PLT_ENTRY_SIZE;
-      else
-       s->_raw_size += PLT_ENTRY_SIZE;
-
-      /* We also need to make an entry in the .rela.plt section.  */
-      s = bfd_get_section_by_name (dynobj, ".rela.plt");
-      BFD_ASSERT (s != NULL);
-      s->_raw_size += sizeof (Elf32_External_Rela);
-
       return TRUE;
     }
   else
@@ -1996,6 +2538,30 @@ ppc_elf_adjust_dynamic_symbol (info, h)
   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;
+
+  if (ELIMINATE_COPY_RELOCS)
+    {
+      struct ppc_elf_dyn_relocs *p;
+      for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
+       {
+         s = p->sec->output_section;
+         if (s != NULL && (s->flags & SEC_READONLY) != 0)
+           break;
+       }
+
+      /* If we didn't find any dynamic relocs in read-only sections, then
+        we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
+      if (p == NULL)
+       {
+         h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+         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
@@ -2010,10 +2576,10 @@ ppc_elf_adjust_dynamic_symbol (info, h)
      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");
+  if (h->size <= elf_gp_size (htab->elf.dynobj))
+    s = htab->dynsbss;
   else
-    s = bfd_get_section_by_name (dynobj, ".dynbss");
+    s = htab->dynbss;
   BFD_ASSERT (s != NULL);
 
   /* We must generate a R_PPC_COPY reloc to tell the dynamic linker to
@@ -2024,10 +2590,10 @@ ppc_elf_adjust_dynamic_symbol (info, h)
     {
       asection *srel;
 
-      if (h->size <= elf_gp_size (dynobj))
-       srel = bfd_get_section_by_name (dynobj, ".rela.sbss");
+      if (h->size <= elf_gp_size (htab->elf.dynobj))
+       srel = htab->relsbss;
       else
-       srel = bfd_get_section_by_name (dynobj, ".rela.bss");
+       srel = htab->relbss;
       BFD_ASSERT (srel != NULL);
       srel->_raw_size += sizeof (Elf32_External_Rela);
       h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
@@ -2042,9 +2608,9 @@ ppc_elf_adjust_dynamic_symbol (info, h)
   /* 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 (power_of_two > bfd_get_section_alignment (htab->elf.dynobj, s))
     {
-      if (! bfd_set_section_alignment (dynobj, s, power_of_two))
+      if (! bfd_set_section_alignment (htab->elf.dynobj, s, power_of_two))
        return FALSE;
     }
 
@@ -2058,25 +2624,221 @@ ppc_elf_adjust_dynamic_symbol (info, h)
   return TRUE;
 }
 \f
+/* This is the condition under which finish_dynamic_symbol will be
+   called from elflink.h.  If elflink.h doesn't call our
+   finish_dynamic_symbol routine, we'll need to do something about
+   initializing any .plt and .got entries in relocate_section.  */
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
+  ((DYN)                                                               \
+   && ((SHARED)                                                                \
+       || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)     \
+   && ((H)->dynindx != -1                                              \
+       || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+
+/* Of those relocs that might be copied as dynamic relocs, this macro
+   selects those that must be copied when linking a shared library,
+   even when the symbol is local.  */
+
+#define MUST_BE_DYN_RELOC(RTYPE)               \
+  ((RTYPE) != R_PPC_REL24                      \
+   && (RTYPE) != R_PPC_REL14                   \
+   && (RTYPE) != R_PPC_REL14_BRTAKEN           \
+   && (RTYPE) != R_PPC_REL14_BRNTAKEN          \
+   && (RTYPE) != R_PPC_REL32)
+
 /* Allocate space in associated reloc sections for dynamic relocs.  */
 
 static bfd_boolean
-allocate_dynrelocs (h, info)
+allocate_dynrelocs (h, inf)
      struct elf_link_hash_entry *h;
-     PTR info ATTRIBUTE_UNUSED;
+     PTR inf;
 {
+  struct bfd_link_info *info = (struct bfd_link_info *) inf;
+  struct ppc_elf_link_hash_entry *eh;
+  struct ppc_elf_link_hash_table *htab;
   struct ppc_elf_dyn_relocs *p;
 
-  if (h->root.type == bfd_link_hash_indirect)
-    return TRUE;
+  if (h->root.type == bfd_link_hash_indirect)
+    return TRUE;
+
+  if (h->root.type == bfd_link_hash_warning)
+    /* When warning symbols are created, they **replace** the "real"
+       entry in the hash table, thus we never get to see the real
+       symbol in a hash traversal.  So look at it now.  */
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+  htab = ppc_elf_hash_table (info);
+  if (htab->elf.dynamic_sections_created
+      && h->plt.refcount > 0)
+    {
+      /* Make sure this symbol is output as a dynamic symbol.  */
+      if (h->dynindx == -1
+         && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+       {
+         if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+           return FALSE;
+       }
+
+      if (info->shared
+         || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
+       {
+         asection *s = htab->plt;
+
+         /* If this is the first .plt entry, make room for the special
+            first entry.  */
+         if (s->_raw_size == 0)
+           s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
+
+         /* The PowerPC PLT is actually composed of two parts, the
+            first part is 2 words (for a load and a jump), and then
+            there is a remaining word available at the end.  */
+         h->plt.offset = (PLT_INITIAL_ENTRY_SIZE
+                          + (PLT_SLOT_SIZE
+                             * ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE)
+                                / PLT_ENTRY_SIZE)));
+
+         /* If this symbol is not defined in a regular file, and we
+            are not generating a shared library, then set the symbol
+            to this location in the .plt.  This is required to make
+            function pointers compare as equal between the normal
+            executable and the shared library.  */
+         if (! info->shared
+             && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+           {
+             h->root.u.def.section = s;
+             h->root.u.def.value = h->plt.offset;
+           }
+
+         /* Make room for this entry.  After the 8192nd entry, room
+            for two entries is allocated.  */
+         s->_raw_size += PLT_ENTRY_SIZE;
+         if ((s->_raw_size - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
+             >= PLT_NUM_SINGLE_ENTRIES)
+           s->_raw_size += PLT_ENTRY_SIZE;
+
+         /* We also need to make an entry in the .rela.plt section.  */
+         htab->relplt->_raw_size += sizeof (Elf32_External_Rela);
+       }
+      else
+       {
+         h->plt.offset = (bfd_vma) -1;
+         h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+       }
+    }
+  else
+    {
+      h->plt.offset = (bfd_vma) -1;
+      h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+    }
+
+  eh = (struct ppc_elf_link_hash_entry *) h;
+  if (eh->elf.got.refcount > 0)
+    {
+      /* Make sure this symbol is output as a dynamic symbol.  */
+      if (eh->elf.dynindx == -1
+         && (eh->elf.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+       {
+         if (!bfd_elf32_link_record_dynamic_symbol (info, &eh->elf))
+           return FALSE;
+       }
+
+      if (eh->tls_mask == (TLS_TLS | TLS_LD)
+         && !(eh->elf.elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+       /* If just an LD reloc, we'll just use htab->tlsld_got.offset.  */
+       eh->elf.got.offset = (bfd_vma) -1;
+      else
+       {
+         bfd_boolean dyn;
+         eh->elf.got.offset = htab->got->_raw_size;
+         if ((eh->tls_mask & TLS_TLS) != 0)
+           {
+             if ((eh->tls_mask & TLS_LD) != 0)
+               htab->got->_raw_size += 8;
+             if ((eh->tls_mask & TLS_GD) != 0)
+               htab->got->_raw_size += 8;
+             if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
+               htab->got->_raw_size += 4;
+             if ((eh->tls_mask & TLS_DTPREL) != 0)
+               htab->got->_raw_size += 4;
+           }
+         else
+           htab->got->_raw_size += 4;
+         dyn = htab->elf.dynamic_sections_created;
+         if (info->shared
+             || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
+           {
+             /* All the entries we allocated need relocs.  */
+             htab->relgot->_raw_size
+               += ((htab->got->_raw_size - eh->elf.got.offset) / 4
+                   * sizeof (Elf32_External_Rela));
+             /* Except LD only needs one.  */
+             if ((eh->tls_mask & TLS_LD) != 0)
+               htab->relgot->_raw_size -= sizeof (Elf32_External_Rela);
+           }
+       }
+    }
+  else
+    eh->elf.got.offset = (bfd_vma) -1;
+
+  if (eh->dyn_relocs == NULL)
+    return TRUE;
+
+  /* In the shared -Bsymbolic case, discard space allocated for
+     dynamic pc-relative relocs against symbols which turn out to be
+     defined in regular objects.  For the normal shared case, discard
+     space for relocs that have become local due to symbol visibility
+     changes.  */
+  if (info->shared)
+    {
+      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+         && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
+             || info->symbolic))
+       {
+         struct ppc_elf_dyn_relocs **pp;
+
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
+           {
+             p->count -= p->pc_count;
+             p->pc_count = 0;
+             if (p->count == 0)
+               *pp = p->next;
+             else
+               pp = &p->next;
+           }
+       }
+    }
+  else if (ELIMINATE_COPY_RELOCS)
+    {
+      /* For the non-shared case, discard space for relocs against
+        symbols which turn out to need copy relocs or are not
+        dynamic.  */
+
+      if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+       {
+         /* Make sure this symbol is output as a dynamic symbol.
+            Undefined weak syms won't yet be marked as dynamic.  */
+         if (h->dynindx == -1
+             && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+           {
+             if (! bfd_elf64_link_record_dynamic_symbol (info, h))
+               return FALSE;
+           }
+
+         /* If that succeeded, we know we'll be keeping all the
+            relocs.  */
+         if (h->dynindx != -1)
+           goto keep;
+       }
 
-  if (h->root.type == bfd_link_hash_warning)
-    /* When warning symbols are created, they **replace** the "real"
-       entry in the hash table, thus we never get to see the real
-       symbol in a hash traversal.  So look at it now.  */
-    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+      eh->dyn_relocs = NULL;
 
-  for (p = ppc_elf_hash_entry (h)->dyn_relocs; p != NULL; p = p->next)
+    keep: ;
+    }
+
+  /* Finally, allocate space.  */
+  for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
       asection *sreloc = elf_section_data (p->sec)->sreloc;
       sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
@@ -2124,9 +2886,8 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
      bfd *output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *info;
 {
-  bfd *dynobj;
+  struct ppc_elf_link_hash_table *htab;
   asection *s;
-  bfd_boolean plt;
   bfd_boolean relocs;
   bfd *ibfd;
 
@@ -2134,43 +2895,42 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
   fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
 #endif
 
-  dynobj = elf_hash_table (info)->dynobj;
-  BFD_ASSERT (dynobj != NULL);
+  htab = ppc_elf_hash_table (info);
+  BFD_ASSERT (htab->elf.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");
+         s = bfd_get_section_by_name (htab->elf.dynobj, ".interp");
          BFD_ASSERT (s != NULL);
          s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
          s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
        }
     }
-  else
+
+  if (htab->tlsld_got.refcount > 0)
     {
-      /* 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;
-       }
+      htab->tlsld_got.offset = htab->got->_raw_size;
+      htab->got->_raw_size += 8;
+      if (info->shared)
+       htab->relgot->_raw_size += sizeof (Elf32_External_Rela);
     }
+  else
+    htab->tlsld_got.offset = (bfd_vma) -1;
 
-  /* Allocate space for local sym dynamic relocs.  */
+  /* Set up .got offsets for local syms, and space for local dynamic
+     relocs.  */
   for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
     {
+      bfd_signed_vma *local_got;
+      bfd_signed_vma *end_local_got;
+      char *lgot_masks;
+      bfd_size_type locsymcount;
+      Elf_Internal_Shdr *symtab_hdr;
+      asection *srel;
+
       if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
        continue;
 
@@ -2179,9 +2939,9 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
          struct ppc_elf_dyn_relocs *p;
 
          for (p = ((struct ppc_elf_dyn_relocs *)
-                  elf_section_data (s)->local_dynrel);
-             p != NULL;
-             p = p->next)
+                   elf_section_data (s)->local_dynrel);
+              p != NULL;
+              p = p->next)
            {
              if (!bfd_is_abs_section (p->sec)
                  && bfd_is_abs_section (p->sec->output_section))
@@ -2202,45 +2962,76 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
                }
            }
        }
+
+      local_got = elf_local_got_refcounts (ibfd);
+      if (!local_got)
+       continue;
+
+      symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+      locsymcount = symtab_hdr->sh_info;
+      end_local_got = local_got + locsymcount;
+      lgot_masks = (char *) end_local_got;
+      s = htab->got;
+      srel = htab->relgot;
+      for (; local_got < end_local_got; ++local_got, ++lgot_masks)
+       if (*local_got > 0)
+         {
+           if (*lgot_masks == (TLS_TLS | TLS_LD))
+             {
+               /* If just an LD reloc, we'll just use
+                  htab->tlsld_got.offset.  */
+               if (htab->tlsld_got.offset == (bfd_vma) -1)
+                 {
+                   htab->tlsld_got.offset = s->_raw_size;
+                   s->_raw_size += 8;
+                   if (info->shared)
+                     srel->_raw_size += sizeof (Elf32_External_Rela);
+                 }
+               *local_got = (bfd_vma) -1;
+             }
+           else
+             {
+               *local_got = s->_raw_size;
+               if ((*lgot_masks & TLS_TLS) != 0)
+                 {
+                   if ((*lgot_masks & TLS_GD) != 0)
+                     s->_raw_size += 8;
+                   if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
+                     s->_raw_size += 4;
+                   if ((*lgot_masks & TLS_DTPREL) != 0)
+                     s->_raw_size += 4;
+                 }
+               else
+                 s->_raw_size += 4;
+               if (info->shared)
+                 srel->_raw_size += ((s->_raw_size - *local_got) / 4
+                                     * sizeof (Elf32_External_Rela));
+             }
+         }
+       else
+         *local_got = (bfd_vma) -1;
     }
 
   /* Allocate space for global sym dynamic relocs.  */
-  elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, NULL);
+  elf_link_hash_traverse (elf_hash_table (info), allocate_dynrelocs, info);
 
-  /* The check_relocs and adjust_dynamic_symbol entry points have
-     determined the sizes of the various dynamic sections.  Allocate
-     memory for them.  */
-  plt = FALSE;
+  /* We've now determined the sizes of the various dynamic sections.
+     Allocate memory for them.  */
   relocs = FALSE;
-  for (s = dynobj->sections; s != NULL; s = s->next)
+  for (s = htab->elf.dynobj->sections; s != NULL; s = s->next)
     {
-      const char *name;
-      bfd_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 == htab->plt
+         || s == htab->got
+         || (htab->sdata != NULL && s == htab->sdata->section)
+         || (htab->sdata2 != NULL && s == htab->sdata2->section))
        {
-         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;
-           }
+         /* Strip this section if we don't need it; see the
+            comment below.  */
        }
-      else if (strncmp (name, ".rela", 5) == 0)
+      else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
        {
          if (s->_raw_size == 0)
            {
@@ -2253,7 +3044,6 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
                 adjust_dynamic_symbol is called, and it is that
                 function which decides whether anything needs to go
                 into these sections.  */
-             strip = TRUE;
            }
          else
            {
@@ -2265,27 +3055,25 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
              s->reloc_count = 0;
            }
        }
-      else if (strcmp (name, ".got") != 0
-              && strcmp (name, ".sdata") != 0
-              && strcmp (name, ".sdata2") != 0)
+      else
        {
          /* It's not one of our sections, so don't allocate space.  */
          continue;
        }
 
-      if (strip)
+      if (s->_raw_size == 0)
        {
          _bfd_strip_section_from_output (info, s);
          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)
+      s->contents = (bfd_byte *) bfd_zalloc (htab->elf.dynobj, s->_raw_size);
+      if (s->contents == NULL)
        return FALSE;
     }
 
-  if (elf_hash_table (info)->dynamic_sections_created)
+  if (htab->elf.dynamic_sections_created)
     {
       /* Add some entries to the .dynamic section.  We fill in the
         values later, in ppc_elf_finish_dynamic_sections, but we
@@ -2301,7 +3089,7 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
            return FALSE;
        }
 
-      if (plt)
+      if (htab->plt != NULL && htab->plt->_raw_size != 0)
        {
          if (!add_dynamic_entry (DT_PLTGOT, 0)
              || !add_dynamic_entry (DT_PLTRELSZ, 0)
@@ -2335,6 +3123,45 @@ ppc_elf_size_dynamic_sections (output_bfd, info)
   return TRUE;
 }
 \f
+static bfd_boolean
+update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type)
+     bfd *abfd;
+     Elf_Internal_Shdr *symtab_hdr;
+     unsigned long r_symndx;
+     int tls_type;
+{
+  bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd);
+  char *local_got_tls_masks;
+
+  if (local_got_refcounts == NULL)
+    {
+      bfd_size_type size = symtab_hdr->sh_info;
+
+      size *= sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks);
+      local_got_refcounts = (bfd_signed_vma *) bfd_zalloc (abfd, size);
+      if (local_got_refcounts == NULL)
+       return FALSE;
+      elf_local_got_refcounts (abfd) = local_got_refcounts;
+    }
+
+  local_got_refcounts[r_symndx] += 1;
+  local_got_tls_masks = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+  local_got_tls_masks[r_symndx] |= tls_type;
+  return TRUE;
+}
+
+static void
+bad_shared_reloc (abfd, r_type)
+     bfd *abfd;
+     enum elf_ppc_reloc_type r_type;
+{
+  (*_bfd_error_handler)
+    (_("%s: relocation %s cannot be used when making a shared object"),
+     bfd_archive_filename (abfd),
+     ppc_elf_howto_table[(int) r_type]->name);
+  bfd_set_error (bfd_error_bad_value);
+}
+
 /* Look through the relocs for a section during the first phase, and
    allocate space in the global offset table or procedure linkage
    table.  */
@@ -2346,17 +3173,12 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
-  bfd *dynobj;
+  struct ppc_elf_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
-  struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
+  struct elf_link_hash_entry **sym_hashes;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
-  bfd_signed_vma *local_got_refcounts;
-  elf_linker_section_t *sdata;
-  elf_linker_section_t *sdata2;
   asection *sreloc;
-  asection *sgot = NULL;
-  asection *srelgot = NULL;
 
   if (info->relocateable)
     return TRUE;
@@ -2370,36 +3192,38 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
   /* Create the linker generated sections all the time so that the
      special symbols are created.  */
 
-  if ((sdata = elf_linker_section (abfd, LINKER_SECTION_SDATA)) == NULL)
+  htab = ppc_elf_hash_table (info);
+  if (htab->sdata == NULL)
     {
-      sdata = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA);
-      if (!sdata)
+      htab->sdata = elf_linker_section (abfd, LINKER_SECTION_SDATA);
+      if (htab->sdata == NULL)
+       htab->sdata = ppc_elf_create_linker_section (abfd, info,
+                                                    LINKER_SECTION_SDATA);
+      if (htab->sdata == NULL)
        return FALSE;
     }
 
-  if ((sdata2 = elf_linker_section (abfd, LINKER_SECTION_SDATA2)) == NULL)
+  if (htab->sdata2 == NULL)
     {
-      sdata2 = ppc_elf_create_linker_section (abfd, info, LINKER_SECTION_SDATA2);
-      if (!sdata2)
+      htab->sdata2 = elf_linker_section (abfd, LINKER_SECTION_SDATA2);
+      if (htab->sdata2 == NULL)
+       htab->sdata2 = ppc_elf_create_linker_section (abfd, info,
+                                                     LINKER_SECTION_SDATA2);
+      if (htab->sdata2 == NULL)
        return FALSE;
     }
 
-  dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
-  local_got_refcounts = elf_local_got_refcounts (abfd);
-
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);
-  if (!elf_bad_symtab (abfd))
-    sym_hashes_end -= symtab_hdr->sh_info;
-
   sreloc = NULL;
 
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
       unsigned long r_symndx;
+      enum elf_ppc_reloc_type r_type;
       struct elf_link_hash_entry *h;
+      int tls_type = 0;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
@@ -2412,182 +3236,118 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
         startup code.  */
       if (h && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
        {
-         if (sgot == NULL)
+         if (htab->got == NULL)
            {
-             if (dynobj == NULL)
-               elf_hash_table (info)->dynobj = dynobj = abfd;
-             sgot = ppc_elf_create_got (dynobj, info);
-             if (sgot == NULL)
+             if (htab->elf.dynobj == NULL)
+               htab->elf.dynobj = abfd;
+             if (!ppc_elf_create_got (htab->elf.dynobj, info))
                return FALSE;
            }
        }
 
-      switch (ELF32_R_TYPE (rel->r_info))
+      r_type = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel->r_info);
+      switch (r_type)
        {
-       /* GOT16 relocations */
+       case R_PPC_GOT_TLSLD16:
+       case R_PPC_GOT_TLSLD16_LO:
+       case R_PPC_GOT_TLSLD16_HI:
+       case R_PPC_GOT_TLSLD16_HA:
+         htab->tlsld_got.refcount += 1;
+         tls_type = TLS_TLS | TLS_LD;
+         goto dogottls;
+
+       case R_PPC_GOT_TLSGD16:
+       case R_PPC_GOT_TLSGD16_LO:
+       case R_PPC_GOT_TLSGD16_HI:
+       case R_PPC_GOT_TLSGD16_HA:
+         tls_type = TLS_TLS | TLS_GD;
+         goto dogottls;
+
+       case R_PPC_GOT_TPREL16:
+       case R_PPC_GOT_TPREL16_LO:
+       case R_PPC_GOT_TPREL16_HI:
+       case R_PPC_GOT_TPREL16_HA:
+         if (info->shared)
+           info->flags |= DF_STATIC_TLS;
+         tls_type = TLS_TLS | TLS_TPREL;
+         goto dogottls;
+
+       case R_PPC_GOT_DTPREL16:
+       case R_PPC_GOT_DTPREL16_LO:
+       case R_PPC_GOT_DTPREL16_HI:
+       case R_PPC_GOT_DTPREL16_HA:
+         tls_type = TLS_TLS | TLS_DTPREL;
+       dogottls:
+         sec->has_tls_reloc = 1;
+         /* Fall thru */
+
+         /* GOT16 relocations */
        case R_PPC_GOT16:
        case R_PPC_GOT16_LO:
        case R_PPC_GOT16_HI:
        case R_PPC_GOT16_HA:
          /* This symbol requires a global offset table entry.  */
-
-         if (sgot == NULL)
+         if (htab->got == NULL)
            {
-             if (dynobj == NULL)
-               elf_hash_table (info)->dynobj = dynobj = abfd;
-             sgot = ppc_elf_create_got (dynobj, info);
-             if (sgot == NULL)
+             if (htab->elf.dynobj == NULL)
+               htab->elf.dynobj = abfd;
+             if (!ppc_elf_create_got (htab->elf.dynobj, info))
                return FALSE;
            }
-
-         if (srelgot == NULL
-             && (h != NULL || info->shared))
-           {
-             srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-             if (srelgot == NULL)
-               {
-                 srelgot = bfd_make_section (dynobj, ".rela.got");
-                 if (srelgot == NULL
-                     || ! bfd_set_section_flags (dynobj, srelgot,
-                                                 (SEC_ALLOC
-                                                  | SEC_LOAD
-                                                  | SEC_HAS_CONTENTS
-                                                  | SEC_IN_MEMORY
-                                                  | SEC_LINKER_CREATED
-                                                  | SEC_READONLY))
-                     || ! bfd_set_section_alignment (dynobj, srelgot, 2))
-                   return FALSE;
-               }
-           }
-
          if (h != NULL)
            {
-             if (h->got.refcount == 0)
-               {
-                 /* 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;
-
-                 /* Allocate space in the .got.  */
-                 sgot->_raw_size += 4;
-                 /* Allocate relocation space.  */
-                 srelgot->_raw_size += sizeof (Elf32_External_Rela);
-               }
-             h->got.refcount++;
+             h->got.refcount += 1;
+             ppc_elf_hash_entry (h)->tls_mask |= tls_type;
            }
          else
-           {
-             /* This is a global offset table entry for a local symbol.  */
-             if (local_got_refcounts == NULL)
-               {
-                 bfd_size_type size;
-
-                 size = symtab_hdr->sh_info;
-                 size *= sizeof (bfd_signed_vma);
-                 local_got_refcounts
-                   = (bfd_signed_vma *) bfd_zalloc (abfd, size);
-                 if (local_got_refcounts == NULL)
-                   return FALSE;
-                 elf_local_got_refcounts (abfd) = local_got_refcounts;
-               }
-             if (local_got_refcounts[r_symndx] == 0)
-               {
-                 sgot->_raw_size += 4;
-
-                 /* If we are generating a shared object, we need to
-                     output a R_PPC_RELATIVE reloc so that the
-                     dynamic linker can adjust this GOT entry.  */
-                 if (info->shared)
-                   srelgot->_raw_size += sizeof (Elf32_External_Rela);
-               }
-             local_got_refcounts[r_symndx]++;
-           }
+           /* This is a global offset table entry for a local symbol.  */
+           if (!update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type))
+             return FALSE;
          break;
 
-       /* Indirect .sdata relocation */
+         /* Indirect .sdata relocation.  */
        case R_PPC_EMB_SDAI16:
          if (info->shared)
            {
-             ((*_bfd_error_handler)
-              (_("%s: relocation %s cannot be used when making a shared object"),
-               bfd_archive_filename (abfd), "R_PPC_EMB_SDAI16"));
+             bad_shared_reloc (abfd, r_type);
              return FALSE;
            }
-
-         if (srelgot == NULL && (h != NULL || info->shared))
-           {
-             srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-             if (srelgot == NULL)
-               {
-                 srelgot = bfd_make_section (dynobj, ".rela.got");
-                 if (srelgot == NULL
-                     || ! bfd_set_section_flags (dynobj, srelgot,
-                                                 (SEC_ALLOC
-                                                  | SEC_LOAD
-                                                  | SEC_HAS_CONTENTS
-                                                  | SEC_IN_MEMORY
-                                                  | SEC_LINKER_CREATED
-                                                  | SEC_READONLY))
-                     || ! bfd_set_section_alignment (dynobj, srelgot, 2))
-                   return FALSE;
-               }
-           }
-
-         if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata, h, rel))
+         if (!bfd_elf32_create_pointer_linker_section (abfd, info,
+                                                       htab->sdata, h, rel))
            return FALSE;
-
          break;
 
-       /* Indirect .sdata2 relocation */
+         /* Indirect .sdata2 relocation.  */
        case R_PPC_EMB_SDA2I16:
          if (info->shared)
            {
-             ((*_bfd_error_handler)
-              (_("%s: relocation %s cannot be used when making a shared object"),
-               bfd_archive_filename (abfd), "R_PPC_EMB_SDA2I16"));
+             bad_shared_reloc (abfd, r_type);
              return FALSE;
            }
-
-         if (srelgot == NULL && (h != NULL || info->shared))
-           {
-             srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-             if (srelgot == NULL)
-               {
-                 srelgot = bfd_make_section (dynobj, ".rela.got");
-                 if (srelgot == NULL
-                     || ! bfd_set_section_flags (dynobj, srelgot,
-                                                 (SEC_ALLOC
-                                                  | SEC_LOAD
-                                                  | SEC_HAS_CONTENTS
-                                                  | SEC_IN_MEMORY
-                                                  | SEC_LINKER_CREATED
-                                                  | SEC_READONLY))
-                     || ! bfd_set_section_alignment (dynobj, srelgot, 2))
-                   return FALSE;
-               }
-           }
-
-         if (!bfd_elf32_create_pointer_linker_section (abfd, info, sdata2, h, rel))
+         if (!bfd_elf32_create_pointer_linker_section (abfd, info,
+                                                       htab->sdata2, h, rel))
            return FALSE;
-
          break;
 
        case R_PPC_SDAREL16:
        case R_PPC_EMB_SDA2REL:
        case R_PPC_EMB_SDA21:
+       case R_PPC_EMB_RELSDA:
+       case R_PPC_EMB_NADDR32:
+       case R_PPC_EMB_NADDR16:
+       case R_PPC_EMB_NADDR16_LO:
+       case R_PPC_EMB_NADDR16_HI:
+       case R_PPC_EMB_NADDR16_HA:
          if (info->shared)
            {
-             ((*_bfd_error_handler)
-              (_("%s: relocation %s cannot be used when making a shared object"),
-               bfd_archive_filename (abfd),
-               ppc_elf_howto_table[(int) ELF32_R_TYPE (rel->r_info)]->name));
+             bad_shared_reloc (abfd, r_type);
              return FALSE;
            }
          break;
 
        case R_PPC_PLT32:
        case R_PPC_PLTREL24:
+       case R_PPC_PLTREL32:
        case R_PPC_PLT16_LO:
        case R_PPC_PLT16_HI:
        case R_PPC_PLT16_HA:
@@ -2595,25 +3355,19 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
          fprintf (stderr, "Reloc requires a PLT entry\n");
 #endif
          /* This symbol requires a procedure linkage table entry.  We
-             actually build the entry in adjust_dynamic_symbol,
-             because this might be a case of linking PIC code without
-             linking in any dynamic objects, in which case we don't
-             need to generate a procedure linkage table after all.  */
+            actually build the entry in finish_dynamic_symbol,
+            because this might be a case of linking PIC code without
+            linking in any dynamic objects, in which case we don't
+            need to generate a procedure linkage table after all.  */
 
          if (h == NULL)
            {
              /* It does not make sense to have a procedure linkage
-                 table entry for a local symbol.  */
+                table entry for a local symbol.  */
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
            }
 
-         /* 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;
-           }
          h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
          h->plt.refcount++;
          break;
@@ -2625,9 +3379,37 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
        case R_PPC_SECTOFF_LO:
        case R_PPC_SECTOFF_HI:
        case R_PPC_SECTOFF_HA:
+       case R_PPC_DTPREL16:
+       case R_PPC_DTPREL16_LO:
+       case R_PPC_DTPREL16_HI:
+       case R_PPC_DTPREL16_HA:
+       case R_PPC_TOC16:
+         break;
+
+         /* This are just markers.  */
+       case R_PPC_TLS:
+       case R_PPC_EMB_MRKREF:
+       case R_PPC_NONE:
+       case R_PPC_max:
          break;
 
-         /* This refers only to functions defined in the shared library */
+         /* These should only appear in dynamic objects.  */
+       case R_PPC_COPY:
+       case R_PPC_GLOB_DAT:
+       case R_PPC_JMP_SLOT:
+       case R_PPC_RELATIVE:
+         break;
+
+         /* These aren't handled yet.  We'll report an error later.  */
+       case R_PPC_ADDR30:
+       case R_PPC_EMB_RELSEC16:
+       case R_PPC_EMB_RELST_LO:
+       case R_PPC_EMB_RELST_HI:
+       case R_PPC_EMB_RELST_HA:
+       case R_PPC_EMB_BIT_FLD:
+         break;
+
+         /* This refers only to functions defined in the shared library.  */
        case R_PPC_LOCAL24PC:
          break;
 
@@ -2645,6 +3427,25 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
            return FALSE;
          break;
 
+         /* We shouldn't really be seeing these.  */
+       case R_PPC_TPREL32:
+         if (info->shared)
+           info->flags |= DF_STATIC_TLS;
+         goto dodyn;
+
+         /* Nor these.  */
+       case R_PPC_DTPMOD32:
+       case R_PPC_DTPREL32:
+         goto dodyn;
+
+       case R_PPC_TPREL16:
+       case R_PPC_TPREL16_LO:
+       case R_PPC_TPREL16_HI:
+       case R_PPC_TPREL16_HA:
+         if (info->shared)
+           info->flags |= DF_STATIC_TLS;
+         goto dodyn;
+
          /* When creating a shared object, we must copy these
             relocs into the output file.  We create a reloc
             section in dynobj and make room for the reloc.  */
@@ -2659,15 +3460,71 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
            break;
          /* fall through */
 
-       default:
-         if (info->shared)
+       case R_PPC_ADDR32:
+       case R_PPC_ADDR24:
+       case R_PPC_ADDR16:
+       case R_PPC_ADDR16_LO:
+       case R_PPC_ADDR16_HI:
+       case R_PPC_ADDR16_HA:
+       case R_PPC_ADDR14:
+       case R_PPC_ADDR14_BRTAKEN:
+       case R_PPC_ADDR14_BRNTAKEN:
+       case R_PPC_UADDR32:
+       case R_PPC_UADDR16:
+         if (h != NULL && !info->shared)
+           {
+             /* We may need a plt entry if the symbol turns out to be
+                a function defined in a dynamic object.  */
+             h->plt.refcount++;
+
+             /* We may need a copy reloc too.  */
+             h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+           }
+
+       dodyn:
+         /* If we are creating a shared library, and this is a reloc
+            against a global symbol, or a non PC relative reloc
+            against a local symbol, then we need to copy the reloc
+            into the shared library.  However, if we are linking with
+            -Bsymbolic, we do not need to copy a reloc against a
+            global symbol which is defined in an object we are
+            including in the link (i.e., DEF_REGULAR is set).  At
+            this point we have not seen all the input files, so it is
+            possible that DEF_REGULAR is not set now but will be set
+            later (it is never cleared).  In case of a weak definition,
+            DEF_REGULAR may be cleared later by a strong definition in
+            a shared library.  We account for that possibility below by
+            storing information in the dyn_relocs field of the hash
+            table entry.  A similar situation occurs when creating
+            shared libraries and symbol visibility changes render the
+            symbol local.
+
+            If on the other hand, we are creating an executable, we
+            may need to keep relocations for symbols satisfied by a
+            dynamic library if we manage to avoid copy relocs for the
+            symbol.  */
+         if ((info->shared
+              && (MUST_BE_DYN_RELOC (r_type)
+                  || (h != NULL
+                      && (! info->symbolic
+                          || h->root.type == bfd_link_hash_defweak
+                          || (h->elf_link_hash_flags
+                              & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+             || (ELIMINATE_COPY_RELOCS
+                 && !info->shared
+                 && (sec->flags & SEC_ALLOC) != 0
+                 && h != NULL
+                 && (h->root.type == bfd_link_hash_defweak
+                     || (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_DEF_REGULAR) == 0)))
            {
              struct ppc_elf_dyn_relocs *p;
              struct ppc_elf_dyn_relocs **head;
 
 #ifdef DEBUG
              fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n",
-                      (h && h->root.root.string) ? h->root.root.string : "<unknown>");
+                      (h && h->root.root.string
+                       ? h->root.root.string : "<unknown>"));
 #endif
              if (sreloc == NULL)
                {
@@ -2684,19 +3541,21 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
                              && strcmp (bfd_get_section_name (abfd, sec),
                                         name + 5) == 0);
 
-                 sreloc = bfd_get_section_by_name (dynobj, name);
+                 sreloc = bfd_get_section_by_name (htab->elf.dynobj, name);
                  if (sreloc == NULL)
                    {
                      flagword flags;
 
-                     sreloc = bfd_make_section (dynobj, name);
+                     sreloc = bfd_make_section (htab->elf.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))
+                         || ! bfd_set_section_flags (htab->elf.dynobj,
+                                                     sreloc, flags)
+                         || ! bfd_set_section_alignment (htab->elf.dynobj,
+                                                         sreloc, 2))
                        return FALSE;
                    }
                  elf_section_data (sec)->sreloc = sreloc;
@@ -2715,9 +3574,8 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
                     easily.  Oh well.  */
 
                  asection *s;
-                 s = (bfd_section_from_r_symndx
-                      (abfd, &ppc_elf_hash_table (info)->sym_sec,
-                       sec, r_symndx));
+                 s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+                                                sec, r_symndx);
                  if (s == NULL)
                    return FALSE;
 
@@ -2729,16 +3587,19 @@ ppc_elf_check_relocs (abfd, info, sec, relocs)
              if (p == NULL || p->sec != sec)
                {
                  p = ((struct ppc_elf_dyn_relocs *)
-                      bfd_alloc (elf_hash_table (info)->dynobj, sizeof *p));
+                      bfd_alloc (htab->elf.dynobj, sizeof *p));
                  if (p == NULL)
                    return FALSE;
                  p->next = *head;
                  *head = p;
                  p->sec = sec;
                  p->count = 0;
+                 p->pc_count = 0;
                }
 
-             p->count++;
+             p->count += 1;
+             if (!MUST_BE_DYN_RELOC (r_type))
+               p->pc_count += 1;
            }
 
          break;
@@ -2788,85 +3649,348 @@ ppc_elf_gc_mark_hook (sec, info, rel, h, sym)
   return NULL;
 }
 
-/* Update the got entry reference counts for the section being removed.  */
+/* Update the got, plt and dynamic reloc reference counts for the
+   section being removed.  */
 
 static bfd_boolean
 ppc_elf_gc_sweep_hook (abfd, info, sec, relocs)
      bfd *abfd;
-     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
+  struct ppc_elf_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  struct elf_link_hash_entry *h;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
+  htab = ppc_elf_hash_table (info);
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
   local_got_refcounts = elf_local_got_refcounts (abfd);
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
-    switch (ELF32_R_TYPE (rel->r_info))
-      {
-      case R_PPC_GOT16:
-      case R_PPC_GOT16_LO:
-      case R_PPC_GOT16_HI:
-      case R_PPC_GOT16_HA:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->got.refcount > 0)
-             h->got.refcount--;
-         }
-       else if (local_got_refcounts != NULL)
-         {
-           if (local_got_refcounts[r_symndx] > 0)
-             local_got_refcounts[r_symndx]--;
-         }
-        break;
-
-      case R_PPC_PLT32:
-      case R_PPC_PLTREL24:
-      case R_PPC_PLT16_LO:
-      case R_PPC_PLT16_HI:
-      case R_PPC_PLT16_HA:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->plt.refcount > 0)
-             h->plt.refcount--;
-         }
-       /* Fall through */
+    {
+      unsigned long r_symndx;
+      enum elf_ppc_reloc_type r_type;
+      struct elf_link_hash_entry *h = NULL;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct ppc_elf_dyn_relocs **pp, *p;
+         struct ppc_elf_link_hash_entry *eh;
+
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct ppc_elf_link_hash_entry *) h;
+
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
+
+      r_type = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel->r_info);
+      switch (r_type)
+       {
+       case R_PPC_GOT_TLSLD16:
+       case R_PPC_GOT_TLSLD16_LO:
+       case R_PPC_GOT_TLSLD16_HI:
+       case R_PPC_GOT_TLSLD16_HA:
+         htab->tlsld_got.refcount -= 1;
+         /* Fall thru */
+
+       case R_PPC_GOT_TLSGD16:
+       case R_PPC_GOT_TLSGD16_LO:
+       case R_PPC_GOT_TLSGD16_HI:
+       case R_PPC_GOT_TLSGD16_HA:
+       case R_PPC_GOT_TPREL16:
+       case R_PPC_GOT_TPREL16_LO:
+       case R_PPC_GOT_TPREL16_HI:
+       case R_PPC_GOT_TPREL16_HA:
+       case R_PPC_GOT_DTPREL16:
+       case R_PPC_GOT_DTPREL16_LO:
+       case R_PPC_GOT_DTPREL16_HI:
+       case R_PPC_GOT_DTPREL16_HA:
+       case R_PPC_GOT16:
+       case R_PPC_GOT16_LO:
+       case R_PPC_GOT16_HI:
+       case R_PPC_GOT16_HA:
+         if (h != NULL)
+           {
+             if (h->got.refcount > 0)
+               h->got.refcount--;
+           }
+         else if (local_got_refcounts != NULL)
+           {
+             if (local_got_refcounts[r_symndx] > 0)
+               local_got_refcounts[r_symndx]--;
+           }
+         break;
+
+       case R_PPC_REL24:
+       case R_PPC_REL14:
+       case R_PPC_REL14_BRTAKEN:
+       case R_PPC_REL14_BRNTAKEN:
+       case R_PPC_REL32:
+         if (h == NULL
+             || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
+             || SYMBOL_REFERENCES_LOCAL (info, h))
+           break;
+         /* Fall thru */
+
+       case R_PPC_ADDR32:
+       case R_PPC_ADDR24:
+       case R_PPC_ADDR16:
+       case R_PPC_ADDR16_LO:
+       case R_PPC_ADDR16_HI:
+       case R_PPC_ADDR16_HA:
+       case R_PPC_ADDR14:
+       case R_PPC_ADDR14_BRTAKEN:
+       case R_PPC_ADDR14_BRNTAKEN:
+       case R_PPC_UADDR32:
+       case R_PPC_UADDR16:
+       case R_PPC_PLT32:
+       case R_PPC_PLTREL24:
+       case R_PPC_PLT16_LO:
+       case R_PPC_PLT16_HI:
+       case R_PPC_PLT16_HA:
+         if (h != NULL)
+           {
+             if (h->plt.refcount > 0)
+               h->plt.refcount--;
+           }
+         break;
+
+       default:
+         break;
+       }
+    }
+  return TRUE;
+}
+
+/* Set htab->tls_sec and htab->tls_get_addr.  */
+
+bfd_boolean
+ppc_elf_tls_setup (obfd, info)
+     bfd *obfd;
+     struct bfd_link_info *info;
+{
+  asection *tls;
+  struct ppc_elf_link_hash_table *htab;
+
+  htab = ppc_elf_hash_table (info);
+  htab->tls_get_addr = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
+                                            FALSE, FALSE, TRUE);
+
+  for (tls = obfd->sections; tls != NULL; tls = tls->next)
+    if ((tls->flags & (SEC_THREAD_LOCAL | SEC_LOAD))
+       == (SEC_THREAD_LOCAL | SEC_LOAD))
+      break;
+  htab->tls_sec = tls;
+
+  return tls != NULL;
+}
 
-      default:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
+/* Run through all the TLS relocs looking for optimization
+   opportunities.  */
+
+bfd_boolean
+ppc_elf_tls_optimize (obfd, info)
+     bfd *obfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
+{
+  bfd *ibfd;
+  asection *sec;
+  struct ppc_elf_link_hash_table *htab;
+
+  if (info->relocateable || info->shared)
+    return TRUE;
+
+  htab = ppc_elf_hash_table (info);
+  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+    {
+      Elf_Internal_Sym *locsyms = NULL;
+      Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+
+      for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+       if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
          {
-           struct ppc_elf_dyn_relocs **pp, *p;
+           Elf_Internal_Rela *relstart, *rel, *relend;
+           int expecting_tls_get_addr;
+
+           /* Read the relocations.  */
+           relstart = _bfd_elf32_link_read_relocs (ibfd, sec, (PTR) NULL,
+                                                   (Elf_Internal_Rela *) NULL,
+                                                   info->keep_memory);
+           if (relstart == NULL)
+             return FALSE;
 
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+           expecting_tls_get_addr = 0;
+           relend = relstart + sec->reloc_count;
+           for (rel = relstart; rel < relend; rel++)
+             {
+               enum elf_ppc_reloc_type r_type;
+               unsigned long r_symndx;
+               struct elf_link_hash_entry *h = NULL;
+               char *tls_mask;
+               char tls_set, tls_clear;
+               bfd_boolean is_local;
+
+               r_symndx = ELF32_R_SYM (rel->r_info);
+               if (r_symndx >= symtab_hdr->sh_info)
+                 {
+                   struct elf_link_hash_entry **sym_hashes;
 
-           for (pp = &ppc_elf_hash_entry (h)->dyn_relocs;
-                (p = *pp) != NULL;
-                pp = &p->next)
-             if (p->sec == sec)
-               {
-                 if (--p->count == 0)
-                   *pp = p->next;
-                 break;
-               }
+                   sym_hashes = elf_sym_hashes (ibfd);
+                   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;
+                 }
+
+               is_local = FALSE;
+               if (h == NULL
+                   || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+                 is_local = TRUE;
+
+               r_type = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel->r_info);
+               switch (r_type)
+                 {
+                 case R_PPC_GOT_TLSLD16:
+                 case R_PPC_GOT_TLSLD16_LO:
+                 case R_PPC_GOT_TLSLD16_HI:
+                 case R_PPC_GOT_TLSLD16_HA:
+                   /* These relocs should never be against a symbol
+                      defined in a shared lib.  Leave them alone if
+                      that turns out to be the case.  */
+                   expecting_tls_get_addr = 0;
+                   htab->tlsld_got.refcount -= 1;
+                   if (!is_local)
+                     continue;
+
+                   /* LD -> LE */
+                   tls_set = 0;
+                   tls_clear = TLS_LD;
+                   expecting_tls_get_addr = 1;
+                   break;
+
+                 case R_PPC_GOT_TLSGD16:
+                 case R_PPC_GOT_TLSGD16_LO:
+                 case R_PPC_GOT_TLSGD16_HI:
+                 case R_PPC_GOT_TLSGD16_HA:
+                   if (is_local)
+                     /* GD -> LE */
+                     tls_set = 0;
+                   else
+                     /* GD -> IE */
+                     tls_set = TLS_TLS | TLS_TPRELGD;
+                   tls_clear = TLS_GD;
+                   expecting_tls_get_addr = 1;
+                   break;
+
+                 case R_PPC_GOT_TPREL16:
+                 case R_PPC_GOT_TPREL16_LO:
+                 case R_PPC_GOT_TPREL16_HI:
+                 case R_PPC_GOT_TPREL16_HA:
+                   expecting_tls_get_addr = 0;
+                   if (is_local)
+                     {
+                       /* IE -> LE */
+                       tls_set = 0;
+                       tls_clear = TLS_TPREL;
+                       break;
+                     }
+                   else
+                     continue;
+
+                 case R_PPC_REL14:
+                 case R_PPC_REL14_BRTAKEN:
+                 case R_PPC_REL14_BRNTAKEN:
+                 case R_PPC_REL24:
+                   if (expecting_tls_get_addr
+                       && h != NULL
+                       && h == htab->tls_get_addr)
+                     {
+                       if (h->plt.refcount > 0)
+                         h->plt.refcount -= 1;
+                     }
+                   expecting_tls_get_addr = 0;
+                   continue;
+
+                 default:
+                   expecting_tls_get_addr = 0;
+                   continue;
+                 }
+
+               if (h != NULL)
+                 {
+                   if (tls_set == 0)
+                     {
+                       /* We managed to get rid of a got entry.  */
+                       if (h->got.refcount > 0)
+                         h->got.refcount -= 1;
+                     }
+                   tls_mask = &ppc_elf_hash_entry (h)->tls_mask;
+                 }
+               else
+                 {
+                   Elf_Internal_Sym *sym;
+                   bfd_signed_vma *lgot_refs;
+                   char *lgot_masks;
+
+                   if (locsyms == NULL)
+                     {
+                       locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+                       if (locsyms == NULL)
+                         locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
+                                                         symtab_hdr->sh_info,
+                                                         0, NULL, NULL, NULL);
+                       if (locsyms == NULL)
+                         {
+                           if (elf_section_data (sec)->relocs != relstart)
+                             free (relstart);
+                           return FALSE;
+                         }
+                     }
+                   sym = locsyms + r_symndx;
+                   lgot_refs = elf_local_got_refcounts (ibfd);
+                   if (lgot_refs == NULL)
+                     abort ();
+                   if (tls_set == 0)
+                     {
+                       /* We managed to get rid of a got entry.  */
+                       if (lgot_refs[r_symndx] > 0)
+                         lgot_refs[r_symndx] -= 1;
+                     }
+                   lgot_masks = (char *) (lgot_refs + symtab_hdr->sh_info);
+                   tls_mask = &lgot_masks[r_symndx];
+                 }
+
+               *tls_mask |= tls_set;
+               *tls_mask &= ~tls_clear;
+             }
+
+           if (elf_section_data (sec)->relocs != relstart)
+             free (relstart);
          }
-       break;
-      }
 
+      if (locsyms != NULL
+         && (symtab_hdr->contents != (unsigned char *) locsyms))
+       {
+         if (!info->keep_memory)
+           free (locsyms);
+         else
+           symtab_hdr->contents = (unsigned char *) locsyms;
+       }
+    }
   return TRUE;
 }
 \f
@@ -2898,9 +4022,9 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
          bfd_size_type amt;
 
          /* We don't go through bfd_make_section, because we don't
-             want to attach this common section to DYNOBJ.  The linker
-             will move the symbols to the appropriate output section
-             when it defines common symbols.  */
+            want to attach this common section to DYNOBJ.  The linker
+            will move the symbols to the appropriate output section
+            when it defines common symbols.  */
          amt = sizeof (asection);
          sdata->bss_section = (asection *) bfd_zalloc (abfd, amt);
          if (sdata->bss_section == NULL)
@@ -2939,20 +4063,18 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
      struct elf_link_hash_entry *h;
      Elf_Internal_Sym *sym;
 {
-  bfd *dynobj;
+  struct ppc_elf_link_hash_table *htab;
 
 #ifdef DEBUG
   fprintf (stderr, "ppc_elf_finish_dynamic_symbol called for %s",
           h->root.root.string);
 #endif
 
-  dynobj = elf_hash_table (info)->dynobj;
-  BFD_ASSERT (dynobj != NULL);
+  htab = ppc_elf_hash_table (info);
+  BFD_ASSERT (htab->elf.dynobj != NULL);
 
   if (h->plt.offset != (bfd_vma) -1)
     {
-      asection *splt;
-      asection *srela;
       Elf_Internal_Rela rela;
       bfd_byte *loc;
       bfd_vma reloc_index;
@@ -2962,20 +4084,17 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
 #endif
 
       /* This symbol has an entry in the procedure linkage table.  Set
-         it up.  */
+        it up.  */
 
       BFD_ASSERT (h->dynindx != -1);
-
-      splt = bfd_get_section_by_name (dynobj, ".plt");
-      srela = bfd_get_section_by_name (dynobj, ".rela.plt");
-      BFD_ASSERT (splt != NULL && srela != NULL);
+      BFD_ASSERT (htab->plt != NULL && htab->relplt != NULL);
 
       /* We don't need to fill in the .plt.  The ppc dynamic linker
         will fill it in.  */
 
       /* Fill in the entry in the .rela.plt section.  */
-      rela.r_offset = (splt->output_section->vma
-                      + splt->output_offset
+      rela.r_offset = (htab->plt->output_section->vma
+                      + htab->plt->output_offset
                       + h->plt.offset);
       rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT);
       rela.r_addend = 0;
@@ -2983,7 +4102,8 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
       reloc_index = (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_SLOT_SIZE;
       if (reloc_index > PLT_NUM_SINGLE_ENTRIES)
        reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2;
-      loc = srela->contents + reloc_index * sizeof (Elf32_External_Rela);
+      loc = (htab->relplt->contents
+            + reloc_index * sizeof (Elf32_External_Rela));
       bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
 
       if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
@@ -3001,49 +4121,6 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
        }
     }
 
-  if (h->got.offset != (bfd_vma) -1)
-    {
-      asection *sgot;
-      asection *srela;
-      Elf_Internal_Rela rela;
-      bfd_byte *loc;
-
-      /* This symbol has an entry in the global offset table.  Set it
-         up.  */
-
-      sgot = bfd_get_section_by_name (dynobj, ".got");
-      srela = bfd_get_section_by_name (dynobj, ".rela.got");
-      BFD_ASSERT (sgot != NULL && srela != NULL);
-
-      rela.r_offset = (sgot->output_section->vma
-                      + sgot->output_offset
-                      + (h->got.offset &~ (bfd_vma) 1));
-
-      /* If this is a -Bsymbolic link, and the symbol is defined
-        locally, we just want to emit a RELATIVE reloc.  The entry in
-        the global offset table will already have been initialized in
-        the relocate_section function.  */
-      if (info->shared
-         && SYMBOL_REFERENCES_LOCAL (info, h))
-       {
-         rela.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
-         rela.r_addend = (h->root.u.def.value
-                          + h->root.u.def.section->output_section->vma
-                          + h->root.u.def.section->output_offset);
-       }
-      else
-       {
-         BFD_ASSERT ((h->got.offset & 1) == 0);
-         rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_GLOB_DAT);
-         rela.r_addend = 0;
-       }
-
-      bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
-      loc = srela->contents;
-      loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
-      bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
-    }
-
   if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
     {
       asection *s;
@@ -3058,12 +4135,10 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
 
       BFD_ASSERT (h->dynindx != -1);
 
-      if (h->size <= elf_gp_size (dynobj))
-       s = bfd_get_section_by_name (h->root.u.def.section->owner,
-                                    ".rela.sbss");
+      if (h->size <= elf_gp_size (htab->elf.dynobj))
+       s = htab->relsbss;
       else
-       s = bfd_get_section_by_name (h->root.u.def.section->owner,
-                                    ".rela.bss");
+       s = htab->relbss;
       BFD_ASSERT (s != NULL);
 
       rela.r_offset = (h->root.u.def.value
@@ -3096,80 +4171,69 @@ ppc_elf_finish_dynamic_sections (output_bfd, info)
      struct bfd_link_info *info;
 {
   asection *sdyn;
-  bfd *dynobj = elf_hash_table (info)->dynobj;
-  asection *sgot = bfd_get_section_by_name (dynobj, ".got");
+  struct ppc_elf_link_hash_table *htab;
 
 #ifdef DEBUG
   fprintf (stderr, "ppc_elf_finish_dynamic_sections called\n");
 #endif
 
-  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+  htab = ppc_elf_hash_table (info);
+  sdyn = bfd_get_section_by_name (htab->elf.dynobj, ".dynamic");
 
-  if (elf_hash_table (info)->dynamic_sections_created)
+  if (htab->elf.dynamic_sections_created)
     {
-      asection *splt;
       Elf32_External_Dyn *dyncon, *dynconend;
 
-      splt = bfd_get_section_by_name (dynobj, ".plt");
-      BFD_ASSERT (splt != NULL && sdyn != NULL);
+      BFD_ASSERT (htab->plt != 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;
-         bfd_boolean size;
+         asection *s;
 
-         bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn);
+         bfd_elf32_swap_dyn_in (htab->elf.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;
-           }
+           case DT_PLTGOT:
+             s = htab->plt;
+             dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+             break;
+
+           case DT_PLTRELSZ:
+             dyn.d_un.d_val = htab->relplt->_raw_size;
+             break;
 
-         if (name != NULL)
-           {
-             asection *s;
+           case DT_JMPREL:
+             s = htab->relplt;
+             dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+             break;
 
-             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);
+           default:
+             continue;
            }
+
+         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_.  */
-  if (sgot)
+  if (htab->got)
     {
-      unsigned char *contents = sgot->contents;
+      unsigned char *contents = htab->got->contents;
       bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents);
 
       if (sdyn == NULL)
-       bfd_put_32 (output_bfd, (bfd_vma) 0, contents+4);
+       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);
+                   contents + 4);
 
-      elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+      elf_section_data (htab->got->output_section)->this_hdr.sh_entsize = 4;
     }
 
   return TRUE;
@@ -3216,25 +4280,16 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
      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_linker_section_t *sdata = NULL;
-  elf_linker_section_t *sdata2 = NULL;
-  Elf_Internal_Rela *rel = relocs;
-  Elf_Internal_Rela *relend = relocs + input_section->reloc_count;
+  Elf_Internal_Shdr *symtab_hdr;
+  struct elf_link_hash_entry **sym_hashes;
+  struct ppc_elf_link_hash_table *htab;
+  Elf_Internal_Rela *rel;
+  Elf_Internal_Rela *relend;
+  Elf_Internal_Rela outrel;
+  bfd_byte *loc;
   asection *sreloc = NULL;
-  asection *splt;
-  asection *sgot;
   bfd_vma *local_got_offsets;
   bfd_boolean ret = TRUE;
-  long insn;
-
-  if (dynobj)
-    {
-      sdata = elf_linker_section (dynobj, LINKER_SECTION_SDATA);
-      sdata2 = elf_linker_section (dynobj, LINKER_SECTION_SDATA2);
-    }
 
 #ifdef DEBUG
   fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n",
@@ -3251,56 +4306,43 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
     /* Initialize howto table if needed.  */
     ppc_elf_howto_init ();
 
+  htab = ppc_elf_hash_table (info);
   local_got_offsets = elf_local_got_offsets (input_bfd);
-
-  splt = sgot = NULL;
-  if (dynobj != NULL)
-    {
-      splt = bfd_get_section_by_name (dynobj, ".plt");
-      sgot = bfd_get_section_by_name (dynobj, ".got");
-    }
-
+  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+  sym_hashes = elf_sym_hashes (input_bfd);
+  rel = relocs;
+  relend = relocs + input_section->reloc_count;
   for (; rel < relend; rel++)
     {
-      enum elf_ppc_reloc_type r_type   = (enum elf_ppc_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;
+      enum elf_ppc_reloc_type r_type;
+      bfd_vma addend;
+      bfd_reloc_status_type r;
+      Elf_Internal_Sym *sym;
+      asection *sec;
+      struct elf_link_hash_entry *h;
+      const char *sym_name;
       reloc_howto_type *howto;
       unsigned long r_symndx;
       bfd_vma relocation;
-      int will_become_local;
-
-      /* Unknown relocation handling */
-      if ((unsigned) r_type >= (unsigned) R_PPC_max
-         || !ppc_elf_howto_table[(int) r_type])
-       {
-         (*_bfd_error_handler) (_("%s: unknown relocation type %d"),
-                                bfd_archive_filename (input_bfd),
-                                (int) r_type);
-
-         bfd_set_error (bfd_error_bad_value);
-         ret = FALSE;
-         continue;
-       }
-
-      howto = ppc_elf_howto_table[(int) r_type];
+      bfd_vma branch_bit, insn, from;
+      bfd_boolean unresolved_reloc;
+      bfd_boolean warned;
+      unsigned int tls_type, tls_mask, tls_gd;
+
+      r_type = (enum elf_ppc_reloc_type)ELF32_R_TYPE (rel->r_info);
+      sym = (Elf_Internal_Sym *) 0;
+      sec = (asection *) 0;
+      h = (struct elf_link_hash_entry *) 0;
+      unresolved_reloc = FALSE;
+      warned = FALSE;
       r_symndx = ELF32_R_SYM (rel->r_info);
-
       if (r_symndx < symtab_hdr->sh_info)
        {
          sym = local_syms + r_symndx;
          sec = local_sections[r_symndx];
-         sym_name = "<local symbol>";
+         sym_name = bfd_elf_local_sym_name (input_bfd, sym);
 
          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
-         addend = rel->r_addend;
-         /* Relocs to local symbols are always resolved.  */
-         will_become_local = 1;
        }
       else
        {
@@ -3310,127 +4352,551 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            h = (struct elf_link_hash_entry *) h->root.u.i.link;
          sym_name = h->root.root.string;
 
-         /* Can this relocation be resolved immediately?  */
-         will_become_local = SYMBOL_REFERENCES_LOCAL (info, h);
-
+         relocation = 0;
          if (h->root.type == bfd_link_hash_defined
              || h->root.type == bfd_link_hash_defweak)
            {
              sec = h->root.u.def.section;
-             if (((r_type == R_PPC_PLT32
-                   || r_type == R_PPC_PLTREL24)
-                  && splt != NULL
-                  && h->plt.offset != (bfd_vma) -1)
-                 || (r_type == R_PPC_LOCAL24PC
-                     && sec->output_section == NULL)
-                 || ((r_type == R_PPC_GOT16
-                      || r_type == R_PPC_GOT16_LO
-                      || r_type == R_PPC_GOT16_HI
-                      || r_type == R_PPC_GOT16_HA)
-                     && elf_hash_table (info)->dynamic_sections_created
-                     && (! info->shared || ! will_become_local))
-                 || (info->shared
-                     && ! will_become_local
-                     && ((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
-                             && (h->elf_link_hash_flags
-                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
-                     && (r_type == R_PPC_ADDR32
-                         || r_type == R_PPC_ADDR24
-                         || r_type == R_PPC_ADDR16
-                         || r_type == R_PPC_ADDR16_LO
-                         || r_type == R_PPC_ADDR16_HI
-                         || r_type == R_PPC_ADDR16_HA
-                         || r_type == R_PPC_ADDR14
-                         || r_type == R_PPC_ADDR14_BRTAKEN
-                         || r_type == R_PPC_ADDR14_BRNTAKEN
-                         || r_type == R_PPC_COPY
-                         || r_type == R_PPC_GLOB_DAT
-                         || r_type == R_PPC_JMP_SLOT
-                         || r_type == R_PPC_UADDR32
-                         || r_type == R_PPC_UADDR16
-                         || r_type == R_PPC_SDAREL16
-                         || r_type == R_PPC_EMB_NADDR32
-                         || r_type == R_PPC_EMB_NADDR16
-                         || r_type == R_PPC_EMB_NADDR16_LO
-                         || r_type == R_PPC_EMB_NADDR16_HI
-                         || r_type == R_PPC_EMB_NADDR16_HA
-                         || r_type == R_PPC_EMB_SDAI16
-                         || r_type == R_PPC_EMB_SDA2I16
-                         || r_type == R_PPC_EMB_SDA2REL
-                         || r_type == R_PPC_EMB_SDA21
-                         || r_type == R_PPC_EMB_MRKREF
-                         || r_type == R_PPC_EMB_BIT_FLD
-                         || r_type == R_PPC_EMB_RELSDA
-                         || ((r_type == R_PPC_REL24
-                              || r_type == R_PPC_REL32
-                              || r_type == R_PPC_REL14
-                              || r_type == R_PPC_REL14_BRTAKEN
-                              || r_type == R_PPC_REL14_BRNTAKEN
-                              || r_type == R_PPC_RELATIVE)
-                             && strcmp (h->root.root.string,
-                                        "_GLOBAL_OFFSET_TABLE_") != 0))))
-               {
-                 /* 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 if (sec->output_section == NULL)
-               {
-                  (*_bfd_error_handler)
-                    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
-                     bfd_archive_filename (input_bfd), h->root.root.string,
-                     bfd_get_section_name (input_bfd, input_section));
-                 relocation = 0;
-               }
+             /* Set a flag that will be cleared later if we find a
+                relocation value for this symbol.  output_section
+                is typically NULL for symbols satisfied by a shared
+                library.  */
+             if (sec->output_section == NULL)
+               unresolved_reloc = TRUE;
              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->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
-           relocation = 0;
+           ;
          else
            {
-             if (! (*info->callbacks->undefined_symbol) (info,
-                                                        h->root.root.string,
-                                                        input_bfd,
-                                                        input_section,
-                                                        rel->r_offset,
-                                                        (!info->shared
-                                                         || info->no_undefined
-                                                         || ELF_ST_VISIBILITY (h->other))))
+             if (! ((*info->callbacks->undefined_symbol)
+                    (info, h->root.root.string, input_bfd, input_section,
+                     rel->r_offset, (!info->shared
+                                     || info->no_undefined
+                                     || ELF_ST_VISIBILITY (h->other)))))
                return FALSE;
-             relocation = 0;
+             warned = TRUE;
+           }
+       }
+
+      /* TLS optimizations.  Replace instruction sequences and relocs
+        based on information we collected in tls_optimize.  We edit
+        RELOCS so that --emit-relocs will output something sensible
+        for the final instruction stream.  */
+      tls_mask = 0;
+      tls_gd = 0;
+      if (IS_PPC_TLS_RELOC (r_type))
+       {
+         if (h != NULL)
+           tls_mask = ((struct ppc_elf_link_hash_entry *) h)->tls_mask;
+         else if (local_got_offsets != NULL)
+           {
+             char *lgot_masks;
+             lgot_masks = (char *) (local_got_offsets + symtab_hdr->sh_info);
+             tls_mask = lgot_masks[r_symndx];
+           }
+       }
+
+      /* Ensure reloc mapping code below stays sane.  */
+      if ((R_PPC_GOT_TLSLD16 & 3)    != (R_PPC_GOT_TLSGD16 & 3)
+         || (R_PPC_GOT_TLSLD16_LO & 3) != (R_PPC_GOT_TLSGD16_LO & 3)
+         || (R_PPC_GOT_TLSLD16_HI & 3) != (R_PPC_GOT_TLSGD16_HI & 3)
+         || (R_PPC_GOT_TLSLD16_HA & 3) != (R_PPC_GOT_TLSGD16_HA & 3)
+         || (R_PPC_GOT_TLSLD16 & 3)    != (R_PPC_GOT_TPREL16 & 3)
+         || (R_PPC_GOT_TLSLD16_LO & 3) != (R_PPC_GOT_TPREL16_LO & 3)
+         || (R_PPC_GOT_TLSLD16_HI & 3) != (R_PPC_GOT_TPREL16_HI & 3)
+         || (R_PPC_GOT_TLSLD16_HA & 3) != (R_PPC_GOT_TPREL16_HA & 3))
+       abort ();
+      switch (r_type)
+       {
+       default:
+         break;
+
+       case R_PPC_GOT_TPREL16:
+       case R_PPC_GOT_TPREL16_LO:
+         if (tls_mask != 0
+             && (tls_mask & TLS_TPREL) == 0)
+           {
+             bfd_vma insn;
+             insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+             insn &= 31 << 21;
+             insn |= 0x3c020000;       /* addis 0,2,0 */
+             bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+             r_type = R_PPC_TPREL16_HA;
+             rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+           }
+         break;
+
+       case R_PPC_TLS:
+         if (tls_mask != 0
+             && (tls_mask & TLS_TPREL) == 0)
+           {
+             bfd_vma insn, rtra;
+             insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+             if ((insn & ((31 << 26) | (31 << 11)))
+                 == ((31 << 26) | (2 << 11)))
+               rtra = insn & ((1 << 26) - (1 << 16));
+             else if ((insn & ((31 << 26) | (31 << 16)))
+                      == ((31 << 26) | (2 << 16)))
+               rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
+             else
+               abort ();
+             if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
+               /* add -> addi.  */
+               insn = 14 << 26;
+             else if ((insn & (31 << 1)) == 23 << 1
+                      && ((insn & (31 << 6)) < 14 << 6
+                          || ((insn & (31 << 6)) >= 16 << 6
+                              && (insn & (31 << 6)) < 24 << 6)))
+               /* load and store indexed -> dform.  */
+               insn = (32 | ((insn >> 6) & 31)) << 26;
+             else if ((insn & (31 << 1)) == 21 << 1
+                      && (insn & (0x1a << 6)) == 0)
+               /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu.  */
+               insn = (((58 | ((insn >> 6) & 4)) << 26)
+                       | ((insn >> 6) & 1));
+             else if ((insn & (31 << 1)) == 21 << 1
+                      && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
+               /* lwax -> lwa.  */
+               insn = (58 << 26) | 2;
+             else
+               abort ();
+             insn |= rtra;
+             bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+             r_type = R_PPC_TPREL16_LO;
+             rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+             /* Was PPC_TLS which sits on insn boundary, now
+                PPC_TPREL16_LO which is at insn+2.  */
+             rel->r_offset += 2;
+           }
+         break;
+
+       case R_PPC_GOT_TLSGD16_HI:
+       case R_PPC_GOT_TLSGD16_HA:
+         tls_gd = TLS_TPRELGD;
+         if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+           goto tls_gdld_hi;
+         break;
+
+       case R_PPC_GOT_TLSLD16_HI:
+       case R_PPC_GOT_TLSLD16_HA:
+         if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+           {
+           tls_gdld_hi:
+             if ((tls_mask & tls_gd) != 0)
+               r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
+                         + R_PPC_GOT_TPREL16);
+             else
+               {
+                 bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+                 rel->r_offset -= 2;
+                 r_type = R_PPC_NONE;
+               }
+             rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+           }
+         break;
+
+       case R_PPC_GOT_TLSGD16:
+       case R_PPC_GOT_TLSGD16_LO:
+         tls_gd = TLS_TPRELGD;
+         if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+           goto tls_get_addr_check;
+         break;
+
+       case R_PPC_GOT_TLSLD16:
+       case R_PPC_GOT_TLSLD16_LO:
+         if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+           {
+           tls_get_addr_check:
+             if (rel + 1 < relend)
+               {
+                 enum elf_ppc_reloc_type r_type2;
+                 unsigned long r_symndx2;
+                 struct elf_link_hash_entry *h2;
+                 bfd_vma insn1, insn2, insn3;
+                 bfd_vma offset;
+
+                 /* The next instruction should be a call to
+                    __tls_get_addr.  Peek at the reloc to be sure.  */
+                 r_type2
+                   = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel[1].r_info);
+                 r_symndx2 = ELF32_R_SYM (rel[1].r_info);
+                 if (r_symndx2 < symtab_hdr->sh_info
+                     || (r_type2 != R_PPC_REL14
+                         && r_type2 != R_PPC_REL14_BRTAKEN
+                         && r_type2 != R_PPC_REL14_BRNTAKEN
+                         && r_type2 != R_PPC_REL24
+                         && r_type2 != R_PPC_PLTREL24))
+                   break;
+
+                 h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
+                 while (h2->root.type == bfd_link_hash_indirect
+                        || h2->root.type == bfd_link_hash_warning)
+                   h2 = (struct elf_link_hash_entry *) h2->root.u.i.link;
+                 if (h2 == NULL || h2 != htab->tls_get_addr)
+                   break;
+
+                 /* OK, it checks out.  Replace the call.  */
+                 offset = rel[1].r_offset;
+                 insn1 = bfd_get_32 (output_bfd,
+                                     contents + rel->r_offset - 2);
+                 insn3 = bfd_get_32 (output_bfd,
+                                     contents + offset + 4);
+                 if ((tls_mask & tls_gd) != 0)
+                   {
+                     /* IE */
+                     insn1 &= (1 << 26) - 1;
+                     insn1 |= 32 << 26;        /* lwz */
+                     insn2 = 0x7c631214;       /* add 3,3,2 */
+                     rel[1].r_info = ELF32_R_INFO (r_symndx2, R_PPC_NONE);
+                     r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
+                               + R_PPC_GOT_TPREL16);
+                     rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+                   }
+                 else
+                   {
+                     /* LE */
+                     insn1 = 0x3c620000;       /* addis 3,2,0 */
+                     insn2 = 0x38630000;       /* addi 3,3,0 */
+                     if (tls_gd == 0)
+                       {
+                         /* Was an LD reloc.  */
+                         r_symndx = 0;
+                         rel->r_addend = htab->tls_sec->vma + DTP_OFFSET;
+                         rel[1].r_addend = htab->tls_sec->vma + DTP_OFFSET;
+                       }
+                     r_type = R_PPC_TPREL16_HA;
+                     rel->r_info = ELF32_R_INFO (r_symndx, r_type);
+                     rel[1].r_info = ELF32_R_INFO (r_symndx,
+                                                   R_PPC_TPREL16_LO);
+                     rel[1].r_offset += 2;
+                   }
+                 if (insn3 == NOP
+                     || insn3 == CROR_151515 || insn3 == CROR_313131)
+                   {
+                     insn3 = insn2;
+                     insn2 = NOP;
+                     rel[1].r_offset += 4;
+                   }
+                 bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+                 bfd_put_32 (output_bfd, insn2, contents + offset);
+                 bfd_put_32 (output_bfd, insn3, contents + offset + 4);
+                 if (tls_gd == 0)
+                   {
+                     /* We changed the symbol on an LD reloc.  Start over
+                        in order to get h, sym, sec etc. right.  */
+                     rel--;
+                     continue;
+                   }
+               }
            }
+         break;
+       }
+
+      /* Handle other relocations that tweak non-addend part of insn.  */
+      branch_bit = 0;
+      switch (r_type)
+       {
+       default:
+         break;
+
+         /* Branch taken prediction relocations.  */
+       case R_PPC_ADDR14_BRTAKEN:
+       case R_PPC_REL14_BRTAKEN:
+         branch_bit = BRANCH_PREDICT_BIT;
+         /* Fall thru */
+
+         /* Branch not taken predicition relocations.  */
+       case R_PPC_ADDR14_BRNTAKEN:
+       case R_PPC_REL14_BRNTAKEN:
+         insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+         insn &= ~BRANCH_PREDICT_BIT;
+         insn |= branch_bit;
+
+         from = (rel->r_offset
+                 + input_section->output_offset
+                 + input_section->output_section->vma);
+
+         /* Invert 'y' bit if not the default.  */
+         if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
+           insn ^= BRANCH_PREDICT_BIT;
+
+         bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+         break;
        }
 
-      switch ((int) r_type)
+      addend = rel->r_addend;
+      tls_type = 0;
+      howto = NULL;
+      if ((unsigned) r_type < (unsigned) R_PPC_max)
+       howto = ppc_elf_howto_table[(int) r_type];
+      switch (r_type)
        {
        default:
-         (*_bfd_error_handler) (_("%s: unknown relocation type %d for symbol %s"),
-                                bfd_archive_filename (input_bfd),
-                                (int) r_type, sym_name);
+         (*_bfd_error_handler)
+           (_("%s: unknown relocation type %d for symbol %s"),
+            bfd_archive_filename (input_bfd), (int) r_type, sym_name);
 
          bfd_set_error (bfd_error_bad_value);
          ret = FALSE;
          continue;
 
-       case (int) R_PPC_NONE:
+       case R_PPC_NONE:
+       case R_PPC_TLS:
+       case R_PPC_EMB_MRKREF:
+       case R_PPC_GNU_VTINHERIT:
+       case R_PPC_GNU_VTENTRY:
          continue;
 
+         /* GOT16 relocations.  Like an ADDR16 using the symbol's
+            address in the GOT as relocation value instead of the
+            symbol's value itself.  Also, create a GOT entry for the
+            symbol and put the symbol value there.  */
+       case R_PPC_GOT_TLSGD16:
+       case R_PPC_GOT_TLSGD16_LO:
+       case R_PPC_GOT_TLSGD16_HI:
+       case R_PPC_GOT_TLSGD16_HA:
+         tls_type = TLS_TLS | TLS_GD;
+         goto dogot;
+
+       case R_PPC_GOT_TLSLD16:
+       case R_PPC_GOT_TLSLD16_LO:
+       case R_PPC_GOT_TLSLD16_HI:
+       case R_PPC_GOT_TLSLD16_HA:
+         tls_type = TLS_TLS | TLS_LD;
+         goto dogot;
+
+       case R_PPC_GOT_TPREL16:
+       case R_PPC_GOT_TPREL16_LO:
+       case R_PPC_GOT_TPREL16_HI:
+       case R_PPC_GOT_TPREL16_HA:
+         tls_type = TLS_TLS | TLS_TPREL;
+         goto dogot;
+
+       case R_PPC_GOT_DTPREL16:
+       case R_PPC_GOT_DTPREL16_LO:
+       case R_PPC_GOT_DTPREL16_HI:
+       case R_PPC_GOT_DTPREL16_HA:
+         tls_type = TLS_TLS | TLS_DTPREL;
+         goto dogot;
+
+       case R_PPC_GOT16:
+       case R_PPC_GOT16_LO:
+       case R_PPC_GOT16_HI:
+       case R_PPC_GOT16_HA:
+       dogot:
+         {
+           /* Relocation is to the entry for this symbol in the global
+              offset table.  */
+           bfd_vma off;
+           bfd_vma *offp;
+           unsigned long indx;
+
+           if (htab->got == NULL)
+             abort ();
+
+           indx = 0;
+           if (tls_type == (TLS_TLS | TLS_LD)
+               && (h == NULL
+                   || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+             offp = &htab->tlsld_got.offset;
+           else if (h != NULL)
+             {
+               bfd_boolean dyn;
+               dyn = htab->elf.dynamic_sections_created;
+               if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+                   || (info->shared
+                       && SYMBOL_REFERENCES_LOCAL (info, h)))
+                 /* This is actually a static link, or it is a
+                    -Bsymbolic link and the symbol is defined
+                    locally, or the symbol was forced to be local
+                    because of a version file.  */
+                 ;
+               else
+                 {
+                   indx = h->dynindx;
+                   unresolved_reloc = FALSE;
+                 }
+               offp = &h->got.offset;
+             }
+           else
+             {
+               if (local_got_offsets == NULL)
+                 abort ();
+               offp = &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
+              processed this entry.  */
+           off = *offp;
+           if ((off & 1) != 0)
+             off &= ~1;
+           else
+             {
+               unsigned int tls_m = (tls_mask
+                                     & (TLS_LD | TLS_GD | TLS_DTPREL
+                                        | TLS_TPREL | TLS_TPRELGD));
+
+               if (offp == &htab->tlsld_got.offset)
+                 tls_m = TLS_LD;
+               else if (h == NULL
+                        || !(h->elf_link_hash_flags
+                             & ELF_LINK_HASH_DEF_DYNAMIC))
+                 tls_m &= ~TLS_LD;
+
+               /* We might have multiple got entries for this sym.
+                  Initialize them all.  */
+               do
+                 {
+                   int tls_ty = 0;
+
+                   if ((tls_m & TLS_LD) != 0)
+                     {
+                       tls_ty = TLS_TLS | TLS_LD;
+                       tls_m &= ~TLS_LD;
+                     }
+                   else if ((tls_m & TLS_GD) != 0)
+                     {
+                       tls_ty = TLS_TLS | TLS_GD;
+                       tls_m &= ~TLS_GD;
+                     }
+                   else if ((tls_m & TLS_DTPREL) != 0)
+                     {
+                       tls_ty = TLS_TLS | TLS_DTPREL;
+                       tls_m &= ~TLS_DTPREL;
+                     }
+                   else if ((tls_m & (TLS_TPREL | TLS_TPRELGD)) != 0)
+                     {
+                       tls_ty = TLS_TLS | TLS_TPREL;
+                       tls_m = 0;
+                     }
+
+                   /* Generate relocs for the dynamic linker.  */
+                   if (info->shared || indx != 0)
+                     {
+                       outrel.r_offset = (htab->got->output_section->vma
+                                          + htab->got->output_offset
+                                          + off);
+                       if (tls_ty & (TLS_LD | TLS_GD))
+                         {
+                           outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32);
+                           outrel.r_addend = 0;
+                           if (tls_ty == (TLS_TLS | TLS_GD))
+                             {
+                               loc = htab->relgot->contents;
+                               loc += (htab->relgot->reloc_count++
+                                       * sizeof (Elf32_External_Rela));
+                               bfd_elf32_swap_reloca_out (output_bfd,
+                                                          &outrel, loc);
+                               outrel.r_info
+                                 = ELF32_R_INFO (indx, R_PPC_DTPREL32);
+                               outrel.r_offset += 4;
+                             }
+                         }
+                       else if (tls_ty == (TLS_TLS | TLS_DTPREL))
+                         outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32);
+                       else if (tls_ty == (TLS_TLS | TLS_TPREL))
+                         outrel.r_info = ELF32_R_INFO (indx, R_PPC_TPREL32);
+                       else if (indx == 0)
+                         outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
+                       else
+                         outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
+                       outrel.r_addend = 0;
+                       if (indx == 0)
+                         outrel.r_addend += relocation;
+                       loc = htab->relgot->contents;
+                       loc += (htab->relgot->reloc_count++
+                               * sizeof (Elf32_External_Rela));
+                       bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+                     }
+
+                   /* Init the .got section contents if we're not
+                      emitting a reloc.  */
+                   else
+                     {
+                       bfd_vma value = relocation;
+
+                       if ((tls_ty & (TLS_GD | TLS_TPREL | TLS_DTPREL
+                                      | TLS_TPRELGD)) != 0)
+                         {
+                           value -= htab->tls_sec->vma + DTP_OFFSET;
+                           if ((tls_ty & TLS_TPREL) != 0)
+                             value += DTP_OFFSET - TP_OFFSET;
+                         }
+
+                       if (tls_ty == (TLS_TLS | TLS_GD))
+                         {
+                           bfd_put_32 (output_bfd, value,
+                                       htab->got->contents + off + 4);
+                           value = 1;
+                         }
+                       else if (tls_ty == (TLS_TLS | TLS_LD))
+                         value = 1;
+                       bfd_put_32 (output_bfd, value,
+                                   htab->got->contents + off);
+                     }
+
+                   off += 4;
+                   if (tls_ty & (TLS_LD | TLS_GD))
+                     off += 4;
+                 }
+               while (tls_m != 0);
+
+               off = *offp;
+               *offp = off | 1;
+             }
+
+           if (off >= (bfd_vma) -2)
+             abort ();
+
+           if ((tls_type & TLS_TLS) != 0)
+             {
+               if (tls_type != (TLS_TLS | TLS_LD))
+                 {
+                   if ((tls_mask & TLS_LD) != 0
+                       && !(h == NULL
+                            || !(h->elf_link_hash_flags
+                                 & ELF_LINK_HASH_DEF_DYNAMIC)))
+                     off += 8;
+                   if (tls_type != (TLS_TLS | TLS_GD))
+                     {
+                       if ((tls_mask & TLS_GD) != 0)
+                         off += 8;
+                       if (tls_type != (TLS_TLS | TLS_DTPREL))
+                         {
+                           if ((tls_mask & TLS_DTPREL) != 0)
+                             off += 4;
+                         }
+                     }
+                 }
+             }
+
+           relocation = htab->got->output_offset + off - 4;
+
+           /* Addends on got relocations don't make much sense.
+              x+off@got is actually x@got+off, and since the got is
+              generated by a hash table traversal, the value in the
+              got at entry m+n bears little relation to the entry m.  */
+           if (addend != 0)
+             (*_bfd_error_handler)
+               (_("%s(%s+0x%lx): non-zero addend on got reloc against `%s'"),
+                bfd_archive_filename (input_bfd),
+                bfd_get_section_name (input_bfd, input_section),
+                (long) rel->r_offset,
+                sym_name);
+         }
+       break;
+
        /* Relocations that need no special processing.  */
-       case (int) R_PPC_LOCAL24PC:
+       case R_PPC_LOCAL24PC:
          /* It makes no sense to point a local relocation
             at a symbol not in this object.  */
          if (h != NULL
@@ -3449,45 +4915,95 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          break;
 
-       /* Relocations that may need to be propagated if this is a shared
-           object.  */
-       case (int) R_PPC_REL24:
-       case (int) R_PPC_REL32:
-       case (int) R_PPC_REL14:
+       case R_PPC_DTPREL16:
+       case R_PPC_DTPREL16_LO:
+       case R_PPC_DTPREL16_HI:
+       case R_PPC_DTPREL16_HA:
+         addend -= htab->tls_sec->vma + DTP_OFFSET;
+         break;
+
+         /* Relocations that may need to be propagated if this is a shared
+            object.  */
+       case R_PPC_TPREL16:
+       case R_PPC_TPREL16_LO:
+       case R_PPC_TPREL16_HI:
+       case R_PPC_TPREL16_HA:
+         addend -= htab->tls_sec->vma + TP_OFFSET;
+         /* The TPREL16 relocs shouldn't really be used in shared
+            libs as they will result in DT_TEXTREL being set, but
+            support them anyway.  */
+         goto dodyn;
+
+       case R_PPC_TPREL32:
+         addend -= htab->tls_sec->vma + TP_OFFSET;
+         goto dodyn;
+
+       case R_PPC_DTPREL32:
+         addend -= htab->tls_sec->vma + DTP_OFFSET;
+         goto dodyn;
+
+       case R_PPC_REL24:
+       case R_PPC_REL32:
+       case R_PPC_REL14:
+       case R_PPC_REL14_BRTAKEN:
+       case R_PPC_REL14_BRNTAKEN:
          /* 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
              || SYMBOL_REFERENCES_LOCAL (info, h))
            break;
-       /* fall through */
-
-       /* Relocations that always need to be propagated if this is a shared
-           object.  */
-       case (int) R_PPC_ADDR32:
-       case (int) R_PPC_ADDR24:
-       case (int) R_PPC_ADDR16:
-       case (int) R_PPC_ADDR16_LO:
-       case (int) R_PPC_ADDR16_HI:
-       case (int) R_PPC_ADDR16_HA:
-       case (int) R_PPC_ADDR14:
-       case (int) R_PPC_UADDR32:
-       case (int) R_PPC_UADDR16:
-         if (info->shared && r_symndx != 0)
+         /* fall through */
+
+         /* Relocations that always need to be propagated if this is a shared
+            object.  */
+       case R_PPC_ADDR32:
+       case R_PPC_ADDR24:
+       case R_PPC_ADDR16:
+       case R_PPC_ADDR16_LO:
+       case R_PPC_ADDR16_HI:
+       case R_PPC_ADDR16_HA:
+       case R_PPC_ADDR14:
+       case R_PPC_ADDR14_BRTAKEN:
+       case R_PPC_ADDR14_BRNTAKEN:
+       case R_PPC_UADDR32:
+       case R_PPC_UADDR16:
+       case R_PPC_DTPMOD32:
+         /* r_symndx will be zero only for relocs against symbols
+            from removed linkonce sections, or sections discarded by
+            a linker script.  */
+       dodyn:
+         if (r_symndx == 0)
+           break;
+         /* Fall thru.  */
+
+         if ((info->shared
+              && (MUST_BE_DYN_RELOC (r_type)
+                  || (h != NULL
+                      && h->dynindx != -1
+                      && (!info->symbolic
+                          || (h->elf_link_hash_flags
+                              & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+             || (ELIMINATE_COPY_RELOCS
+                 && !info->shared
+                 && (input_section->flags & SEC_ALLOC) != 0
+                 && h != NULL
+                 && h->dynindx != -1
+                 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+                 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+                 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
            {
-             Elf_Internal_Rela outrel;
-             bfd_byte *loc;
              int skip;
 
 #ifdef DEBUG
              fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n",
-                      (h && h->root.root.string) ? h->root.root.string : "<unknown>");
+                      (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.  */
-
+                are copied into the output file to be resolved at run
+                time.  */
              if (sreloc == NULL)
                {
                  const char *name;
@@ -3504,7 +5020,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                                                               input_section),
                                         name + 5) == 0);
 
-                 sreloc = bfd_get_section_by_name (dynobj, name);
+                 sreloc = bfd_get_section_by_name (htab->elf.dynobj, name);
                  BFD_ASSERT (sreloc != NULL);
                }
 
@@ -3522,9 +5038,11 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              if (skip)
                memset (&outrel, 0, sizeof outrel);
              /* h->dynindx may be -1 if this symbol was marked to
-                 become local.  */
-             else if (! will_become_local)
+                become local.  */
+             else if (h != NULL
+                      && !SYMBOL_REFERENCES_LOCAL (info, h))
                {
+                 unresolved_reloc = FALSE;
                  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = rel->r_addend;
                }
@@ -3538,16 +5056,6 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                    {
                      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 (bfd_is_abs_section (sec))
                        indx = 0;
                      else if (sec == NULL || sec->owner == NULL)
@@ -3571,8 +5079,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                          if (indx <= 0)
                            {
                              printf ("indx=%d section=%s flags=%08x name=%s\n",
-                                    indx, osec->name, osec->flags,
-                                    h->root.root.string);
+                                     indx, osec->name, osec->flags,
+                                     h->root.root.string);
                            }
 #endif
                        }
@@ -3599,186 +5107,66 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  break;
                }
            }
-
-         /* Arithmetic adjust relocations that aren't going into a
-            shared object.  */
-         if (r_type == R_PPC_ADDR16_HA
-             /* It's just possible that this symbol is a weak symbol
-                that's not actually defined anywhere. In that case,
-                'sec' would be NULL, and we should leave the symbol
-                alone (it will be set to zero elsewhere in the link).  */
-             && sec != NULL)
-           {
-             addend += ((relocation + addend) & 0x8000) << 1;
-           }
-         break;
-
-       /* branch taken prediction relocations */
-       case (int) R_PPC_ADDR14_BRTAKEN:
-       case (int) R_PPC_REL14_BRTAKEN:
-         insn = bfd_get_32 (output_bfd, contents + offset);
-         if ((relocation - offset) & 0x8000)
-           insn &= ~BRANCH_PREDICT_BIT;
-         else
-           insn |= BRANCH_PREDICT_BIT;
-         bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
-         break;
-
-       /* branch not taken predicition relocations */
-       case (int) R_PPC_ADDR14_BRNTAKEN:
-       case (int) R_PPC_REL14_BRNTAKEN:
-         insn = bfd_get_32 (output_bfd, contents + offset);
-         if ((relocation - offset) & 0x8000)
-           insn |= BRANCH_PREDICT_BIT;
-         else
-           insn &= ~BRANCH_PREDICT_BIT;
-         bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
-         break;
-
-       /* GOT16 relocations */
-       case (int) R_PPC_GOT16:
-       case (int) R_PPC_GOT16_LO:
-       case (int) R_PPC_GOT16_HI:
-       case (int) R_PPC_GOT16_HA:
-         /* Relocation is to the entry for this symbol in the global
-             offset table.  */
-         BFD_ASSERT (sgot != NULL);
-
-         if (h != NULL)
-           {
-             bfd_vma off;
-
-             off = h->got.offset;
-             BFD_ASSERT (off != (bfd_vma) -1);
-
-             if (! elf_hash_table (info)->dynamic_sections_created
-                 || (info->shared
-                     && SYMBOL_REFERENCES_LOCAL (info, h)))
-               {
-                 /* This is actually a static link, or it is a
-                     -Bsymbolic link and the symbol is defined
-                     locally.  We must initialize this entry in the
-                     global offset table.  Since the offset must
-                     always be a multiple of 4, we use the least
-                     significant bit to record whether we have
-                     initialized it already.
-
-                    When doing a dynamic link, we create a .rela.got
-                    relocation entry to initialize the value.  This
-                    is done in the finish_dynamic_symbol routine.  */
-                 if ((off & 1) != 0)
-                   off &= ~1;
-                 else
-                   {
-                     bfd_put_32 (output_bfd, relocation,
-                                 sgot->contents + off);
-                     h->got.offset |= 1;
-                   }
-               }
-
-             relocation = sgot->output_offset + off - 4;
-           }
-         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 processed this entry.  */
-             if ((off & 1) != 0)
-               off &= ~1;
-             else
-               {
-
-                 if (info->shared)
-                   {
-                     asection *srelgot;
-                     Elf_Internal_Rela outrel;
-                     bfd_byte *loc;
-
-                     /* We need to generate a R_PPC_RELATIVE reloc
-                        for the dynamic linker.  */
-                     srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-                     BFD_ASSERT (srelgot != NULL);
-
-                     outrel.r_offset = (sgot->output_section->vma
-                                        + sgot->output_offset
-                                        + off);
-                     outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
-                     outrel.r_addend = relocation;
-                     loc = srelgot->contents;
-                     loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
-                     bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-                     relocation = 0;
-                   }
-
-                 bfd_put_32 (output_bfd, relocation, sgot->contents + off);
-                 local_got_offsets[r_symndx] |= 1;
-               }
-
-             relocation = sgot->output_offset + off - 4;
-           }
-         if (r_type == R_PPC_GOT16_HA)
-           addend += ((relocation + addend) & 0x8000) << 1;
          break;
 
-       /* Indirect .sdata relocation */
-       case (int) R_PPC_EMB_SDAI16:
-         BFD_ASSERT (sdata != NULL);
-         relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
-                                                               sdata, h, relocation, rel,
-                                                               R_PPC_RELATIVE);
+         /* Indirect .sdata relocation.  */
+       case R_PPC_EMB_SDAI16:
+         BFD_ASSERT (htab->sdata != NULL);
+         relocation
+           = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd,
+                                                      info, htab->sdata, h,
+                                                      relocation, rel,
+                                                      R_PPC_RELATIVE);
          break;
 
-       /* Indirect .sdata2 relocation */
-       case (int) R_PPC_EMB_SDA2I16:
-         BFD_ASSERT (sdata2 != NULL);
-         relocation = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd, info,
-                                                               sdata2, h, relocation, rel,
-                                                               R_PPC_RELATIVE);
+         /* Indirect .sdata2 relocation.  */
+       case R_PPC_EMB_SDA2I16:
+         BFD_ASSERT (htab->sdata2 != NULL);
+         relocation
+           = bfd_elf32_finish_pointer_linker_section (output_bfd, input_bfd,
+                                                      info, htab->sdata2, h,
+                                                      relocation, rel,
+                                                      R_PPC_RELATIVE);
          break;
 
-       /* Handle the TOC16 reloc.  We want to use the offset within the .got
-          section, not the actual VMA.  This is appropriate when generating
-          an embedded ELF object, for which the .got section acts like the
-          AIX .toc section.  */
-       case (int) R_PPC_TOC16:                 /* phony GOT16 relocations */
+         /* Handle the TOC16 reloc.  We want to use the offset within the .got
+            section, not the actual VMA.  This is appropriate when generating
+            an embedded ELF object, for which the .got section acts like the
+            AIX .toc section.  */
+       case R_PPC_TOC16:                       /* phony GOT16 relocations */
          BFD_ASSERT (sec != (asection *) 0);
          BFD_ASSERT (bfd_is_und_section (sec)
                      || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0
                      || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0)
 
-         addend -= sec->output_section->vma + sec->output_offset + 0x8000;
+           addend -= sec->output_section->vma + sec->output_offset + 0x8000;
          break;
 
-       case (int) R_PPC_PLTREL24:
+       case R_PPC_PLTREL24:
          /* Relocation is to the entry for this symbol in the
-             procedure linkage table.  */
+            procedure linkage table.  */
          BFD_ASSERT (h != NULL);
 
          if (h->plt.offset == (bfd_vma) -1
-             || splt == NULL)
+             || htab->plt == NULL)
            {
              /* We didn't make a PLT entry for this symbol.  This
-                 happens when statically linking PIC code, or when
-                 using -Bsymbolic.  */
+                happens when statically linking PIC code, or when
+                using -Bsymbolic.  */
              break;
            }
 
-         relocation = (splt->output_section->vma
-                       + splt->output_offset
+         unresolved_reloc = FALSE;
+         relocation = (htab->plt->output_section->vma
+                       + htab->plt->output_offset
                        + h->plt.offset);
          break;
 
-       /* relocate against _SDA_BASE_ */
-       case (int) R_PPC_SDAREL16:
+         /* Relocate against _SDA_BASE_.  */
+       case R_PPC_SDAREL16:
          {
            const char *name;
+           const struct elf_link_hash_entry *sh;
 
            BFD_ASSERT (sec != (asection *) 0);
            name = bfd_get_section_name (abfd, sec->output_section);
@@ -3790,19 +5178,21 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
                                       bfd_archive_filename (input_bfd),
                                       sym_name,
-                                      ppc_elf_howto_table[(int) r_type]->name,
+                                      howto->name,
                                       name);
              }
-           addend -= (sdata->sym_hash->root.u.def.value
-                      + sdata->sym_hash->root.u.def.section->output_section->vma
-                      + sdata->sym_hash->root.u.def.section->output_offset);
+           sh = htab->sdata->sym_hash;
+           addend -= (sh->root.u.def.value
+                      + sh->root.u.def.section->output_section->vma
+                      + sh->root.u.def.section->output_offset);
          }
          break;
 
-       /* relocate against _SDA2_BASE_ */
-       case (int) R_PPC_EMB_SDA2REL:
+         /* Relocate against _SDA2_BASE_.  */
+       case R_PPC_EMB_SDA2REL:
          {
            const char *name;
+           const struct elf_link_hash_entry *sh;
 
            BFD_ASSERT (sec != (asection *) 0);
            name = bfd_get_section_name (abfd, sec->output_section);
@@ -3812,24 +5202,26 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
                                       bfd_archive_filename (input_bfd),
                                       sym_name,
-                                      ppc_elf_howto_table[(int) r_type]->name,
+                                      howto->name,
                                       name);
 
                bfd_set_error (bfd_error_bad_value);
                ret = FALSE;
                continue;
              }
-           addend -= (sdata2->sym_hash->root.u.def.value
-                      + sdata2->sym_hash->root.u.def.section->output_section->vma
-                      + sdata2->sym_hash->root.u.def.section->output_offset);
+           sh = htab->sdata2->sym_hash;
+           addend -= (sh->root.u.def.value
+                      + sh->root.u.def.section->output_section->vma
+                      + sh->root.u.def.section->output_offset);
          }
          break;
 
-       /* relocate against either _SDA_BASE_, _SDA2_BASE_, or 0 */
-       case (int) R_PPC_EMB_SDA21:
-       case (int) R_PPC_EMB_RELSDA:
+         /* Relocate against either _SDA_BASE_, _SDA2_BASE_, or 0.  */
+       case R_PPC_EMB_SDA21:
+       case R_PPC_EMB_RELSDA:
          {
            const char *name;
+           const struct elf_link_hash_entry *sh;
            int reg;
 
            BFD_ASSERT (sec != (asection *) 0);
@@ -3840,18 +5232,20 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                     && (name[5] == 0 || name[5] == '.'))))
              {
                reg = 13;
-               addend -= (sdata->sym_hash->root.u.def.value
-                          + sdata->sym_hash->root.u.def.section->output_section->vma
-                          + sdata->sym_hash->root.u.def.section->output_offset);
+               sh = htab->sdata->sym_hash;
+               addend -= (sh->root.u.def.value
+                          + sh->root.u.def.section->output_section->vma
+                          + sh->root.u.def.section->output_offset);
              }
 
            else if (strncmp (name, ".sdata2", 7) == 0
                     || strncmp (name, ".sbss2", 6) == 0)
              {
                reg = 2;
-               addend -= (sdata2->sym_hash->root.u.def.value
-                          + sdata2->sym_hash->root.u.def.section->output_section->vma
-                          + sdata2->sym_hash->root.u.def.section->output_offset);
+               sh = htab->sdata2->sym_hash;
+               addend -= (sh->root.u.def.value
+                          + sh->root.u.def.section->output_section->vma
+                          + sh->root.u.def.section->output_offset);
              }
 
            else if (strcmp (name, ".PPC.EMB.sdata0") == 0
@@ -3865,7 +5259,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                (*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
                                       bfd_archive_filename (input_bfd),
                                       sym_name,
-                                      ppc_elf_howto_table[(int) r_type]->name,
+                                      howto->name,
                                       name);
 
                bfd_set_error (bfd_error_bad_value);
@@ -3875,72 +5269,83 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
            if (r_type == R_PPC_EMB_SDA21)
              {                 /* fill in register field */
-               insn = bfd_get_32 (output_bfd, contents + offset);
+               insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
                insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
-               bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
+               bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
              }
          }
          break;
 
-       /* Relocate against the beginning of the section */
-       case (int) R_PPC_SECTOFF:
-       case (int) R_PPC_SECTOFF_LO:
-       case (int) R_PPC_SECTOFF_HI:
-         BFD_ASSERT (sec != (asection *) 0);
-         addend -= sec->output_section->vma;
-         break;
-
-       case (int) R_PPC_SECTOFF_HA:
+         /* Relocate against the beginning of the section.  */
+       case R_PPC_SECTOFF:
+       case R_PPC_SECTOFF_LO:
+       case R_PPC_SECTOFF_HI:
+       case R_PPC_SECTOFF_HA:
          BFD_ASSERT (sec != (asection *) 0);
          addend -= sec->output_section->vma;
-         addend += ((relocation + addend) & 0x8000) << 1;
-         break;
-
-       /* Negative relocations */
-       case (int) R_PPC_EMB_NADDR32:
-       case (int) R_PPC_EMB_NADDR16:
-       case (int) R_PPC_EMB_NADDR16_LO:
-       case (int) R_PPC_EMB_NADDR16_HI:
-         addend -= 2 * relocation;
          break;
 
-       case (int) R_PPC_EMB_NADDR16_HA:
+         /* Negative relocations.  */
+       case R_PPC_EMB_NADDR32:
+       case R_PPC_EMB_NADDR16:
+       case R_PPC_EMB_NADDR16_LO:
+       case R_PPC_EMB_NADDR16_HI:
+       case R_PPC_EMB_NADDR16_HA:
          addend -= 2 * relocation;
-         addend += ((relocation + addend) & 0x8000) << 1;
          break;
 
-       /* NOP relocation that prevents garbage collecting linkers from omitting a
-          reference.  */
-       case (int) R_PPC_EMB_MRKREF:
-         continue;
-
-       case (int) R_PPC_COPY:
-       case (int) R_PPC_GLOB_DAT:
-       case (int) R_PPC_JMP_SLOT:
-       case (int) R_PPC_RELATIVE:
-       case (int) R_PPC_PLT32:
-       case (int) R_PPC_PLTREL32:
-       case (int) R_PPC_PLT16_LO:
-       case (int) R_PPC_PLT16_HI:
-       case (int) R_PPC_PLT16_HA:
-       case (int) R_PPC_EMB_RELSEC16:
-       case (int) R_PPC_EMB_RELST_LO:
-       case (int) R_PPC_EMB_RELST_HI:
-       case (int) R_PPC_EMB_RELST_HA:
-       case (int) R_PPC_EMB_BIT_FLD:
-         (*_bfd_error_handler) (_("%s: Relocation %s is not yet supported for symbol %s."),
-                                bfd_archive_filename (input_bfd),
-                                ppc_elf_howto_table[(int) r_type]->name,
-                                sym_name);
+       case R_PPC_COPY:
+       case R_PPC_GLOB_DAT:
+       case R_PPC_JMP_SLOT:
+       case R_PPC_RELATIVE:
+       case R_PPC_PLT32:
+       case R_PPC_PLTREL32:
+       case R_PPC_PLT16_LO:
+       case R_PPC_PLT16_HI:
+       case R_PPC_PLT16_HA:
+       case R_PPC_ADDR30:
+       case R_PPC_EMB_RELSEC16:
+       case R_PPC_EMB_RELST_LO:
+       case R_PPC_EMB_RELST_HI:
+       case R_PPC_EMB_RELST_HA:
+       case R_PPC_EMB_BIT_FLD:
+         (*_bfd_error_handler)
+           (_("%s: Relocation %s is not yet supported for symbol %s."),
+            bfd_archive_filename (input_bfd),
+            howto->name,
+            sym_name);
 
          bfd_set_error (bfd_error_invalid_operation);
          ret = FALSE;
          continue;
+       }
 
-       case (int) R_PPC_GNU_VTINHERIT:
-       case (int) R_PPC_GNU_VTENTRY:
-         /* These are no-ops in the end.  */
-         continue;
+      /* Do any further special processing.  */
+      switch (r_type)
+       {
+       default:
+         break;
+
+       case R_PPC_ADDR16_HA:
+       case R_PPC_GOT16_HA:
+       case R_PPC_PLT16_HA:
+       case R_PPC_SECTOFF_HA:
+       case R_PPC_TPREL16_HA:
+       case R_PPC_DTPREL16_HA:
+       case R_PPC_GOT_TLSGD16_HA:
+       case R_PPC_GOT_TLSLD16_HA:
+       case R_PPC_GOT_TPREL16_HA:
+       case R_PPC_GOT_DTPREL16_HA:
+       case R_PPC_EMB_NADDR16_HA:
+       case R_PPC_EMB_RELST_HA:
+         /* It's just possible that this symbol is a weak symbol
+            that's not actually defined anywhere. In that case,
+            'sec' would be NULL, and we should leave the symbol
+            alone (it will be set to zero elsewhere in the link).  */
+         if (sec != NULL)
+           /* Add 0x10000 if sign bit in 0:15 is set.  */
+           addend += ((relocation + addend) & 0x8000) << 1;
+         break;
        }
 
 #ifdef DEBUG
@@ -3949,27 +5354,41 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
               (int) r_type,
               sym_name,
               r_symndx,
-              (long) offset,
+              (long) rel->r_offset,
               (long) addend);
 #endif
 
+      if (unresolved_reloc
+         && !((input_section->flags & SEC_DEBUGGING) != 0
+              && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+       {
+         (*_bfd_error_handler)
+           (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+            bfd_archive_filename (input_bfd),
+            bfd_get_section_name (input_bfd, input_section),
+            (long) rel->r_offset,
+            sym_name);
+         ret = FALSE;
+       }
+
       r = _bfd_final_link_relocate (howto,
                                    input_bfd,
                                    input_section,
                                    contents,
-                                   offset,
+                                   rel->r_offset,
                                    relocation,
                                    addend);
 
-      if (r == bfd_reloc_ok)
-       ;
-      else if (r == bfd_reloc_overflow)
+      if (r != bfd_reloc_ok)
        {
-         const char *name;
-
-         if (h != NULL)
+         if (sym_name == NULL)
+           sym_name = "(null)";
+         if (r == bfd_reloc_overflow)
            {
-             if (h->root.type == bfd_link_hash_undefweak
+             if (warned)
+               continue;
+             if (h != NULL
+                 && h->root.type == bfd_link_hash_undefweak
                  && howto->pc_relative)
                {
                  /* Assume this is a call protected by other code that
@@ -3981,30 +5400,25 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  continue;
                }
 
-             name = h->root.root.string;
+             if (! (*info->callbacks->reloc_overflow) (info,
+                                                       sym_name,
+                                                       howto->name,
+                                                       rel->r_addend,
+                                                       input_bfd,
+                                                       input_section,
+                                                       rel->r_offset))
+               return FALSE;
            }
          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);
+             (*_bfd_error_handler)
+               (_("%s(%s+0x%lx): reloc against `%s': error %d"),
+                bfd_archive_filename (input_bfd),
+                bfd_get_section_name (input_bfd, input_section),
+                (long) rel->r_offset, sym_name, (int) r);
+             ret = FALSE;
            }
-
-         if (! (*info->callbacks->reloc_overflow) (info,
-                                                  name,
-                                                  howto->name,
-                                                  (bfd_vma) 0,
-                                                  input_bfd,
-                                                  input_section,
-                                                  offset))
-           return FALSE;
        }
-      else
-       ret = FALSE;
     }
 
 #ifdef DEBUG
@@ -4033,7 +5447,8 @@ ppc_elf_reloc_type_class (rela)
     }
 }
 \f
-/* Support for core dump NOTE sections */
+/* Support for core dump NOTE sections.  */
+
 static bfd_boolean
 ppc_elf_grok_prstatus (abfd, note)
      bfd *abfd;
@@ -4044,21 +5459,21 @@ ppc_elf_grok_prstatus (abfd, note)
 
   switch (note->descsz)
     {
-      default:
-       return FALSE;
+    default:
+      return FALSE;
 
-      case 268:                /* Linux/PPC */
-       /* pr_cursig */
-       elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+    case 268:          /* Linux/PPC.  */
+      /* pr_cursig */
+      elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
 
-       /* pr_pid */
-       elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+      /* pr_pid */
+      elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
 
-       /* pr_reg */
-       offset = 72;
-       raw_size = 192;
+      /* pr_reg */
+      offset = 72;
+      raw_size = 192;
 
-       break;
+      break;
     }
 
   /* Make a ".reg/999" section.  */
@@ -4073,14 +5488,14 @@ ppc_elf_grok_psinfo (abfd, note)
 {
   switch (note->descsz)
     {
-      default:
-       return FALSE;
+    default:
+      return FALSE;
 
-      case 128:                /* Linux/PPC elf_prpsinfo */
-       elf_tdata (abfd)->core_program
-        = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
-       elf_tdata (abfd)->core_command
-        = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+    case 128:          /* Linux/PPC elf_prpsinfo.  */
+      elf_tdata (abfd)->core_program
+       = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+      elf_tdata (abfd)->core_command
+       = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
     }
 
   /* Note that for some reason, a spurious space is tacked
@@ -4101,28 +5516,27 @@ ppc_elf_grok_psinfo (abfd, note)
 /* Very simple linked list structure for recording apuinfo values.  */
 typedef struct apuinfo_list
 {
-  struct apuinfo_list *        next;
-  unsigned long         value;
+  struct apuinfo_list *next;
+  unsigned long value;
 }
 apuinfo_list;
 
 static apuinfo_list * head;
 
-static void          apuinfo_list_init    PARAMS ((void));
-static void          apuinfo_list_add     PARAMS ((unsigned long));
-static unsigned      apuinfo_list_length  PARAMS ((void));
+static void apuinfo_list_init PARAMS ((void));
+static void apuinfo_list_add PARAMS ((unsigned long));
+static unsigned apuinfo_list_length PARAMS ((void));
 static unsigned long apuinfo_list_element PARAMS ((unsigned long));
-static void          apuinfo_list_finish  PARAMS ((void));
+static void apuinfo_list_finish PARAMS ((void));
 
-extern void          ppc_elf_begin_write_processing
+extern void ppc_elf_begin_write_processing
   PARAMS ((bfd *, struct bfd_link_info *));
-extern void          ppc_elf_final_write_processing
+extern void ppc_elf_final_write_processing
   PARAMS ((bfd *, bfd_boolean));
-extern bfd_boolean   ppc_elf_write_section
+extern bfd_boolean ppc_elf_write_section
   PARAMS ((bfd *, asection *, bfd_byte *));
 
 
-
 static void
 apuinfo_list_init PARAMS ((void))
 {
@@ -4133,7 +5547,7 @@ static void
 apuinfo_list_add (value)
      unsigned long value;
 {
-  apuinfo_list * entry = head;
+  apuinfo_list *entry = head;
 
   while (entry != NULL)
     {
@@ -4154,7 +5568,7 @@ apuinfo_list_add (value)
 static unsigned
 apuinfo_list_length PARAMS ((void))
 {
-  apuinfo_list * entry;
+  apuinfo_list *entry;
   unsigned long count;
 
   for (entry = head, count = 0;
@@ -4182,11 +5596,11 @@ apuinfo_list_element (number)
 static void
 apuinfo_list_finish PARAMS ((void))
 {
-  apuinfo_list * entry;
+  apuinfo_list *entry;
 
   for (entry = head; entry;)
     {
-      apuinfo_list * next = entry->next;
+      apuinfo_list *next = entry->next;
       free (entry);
       entry = next;
     }
@@ -4194,8 +5608,8 @@ apuinfo_list_finish PARAMS ((void))
   head = NULL;
 }
 
-#define APUINFO_SECTION_NAME ".PPC.EMB.apuinfo"
-#define APUINFO_LABEL        "APUinfo"
+#define APUINFO_SECTION_NAME   ".PPC.EMB.apuinfo"
+#define APUINFO_LABEL          "APUinfo"
 
 /* Scan the input BFDs and create a linked list of
    the APUinfo values that will need to be emitted.  */
@@ -4205,16 +5619,16 @@ ppc_elf_begin_write_processing (abfd, link_info)
      bfd *abfd;
      struct bfd_link_info *link_info;
 {
-  bfd *         ibfd;
-  asection *    asec;
-  char *        buffer;
-  unsigned     num_input_sections;
+  bfd *ibfd;
+  asection *asec;
+  char *buffer;
+  unsigned num_input_sections;
   bfd_size_type        output_section_size;
-  unsigned      i;
-  unsigned      num_entries;
+  unsigned i;
+  unsigned num_entries;
   unsigned long        offset;
   unsigned long length;
-  const char *  error_message = NULL;
+  const char *error_message = NULL;
 
   if (link_info == NULL)
     return;
@@ -4254,9 +5668,8 @@ ppc_elf_begin_write_processing (abfd, link_info)
   /* Read in the input sections contents.  */
   for (ibfd = link_info->input_bfds; ibfd; ibfd = ibfd->link_next)
     {
-      unsigned long    datum;
-      char *           ptr;
-
+      unsigned long datum;
+      char *ptr;
 
       asec = bfd_get_section_by_name (ibfd, APUINFO_SECTION_NAME);
       if (asec == NULL)
@@ -4319,7 +5732,7 @@ ppc_elf_begin_write_processing (abfd, link_info)
 
   asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
 
-  if (! bfd_set_section_size  (abfd, asec, output_section_size))
+  if (! bfd_set_section_size (abfd, asec, output_section_size))
     ibfd = abfd,
       error_message = _("warning: unable to set size of %s section in %s");
 
@@ -4327,8 +5740,8 @@ ppc_elf_begin_write_processing (abfd, link_info)
   free (buffer);
 
   if (error_message)
-    _bfd_error_handler (error_message, APUINFO_SECTION_NAME,
-                       bfd_archive_filename (ibfd));
+    (*_bfd_error_handler) (error_message, APUINFO_SECTION_NAME,
+                          bfd_archive_filename (ibfd));
 }
 
 
@@ -4337,11 +5750,12 @@ ppc_elf_begin_write_processing (abfd, link_info)
 
 bfd_boolean
 ppc_elf_write_section (abfd, asec, contents)
-     bfd * abfd ATTRIBUTE_UNUSED;
-     asection * asec;
-     bfd_byte * contents ATTRIBUTE_UNUSED;
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asection *asec;
+     bfd_byte *contents ATTRIBUTE_UNUSED;
 {
-  return apuinfo_list_length () && strcmp (asec->name, APUINFO_SECTION_NAME) == 0;
+  return (apuinfo_list_length ()
+         && strcmp (asec->name, APUINFO_SECTION_NAME) == 0);
 }
 
 
@@ -4349,13 +5763,13 @@ ppc_elf_write_section (abfd, asec, contents)
 
 void
 ppc_elf_final_write_processing (abfd, linker)
-     bfd * abfd;
+     bfd *abfd;
      bfd_boolean linker ATTRIBUTE_UNUSED;
 {
-  bfd_byte *    buffer;
-  asection *    asec;
-  unsigned      i;
-  unsigned      num_entries;
+  bfd_byte *buffer;
+  asection *asec;
+  unsigned i;
+  unsigned num_entries;
   bfd_size_type length;
 
   asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME);
@@ -4372,7 +5786,8 @@ ppc_elf_final_write_processing (abfd, linker)
   buffer = bfd_malloc (length);
   if (buffer == NULL)
     {
-      _bfd_error_handler (_("failed to allocate space for new APUinfo section."));
+      (*_bfd_error_handler)
+       (_("failed to allocate space for new APUinfo section."));
       return;
     }
 
@@ -4391,10 +5806,10 @@ ppc_elf_final_write_processing (abfd, linker)
     }
 
   if (length != asec->_raw_size)
-    _bfd_error_handler (_("failed to compute new APUinfo section."));
+    (*_bfd_error_handler) (_("failed to compute new APUinfo section."));
 
   if (! bfd_set_section_contents (abfd, asec, buffer, (file_ptr) 0, length))
-    _bfd_error_handler (_("failed to install new APUinfo section."));
+    (*_bfd_error_handler) (_("failed to install new APUinfo section."));
 
   free (buffer);
 
@@ -4427,11 +5842,10 @@ ppc_elf_final_write_processing (abfd, linker)
 #define elf_backend_rela_normal                1
 
 #define bfd_elf32_bfd_merge_private_bfd_data   ppc_elf_merge_private_bfd_data
-#define bfd_elf32_bfd_relax_section             ppc_elf_relax_section
+#define bfd_elf32_bfd_relax_section            ppc_elf_relax_section
 #define bfd_elf32_bfd_reloc_type_lookup                ppc_elf_reloc_type_lookup
 #define bfd_elf32_bfd_set_private_flags                ppc_elf_set_private_flags
-#define bfd_elf32_bfd_final_link               _bfd_elf32_gc_common_final_link
-#define bfd_elf32_bfd_link_hash_table_create   ppc_elf_link_hash_table_create
+#define bfd_elf32_bfd_link_hash_table_create   ppc_elf_link_hash_table_create
 
 #define elf_backend_object_p                   ppc_elf_object_p
 #define elf_backend_gc_mark_hook               ppc_elf_gc_mark_hook
@@ -4452,8 +5866,8 @@ ppc_elf_final_write_processing (abfd, linker)
 #define elf_backend_grok_prstatus              ppc_elf_grok_prstatus
 #define elf_backend_grok_psinfo                        ppc_elf_grok_psinfo
 #define elf_backend_reloc_type_class           ppc_elf_reloc_type_class
-#define elf_backend_begin_write_processing      ppc_elf_begin_write_processing
-#define elf_backend_final_write_processing      ppc_elf_final_write_processing
-#define elf_backend_write_section               ppc_elf_write_section
+#define elf_backend_begin_write_processing     ppc_elf_begin_write_processing
+#define elf_backend_final_write_processing     ppc_elf_final_write_processing
+#define elf_backend_write_section              ppc_elf_write_section
 
 #include "elf32-target.h"
diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h
new file mode 100644 (file)
index 0000000..ead9c94
--- /dev/null
@@ -0,0 +1,23 @@
+/* PowerPC-specific support for 64-bit ELF.
+   Copyright 2003 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is 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.  */
+
+bfd_boolean ppc_elf_tls_setup
+  PARAMS ((bfd *, struct bfd_link_info *));
+bfd_boolean ppc_elf_tls_optimize
+  PARAMS ((bfd *, struct bfd_link_info *));
index e8d94af..857b7a0 100644 (file)
@@ -1,5 +1,5 @@
 /* IBM S/390-specific support for 32-bit ELF
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Carl B. Pedersen and Martin Schwidefsky.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -351,7 +351,7 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
 /* A relocation function which doesn't do anything.  */
 static bfd_reloc_status_type
 s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
-                      output_bfd, error_message)
+               output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -935,7 +935,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
              && local_got_refcounts == NULL)
            {
              bfd_size_type size;
-             
+
              size = symtab_hdr->sh_info;
              size *= (sizeof (bfd_signed_vma) + sizeof(char));
              local_got_refcounts = ((bfd_signed_vma *)
@@ -969,20 +969,20 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
          /* Got is created, nothing to be done.  */
          break;
 
-        case R_390_PLT16DBL:
-        case R_390_PLT32DBL:
+       case R_390_PLT16DBL:
+       case R_390_PLT32DBL:
        case R_390_PLT32:
        case R_390_PLTOFF16:
        case R_390_PLTOFF32:
          /* This symbol requires a procedure linkage table entry.  We
-             actually build the entry in adjust_dynamic_symbol,
-             because this might be a case of linking PIC code which is
-             never referenced by a dynamic object, in which case we
-             don't need to generate a procedure linkage table entry
-             after all.  */
+            actually build the entry in adjust_dynamic_symbol,
+            because this might be a case of linking PIC code which is
+            never referenced by a dynamic object, in which case we
+            don't need to generate a procedure linkage table entry
+            after all.  */
 
          /* If this is a local symbol, we resolve it directly without
-             creating a procedure linkage table entry.  */
+            creating a procedure linkage table entry.  */
          if (h != NULL)
            {
              h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
@@ -1022,10 +1022,10 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
        case R_390_TLS_IEENT:
          if (info->shared)
            info->flags |= DF_STATIC_TLS;
-         /* Fall through */
+         /* Fall through */
 
        case R_390_GOT12:
-        case R_390_GOT16:
+       case R_390_GOT16:
        case R_390_GOT32:
        case R_390_GOTENT:
        case R_390_TLS_GD32:
@@ -1087,19 +1087,19 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
 
          if (r_type != R_390_TLS_IE32)
            break;
-         /* Fall through */
+         /* Fall through */
 
        case R_390_TLS_LE32:
          if (!info->shared)
            break;
          info->flags |= DF_STATIC_TLS;
-         /* Fall through */        
+         /* Fall through.  */
 
-        case R_390_8:
-        case R_390_16:
+       case R_390_8:
+       case R_390_16:
        case R_390_32:
-        case R_390_PC16:
-        case R_390_PC16DBL:
+       case R_390_PC16:
+       case R_390_PC16DBL:
        case R_390_PC32DBL:
        case R_390_PC32:
          if (h != NULL && !info->shared)
@@ -1216,8 +1216,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
                  /* Track dynamic relocs needed for local syms too.
                     We really need local syms available to do this
                     easily.  Oh well.  */
-
                  asection *s;
+
                  s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
                                                 sec, r_symndx);
                  if (s == NULL)
@@ -1231,6 +1231,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
              if (p == NULL || p->sec != sec)
                {
                  bfd_size_type amt = sizeof *p;
+
                  p = ((struct elf_s390_dyn_relocs *)
                       bfd_alloc (htab->elf.dynobj, amt));
                  if (p == NULL)
@@ -1253,17 +1254,17 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
 
          /* This relocation describes the C++ object vtable hierarchy.
             Reconstruct it for later use during GC.  */
-        case R_390_GNU_VTINHERIT:
-          if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
-            return FALSE;
-          break;
+       case R_390_GNU_VTINHERIT:
+         if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+           return FALSE;
+         break;
 
          /* This relocation describes which C++ vtable entries are actually
             used.  Record for later use during GC.  */
-        case R_390_GNU_VTENTRY:
-          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
-            return FALSE;
-          break;
+       case R_390_GNU_VTENTRY:
+         if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+           return FALSE;
+         break;
 
        default:
          break;
@@ -1326,9 +1327,6 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  int r_type;
-  struct elf_link_hash_entry *h;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
@@ -1339,16 +1337,31 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
     {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
+
       r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct elf_s390_link_hash_entry *eh;
+         struct elf_s390_dyn_relocs **pp;
+         struct elf_s390_dyn_relocs *p;
 
-      if (r_symndx < symtab_hdr->sh_info)
-       h = NULL;
-      else
-       h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct elf_s390_link_hash_entry *) h;
 
-      r_type = elf_s390_tls_transition (info,
-                                       ELF32_R_TYPE (rel->r_info),
-                                       r_symndx >= symtab_hdr->sh_info);
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
+
+      r_type = ELF32_R_TYPE (rel->r_info);
+      r_type = elf_s390_tls_transition (info, r_type, h != NULL);
       switch (r_type)
        {
        case R_390_TLS_LDM32:
@@ -1379,14 +1392,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
              if (local_got_refcounts[r_symndx] > 0)
                local_got_refcounts[r_symndx] -= 1;
            }
-         if (r_type != R_390_TLS_IE32)
-           break;
-         /* Fall through */
-         
-       case R_390_TLS_LE32:
-         if (!info->shared)
-           break;
-         /* Fall through */
+         break;
 
        case R_390_8:
        case R_390_12:
@@ -1396,33 +1402,10 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
        case R_390_PC16DBL:
        case R_390_PC32DBL:
        case R_390_PC32:
-         if (h != NULL)
-           {
-             struct elf_s390_link_hash_entry *eh;
-             struct elf_s390_dyn_relocs **pp;
-             struct elf_s390_dyn_relocs *p;
-             
-             if (!info->shared && h->plt.refcount > 0)
-               h->plt.refcount -= 1;
-             
-             eh = (struct elf_s390_link_hash_entry *) h;
-             
-             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-               if (p->sec == sec)
-                 {
-                   if (ELF32_R_TYPE (rel->r_info) == R_390_PC16
-                       || ELF32_R_TYPE (rel->r_info) == R_390_PC16DBL
-                       || ELF32_R_TYPE (rel->r_info) == R_390_PC32DBL
-                       || ELF32_R_TYPE (rel->r_info) == R_390_PC32)
-                     p->pc_count -= 1;
-                   p->count -= 1;
-                   if (p->count == 0)
-                     *pp = p->next;
-                   break;
-                 }
-           }
-         break;
-         
+         if (info->shared)
+           break;
+         /* Fall through.  */
+
        case R_390_PLT16DBL:
        case R_390_PLT32DBL:
        case R_390_PLT32:
@@ -1516,8 +1499,8 @@ elf_s390_adjust_dynamic_symbol (info, h)
              && h->root.type != bfd_link_hash_undefined))
        {
          /* This case can occur if we saw a PLT32 reloc in an input
-             file, but the symbol was never referred to by a dynamic
-             object, or if all references were garbage collected.  In
+            file, but the symbol was never referred to by a dynamic
+            object, or if all references were garbage collected.  In
             such a case, we don't actually need to build a procedure
             linkage table, and we can just do a PC32 reloc instead.  */
          h->plt.offset = (bfd_vma) -1;
@@ -1847,6 +1830,7 @@ allocate_dynrelocs (h, inf)
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
       asection *sreloc = elf_section_data (p->sec)->sreloc;
+
       sreloc->_raw_size += p->count * sizeof (Elf32_External_Rela);
     }
 
@@ -2014,7 +1998,7 @@ elf_s390_size_dynamic_sections (output_bfd, info)
        }
       else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
        {
-         if (s->_raw_size != 0 && s != htab->srelplt)
+         if (s->_raw_size != 0)
            relocs = TRUE;
 
          /* We use the reloc_count field as a counter if we need
@@ -2079,10 +2063,10 @@ elf_s390_size_dynamic_sections (output_bfd, info)
        }
 
       if (relocs)
-        {
-          if (!add_dynamic_entry (DT_RELA, 0)
-              || !add_dynamic_entry (DT_RELASZ, 0)
-              || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
+       {
+         if (!add_dynamic_entry (DT_RELA, 0)
+             || !add_dynamic_entry (DT_RELASZ, 0)
+             || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela)))
            return FALSE;
 
          /* If any dynamic relocs apply to a read-only section,
@@ -2202,8 +2186,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 
       r_type = ELF32_R_TYPE (rel->r_info);
       if (r_type == (int) R_390_GNU_VTINHERIT
-          || r_type == (int) R_390_GNU_VTENTRY)
-        continue;
+         || r_type == (int) R_390_GNU_VTENTRY)
+       continue;
       if (r_type >= (int) R_390_max)
        {
          bfd_set_error (bfd_error_bad_value);
@@ -2252,7 +2236,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
@@ -2260,7 +2243,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
            {
              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
                       || ELF_ST_VISIBILITY (h->other)))))
                return FALSE;
@@ -2291,7 +2274,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                 Current offset - size first entry / entry size.  */
              plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
                PLT_ENTRY_SIZE;
-             
+
              /* Offset in GOT is PLT index plus GOT headers(3) times 4,
                 addr & GOT addr.  */
              relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
@@ -2303,164 +2286,162 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          /* Fall through.  */
 
-        case R_390_GOT12:
-        case R_390_GOT16:
-        case R_390_GOT32:
+       case R_390_GOT12:
+       case R_390_GOT16:
+       case R_390_GOT32:
        case R_390_GOTENT:
-          /* Relocation is to the entry for this symbol in the global
-             offset table.  */
+         /* Relocation is to the entry for this symbol in the global
+            offset table.  */
          if (htab->sgot == NULL)
            abort ();
 
-          if (h != NULL)
-            {
+         if (h != NULL)
+           {
              bfd_boolean dyn;
 
-              off = h->got.offset;
+             off = h->got.offset;
              dyn = htab->elf.dynamic_sections_created;
-              if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
-                  || (info->shared
-                      && (info->symbolic
+             if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
+                 || (info->shared
+                     && (info->symbolic
                          || h->dynindx == -1
                          || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-                      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
-                {
-                  /* This is actually a static link, or it is a
-                     -Bsymbolic link and the symbol is defined
-                     locally, or the symbol was forced to be local
-                     because of a version file.  We must initialize
-                     this entry in the global offset table.  Since the
-                     offset must always be a multiple of 2, 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 finish_dynamic_symbol routine.  */
-                  if ((off & 1) != 0)
-                    off &= ~1;
-                  else
-                    {
+                     && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+               {
+                 /* This is actually a static link, or it is a
+                    -Bsymbolic link and the symbol is defined
+                    locally, or the symbol was forced to be local
+                    because of a version file.  We must initialize
+                    this entry in the global offset table.  Since the
+                    offset must always be a multiple of 2, 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 finish_dynamic_symbol routine.  */
+                 if ((off & 1) != 0)
+                   off &= ~1;
+                 else
+                   {
                      bfd_put_32 (output_bfd, relocation,
                                  htab->sgot->contents + off);
-                      h->got.offset |= 1;
-                    }
-                }
+                     h->got.offset |= 1;
+                   }
+               }
              else
                unresolved_reloc = FALSE;
-            }
-          else
-            {
+           }
+         else
+           {
              if (local_got_offsets == NULL)
                abort ();
 
-              off = local_got_offsets[r_symndx];
+             off = local_got_offsets[r_symndx];
 
-              /* The offset must always be a multiple of 4.  We use
-                 the least significant bit to record whether we have
-                 already generated the necessary reloc.  */
-              if ((off & 1) != 0)
-                off &= ~1;
-              else
-                {
-                  bfd_put_32 (output_bfd, relocation,
+             /* The offset must always be a multiple of 4.  We use
+                the least significant bit to record whether we have
+                already generated the necessary reloc.  */
+             if ((off & 1) != 0)
+               off &= ~1;
+             else
+               {
+                 bfd_put_32 (output_bfd, relocation,
                              htab->sgot->contents + off);
 
-                  if (info->shared)
-                    {
-                      asection *srelgot;
-                      Elf_Internal_Rela outrel;
+                 if (info->shared)
+                   {
+                     asection *srelgot;
+                     Elf_Internal_Rela outrel;
                      bfd_byte *loc;
 
-                      srelgot = htab->srelgot;
+                     srelgot = htab->srelgot;
                      if (srelgot == NULL)
                        abort ();
 
-                      outrel.r_offset = (htab->sgot->output_section->vma
-                                         + htab->sgot->output_offset
-                                         + off);
-                      outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
+                     outrel.r_offset = (htab->sgot->output_section->vma
+                                        + htab->sgot->output_offset
+                                        + off);
+                     outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
                      outrel.r_addend = relocation;
                      loc = srelgot->contents;
                      loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
-                      bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
-                    }
+                     bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
+                   }
 
-                  local_got_offsets[r_symndx] |= 1;
-                }
-            }
+                 local_got_offsets[r_symndx] |= 1;
+               }
+           }
 
          if (off >= (bfd_vma) -2)
            abort ();
 
          relocation = htab->sgot->output_offset + off;
 
-         /*
-          * For @GOTENT the relocation is against the offset between
-          * the instruction and the symbols entry in the GOT and not
-          * between the start of the GOT and the symbols entry. We
-          * add the vma of the GOT to get the correct value.
-          */
+         /* For @GOTENT the relocation is against the offset between
+            the instruction and the symbols entry in the GOT and not
+            between the start of the GOT and the symbols entry. We
+            add the vma of the GOT to get the correct value.  */
          if (   r_type == R_390_GOTENT
              || r_type == R_390_GOTPLTENT)
            relocation += htab->sgot->output_section->vma;
 
-          break;
+         break;
 
        case R_390_GOTOFF16:
-        case R_390_GOTOFF32:
-          /* Relocation is relative to the start of the global offset
-             table.  */
-
-          /* Note that sgot->output_offset is not involved in this
-             calculation.  We always want the start of .got.  If we
-             defined _GLOBAL_OFFSET_TABLE in a different way, as is
-             permitted by the ABI, we might have to change this
-             calculation.  */
-          relocation -= htab->sgot->output_section->vma;
-          break;
-
-        case R_390_GOTPC:
+       case R_390_GOTOFF32:
+         /* Relocation is relative to the start of the global offset
+            table.  */
+
+         /* Note that sgot->output_offset is not involved in this
+            calculation.  We always want the start of .got.  If we
+            defined _GLOBAL_OFFSET_TABLE in a different way, as is
+            permitted by the ABI, we might have to change this
+            calculation.  */
+         relocation -= htab->sgot->output_section->vma;
+         break;
+
+       case R_390_GOTPC:
        case R_390_GOTPCDBL:
-          /* Use global offset table as symbol value.  */
-          relocation = htab->sgot->output_section->vma;
+         /* Use global offset table as symbol value.  */
+         relocation = htab->sgot->output_section->vma;
          unresolved_reloc = FALSE;
-          break;
+         break;
 
-        case R_390_PLT16DBL:
-        case R_390_PLT32DBL:
-        case R_390_PLT32:
-          /* Relocation is to the entry for this symbol in the
-             procedure linkage table.  */
+       case R_390_PLT16DBL:
+       case R_390_PLT32DBL:
+       case R_390_PLT32:
+         /* Relocation is to the entry for this symbol in the
+            procedure linkage table.  */
 
-          /* Resolve a PLT32 reloc against a local symbol directly,
-             without using the procedure linkage table.  */
-          if (h == NULL)
-            break;
+         /* Resolve a PLT32 reloc against a local symbol directly,
+            without using the procedure linkage table.  */
+         if (h == NULL)
+           break;
 
-          if (h->plt.offset == (bfd_vma) -1
+         if (h->plt.offset == (bfd_vma) -1
              || htab->splt == NULL)
-            {
-              /* We didn't make a PLT entry for this symbol.  This
-                 happens when statically linking PIC code, or when
-                 using -Bsymbolic.  */
-              break;
-            }
-
-          relocation = (htab->splt->output_section->vma
-                        + htab->splt->output_offset
-                        + h->plt.offset);
+           {
+             /* We didn't make a PLT entry for this symbol.  This
+                happens when statically linking PIC code, or when
+                using -Bsymbolic.  */
+             break;
+           }
+
+         relocation = (htab->splt->output_section->vma
+                       + htab->splt->output_offset
+                       + h->plt.offset);
          unresolved_reloc = FALSE;
-          break;
+         break;
 
        case R_390_PLTOFF16:
        case R_390_PLTOFF32:
-          /* Relocation is to the entry for this symbol in the
-             procedure linkage table relative to the start of the GOT.  */
+         /* Relocation is to the entry for this symbol in the
+            procedure linkage table relative to the start of the GOT.  */
 
          /* For local symbols or if we didn't make a PLT entry for
             this symbol resolve the symbol directly.  */
-          if (   h == NULL
+         if (   h == NULL
              || h->plt.offset == (bfd_vma) -1
              || htab->splt == NULL)
            {
@@ -2468,28 +2449,28 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              break;
            }
 
-          relocation = (htab->splt->output_section->vma
-                        + htab->splt->output_offset
-                        + h->plt.offset
+         relocation = (htab->splt->output_section->vma
+                       + htab->splt->output_offset
+                       + h->plt.offset
                        - htab->sgot->output_section->vma);
          unresolved_reloc = FALSE;
-          break;
-
-        case R_390_8:
-        case R_390_16:
-        case R_390_32:
-        case R_390_PC16:
-        case R_390_PC16DBL:
-        case R_390_PC32DBL:
-        case R_390_PC32:
+         break;
+
+       case R_390_8:
+       case R_390_16:
+       case R_390_32:
+       case R_390_PC16:
+       case R_390_PC16DBL:
+       case R_390_PC32DBL:
+       case R_390_PC32:
          /* r_symndx will be zero only for relocs against symbols
             from removed linkonce sections, or sections discarded by
             a linker script.  */
-          if (r_symndx == 0
-              || (input_section->flags & SEC_ALLOC) == 0)
+         if (r_symndx == 0
+             || (input_section->flags & SEC_ALLOC) == 0)
            break;
 
-          if ((info->shared
+         if ((info->shared
               && ((r_type != R_390_PC16
                    && r_type != R_390_PC16DBL
                    && r_type != R_390_PC32DBL
@@ -2509,9 +2490,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                           & ELF_LINK_HASH_DEF_REGULAR) == 0)
                      || h->root.type == bfd_link_hash_undefweak
                      || h->root.type == bfd_link_hash_undefined)))
-            {
-              Elf_Internal_Rela outrel;
-              bfd_boolean skip, relocate;
+           {
+             Elf_Internal_Rela outrel;
+             bfd_boolean skip, relocate;
              asection *sreloc;
              bfd_byte *loc;
 
@@ -2519,8 +2500,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                 are copied into the output file to be resolved at run
                 time.  */
 
-              skip = FALSE;
-              relocate = FALSE;
+             skip = FALSE;
+             relocate = FALSE;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
@@ -2529,12 +2510,12 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                skip = TRUE;
              else if (outrel.r_offset == (bfd_vma) -2)
                skip = TRUE, relocate = TRUE;
-              outrel.r_offset += (input_section->output_section->vma
-                                  + input_section->output_offset);
+             outrel.r_offset += (input_section->output_section->vma
+                                 + input_section->output_offset);
 
-              if (skip)
+             if (skip)
                memset (&outrel, 0, sizeof outrel);
-              else if (h != NULL
+             else if (h != NULL
                       && h->dynindx != -1
                       && (r_type == R_390_PC16
                           || r_type == R_390_PC16DBL
@@ -2544,17 +2525,17 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                           || !info->symbolic
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))
-                {
-                  outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
+               {
+                 outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
                  outrel.r_addend = rel->r_addend;
-                }
-              else
-                {
+               }
+             else
+               {
                  /* This symbol is local, or marked to become local.  */
                  relocate = TRUE;
                  outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
                  outrel.r_addend = relocation + rel->r_addend;
-                }
+               }
 
              sreloc = elf_section_data (input_section)->sreloc;
              if (sreloc == NULL)
@@ -2564,13 +2545,13 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
              bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
 
-              /* If this reloc is against an external symbol, we do
-                 not want to fiddle with the addend.  Otherwise, we
-                 need to include the symbol value so that it becomes
-                 an addend for the dynamic reloc.  */
-              if (! relocate)
-                continue;
-            }
+             /* If this reloc is against an external symbol, we do
+                not want to fiddle with the addend.  Otherwise, we
+                need to include the symbol value so that it becomes
+                an addend for the dynamic reloc.  */
+             if (! relocate)
+               continue;
+           }
          break;
 
          /* Relocations for tls literal pool entries.  */
@@ -2592,7 +2573,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
              bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
            }
-         /* Fall through */
+         /* Fall through */
 
        case R_390_TLS_GD32:
        case R_390_TLS_GOTIE32:
@@ -2636,7 +2617,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 
          if ((off & 1) != 0)
            off &= ~1;
-          else
+         else
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
@@ -2667,7 +2648,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                {
                  if (indx == 0)
                    {
-                     BFD_ASSERT (! unresolved_reloc);
+                     BFD_ASSERT (! unresolved_reloc);
                      bfd_put_32 (output_bfd,
                                  relocation - dtpoff_base (info),
                                  htab->sgot->contents + off + GOT_ENTRY_SIZE);
@@ -2771,7 +2752,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              htab->tls_ldm_got.offset |= 1;
            }
          relocation = htab->sgot->output_offset + off;
-         unresolved_reloc = FALSE;       
+         unresolved_reloc = FALSE;
          break;
 
        case R_390_TLS_LE32:
@@ -2981,8 +2962,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_vma relative_offset;
 
       /* This symbol has an entry in the procedure linkage table.  Set
-         it up.  */
-
+        it up.  */
       if (h->dynindx == -1
          || htab->splt == NULL
          || htab->sgotplt == NULL
@@ -2990,26 +2970,26 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
        abort ();
 
       /* Calc. index no.
-         Current offset - size first entry / entry size.  */
+        Current offset - size first entry / entry size.  */
       plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
 
       /* Offset in GOT is PLT index plus GOT headers(3) times 4,
-         addr & GOT addr.  */
+        addr & GOT addr.  */
       got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
 
       /* S390 uses halfwords for relative branch calc!  */
       relative_offset = - ((PLT_FIRST_ENTRY_SIZE +
-                           (PLT_ENTRY_SIZE * plt_index) + 18) / 2);
+                           (PLT_ENTRY_SIZE * plt_index) + 18) / 2);
       /* If offset is > 32768, branch to a previous branch
-         390 can only handle +-64 K jumps.  */
+        390 can only handle +-64 K jumps.  */
       if ( -32768 > (int) relative_offset )
-          relative_offset =
-           -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
+       relative_offset
+         = -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
 
       /* Fill in the entry in the procedure linkage table.  */
       if (!info->shared)
        {
-          bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0,
+         bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD0,
                      htab->splt->contents + h->plt.offset);
          bfd_put_32 (output_bfd, (bfd_vma) PLT_ENTRY_WORD1,
                      htab->splt->contents + h->plt.offset + 4);
@@ -3080,10 +3060,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
        }
       /* Insert offset into  reloc. table here.  */
       bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela),
-                  htab->splt->contents + h->plt.offset + 28);
+                 htab->splt->contents + h->plt.offset + 28);
 
       /* Fill in the entry in the global offset table.
-         Points to instruction after GOT offset.  */
+        Points to instruction after GOT offset.  */
       bfd_put_32 (output_bfd,
                  (htab->splt->output_section->vma
                   + htab->splt->output_offset
@@ -3120,7 +3100,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_byte *loc;
 
       /* This symbol has an entry in the global offset table.  Set it
-         up.  */
+        up.  */
 
       if (htab->sgot == NULL || htab->srelgot == NULL)
        abort ();
@@ -3143,16 +3123,16 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
          BFD_ASSERT((h->got.offset & 1) != 0);
          rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
          rela.r_addend = (h->root.u.def.value
-                           + h->root.u.def.section->output_section->vma
-                           + h->root.u.def.section->output_offset);
-        }
+                          + h->root.u.def.section->output_section->vma
+                          + h->root.u.def.section->output_offset);
+       }
       else
        {
          BFD_ASSERT((h->got.offset & 1) == 0);
          bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
          rela.r_info = ELF32_R_INFO (h->dynindx, R_390_GLOB_DAT);
-          rela.r_addend = 0;
-        }
+         rela.r_addend = 0;
+       }
 
       loc = htab->srelgot->contents;
       loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
@@ -3270,39 +3250,39 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
       /* Fill in the special first entry in the procedure linkage table.  */
       if (htab->splt && htab->splt->_raw_size > 0)
        {
-          memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
-          if (info->shared)
+         memset (htab->splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
+         if (info->shared)
            {
              bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD0,
-                         htab->splt->contents );
+                         htab->splt->contents );
              bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD1,
-                         htab->splt->contents +4 );
+                         htab->splt->contents +4 );
              bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD2,
-                         htab->splt->contents +8 );
+                         htab->splt->contents +8 );
              bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD3,
-                         htab->splt->contents +12 );
+                         htab->splt->contents +12 );
              bfd_put_32 (output_bfd, (bfd_vma) PLT_PIC_FIRST_ENTRY_WORD4,
-                         htab->splt->contents +16 );
-           }
-          else
-           {
-              bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0,
-                          htab->splt->contents );
-              bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
-                          htab->splt->contents +4 );
-              bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2,
-                          htab->splt->contents +8 );
-              bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
-                          htab->splt->contents +12 );
-              bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
-                          htab->splt->contents +16 );
-              bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
-                          htab->splt->contents +20 );
-              bfd_put_32 (output_bfd,
-                          htab->sgotplt->output_section->vma
+                         htab->splt->contents +16 );
+          }
+         else
+          {
+             bfd_put_32 (output_bfd, (bfd_vma)PLT_FIRST_ENTRY_WORD0,
+                         htab->splt->contents );
+             bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD1,
+                         htab->splt->contents +4 );
+             bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD2,
+                         htab->splt->contents +8 );
+             bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD3,
+                         htab->splt->contents +12 );
+             bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD4,
+                         htab->splt->contents +16 );
+             bfd_put_32 (output_bfd, (bfd_vma) PLT_FIRST_ENTRY_WORD5,
+                         htab->splt->contents +20 );
+             bfd_put_32 (output_bfd,
+                         htab->sgotplt->output_section->vma
                          + htab->sgotplt->output_offset,
-                          htab->splt->contents + 24);
-           }
+                         htab->splt->contents + 24);
+          }
          elf_section_data (htab->splt->output_section)
            ->this_hdr.sh_entsize = 4;
        }
@@ -3377,27 +3357,27 @@ elf_s390_grok_prstatus (abfd, note)
 #define elf_backend_plt_header_size    PLT_ENTRY_SIZE
 #define elf_backend_rela_normal                1
 
-#define elf_info_to_howto                     elf_s390_info_to_howto
+#define elf_info_to_howto                    elf_s390_info_to_howto
 
 #define bfd_elf32_bfd_is_local_label_name     elf_s390_is_local_label_name
 #define bfd_elf32_bfd_link_hash_table_create  elf_s390_link_hash_table_create
 #define bfd_elf32_bfd_reloc_type_lookup              elf_s390_reloc_type_lookup
 
 #define elf_backend_adjust_dynamic_symbol     elf_s390_adjust_dynamic_symbol
-#define elf_backend_check_relocs              elf_s390_check_relocs
+#define elf_backend_check_relocs             elf_s390_check_relocs
 #define elf_backend_copy_indirect_symbol      elf_s390_copy_indirect_symbol
 #define elf_backend_create_dynamic_sections   elf_s390_create_dynamic_sections
 #define elf_backend_finish_dynamic_sections   elf_s390_finish_dynamic_sections
 #define elf_backend_finish_dynamic_symbol     elf_s390_finish_dynamic_symbol
-#define elf_backend_gc_mark_hook              elf_s390_gc_mark_hook
-#define elf_backend_gc_sweep_hook             elf_s390_gc_sweep_hook
+#define elf_backend_gc_mark_hook             elf_s390_gc_mark_hook
+#define elf_backend_gc_sweep_hook            elf_s390_gc_sweep_hook
 #define elf_backend_reloc_type_class         elf_s390_reloc_type_class
-#define elf_backend_relocate_section          elf_s390_relocate_section
+#define elf_backend_relocate_section         elf_s390_relocate_section
 #define elf_backend_size_dynamic_sections     elf_s390_size_dynamic_sections
 #define elf_backend_reloc_type_class         elf_s390_reloc_type_class
 #define elf_backend_grok_prstatus            elf_s390_grok_prstatus
 
 #define bfd_elf32_mkobject             elf_s390_mkobject
-#define elf_backend_object_p            elf_s390_object_p
+#define elf_backend_object_p           elf_s390_object_p
 
 #include "elf32-target.h"
index f0e0177..20dc7d1 100644 (file)
@@ -3500,6 +3500,9 @@ struct elf_sh_dyn_relocs
 
   /* Number of pc-relative relocs copied for the input section.  */
   bfd_size_type pc_count;
+
+  /* If TRUE, R_SH_TLS_TPOFF32 relocation is generated.  */
+  bfd_boolean tls_tpoff32;
 };
 
 /* sh ELF linker hash entry.  */
@@ -3524,9 +3527,6 @@ struct elf_sh_link_hash_entry
   enum {
     GOT_UNKNOWN = 0, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE
   } tls_type;
-
-  /* If TRUE, R_SH_TLS_TPOFF32 relocation is generated.  */
-  bfd_boolean tls_tpoff32;
 };
 
 #define sh_elf_hash_entry(ent) ((struct elf_sh_link_hash_entry *)(ent))
@@ -3630,7 +3630,6 @@ sh_elf_link_hash_newfunc (entry, table, string)
       ret->datalabel_got.refcount = ret->root.got.refcount;
 #endif
       ret->tls_type = GOT_UNKNOWN;
-      ret->tls_tpoff32 = FALSE;
     }
 
   return (struct bfd_hash_entry *) ret;
@@ -4053,7 +4052,7 @@ allocate_dynrelocs (h, inf)
       && eh->gotplt_refcount > 0)
     {
       /* The symbol has been forced local, or we have some direct got refs,
-         so treat all the gotplt refs as got refs. */
+        so treat all the gotplt refs as got refs. */
       h->got.refcount += eh->gotplt_refcount;
       if (h->plt.refcount >= eh->gotplt_refcount)
        h->plt.refcount -= eh->gotplt_refcount;
@@ -4207,8 +4206,9 @@ allocate_dynrelocs (h, inf)
     }
   else
     {
-      if (sh_elf_hash_entry (h)->tls_tpoff32)
-       goto keep;
+      for (p = eh->dyn_relocs; p; p = p->next)
+       if (p->tls_tpoff32)
+         goto keep;
 
       /* For the non-shared case, discard space for relocs against
         symbols which turn out to need copy relocs or are not
@@ -4785,7 +4785,6 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (! info->symbolic || info->allow_shlib_undefined)
                   && ! info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
@@ -5256,10 +5255,18 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              tls_type = sh_elf_hash_entry (h)->tls_type;
              if (! info->shared
                  && (h->dynindx == -1
-                     || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
-                 && (tls_type == GOT_TLS_IE
-                     || sh_elf_hash_entry (h)->tls_tpoff32))
-               r_type = R_SH_TLS_LE_32;
+                     || (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+               {
+                 struct elf_sh_dyn_relocs *p;
+
+                 /* If TPOFF32 relocation can be created, convert it.  */
+                 for (p = sh_elf_hash_entry (h)->dyn_relocs; p; p = p->next)
+                   if (p->sec == input_section && p->tls_tpoff32)
+                     {
+                       r_type = R_SH_TLS_LE_32;
+                       break;
+                     }
+               }
            }
 
          if (r_type == R_SH_TLS_GD_32 && tls_type == GOT_TLS_IE)
@@ -5368,7 +5375,13 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  BFD_ASSERT (sreloc != NULL);
                }
 
-             indx = (h && h->dynindx != -1) ? h->dynindx : 0;
+             if (h == NULL
+                 || h->dynindx == -1
+                 || (! info->shared
+                     && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+               indx = 0;
+             else
+               indx = h->dynindx;
              outrel.r_offset = (input_section->output_section->vma
                                 + input_section->output_offset
                                 + rel->r_offset);
@@ -5400,7 +5413,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
          if ((off & 1) != 0)
            off &= ~1;
-          else
+         else
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
@@ -5415,7 +5428,13 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              outrel.r_offset = (sgot->output_section->vma
                                 + sgot->output_offset + off);
 
-             indx = (h && h->dynindx != -1) ? h->dynindx : 0;
+             if (h == NULL
+                 || h->dynindx == -1
+                 || (! info->shared
+                     && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+               indx = 0;
+             else
+               indx = h->dynindx;
              dr_type = (r_type == R_SH_TLS_GD_32 ? R_SH_TLS_DTPMOD32 :
                         R_SH_TLS_TPOFF32);
              if (dr_type == R_SH_TLS_TPOFF32 && indx == 0)
@@ -5900,9 +5919,6 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  struct elf_link_hash_entry *h;
-  struct elf_sh_link_hash_entry *eh;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
@@ -5913,15 +5929,20 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
     {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
 #ifdef INCLUDE_SHMEDIA
       int seen_stt_datalabel = 0;
 #endif
 
       r_symndx = ELF32_R_SYM (rel->r_info);
-      if (r_symndx < symtab_hdr->sh_info)
-       h = NULL;
-      else
+      if (r_symndx >= symtab_hdr->sh_info)
        {
+         struct elf_sh_link_hash_entry *eh;
+         struct elf_sh_dyn_relocs **pp;
+         struct elf_sh_dyn_relocs *p;
+
          h = sym_hashes[r_symndx - symtab_hdr->sh_info];
 #ifdef INCLUDE_SHMEDIA
          while (h->root.type == bfd_link_hash_indirect
@@ -5931,12 +5952,18 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
              h = (struct elf_link_hash_entry *) h->root.u.i.link;
            }
 #endif
+         eh = (struct elf_sh_link_hash_entry *) h;
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
        }
-      eh = (struct elf_sh_link_hash_entry *) h;
 
-      switch (sh_elf_optimized_tls_reloc (info, ELF32_R_TYPE (rel->r_info),
-                                         ELF32_R_SYM (rel->r_info)
-                                         >= symtab_hdr->sh_info))
+      r_type = ELF32_R_TYPE (rel->r_info);
+      switch (sh_elf_optimized_tls_reloc (info, r_type, h != NULL))
        {
        case R_SH_TLS_LD_32:
          if (sh_elf_hash_table (info)->tls_ldm_got.refcount > 0)
@@ -5969,6 +5996,8 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
 #ifdef INCLUDE_SHMEDIA
              if (seen_stt_datalabel)
                {
+                 struct elf_sh_link_hash_entry *eh;
+                 eh = (struct elf_sh_link_hash_entry *) h;
                  if (eh->datalabel_got.refcount > 0)
                    eh->datalabel_got.refcount -= 1;
                }
@@ -5994,27 +6023,9 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
 
        case R_SH_DIR32:
        case R_SH_REL32:
-         if (h != NULL)
-           {
-             struct elf_sh_dyn_relocs **pp;
-             struct elf_sh_dyn_relocs *p;
-
-
-             if (!info->shared && h->plt.refcount > 0)
-               h->plt.refcount -= 1;
-
-             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-               if (p->sec == sec)
-                 {
-                   if (ELF32_R_TYPE (rel->r_info) == R_SH_REL32)
-                     p->pc_count -= 1;
-                   p->count -= 1;
-                   if (p->count == 0)
-                     *pp = p->next;
-                   break;
-                 }
-           }
-         break;
+         if (info->shared)
+           break;
+         /* Fall thru */
 
        case R_SH_PLT32:
 #ifdef INCLUDE_SHMEDIA
@@ -6041,6 +6052,8 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
 #endif
          if (h != NULL)
            {
+             struct elf_sh_link_hash_entry *eh;
+             eh = (struct elf_sh_link_hash_entry *) h;
              if (eh->gotplt_refcount > 0)
                {
                  eh->gotplt_refcount -= 1;
@@ -6596,6 +6609,7 @@ sh_elf_check_relocs (abfd, info, sec, relocs)
                  p->sec = sec;
                  p->count = 0;
                  p->pc_count = 0;
+                 p->tls_tpoff32 = FALSE;
                }
 
              p->count += 1;
@@ -6693,11 +6707,11 @@ sh_elf_check_relocs (abfd, info, sec, relocs)
                  p->sec = sec;
                  p->count = 0;
                  p->pc_count = 0;
+                 p->tls_tpoff32 = FALSE;
                }
 
              p->count += 1;
-             if (h)
-               sh_elf_hash_entry (h)->tls_tpoff32 = TRUE;
+             p->tls_tpoff32 = TRUE;
            }
          break;
 
index dcdce31..e2c6544 100644 (file)
@@ -2,21 +2,21 @@
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    2003 Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -63,8 +63,8 @@ static struct bfd_hash_entry *link_hash_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
 static struct bfd_link_hash_table *elf32_sparc_link_hash_table_create
   PARAMS ((bfd *));
-static bfd_boolean create_got_section PARAMS ((bfd *,
-                                              struct bfd_link_info *));
+static bfd_boolean create_got_section
+  PARAMS ((bfd *, struct bfd_link_info *));
 static bfd_boolean elf32_sparc_create_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 static void elf32_sparc_copy_indirect_symbol
@@ -291,11 +291,14 @@ elf32_sparc_reloc_type_lookup (abfd, code)
       return &elf32_sparc_rev32_howto;
 
     default:
-      for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); i++)
-        {
-          if (sparc_reloc_map[i].bfd_reloc_val == code)
-           return &_bfd_sparc_elf_howto_table[(int) sparc_reloc_map[i].elf_reloc_val];
-        }
+      for (i = 0;
+          i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map);
+          i++)
+       {
+         if (sparc_reloc_map[i].bfd_reloc_val == code)
+           return (_bfd_sparc_elf_howto_table
+                   + (int) sparc_reloc_map[i].elf_reloc_val);
+       }
     }
     bfd_set_error (bfd_error_bad_value);
     return NULL;
@@ -633,9 +636,9 @@ link_hash_newfunc (entry, table, string)
   if (entry == NULL)
     {
       entry = bfd_hash_allocate (table,
-                                 sizeof (struct elf32_sparc_link_hash_entry));
+                                sizeof (struct elf32_sparc_link_hash_entry));
       if (entry == NULL)
-        return entry;
+       return entry;
     }
 
   /* Call the allocation method of the superclass.  */
@@ -758,32 +761,32 @@ elf32_sparc_copy_indirect_symbol (bed, dir, ind)
   if (eind->dyn_relocs != NULL)
     {
       if (edir->dyn_relocs != NULL)
-        {
-          struct elf32_sparc_dyn_relocs **pp;
-          struct elf32_sparc_dyn_relocs *p;
-
-          if (ind->root.type == bfd_link_hash_indirect)
-            abort ();
-
-          /* Add reloc counts against the weak sym to the strong sym
-             list.  Merge any entries against the same section.  */
-          for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
-            {
-              struct elf32_sparc_dyn_relocs *q;
-
-              for (q = edir->dyn_relocs; q != NULL; q = q->next)
-                if (q->sec == p->sec)
-                  {
-                    q->pc_count += p->pc_count;
-                    q->count += p->count;
-                    *pp = p->next;
-                    break;
-                  }
-              if (q == NULL)
-                pp = &p->next;
-            }
-          *pp = edir->dyn_relocs;
-        }
+       {
+         struct elf32_sparc_dyn_relocs **pp;
+         struct elf32_sparc_dyn_relocs *p;
+
+         if (ind->root.type == bfd_link_hash_indirect)
+           abort ();
+
+         /* Add reloc counts against the weak sym to the strong sym
+            list.  Merge any entries against the same section.  */
+         for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+           {
+             struct elf32_sparc_dyn_relocs *q;
+
+             for (q = edir->dyn_relocs; q != NULL; q = q->next)
+               if (q->sec == p->sec)
+                 {
+                   q->pc_count += p->pc_count;
+                   q->count += p->count;
+                   *pp = p->next;
+                   break;
+                 }
+             if (q == NULL)
+               pp = &p->next;
+           }
+         *pp = edir->dyn_relocs;
+       }
 
       edir->dyn_relocs = eind->dyn_relocs;
       eind->dyn_relocs = NULL;
@@ -820,15 +823,15 @@ elf32_sparc_tls_transition (info, abfd, r_type, is_local)
       return R_SPARC_TLS_IE_HI22;
     case R_SPARC_TLS_GD_LO10:
       if (is_local)
-        return R_SPARC_TLS_LE_LOX10;
+       return R_SPARC_TLS_LE_LOX10;
       return R_SPARC_TLS_IE_LO10;
     case R_SPARC_TLS_IE_HI22:
       if (is_local)
-        return R_SPARC_TLS_LE_HIX22;
+       return R_SPARC_TLS_LE_HIX22;
       return r_type;
     case R_SPARC_TLS_IE_LO10:
       if (is_local)
-        return R_SPARC_TLS_LE_LOX10;
+       return R_SPARC_TLS_LE_LOX10;
       return r_type;
     case R_SPARC_TLS_LDM_HI22:
       return R_SPARC_TLS_LE_HIX22;
@@ -880,12 +883,12 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
       r_type = ELF32_R_TYPE (rel->r_info);
 
       if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
-        {
-          (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
-                                 bfd_archive_filename (abfd),
-                                 r_symndx);
-          return FALSE;
-        }
+       {
+         (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
+                                bfd_archive_filename (abfd),
+                                r_symndx);
+         return FALSE;
+       }
 
       if (r_symndx < symtab_hdr->sh_info)
        h = NULL;
@@ -1049,17 +1052,17 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
        case R_SPARC_PLT32:
        case R_SPARC_WPLT30:
          /* This symbol requires a procedure linkage table entry.  We
-             actually build the entry in adjust_dynamic_symbol,
-             because this might be a case of linking PIC code without
-             linking in any dynamic objects, in which case we don't
-             need to generate a procedure linkage table after all.  */
+            actually build the entry in adjust_dynamic_symbol,
+            because this might be a case of linking PIC code without
+            linking in any dynamic objects, in which case we don't
+            need to generate a procedure linkage table after all.  */
 
          if (h == NULL)
            {
              /* The Solaris native assembler will generate a WPLT30
-                 reloc for a local symbol if you assemble a call from
-                 one section to another when using -K pic.  We treat
-                 it as WDISP30.  */
+                reloc for a local symbol if you assemble a call from
+                one section to another when using -K pic.  We treat
+                it as WDISP30.  */
              if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32)
                goto r_sparc_plt32;
              break;
@@ -1149,8 +1152,8 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
              struct elf32_sparc_dyn_relocs **head;
 
              /* When creating a shared object, we must copy these
-                 relocs into the output file.  We create a reloc
-                 section in dynobj and make room for the reloc.  */
+                relocs into the output file.  We create a reloc
+                section in dynobj and make room for the reloc.  */
              if (sreloc == NULL)
                {
                  const char *name;
@@ -1231,15 +1234,15 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
 
          break;
 
-        case R_SPARC_GNU_VTINHERIT:
-          if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
-            return FALSE;
-          break;
+       case R_SPARC_GNU_VTINHERIT:
+         if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+           return FALSE;
+         break;
 
-        case R_SPARC_GNU_VTENTRY:
-          if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
-            return FALSE;
-          break;
+       case R_SPARC_GNU_VTENTRY:
+         if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+           return FALSE;
+         break;
 
        default:
          break;
@@ -1263,21 +1266,21 @@ elf32_sparc_gc_mark_hook (sec, info, rel, h, sym)
       {
       case R_SPARC_GNU_VTINHERIT:
       case R_SPARC_GNU_VTENTRY:
-        break;
+       break;
 
       default:
-        switch (h->root.type)
-          {
-          case bfd_link_hash_defined:
-          case bfd_link_hash_defweak:
-            return h->root.u.def.section;
+       switch (h->root.type)
+         {
+         case bfd_link_hash_defined:
+         case bfd_link_hash_defweak:
+           return h->root.u.def.section;
 
-          case bfd_link_hash_common:
-            return h->root.u.c.p->section;
+         case bfd_link_hash_common:
+           return h->root.u.c.p->section;
 
          default:
            break;
-          }
+         }
        }
      }
    else
@@ -1294,14 +1297,12 @@ elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
-
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  int r_type;
-  struct elf_link_hash_entry *h;
+
+  elf_section_data (sec)->local_dynrel = NULL;
 
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
@@ -1309,116 +1310,98 @@ elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
-    switch ((r_type = elf32_sparc_tls_transition (info, abfd,
-                                                 ELF32_R_TYPE (rel->r_info),
-                                                 ELF32_R_SYM (rel->r_info)
-                                                 >= symtab_hdr->sh_info)))
-      {
-      case R_SPARC_TLS_LDM_HI22:
-      case R_SPARC_TLS_LDM_LO10:
-       if (elf32_sparc_hash_table (info)->tls_ldm_got.refcount > 0)
-         elf32_sparc_hash_table (info)->tls_ldm_got.refcount -= 1;
-       break;
-
-      case R_SPARC_TLS_LE_HIX22:
-      case R_SPARC_TLS_LE_LOX10:
-       if (info->shared)
-         goto r_sparc_plt32;
-       break;
+    {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
 
-      case R_SPARC_PC10:
-      case R_SPARC_PC22:
-         if ((r_symndx = ELF32_R_SYM (rel->r_info)) >= symtab_hdr->sh_info
-             && strcmp (sym_hashes[r_symndx
-                                   - symtab_hdr->sh_info]->root.root.string,
-                                   "_GLOBAL_OFFSET_TABLE_") == 0)
-           break;
-         /* Fall through.  */
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct elf32_sparc_link_hash_entry *eh;
+         struct elf32_sparc_dyn_relocs **pp;
+         struct elf32_sparc_dyn_relocs *p;
 
-      case R_SPARC_DISP8:
-      case R_SPARC_DISP16:
-      case R_SPARC_DISP32:
-      case R_SPARC_WDISP30:
-      case R_SPARC_WDISP22:
-      case R_SPARC_WDISP19:
-      case R_SPARC_WDISP16:
-      case R_SPARC_8:
-      case R_SPARC_16:
-      case R_SPARC_32:
-      case R_SPARC_HI22:
-      case R_SPARC_22:
-      case R_SPARC_13:
-      case R_SPARC_LO10:
-      case R_SPARC_UA16:
-      case R_SPARC_UA32:
-      r_sparc_plt32:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           struct elf32_sparc_link_hash_entry *eh;
-           struct elf32_sparc_dyn_relocs **pp;
-           struct elf32_sparc_dyn_relocs *p;
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct elf32_sparc_link_hash_entry *) h;
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
 
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+      r_type = ELF32_R_TYPE (rel->r_info);
+      r_type = elf32_sparc_tls_transition (info, abfd, r_type, h != NULL);
+      switch (r_type)
+       {
+       case R_SPARC_TLS_LDM_HI22:
+       case R_SPARC_TLS_LDM_LO10:
+         if (elf32_sparc_hash_table (info)->tls_ldm_got.refcount > 0)
+           elf32_sparc_hash_table (info)->tls_ldm_got.refcount -= 1;
+         break;
 
-           if (! info->shared)
-             --h->plt.refcount;
+       case R_SPARC_TLS_GD_HI22:
+       case R_SPARC_TLS_GD_LO10:
+       case R_SPARC_TLS_IE_HI22:
+       case R_SPARC_TLS_IE_LO10:
+       case R_SPARC_GOT10:
+       case R_SPARC_GOT13:
+       case R_SPARC_GOT22:
+         if (h != NULL)
+           {
+             if (h->got.refcount > 0)
+               h->got.refcount--;
+           }
+         else
+           {
+             if (local_got_refcounts[r_symndx] > 0)
+               local_got_refcounts[r_symndx]--;
+           }
+         break;
 
-           eh = (struct elf32_sparc_link_hash_entry *) h;
+       case R_SPARC_PC10:
+       case R_SPARC_PC22:
+         if (h != NULL
+             && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+           break;
+         /* Fall through.  */
 
-           for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-             if (p->sec == sec)
-               {
-                 if (_bfd_sparc_elf_howto_table[r_type].pc_relative)
-                   p->pc_count -= 1;
-                 p->count -= 1;
-                 if (p->count == 0)
-                   *pp = p->next;
-                 break;
-               }
-         }
-       break;
+       case R_SPARC_DISP8:
+       case R_SPARC_DISP16:
+       case R_SPARC_DISP32:
+       case R_SPARC_WDISP30:
+       case R_SPARC_WDISP22:
+       case R_SPARC_WDISP19:
+       case R_SPARC_WDISP16:
+       case R_SPARC_8:
+       case R_SPARC_16:
+       case R_SPARC_32:
+       case R_SPARC_HI22:
+       case R_SPARC_22:
+       case R_SPARC_13:
+       case R_SPARC_LO10:
+       case R_SPARC_UA16:
+       case R_SPARC_UA32:
+       case R_SPARC_PLT32:
+         if (info->shared)
+           break;
+         /* Fall through.  */
 
-      case R_SPARC_TLS_GD_HI22:
-      case R_SPARC_TLS_GD_LO10:
-      case R_SPARC_TLS_IE_HI22:
-      case R_SPARC_TLS_IE_LO10:
-      case R_SPARC_GOT10:
-      case R_SPARC_GOT13:
-      case R_SPARC_GOT22:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->got.refcount > 0)
-             h->got.refcount--;
-         }
-       else
-         {
-           if (local_got_refcounts[r_symndx] > 0)
-             local_got_refcounts[r_symndx]--;
-         }
-        break;
-
-      case R_SPARC_PLT32:
-      case R_SPARC_HIPLT22:
-      case R_SPARC_LOPLT10:
-      case R_SPARC_PCPLT32:
-      case R_SPARC_PCPLT10:
-       r_symndx = ELF32_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->plt.refcount > 0)
-             h->plt.refcount--;
-         }
-       if (r_type == R_SPARC_PLT32)
-         goto r_sparc_plt32;
-       break;
+       case R_SPARC_WPLT30:
+         if (h != NULL)
+           {
+             if (h->plt.refcount > 0)
+               h->plt.refcount--;
+           }
+         break;
 
-      default:
-       break;
-      }
+       default:
+         break;
+       }
+    }
 
   return TRUE;
 }
@@ -1632,7 +1615,7 @@ allocate_dynrelocs (h, inf)
          /* The first four entries in .plt are reserved.  */
          if (s->_raw_size == 0)
            s->_raw_size = 4 * PLT_ENTRY_SIZE;
-                    
+
          /* The procedure linkage table has a maximum size.  */
          if (s->_raw_size >= 0x400000)
            {
@@ -2058,7 +2041,7 @@ struct elf32_sparc_section_data
 };
 
 #define sec_do_relax(sec) \
-  ((struct elf32_sparc_section_data *) (sec)->used_by_bfd)->do_relax
+  ((struct elf32_sparc_section_data *) elf_section_data (sec))->do_relax
 
 static bfd_boolean
 elf32_sparc_new_section_hook (abfd, sec)
@@ -2176,8 +2159,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
       r_type = ELF32_R_TYPE (rel->r_info);
 
       if (r_type == R_SPARC_GNU_VTINHERIT
-          || r_type == R_SPARC_GNU_VTENTRY)
-        continue;
+         || r_type == R_SPARC_GNU_VTENTRY)
+       continue;
 
       if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
        {
@@ -2224,7 +2207,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            ;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            ;
@@ -2245,7 +2227,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_SPARC_GOT13:
        case R_SPARC_GOT22:
          /* Relocation is to the entry for this symbol in the global
-             offset table.  */
+            offset table.  */
          if (htab->sgot == NULL)
            abort ();
 
@@ -2265,13 +2247,13 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
                      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
                {
                  /* This is actually a static link, or it is a
-                     -Bsymbolic link and the symbol is defined
-                     locally, or the symbol was forced to be local
-                     because of a version file.  We must initialize
-                     this entry in the global offset table.  Since the
-                     offset must always be a multiple of 4, we use the
-                     least significant bit to record whether we have
-                     initialized it already.
+                    -Bsymbolic link and the symbol is defined
+                    locally, or the symbol was forced to be local
+                    because of a version file.  We must initialize
+                    this entry in the global offset table.  Since the
+                    offset must always be a multiple of 4, we use the
+                    least significant bit to record whether we have
+                    initialized it already.
 
                     When doing a dynamic link, we create a .rela.got
                     relocation entry to initialize the value.  This
@@ -2343,7 +2325,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_SPARC_WPLT30:
        r_sparc_wplt30:
          /* Relocation is to the entry for this symbol in the
-             procedure linkage table.  */
+            procedure linkage table.  */
 
          /* The Solaris native assembler will generate a WPLT30 reloc
             for a local symbol if you assemble a call from one
@@ -2355,8 +2337,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
          if (h->plt.offset == (bfd_vma) -1)
            {
              /* We didn't make a PLT entry for this symbol.  This
-                 happens when statically linking PIC code, or when
-                 using -Bsymbolic.  */
+                happens when statically linking PIC code, or when
+                using -Bsymbolic.  */
              break;
            }
 
@@ -2428,8 +2410,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              bfd_boolean skip, relocate = FALSE;
 
              /* When generating a shared object, these relocations
-                 are copied into the output file to be resolved at run
-                 time.  */
+                are copied into the output file to be resolved at run
+                time.  */
 
              BFD_ASSERT (sreloc != NULL);
 
@@ -2481,7 +2463,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              if (skip)
                memset (&outrel, 0, sizeof outrel);
              /* h->dynindx may be -1 if the symbol was marked to
-                 become local.  */
+                become local.  */
              else if (h != NULL && ! is_plt
                       && ((! info->symbolic && h->dynindx != -1)
                           || (h->elf_link_hash_flags
@@ -2550,7 +2532,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
 
              /* This reloc will be computed at runtime, so there's no
-                 need to do anything now.  */
+                need to do anything now.  */
              if (! relocate)
                continue;
            }
@@ -2615,7 +2597,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              break;
            }
 
-          if (h != NULL)
+         if (h != NULL)
            {
              off = h->got.offset;
              h->got.offset |= 1;
@@ -2626,14 +2608,14 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
              off = local_got_offsets[r_symndx];
              local_got_offsets[r_symndx] |= 1;
            }
-           
+
        r_sparc_tlsldm:
          if (htab->sgot == NULL)
            abort ();
 
          if ((off & 1) != 0)
            off &= ~1;
-          else
+         else
            {
              Elf_Internal_Rela outrel;
              Elf32_External_Rela *loc;
@@ -3099,7 +3081,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
 {
   bfd *dynobj;
   struct elf32_sparc_link_hash_table *htab;
-        
+
   htab = elf32_sparc_hash_table (info);
   dynobj = htab->elf.dynobj;
 
@@ -3111,7 +3093,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_byte *loc;
 
       /* This symbol has an entry in the procedure linkage table.  Set
-         it up.  */
+        it up.  */
 
       BFD_ASSERT (h->dynindx != -1);
 
@@ -3165,7 +3147,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_byte *loc;
 
       /* This symbol has an entry in the global offset table.  Set it
-         up.  */
+        up.  */
 
       sgot = htab->sgot;
       srela = htab->srelgot;
@@ -3245,7 +3227,7 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
   bfd *dynobj;
   asection *sdyn;
   struct elf32_sparc_link_hash_table *htab;
-  
+
   htab = elf32_sparc_hash_table (info);
   dynobj = htab->elf.dynobj;
 
@@ -3513,7 +3495,7 @@ elf32_sparc_reloc_type_class (rela)
 #define elf_backend_object_p           elf32_sparc_object_p
 #define elf_backend_final_write_processing \
                                        elf32_sparc_final_write_processing
-#define elf_backend_gc_mark_hook        elf32_sparc_gc_mark_hook
+#define elf_backend_gc_mark_hook       elf32_sparc_gc_mark_hook
 #define elf_backend_gc_sweep_hook       elf32_sparc_gc_sweep_hook
 #define elf_backend_reloc_type_class   elf32_sparc_reloc_type_class
 
index a9e8b0b..1aca042 100644 (file)
@@ -1,23 +1,23 @@
 /* VAX series support for 32-bit ELF
-   Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Contributed by Matt Thomas <matt@3am-software.com>.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -1539,7 +1539,6 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
@@ -1699,7 +1698,6 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
              /* 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;
@@ -1908,7 +1906,6 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
 
       /* This symbol has an entry in the procedure linkage table.  Set
         it up.  */
-
       BFD_ASSERT (h->dynindx != -1);
 
       splt = bfd_get_section_by_name (dynobj, ".plt");
@@ -1975,7 +1972,6 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
 
       /* This symbol has an entry in the global offset table.  Set it
         up.  */
-
       sgot = bfd_get_section_by_name (dynobj, ".got");
       srela = bfd_get_section_by_name (dynobj, ".rela.got");
       BFD_ASSERT (sgot != NULL && srela != NULL);
@@ -2014,7 +2010,6 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_byte *loc;
 
       /* This symbol needs a copy reloc.  Set it up.  */
-
       BFD_ASSERT (h->dynindx != -1
                  && (h->root.type == bfd_link_hash_defined
                      || h->root.type == bfd_link_hash_defweak));
index 9569b38..9f564ca 100644 (file)
@@ -2184,7 +2184,13 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
 
          info.h = NULL;
          info.other = isym->st_other;
-         info.first_gotent = &local_got_entries[r_symndx];
+         if (local_got_entries)
+           info.first_gotent = &local_got_entries[r_symndx];
+         else
+           {
+             info.first_gotent = &info.gotent;
+             info.gotent = NULL;
+           }
        }
       else
        {
@@ -4438,8 +4444,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
             unless it has been done already.  */
          if ((sec->flags & SEC_MERGE)
              && ELF_ST_TYPE (sym->st_info) == STT_SECTION
-             && (elf_section_data (sec)->sec_info_type
-                 == ELF_INFO_TYPE_MERGE)
+             && sec->sec_info_type == ELF_INFO_TYPE_MERGE
              && gotent
              && !gotent->reloc_xlated)
            {
@@ -4498,7 +4503,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.root.type == bfd_link_hash_undefweak)
            undef_weak_ref = TRUE;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
            ;
@@ -5171,7 +5175,7 @@ elf64_alpha_finish_dynamic_sections (output_bfd, info)
          bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
        }
 
-      /* Initialize the PLT0 entry */
+      /* Initialize the PLT0 entry */
       if (splt->_raw_size > 0)
        {
          bfd_put_32 (output_bfd, PLT_HEADER_WORD1, splt->contents);
index 98f46dc..4d3b8d4 100644 (file)
@@ -1,21 +1,21 @@
 /* Support for HPPA 64-bit ELF
-   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "alloca-conf.h"
 #include "bfd.h"
index d29f286..807ddf5 100644 (file)
@@ -300,9 +300,11 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -795,9 +797,11 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -1894,7 +1898,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
   /* There is no BFD reloc for R_MIPS_REL32.  */
   { BFD_RELOC_64, R_MIPS_64 },
   { BFD_RELOC_CTOR, R_MIPS_64 },
-  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   { BFD_RELOC_HI16_S, R_MIPS_HI16 },
   { BFD_RELOC_LO16, R_MIPS_LO16 },
   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
index a7b2806..bcf9962 100644 (file)
@@ -52,7 +52,7 @@ struct _mmix_elf_section_data
 };
 
 #define mmix_elf_section_data(sec) \
-  ((struct _mmix_elf_section_data *) (sec)->used_by_bfd)
+  ((struct _mmix_elf_section_data *) elf_section_data (sec))
 
 /* For each section containing a base-plus-offset (BPO) reloc, we attach
    this struct as mmix_elf_section_data (section)->bpo, which is otherwise
index 2ca139d..23d95d5 100644 (file)
@@ -3,21 +3,21 @@
    Written by Linus Nordberg, Swox AB <info@swox.com>,
    based on elf32-ppc.c by Ian Lance Taylor.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This file is based on the 64-bit PowerPC ELF ABI.  It is also based
    on the file elf32-ppc.c.  */
@@ -71,7 +71,11 @@ static bfd_boolean ppc64_elf_new_section_hook
 #define PLT_INITIAL_ENTRY_SIZE PLT_ENTRY_SIZE
 
 /* TOC base pointers offset from start of TOC.  */
-#define TOC_BASE_OFF (0x8000)
+#define TOC_BASE_OFF   0x8000
+
+/* Offset of tp and dtp pointers from start of TLS block.  */
+#define TP_OFFSET      0x7000
+#define DTP_OFFSET     0x8000
 
 /* .plt call stub instructions.  */
 #define ADDIS_R12_R2   0x3d820000      /* addis %r12,%r2,xxx@ha     */
@@ -134,8 +138,8 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
   /* This reloc does nothing.  */
   HOWTO (R_PPC64_NONE,         /* type */
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
-        8,                     /* bitsize */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
@@ -1152,223 +1156,913 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
         0xfffc,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* GNU extension to record C++ vtable hierarchy.  */
-  HOWTO (R_PPC64_GNU_VTINHERIT,        /* type */
+  /* Marker reloc for TLS.  */
+  HOWTO (R_PPC64_TLS,
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
-        0,                     /* bitsize */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
-        NULL,                  /* special_function */
-        "R_PPC64_GNU_VTINHERIT", /* name */
+        bfd_elf_generic_reloc, /* special_function */
+        "R_PPC64_TLS",         /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
         0,                     /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* GNU extension to record C++ vtable member usage.  */
-  HOWTO (R_PPC64_GNU_VTENTRY,  /* type */
+  /* Computes the load module index of the load module that contains the
+     definition of its TLS sym.  */
+  HOWTO (R_PPC64_DTPMOD64,
         0,                     /* rightshift */
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */
-        0,                     /* bitsize */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
-        NULL,                  /* special_function */
-        "R_PPC64_GNU_VTENTRY", /* name */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPMOD64",    /* name */
         FALSE,                 /* partial_inplace */
         0,                     /* src_mask */
-        0,                     /* dst_mask */
+        ONES (64),             /* dst_mask */
         FALSE),                /* pcrel_offset */
-};
-
-\f
-/* Initialize the ppc64_elf_howto_table, so that linear accesses can
-   be done.  */
-
-static void
-ppc_howto_init ()
-{
-  unsigned int i, type;
 
-  for (i = 0;
-       i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]);
-       i++)
-    {
-      type = ppc64_elf_howto_raw[i].type;
-      BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
-                         / sizeof (ppc64_elf_howto_table[0])));
-      ppc64_elf_howto_table[type] = &ppc64_elf_howto_raw[i];
-    }
-}
+  /* Computes a dtv-relative displacement, the difference between the value
+     of sym+add and the base address of the thread-local storage block that
+     contains the definition of sym, minus 0x8000.  */
+  HOWTO (R_PPC64_DTPREL64,
+        0,                     /* rightshift */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL64",    /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        ONES (64),             /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-static reloc_howto_type *
-ppc64_elf_reloc_type_lookup (abfd, code)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     bfd_reloc_code_real_type code;
-{
-  enum elf_ppc64_reloc_type ppc_reloc = R_PPC64_NONE;
+  /* A 16 bit dtprel reloc.  */
+  HOWTO (R_PPC64_DTPREL16,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16",    /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-  if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
-    /* Initialize howto table if needed.  */
-    ppc_howto_init ();
+  /* Like DTPREL16, but no overflow.  */
+  HOWTO (R_PPC64_DTPREL16_LO,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_LO", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-  switch ((int) code)
-    {
-    default:
-      return (reloc_howto_type *) NULL;
+  /* Like DTPREL16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_DTPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-    case BFD_RELOC_NONE:                ppc_reloc = R_PPC64_NONE;
-      break;
-    case BFD_RELOC_32:                  ppc_reloc = R_PPC64_ADDR32;
-      break;
-    case BFD_RELOC_PPC_BA26:            ppc_reloc = R_PPC64_ADDR24;
-      break;
-    case BFD_RELOC_16:                  ppc_reloc = R_PPC64_ADDR16;
-      break;
-    case BFD_RELOC_LO16:                ppc_reloc = R_PPC64_ADDR16_LO;
-      break;
-    case BFD_RELOC_HI16:                ppc_reloc = R_PPC64_ADDR16_HI;
-      break;
-    case BFD_RELOC_HI16_S:              ppc_reloc = R_PPC64_ADDR16_HA;
-      break;
-    case BFD_RELOC_PPC_BA16:            ppc_reloc = R_PPC64_ADDR14;
-      break;
-    case BFD_RELOC_PPC_BA16_BRTAKEN:    ppc_reloc = R_PPC64_ADDR14_BRTAKEN;
-      break;
-    case BFD_RELOC_PPC_BA16_BRNTAKEN:   ppc_reloc = R_PPC64_ADDR14_BRNTAKEN;
-      break;
-    case BFD_RELOC_PPC_B26:             ppc_reloc = R_PPC64_REL24;
-      break;
-    case BFD_RELOC_PPC_B16:             ppc_reloc = R_PPC64_REL14;
-      break;
-    case BFD_RELOC_PPC_B16_BRTAKEN:     ppc_reloc = R_PPC64_REL14_BRTAKEN;
-      break;
-    case BFD_RELOC_PPC_B16_BRNTAKEN:    ppc_reloc = R_PPC64_REL14_BRNTAKEN;
-      break;
-    case BFD_RELOC_16_GOTOFF:           ppc_reloc = R_PPC64_GOT16;
-      break;
-    case BFD_RELOC_LO16_GOTOFF:                 ppc_reloc = R_PPC64_GOT16_LO;
-      break;
-    case BFD_RELOC_HI16_GOTOFF:                 ppc_reloc = R_PPC64_GOT16_HI;
-      break;
-    case BFD_RELOC_HI16_S_GOTOFF:       ppc_reloc = R_PPC64_GOT16_HA;
-      break;
-    case BFD_RELOC_PPC_COPY:            ppc_reloc = R_PPC64_COPY;
-      break;
-    case BFD_RELOC_PPC_GLOB_DAT:        ppc_reloc = R_PPC64_GLOB_DAT;
-      break;
-    case BFD_RELOC_32_PCREL:            ppc_reloc = R_PPC64_REL32;
-      break;
-    case BFD_RELOC_32_PLTOFF:           ppc_reloc = R_PPC64_PLT32;
-      break;
-    case BFD_RELOC_32_PLT_PCREL:        ppc_reloc = R_PPC64_PLTREL32;
-      break;
-    case BFD_RELOC_LO16_PLTOFF:                 ppc_reloc = R_PPC64_PLT16_LO;
-      break;
-    case BFD_RELOC_HI16_PLTOFF:                 ppc_reloc = R_PPC64_PLT16_HI;
-      break;
-    case BFD_RELOC_HI16_S_PLTOFF:       ppc_reloc = R_PPC64_PLT16_HA;
-      break;
-    case BFD_RELOC_16_BASEREL:          ppc_reloc = R_PPC64_SECTOFF;
-      break;
-    case BFD_RELOC_LO16_BASEREL:        ppc_reloc = R_PPC64_SECTOFF_LO;
-      break;
-    case BFD_RELOC_HI16_BASEREL:        ppc_reloc = R_PPC64_SECTOFF_HI;
-      break;
-    case BFD_RELOC_HI16_S_BASEREL:      ppc_reloc = R_PPC64_SECTOFF_HA;
-      break;
-    case BFD_RELOC_CTOR:                ppc_reloc = R_PPC64_ADDR64;
-      break;
-    case BFD_RELOC_64:                  ppc_reloc = R_PPC64_ADDR64;
-      break;
-    case BFD_RELOC_PPC64_HIGHER:        ppc_reloc = R_PPC64_ADDR16_HIGHER;
-      break;
-    case BFD_RELOC_PPC64_HIGHER_S:      ppc_reloc = R_PPC64_ADDR16_HIGHERA;
-      break;
-    case BFD_RELOC_PPC64_HIGHEST:       ppc_reloc = R_PPC64_ADDR16_HIGHEST;
-      break;
-    case BFD_RELOC_PPC64_HIGHEST_S:     ppc_reloc = R_PPC64_ADDR16_HIGHESTA;
-      break;
-    case BFD_RELOC_64_PCREL:            ppc_reloc = R_PPC64_REL64;
-      break;
-    case BFD_RELOC_64_PLTOFF:           ppc_reloc = R_PPC64_PLT64;
-      break;
-    case BFD_RELOC_64_PLT_PCREL:        ppc_reloc = R_PPC64_PLTREL64;
-      break;
-    case BFD_RELOC_PPC_TOC16:           ppc_reloc = R_PPC64_TOC16;
-      break;
-    case BFD_RELOC_PPC64_TOC16_LO:      ppc_reloc = R_PPC64_TOC16_LO;
-      break;
-    case BFD_RELOC_PPC64_TOC16_HI:      ppc_reloc = R_PPC64_TOC16_HI;
-      break;
-    case BFD_RELOC_PPC64_TOC16_HA:      ppc_reloc = R_PPC64_TOC16_HA;
-      break;
-    case BFD_RELOC_PPC64_TOC:           ppc_reloc = R_PPC64_TOC;
-      break;
-    case BFD_RELOC_PPC64_PLTGOT16:      ppc_reloc = R_PPC64_PLTGOT16;
-      break;
-    case BFD_RELOC_PPC64_PLTGOT16_LO:   ppc_reloc = R_PPC64_PLTGOT16_LO;
-      break;
-    case BFD_RELOC_PPC64_PLTGOT16_HI:   ppc_reloc = R_PPC64_PLTGOT16_HI;
-      break;
-    case BFD_RELOC_PPC64_PLTGOT16_HA:   ppc_reloc = R_PPC64_PLTGOT16_HA;
-      break;
-    case BFD_RELOC_PPC64_ADDR16_DS:      ppc_reloc = R_PPC64_ADDR16_DS;
-      break;
-    case BFD_RELOC_PPC64_ADDR16_LO_DS:   ppc_reloc = R_PPC64_ADDR16_LO_DS;
-      break;
-    case BFD_RELOC_PPC64_GOT16_DS:       ppc_reloc = R_PPC64_GOT16_DS;
-      break;
-    case BFD_RELOC_PPC64_GOT16_LO_DS:    ppc_reloc = R_PPC64_GOT16_LO_DS;
-      break;
-    case BFD_RELOC_PPC64_PLT16_LO_DS:    ppc_reloc = R_PPC64_PLT16_LO_DS;
-      break;
-    case BFD_RELOC_PPC64_SECTOFF_DS:     ppc_reloc = R_PPC64_SECTOFF_DS;
-      break;
-    case BFD_RELOC_PPC64_SECTOFF_LO_DS:  ppc_reloc = R_PPC64_SECTOFF_LO_DS;
-      break;
-    case BFD_RELOC_PPC64_TOC16_DS:       ppc_reloc = R_PPC64_TOC16_DS;
-      break;
-    case BFD_RELOC_PPC64_TOC16_LO_DS:    ppc_reloc = R_PPC64_TOC16_LO_DS;
-      break;
-    case BFD_RELOC_PPC64_PLTGOT16_DS:    ppc_reloc = R_PPC64_PLTGOT16_DS;
-      break;
-    case BFD_RELOC_PPC64_PLTGOT16_LO_DS: ppc_reloc = R_PPC64_PLTGOT16_LO_DS;
-      break;
-    case BFD_RELOC_VTABLE_INHERIT:      ppc_reloc = R_PPC64_GNU_VTINHERIT;
-      break;
-    case BFD_RELOC_VTABLE_ENTRY:        ppc_reloc = R_PPC64_GNU_VTENTRY;
-      break;
-    }
+  /* Like DTPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_DTPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-  return ppc64_elf_howto_table[(int) ppc_reloc];
-};
+  /* Like DTPREL16_HI, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_DTPREL16_HIGHER,
+        32,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_HIGHER", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-/* Set the howto pointer for a PowerPC ELF reloc.  */
+  /* Like DTPREL16_HIGHER, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_DTPREL16_HIGHERA,
+        32,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_HIGHERA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-static void
-ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     arelent *cache_ptr;
-     Elf_Internal_Rela *dst;
-{
-  unsigned int type;
+  /* Like DTPREL16_HIGHER, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_DTPREL16_HIGHEST,
+        48,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_HIGHEST", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-  /* Initialize howto table if needed.  */
-  if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
-    ppc_howto_init ();
+  /* Like DTPREL16_HIGHEST, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_DTPREL16_HIGHESTA,
+        48,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_HIGHESTA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-  type = ELF64_R_TYPE (dst->r_info);
-  BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
-                     / sizeof (ppc64_elf_howto_table[0])));
-  cache_ptr->howto = ppc64_elf_howto_table[type];
-}
+  /* Like DTPREL16, but for insns with a DS field.  */
+  HOWTO (R_PPC64_DTPREL16_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xfffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-/* Handle the R_PPC64_ADDR16_HA and similar relocs.  */
+  /* Like DTPREL16_DS, but no overflow.  */
+  HOWTO (R_PPC64_DTPREL16_LO_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_DTPREL16_LO_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xfffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
 
-static bfd_reloc_status_type
+  /* Computes a tp-relative displacement, the difference between the value of
+     sym+add and the value of the thread pointer (r13).  */
+  HOWTO (R_PPC64_TPREL64,
+        0,                     /* rightshift */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL64",     /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        ONES (64),             /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* A 16 bit tprel reloc.  */
+  HOWTO (R_PPC64_TPREL16,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16",     /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16, but no overflow.  */
+  HOWTO (R_PPC64_TPREL16_LO,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_LO",  /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_TPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_HI",  /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_TPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_HA",  /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_HI, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_TPREL16_HIGHER,
+        32,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_HIGHER",      /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_HIGHER, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_TPREL16_HIGHERA,
+        32,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_HIGHERA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_HIGHER, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_TPREL16_HIGHEST,
+        48,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_HIGHEST", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_HIGHEST, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_TPREL16_HIGHESTA,
+        48,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_HIGHESTA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16, but for insns with a DS field.  */
+  HOWTO (R_PPC64_TPREL16_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_DS",  /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xfffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like TPREL16_DS, but no overflow.  */
+  HOWTO (R_PPC64_TPREL16_LO_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_TPREL16_LO_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xfffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+     with values (sym+add)@dtpmod and (sym+add)@dtprel, and computes the offset
+     to the first entry relative to the TOC base (r2).  */
+  HOWTO (R_PPC64_GOT_TLSGD16,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSGD16", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TLSGD16, but no overflow.  */
+  HOWTO (R_PPC64_GOT_TLSGD16_LO,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSGD16_LO", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TLSGD16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_GOT_TLSGD16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSGD16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TLSGD16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_GOT_TLSGD16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSGD16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates two contiguous entries in the GOT to hold a tls_index structure,
+     with values (sym+add)@dtpmod and zero, and computes the offset to the
+     first entry relative to the TOC base (r2).  */
+  HOWTO (R_PPC64_GOT_TLSLD16,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSLD16", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TLSLD16, but no overflow.  */
+  HOWTO (R_PPC64_GOT_TLSLD16_LO,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSLD16_LO", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TLSLD16_LO, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_GOT_TLSLD16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSLD16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TLSLD16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_GOT_TLSLD16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TLSLD16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates an entry in the GOT with value (sym+add)@dtprel, and computes
+     the offset to the entry relative to the TOC base (r2).  */
+  HOWTO (R_PPC64_GOT_DTPREL16_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_DTPREL16_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xfffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_DTPREL16_DS, but no overflow.  */
+  HOWTO (R_PPC64_GOT_DTPREL16_LO_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_DTPREL16_LO_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xfffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_DTPREL16_LO_DS, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_GOT_DTPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_DTPREL16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_DTPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_GOT_DTPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_DTPREL16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Allocates an entry in the GOT with value (sym+add)@tprel, and computes the
+     offset to the entry relative to the TOC base (r2).  */
+  HOWTO (R_PPC64_GOT_TPREL16_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TPREL16_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TPREL16_DS, but no overflow.  */
+  HOWTO (R_PPC64_GOT_TPREL16_LO_DS,
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TPREL16_LO_DS", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TPREL16_LO_DS, but next higher group of 16 bits.  */
+  HOWTO (R_PPC64_GOT_TPREL16_HI,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TPREL16_HI", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* Like GOT_TPREL16_HI, but adjust for low 16 bits.  */
+  HOWTO (R_PPC64_GOT_TPREL16_HA,
+        16,                    /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        ppc64_elf_unhandled_reloc, /* special_function */
+        "R_PPC64_GOT_TPREL16_HA", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
+  /* GNU extension to record C++ vtable hierarchy.  */
+  HOWTO (R_PPC64_GNU_VTINHERIT,        /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        NULL,                  /* special_function */
+        "R_PPC64_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_PPC64_GNU_VTENTRY,  /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        NULL,                  /* special_function */
+        "R_PPC64_GNU_VTENTRY", /* name */
+        FALSE,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        FALSE),                /* pcrel_offset */
+};
+
+\f
+/* Initialize the ppc64_elf_howto_table, so that linear accesses can
+   be done.  */
+
+static void
+ppc_howto_init ()
+{
+  unsigned int i, type;
+
+  for (i = 0;
+       i < sizeof (ppc64_elf_howto_raw) / sizeof (ppc64_elf_howto_raw[0]);
+       i++)
+    {
+      type = ppc64_elf_howto_raw[i].type;
+      BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
+                         / sizeof (ppc64_elf_howto_table[0])));
+      ppc64_elf_howto_table[type] = &ppc64_elf_howto_raw[i];
+    }
+}
+
+static reloc_howto_type *
+ppc64_elf_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  enum elf_ppc64_reloc_type r = R_PPC64_NONE;
+
+  if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
+    /* Initialize howto table if needed.  */
+    ppc_howto_init ();
+
+  switch ((int) code)
+    {
+    default:
+      return (reloc_howto_type *) NULL;
+
+    case BFD_RELOC_NONE:                       r = R_PPC64_NONE;
+      break;
+    case BFD_RELOC_32:                         r = R_PPC64_ADDR32;
+      break;
+    case BFD_RELOC_PPC_BA26:                   r = R_PPC64_ADDR24;
+      break;
+    case BFD_RELOC_16:                         r = R_PPC64_ADDR16;
+      break;
+    case BFD_RELOC_LO16:                       r = R_PPC64_ADDR16_LO;
+      break;
+    case BFD_RELOC_HI16:                       r = R_PPC64_ADDR16_HI;
+      break;
+    case BFD_RELOC_HI16_S:                     r = R_PPC64_ADDR16_HA;
+      break;
+    case BFD_RELOC_PPC_BA16:                   r = R_PPC64_ADDR14;
+      break;
+    case BFD_RELOC_PPC_BA16_BRTAKEN:           r = R_PPC64_ADDR14_BRTAKEN;
+      break;
+    case BFD_RELOC_PPC_BA16_BRNTAKEN:          r = R_PPC64_ADDR14_BRNTAKEN;
+      break;
+    case BFD_RELOC_PPC_B26:                    r = R_PPC64_REL24;
+      break;
+    case BFD_RELOC_PPC_B16:                    r = R_PPC64_REL14;
+      break;
+    case BFD_RELOC_PPC_B16_BRTAKEN:            r = R_PPC64_REL14_BRTAKEN;
+      break;
+    case BFD_RELOC_PPC_B16_BRNTAKEN:           r = R_PPC64_REL14_BRNTAKEN;
+      break;
+    case BFD_RELOC_16_GOTOFF:                  r = R_PPC64_GOT16;
+      break;
+    case BFD_RELOC_LO16_GOTOFF:                        r = R_PPC64_GOT16_LO;
+      break;
+    case BFD_RELOC_HI16_GOTOFF:                        r = R_PPC64_GOT16_HI;
+      break;
+    case BFD_RELOC_HI16_S_GOTOFF:              r = R_PPC64_GOT16_HA;
+      break;
+    case BFD_RELOC_PPC_COPY:                   r = R_PPC64_COPY;
+      break;
+    case BFD_RELOC_PPC_GLOB_DAT:               r = R_PPC64_GLOB_DAT;
+      break;
+    case BFD_RELOC_32_PCREL:                   r = R_PPC64_REL32;
+      break;
+    case BFD_RELOC_32_PLTOFF:                  r = R_PPC64_PLT32;
+      break;
+    case BFD_RELOC_32_PLT_PCREL:               r = R_PPC64_PLTREL32;
+      break;
+    case BFD_RELOC_LO16_PLTOFF:                        r = R_PPC64_PLT16_LO;
+      break;
+    case BFD_RELOC_HI16_PLTOFF:                        r = R_PPC64_PLT16_HI;
+      break;
+    case BFD_RELOC_HI16_S_PLTOFF:              r = R_PPC64_PLT16_HA;
+      break;
+    case BFD_RELOC_16_BASEREL:                 r = R_PPC64_SECTOFF;
+      break;
+    case BFD_RELOC_LO16_BASEREL:               r = R_PPC64_SECTOFF_LO;
+      break;
+    case BFD_RELOC_HI16_BASEREL:               r = R_PPC64_SECTOFF_HI;
+      break;
+    case BFD_RELOC_HI16_S_BASEREL:             r = R_PPC64_SECTOFF_HA;
+      break;
+    case BFD_RELOC_CTOR:                       r = R_PPC64_ADDR64;
+      break;
+    case BFD_RELOC_64:                         r = R_PPC64_ADDR64;
+      break;
+    case BFD_RELOC_PPC64_HIGHER:               r = R_PPC64_ADDR16_HIGHER;
+      break;
+    case BFD_RELOC_PPC64_HIGHER_S:             r = R_PPC64_ADDR16_HIGHERA;
+      break;
+    case BFD_RELOC_PPC64_HIGHEST:              r = R_PPC64_ADDR16_HIGHEST;
+      break;
+    case BFD_RELOC_PPC64_HIGHEST_S:            r = R_PPC64_ADDR16_HIGHESTA;
+      break;
+    case BFD_RELOC_64_PCREL:                   r = R_PPC64_REL64;
+      break;
+    case BFD_RELOC_64_PLTOFF:                  r = R_PPC64_PLT64;
+      break;
+    case BFD_RELOC_64_PLT_PCREL:               r = R_PPC64_PLTREL64;
+      break;
+    case BFD_RELOC_PPC_TOC16:                  r = R_PPC64_TOC16;
+      break;
+    case BFD_RELOC_PPC64_TOC16_LO:             r = R_PPC64_TOC16_LO;
+      break;
+    case BFD_RELOC_PPC64_TOC16_HI:             r = R_PPC64_TOC16_HI;
+      break;
+    case BFD_RELOC_PPC64_TOC16_HA:             r = R_PPC64_TOC16_HA;
+      break;
+    case BFD_RELOC_PPC64_TOC:                  r = R_PPC64_TOC;
+      break;
+    case BFD_RELOC_PPC64_PLTGOT16:             r = R_PPC64_PLTGOT16;
+      break;
+    case BFD_RELOC_PPC64_PLTGOT16_LO:          r = R_PPC64_PLTGOT16_LO;
+      break;
+    case BFD_RELOC_PPC64_PLTGOT16_HI:          r = R_PPC64_PLTGOT16_HI;
+      break;
+    case BFD_RELOC_PPC64_PLTGOT16_HA:          r = R_PPC64_PLTGOT16_HA;
+      break;
+    case BFD_RELOC_PPC64_ADDR16_DS:            r = R_PPC64_ADDR16_DS;
+      break;
+    case BFD_RELOC_PPC64_ADDR16_LO_DS:         r = R_PPC64_ADDR16_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_GOT16_DS:             r = R_PPC64_GOT16_DS;
+      break;
+    case BFD_RELOC_PPC64_GOT16_LO_DS:          r = R_PPC64_GOT16_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_PLT16_LO_DS:          r = R_PPC64_PLT16_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_SECTOFF_DS:           r = R_PPC64_SECTOFF_DS;
+      break;
+    case BFD_RELOC_PPC64_SECTOFF_LO_DS:                r = R_PPC64_SECTOFF_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_TOC16_DS:             r = R_PPC64_TOC16_DS;
+      break;
+    case BFD_RELOC_PPC64_TOC16_LO_DS:          r = R_PPC64_TOC16_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_PLTGOT16_DS:          r = R_PPC64_PLTGOT16_DS;
+      break;
+    case BFD_RELOC_PPC64_PLTGOT16_LO_DS:       r = R_PPC64_PLTGOT16_LO_DS;
+      break;
+    case BFD_RELOC_PPC_TLS:                    r = R_PPC64_TLS;
+      break;
+    case BFD_RELOC_PPC_DTPMOD:                 r = R_PPC64_DTPMOD64;
+      break;
+    case BFD_RELOC_PPC_TPREL16:                        r = R_PPC64_TPREL16;
+      break;
+    case BFD_RELOC_PPC_TPREL16_LO:             r = R_PPC64_TPREL16_LO;
+      break;
+    case BFD_RELOC_PPC_TPREL16_HI:             r = R_PPC64_TPREL16_HI;
+      break;
+    case BFD_RELOC_PPC_TPREL16_HA:             r = R_PPC64_TPREL16_HA;
+      break;
+    case BFD_RELOC_PPC_TPREL:                  r = R_PPC64_TPREL64;
+      break;
+    case BFD_RELOC_PPC_DTPREL16:               r = R_PPC64_DTPREL16;
+      break;
+    case BFD_RELOC_PPC_DTPREL16_LO:            r = R_PPC64_DTPREL16_LO;
+      break;
+    case BFD_RELOC_PPC_DTPREL16_HI:            r = R_PPC64_DTPREL16_HI;
+      break;
+    case BFD_RELOC_PPC_DTPREL16_HA:            r = R_PPC64_DTPREL16_HA;
+      break;
+    case BFD_RELOC_PPC_DTPREL:                 r = R_PPC64_DTPREL64;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSGD16:            r = R_PPC64_GOT_TLSGD16;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSGD16_LO:         r = R_PPC64_GOT_TLSGD16_LO;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSGD16_HI:         r = R_PPC64_GOT_TLSGD16_HI;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSGD16_HA:         r = R_PPC64_GOT_TLSGD16_HA;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSLD16:            r = R_PPC64_GOT_TLSLD16;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSLD16_LO:         r = R_PPC64_GOT_TLSLD16_LO;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSLD16_HI:         r = R_PPC64_GOT_TLSLD16_HI;
+      break;
+    case BFD_RELOC_PPC_GOT_TLSLD16_HA:         r = R_PPC64_GOT_TLSLD16_HA;
+      break;
+    case BFD_RELOC_PPC_GOT_TPREL16:            r = R_PPC64_GOT_TPREL16_DS;
+      break;
+    case BFD_RELOC_PPC_GOT_TPREL16_LO:         r = R_PPC64_GOT_TPREL16_LO_DS;
+      break;
+    case BFD_RELOC_PPC_GOT_TPREL16_HI:         r = R_PPC64_GOT_TPREL16_HI;
+      break;
+    case BFD_RELOC_PPC_GOT_TPREL16_HA:         r = R_PPC64_GOT_TPREL16_HA;
+      break;
+    case BFD_RELOC_PPC_GOT_DTPREL16:           r = R_PPC64_GOT_DTPREL16_DS;
+      break;
+    case BFD_RELOC_PPC_GOT_DTPREL16_LO:                r = R_PPC64_GOT_DTPREL16_LO_DS;
+      break;
+    case BFD_RELOC_PPC_GOT_DTPREL16_HI:                r = R_PPC64_GOT_DTPREL16_HI;
+      break;
+    case BFD_RELOC_PPC_GOT_DTPREL16_HA:                r = R_PPC64_GOT_DTPREL16_HA;
+      break;
+    case BFD_RELOC_PPC64_TPREL16_DS:           r = R_PPC64_TPREL16_DS;
+      break;
+    case BFD_RELOC_PPC64_TPREL16_LO_DS:                r = R_PPC64_TPREL16_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_TPREL16_HIGHER:       r = R_PPC64_TPREL16_HIGHER;
+      break;
+    case BFD_RELOC_PPC64_TPREL16_HIGHERA:      r = R_PPC64_TPREL16_HIGHERA;
+      break;
+    case BFD_RELOC_PPC64_TPREL16_HIGHEST:      r = R_PPC64_TPREL16_HIGHEST;
+      break;
+    case BFD_RELOC_PPC64_TPREL16_HIGHESTA:     r = R_PPC64_TPREL16_HIGHESTA;
+      break;
+    case BFD_RELOC_PPC64_DTPREL16_DS:          r = R_PPC64_DTPREL16_DS;
+      break;
+    case BFD_RELOC_PPC64_DTPREL16_LO_DS:       r = R_PPC64_DTPREL16_LO_DS;
+      break;
+    case BFD_RELOC_PPC64_DTPREL16_HIGHER:      r = R_PPC64_DTPREL16_HIGHER;
+      break;
+    case BFD_RELOC_PPC64_DTPREL16_HIGHERA:     r = R_PPC64_DTPREL16_HIGHERA;
+      break;
+    case BFD_RELOC_PPC64_DTPREL16_HIGHEST:     r = R_PPC64_DTPREL16_HIGHEST;
+      break;
+    case BFD_RELOC_PPC64_DTPREL16_HIGHESTA:    r = R_PPC64_DTPREL16_HIGHESTA;
+      break;
+    case BFD_RELOC_VTABLE_INHERIT:             r = R_PPC64_GNU_VTINHERIT;
+      break;
+    case BFD_RELOC_VTABLE_ENTRY:               r = R_PPC64_GNU_VTENTRY;
+      break;
+    }
+
+  return ppc64_elf_howto_table[(int) r];
+};
+
+/* Set the howto pointer for a PowerPC ELF reloc.  */
+
+static void
+ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf_Internal_Rela *dst;
+{
+  unsigned int type;
+
+  /* Initialize howto table if needed.  */
+  if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
+    ppc_howto_init ();
+
+  type = ELF64_R_TYPE (dst->r_info);
+  BFD_ASSERT (type < (sizeof (ppc64_elf_howto_table)
+                     / sizeof (ppc64_elf_howto_table[0])));
+  cache_ptr->howto = ppc64_elf_howto_table[type];
+}
+
+/* Handle the R_PPC64_ADDR16_HA and similar relocs.  */
+
+static bfd_reloc_status_type
 ppc64_elf_ha_reloc (abfd, reloc_entry, symbol, data,
                    input_section, output_bfd, error_message)
      bfd *abfd;
@@ -1681,15 +2375,23 @@ ppc64_elf_merge_private_bfd_data (ibfd, obfd)
 struct _ppc64_elf_section_data
 {
   struct bfd_elf_section_data elf;
+
+  /* An array with one entry for each opd function descriptor.  */
   union
   {
+    /* Points to the function code section for local opd entries.  */
     asection **func_sec;
+    /* After editing .opd, adjust references to opd local syms.  */
     long *adjust;
   } opd;
+
+  /* An array for toc sections, indexed by offset/8.
+     Specifies the relocation symbol index used at a given toc offset.  */
+  unsigned *t_symndx;
 };
 
 #define ppc64_elf_section_data(sec) \
-  ((struct _ppc64_elf_section_data *) (sec)->used_by_bfd)
+  ((struct _ppc64_elf_section_data *) elf_section_data (sec))
 
 static bfd_boolean
 ppc64_elf_new_section_hook (abfd, sec)
@@ -1747,7 +2449,7 @@ ppc64_elf_new_section_hook (abfd, sec)
    .
    .   .foo_stub:
    .           addis   12,2,Lfoo@toc@ha        # in practice, the call stub
-   .           addi    12,12,Lfoo@toc@l        # is slightly optimised, but
+   .           addi    12,12,Lfoo@toc@l        # is slightly optimized, but
    .           std     2,40(1)                 # this is the general idea
    .           ld      11,0(12)
    .           ld      2,8(12)
@@ -1795,14 +2497,56 @@ struct ppc_dyn_relocs
   bfd_size_type pc_count;
 };
 
+/* Track GOT entries needed for a given symbol.  We might need more
+   than one got entry per symbol.  */
+struct got_entry
+{
+  struct got_entry *next;
+
+  /* The symbol addend that we'll be placing in the GOT.  */
+  bfd_vma addend;
+
+  /* Reference count until size_dynamic_sections, GOT offset thereafter.  */
+  union
+    {
+      bfd_signed_vma refcount;
+      bfd_vma offset;
+    } got;
+
+  /* Zero for non-tls entries, or TLS_TLS and one of TLS_GD, TLS_LD,
+     TLS_TPREL or TLS_DTPREL for tls entries.  */
+  char tls_type;
+};
+
+/* The same for PLT.  */
+struct plt_entry
+{
+  struct plt_entry *next;
+
+  bfd_vma addend;
+
+  union
+    {
+      bfd_signed_vma refcount;
+      bfd_vma offset;
+    } plt;
+};
+
 /* Of those relocs that might be copied as dynamic relocs, this macro
-   selects between relative and absolute types.  */
+   selects those that must be copied when linking a shared library,
+   even when the symbol is local.  */
 
-#define IS_ABSOLUTE_RELOC(RTYPE)               \
+#define MUST_BE_DYN_RELOC(RTYPE)               \
   ((RTYPE) != R_PPC64_REL32                    \
    && (RTYPE) != R_PPC64_REL64                 \
    && (RTYPE) != R_PPC64_REL30)
 
+/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
+   copying dynamic variables from a shared lib into an app's dynbss
+   section, and instead use a dynamic relocation to point into the
+   shared lib.  */
+#define ELIMINATE_COPY_RELOCS 1
+
 /* Section name for stubs is the associated section name plus this
    string.  */
 #define STUB_SUFFIX ".stub"
@@ -1860,6 +2604,9 @@ struct ppc_stub_hash_entry {
   /* The symbol table entry, if any, that this was derived from.  */
   struct ppc_link_hash_entry *h;
 
+  /* And the reloc addend that this was derived from.  */
+  bfd_vma addend;
+
   /* Where this stub is being called from, or, in the case of combined
      stub sections, the first input section in the group.  */
   asection *id_sec;
@@ -1895,6 +2642,23 @@ struct ppc_link_hash_entry
   unsigned int is_func:1;
   unsigned int is_func_descriptor:1;
   unsigned int is_entry:1;
+
+  /* Contexts in which symbol is used in the GOT (or TOC).
+     TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the
+     corresponding relocs are encountered during check_relocs.
+     tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to
+     indicate the corresponding GOT entry type is not needed.
+     tls_optimize may also set TLS_TPRELGD when a GD reloc turns into
+     a TPREL one.  We use a separate flag rather than setting TPREL
+     just for convenience in distinguishing the two cases.  */
+#define TLS_GD          1      /* GD reloc. */
+#define TLS_LD          2      /* LD reloc. */
+#define TLS_TPREL       4      /* TPREL reloc, => IE. */
+#define TLS_DTPREL      8      /* DTPREL reloc, => LD. */
+#define TLS_TLS                16      /* Any TLS reloc.  */
+#define TLS_EXPLICIT   32      /* Marks TOC section TLS relocs. */
+#define TLS_TPRELGD    64      /* TPREL reloc resulting from GD->IE. */
+  char tls_mask;
 };
 
 /* ppc64 ELF linker hash table.  */
@@ -1941,6 +2705,18 @@ struct ppc_link_hash_table
   asection *sbrlt;
   asection *srelbrlt;
 
+  /* Short-cut to first output tls section.  */
+  asection *tls_sec;
+
+  /* Shortcut to .__tls_get_addr.  */
+  struct elf_link_hash_entry *tls_get_addr;
+
+  /* TLS local dynamic got entry handling.  */
+  union {
+    bfd_signed_vma refcount;
+    bfd_vma offset;
+  } tlsld_got;
+
   /* Set on error.  */
   unsigned int stub_error;
 
@@ -1985,6 +2761,10 @@ static bfd_boolean ppc64_elf_create_dynamic_sections
 static void ppc64_elf_copy_indirect_symbol
   PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
           struct elf_link_hash_entry *));
+static bfd_boolean update_local_sym_info
+  PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned long, bfd_vma, int));
+static bfd_boolean update_plt_info
+  PARAMS ((bfd *, struct ppc_link_hash_entry *, bfd_vma));
 static bfd_boolean ppc64_elf_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
           const Elf_Internal_Rela *));
@@ -2002,6 +2782,11 @@ static bfd_boolean ppc64_elf_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 static void ppc64_elf_hide_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
+static bfd_boolean get_sym_h
+  PARAMS ((struct elf_link_hash_entry **, Elf_Internal_Sym **, asection **,
+          char **, Elf_Internal_Sym **, unsigned long, bfd *));
+static int get_tls_mask
+  PARAMS ((char **, Elf_Internal_Sym **, const Elf_Internal_Rela *, bfd *));
 static bfd_boolean allocate_dynrelocs
   PARAMS ((struct elf_link_hash_entry *, PTR));
 static bfd_boolean readonly_dynrelocs
@@ -2010,7 +2795,7 @@ static enum elf_reloc_type_class ppc64_elf_reloc_type_class
   PARAMS ((const Elf_Internal_Rela *));
 static bfd_boolean ppc64_elf_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
-static INLINE enum ppc_stub_type ppc_type_of_stub
+static enum ppc_stub_type ppc_type_of_stub
   PARAMS ((asection *, const Elf_Internal_Rela *,
           struct ppc_link_hash_entry **, bfd_vma));
 static bfd_byte *build_plt_stub
@@ -2142,6 +2927,7 @@ link_hash_newfunc (entry, table, string)
       eh->is_func = 0;
       eh->is_func_descriptor = 0;
       eh->is_entry = 0;
+      eh->tls_mask = 0;
     }
 
   return entry;
@@ -2188,11 +2974,22 @@ ppc64_elf_link_hash_table_create (abfd)
   htab->sfpr = NULL;
   htab->sbrlt = NULL;
   htab->srelbrlt = NULL;
+  htab->tls_sec = NULL;
+  htab->tls_get_addr = NULL;
+  htab->tlsld_got.refcount = 0;
   htab->stub_error = 0;
   htab->has_14bit_branch = 0;
   htab->have_undefweak = 0;
   htab->stub_iteration = 0;
   htab->sym_sec.abfd = NULL;
+  /* Initializing two fields of the union is just cosmetic.  We really
+     only care about glist, but when compiled on a 32-bit host the
+     bfd_vma fields are larger.  Setting the bfd_vma to zero makes
+     debugger inspection of these fields look nicer.  */
+  htab->elf.init_refcount.refcount = 0;
+  htab->elf.init_refcount.glist = NULL;
+  htab->elf.init_offset.offset = 0;
+  htab->elf.init_offset.glist = NULL;
 
   return &htab->elf.root;
 }
@@ -2471,7 +3268,7 @@ ppc64_elf_create_dynamic_sections (dynobj, info)
 
 static void
 ppc64_elf_copy_indirect_symbol (bed, dir, ind)
-     struct elf_backend_data *bed;
+     struct elf_backend_data *bed ATTRIBUTE_UNUSED;
      struct elf_link_hash_entry *dir, *ind;
 {
   struct ppc_link_hash_entry *edir, *eind;
@@ -2479,6 +3276,7 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind)
   edir = (struct ppc_link_hash_entry *) dir;
   eind = (struct ppc_link_hash_entry *) ind;
 
+  /* Copy over any dynamic relocs we may have on the indirect sym.  */
   if (eind->dyn_relocs != NULL)
     {
       if (edir->dyn_relocs != NULL)
@@ -2486,7 +3284,7 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind)
          struct ppc_dyn_relocs **pp;
          struct ppc_dyn_relocs *p;
 
-         if (ind->root.type == bfd_link_hash_indirect)
+         if (eind->elf.root.type == bfd_link_hash_indirect)
            abort ();
 
          /* Add reloc counts against the weak sym to the strong sym
@@ -2516,8 +3314,89 @@ ppc64_elf_copy_indirect_symbol (bed, dir, ind)
   edir->is_func |= eind->is_func;
   edir->is_func_descriptor |= eind->is_func_descriptor;
   edir->is_entry |= eind->is_entry;
+  edir->tls_mask |= eind->tls_mask;
+
+  /* Copy down any references that we may have already seen to the
+     symbol which just became indirect.  */
+  edir->elf.elf_link_hash_flags |=
+    (eind->elf.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));
+
+  /* If we were called to copy over info for a weak sym, that's all.  */
+  if (eind->elf.root.type != bfd_link_hash_indirect)
+    return;
+
+  /* Copy over got entries.  */
+  if (eind->elf.got.glist != NULL)
+    {
+      if (edir->elf.got.glist != NULL)
+       {
+         struct got_entry **entp;
+         struct got_entry *ent;
+
+         for (entp = &eind->elf.got.glist; (ent = *entp) != NULL; )
+           {
+             struct got_entry *dent;
+
+             for (dent = edir->elf.got.glist; dent != NULL; dent = dent->next)
+               if (dent->addend == ent->addend
+                   && dent->tls_type == ent->tls_type)
+                 {
+                   dent->got.refcount += ent->got.refcount;
+                   *entp = ent->next;
+                   break;
+                 }
+             if (dent == NULL)
+               entp = &ent->next;
+           }
+         *entp = edir->elf.got.glist;
+       }
+
+      edir->elf.got.glist = eind->elf.got.glist;
+      eind->elf.got.glist = NULL;
+    }
+
+  /* And plt entries.  */
+  if (eind->elf.plt.plist != NULL)
+    {
+      if (edir->elf.plt.plist != NULL)
+       {
+         struct plt_entry **entp;
+         struct plt_entry *ent;
 
-  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+         for (entp = &eind->elf.plt.plist; (ent = *entp) != NULL; )
+           {
+             struct plt_entry *dent;
+
+             for (dent = edir->elf.plt.plist; dent != NULL; dent = dent->next)
+               if (dent->addend == ent->addend)
+                 {
+                   dent->plt.refcount += ent->plt.refcount;
+                   *entp = ent->next;
+                   break;
+                 }
+             if (dent == NULL)
+               entp = &ent->next;
+           }
+         *entp = edir->elf.plt.plist;
+       }
+
+      edir->elf.plt.plist = eind->elf.plt.plist;
+      eind->elf.plt.plist = NULL;
+    }
+
+  if (edir->elf.dynindx == -1)
+    {
+      edir->elf.dynindx = eind->elf.dynindx;
+      edir->elf.dynstr_index = eind->elf.dynstr_index;
+      eind->elf.dynindx = -1;
+      eind->elf.dynstr_index = 0;
+    }
+  else
+    BFD_ASSERT (eind->elf.dynindx == -1);
 }
 
 /* Set a flag, used by ppc64_elf_gc_mark_hook, on the entry symbol and
@@ -2542,6 +3421,83 @@ ppc64_elf_mark_entry_syms (info)
   return TRUE;
 }
 
+static bfd_boolean
+update_local_sym_info (abfd, symtab_hdr, r_symndx, r_addend, tls_type)
+     bfd *abfd;
+     Elf_Internal_Shdr *symtab_hdr;
+     unsigned long r_symndx;
+     bfd_vma r_addend;
+     int tls_type;
+{
+  struct got_entry **local_got_ents = elf_local_got_ents (abfd);
+  char *local_got_tls_masks;
+
+  if (local_got_ents == NULL)
+    {
+      bfd_size_type size = symtab_hdr->sh_info;
+
+      size *= sizeof (*local_got_ents) + sizeof (*local_got_tls_masks);
+      local_got_ents = (struct got_entry **) bfd_zalloc (abfd, size);
+      if (local_got_ents == NULL)
+       return FALSE;
+      elf_local_got_ents (abfd) = local_got_ents;
+    }
+
+  if ((tls_type & TLS_EXPLICIT) == 0)
+    {
+      struct got_entry *ent;
+
+      for (ent = local_got_ents[r_symndx]; ent != NULL; ent = ent->next)
+       if (ent->addend == r_addend && ent->tls_type == tls_type)
+         break;
+      if (ent == NULL)
+       {
+         bfd_size_type amt = sizeof (*ent);
+         ent = (struct got_entry *) bfd_alloc (abfd, amt);
+         if (ent == NULL)
+           return FALSE;
+         ent->next = local_got_ents[r_symndx];
+         ent->addend = r_addend;
+         ent->tls_type = tls_type;
+         ent->got.refcount = 0;
+         local_got_ents[r_symndx] = ent;
+       }
+      ent->got.refcount += 1;
+    }
+
+  local_got_tls_masks = (char *) (local_got_ents + symtab_hdr->sh_info);
+  local_got_tls_masks[r_symndx] |= tls_type;
+  return TRUE;
+}
+
+static bfd_boolean
+update_plt_info (abfd, eh, addend)
+     bfd *abfd;
+     struct ppc_link_hash_entry *eh;
+     bfd_vma addend;
+{
+  struct plt_entry *ent;
+
+  for (ent = eh->elf.plt.plist; ent != NULL; ent = ent->next)
+    if (ent->addend == addend)
+      break;
+  if (ent == NULL)
+    {
+      bfd_size_type amt = sizeof (*ent);
+      ent = (struct plt_entry *) bfd_alloc (abfd, amt);
+      if (ent == NULL)
+       return FALSE;
+      ent->next = eh->elf.plt.plist;
+      ent->addend = addend;
+      ent->plt.refcount = 0;
+      eh->elf.plt.plist = ent;
+    }
+  ent->plt.refcount += 1;
+  eh->elf.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+  eh->is_func = 1;
+  return TRUE;
+}
+
 /* Look through the relocs for a section during the first phase, and
    calculate needed space in the global offset table, procedure
    linkage table, and dynamic reloc sections.  */
@@ -2610,6 +3566,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
       unsigned long r_symndx;
       struct elf_link_hash_entry *h;
       enum elf_ppc64_reloc_type r_type;
+      int tls_type = 0;
 
       r_symndx = ELF64_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info)
@@ -2620,14 +3577,45 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
       r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
       switch (r_type)
        {
-         /* GOT16 relocations */
+       case R_PPC64_GOT_TLSLD16:
+       case R_PPC64_GOT_TLSLD16_LO:
+       case R_PPC64_GOT_TLSLD16_HI:
+       case R_PPC64_GOT_TLSLD16_HA:
+         htab->tlsld_got.refcount += 1;
+         tls_type = TLS_TLS | TLS_LD;
+         goto dogottls;
+
+       case R_PPC64_GOT_TLSGD16:
+       case R_PPC64_GOT_TLSGD16_LO:
+       case R_PPC64_GOT_TLSGD16_HI:
+       case R_PPC64_GOT_TLSGD16_HA:
+         tls_type = TLS_TLS | TLS_GD;
+         goto dogottls;
+
+       case R_PPC64_GOT_TPREL16_DS:
+       case R_PPC64_GOT_TPREL16_LO_DS:
+       case R_PPC64_GOT_TPREL16_HI:
+       case R_PPC64_GOT_TPREL16_HA:
+         if (info->shared)
+           info->flags |= DF_STATIC_TLS;
+         tls_type = TLS_TLS | TLS_TPREL;
+         goto dogottls;
+
+       case R_PPC64_GOT_DTPREL16_DS:
+       case R_PPC64_GOT_DTPREL16_LO_DS:
+       case R_PPC64_GOT_DTPREL16_HI:
+       case R_PPC64_GOT_DTPREL16_HA:
+         tls_type = TLS_TLS | TLS_DTPREL;
+       dogottls:
+         sec->has_tls_reloc = 1;
+         /* Fall thru */
+
        case R_PPC64_GOT16:
        case R_PPC64_GOT16_DS:
        case R_PPC64_GOT16_HA:
        case R_PPC64_GOT16_HI:
        case R_PPC64_GOT16_LO:
        case R_PPC64_GOT16_LO_DS:
-
          /* This symbol requires a global offset table entry.  */
          if (htab->sgot == NULL
              && !create_got_section (htab->elf.dynobj, info))
@@ -2635,28 +3623,34 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
 
          if (h != NULL)
            {
-             h->got.refcount += 1;
-           }
-         else
-           {
-             bfd_signed_vma *local_got_refcounts;
+             struct ppc_link_hash_entry *eh;
+             struct got_entry *ent;
 
-             /* This is a global offset table entry for a local symbol.  */
-             local_got_refcounts = elf_local_got_refcounts (abfd);
-             if (local_got_refcounts == NULL)
+             eh = (struct ppc_link_hash_entry *) h;
+             for (ent = eh->elf.got.glist; ent != NULL; ent = ent->next)
+               if (ent->addend == rel->r_addend
+                   && ent->tls_type == tls_type)
+                 break;
+             if (ent == NULL)
                {
-                 bfd_size_type size;
-
-                 size = symtab_hdr->sh_info;
-                 size *= sizeof (bfd_signed_vma);
-                 local_got_refcounts = ((bfd_signed_vma *)
-                                        bfd_zalloc (abfd, size));
-                 if (local_got_refcounts == NULL)
+                 bfd_size_type amt = sizeof (*ent);
+                 ent = (struct got_entry *) bfd_alloc (abfd, amt);
+                 if (ent == NULL)
                    return FALSE;
-                 elf_local_got_refcounts (abfd) = local_got_refcounts;
+                 ent->next = eh->elf.got.glist;
+                 ent->addend = rel->r_addend;
+                 ent->tls_type = tls_type;
+                 ent->got.refcount = 0;
+                 eh->elf.got.glist = ent;
                }
-             local_got_refcounts[r_symndx] += 1;
+             ent->got.refcount += 1;
+             eh->tls_mask |= tls_type;
            }
+         else
+           /* This is a global offset table entry for a local symbol.  */
+           if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
+                                       rel->r_addend, tls_type))
+             return FALSE;
          break;
 
        case R_PPC64_PLT16_HA:
@@ -2676,10 +3670,10 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
              bfd_set_error (bfd_error_bad_value);
              return FALSE;
            }
-
-         h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-         h->plt.refcount += 1;
-         ((struct ppc_link_hash_entry *) h)->is_func = 1;
+         else
+           if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
+                                 rel->r_addend))
+             return FALSE;
          break;
 
          /* The following relocations don't need to propagate the
@@ -2697,6 +3691,16 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
        case R_PPC64_TOC16_HA:
        case R_PPC64_TOC16_DS:
        case R_PPC64_TOC16_LO_DS:
+       case R_PPC64_DTPREL16:
+       case R_PPC64_DTPREL16_LO:
+       case R_PPC64_DTPREL16_HI:
+       case R_PPC64_DTPREL16_HA:
+       case R_PPC64_DTPREL16_DS:
+       case R_PPC64_DTPREL16_LO_DS:
+       case R_PPC64_DTPREL16_HIGHER:
+       case R_PPC64_DTPREL16_HIGHERA:
+       case R_PPC64_DTPREL16_HIGHEST:
+       case R_PPC64_DTPREL16_HIGHESTA:
          break;
 
          /* This relocation describes the C++ object vtable hierarchy.
@@ -2726,9 +3730,93 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
            {
              /* We may need a .plt entry if the function this reloc
                 refers to is in a shared lib.  */
-             h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
-             h->plt.refcount += 1;
-             ((struct ppc_link_hash_entry *) h)->is_func = 1;
+             if (!update_plt_info (abfd, (struct ppc_link_hash_entry *) h,
+                                   rel->r_addend))
+               return FALSE;
+             if (h == htab->tls_get_addr)
+               sec->has_tls_reloc = 1;
+             else if ((strncmp (h->root.root.string, ".__tls_get_addr", 15)
+                       == 0)
+                      && (h->root.root.string[15] == 0
+                          || h->root.root.string[15] == '@'))
+               {
+                 htab->tls_get_addr = h;
+                 sec->has_tls_reloc = 1;
+               }
+           }
+         break;
+
+       case R_PPC64_TPREL64:
+         tls_type = TLS_EXPLICIT | TLS_TLS | TLS_TPREL;
+         if (info->shared)
+           info->flags |= DF_STATIC_TLS;
+         goto dotlstoc;
+
+       case R_PPC64_DTPMOD64:
+         if (rel + 1 < rel_end
+             && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)
+             && rel[1].r_offset == rel->r_offset + 8)
+           tls_type = TLS_EXPLICIT | TLS_TLS | TLS_GD;
+         else
+           tls_type = TLS_EXPLICIT | TLS_TLS | TLS_LD;
+         goto dotlstoc;
+
+       case R_PPC64_DTPREL64:
+         tls_type = TLS_EXPLICIT | TLS_TLS | TLS_DTPREL;
+         if (rel != relocs
+             && rel[-1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPMOD64)
+             && rel[-1].r_offset == rel->r_offset - 8)
+           /* This is the second reloc of a dtpmod, dtprel pair.
+              Don't mark with TLS_DTPREL.  */
+           goto dodyn;
+
+       dotlstoc:
+         sec->has_tls_reloc = 1;
+         if (h != NULL)
+           {
+             struct ppc_link_hash_entry *eh;
+             eh = (struct ppc_link_hash_entry *) h;
+             eh->tls_mask |= tls_type;
+           }
+         else
+           if (!update_local_sym_info (abfd, symtab_hdr, r_symndx,
+                                       rel->r_addend, tls_type))
+             return FALSE;
+
+         if (ppc64_elf_section_data (sec)->t_symndx == NULL)
+           {
+             /* One extra to simplify get_tls_mask.  */
+             bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1;
+             ppc64_elf_section_data (sec)->t_symndx
+               = (unsigned *) bfd_zalloc (abfd, amt);
+             if (ppc64_elf_section_data (sec)->t_symndx == NULL)
+               return FALSE;
+           }
+         BFD_ASSERT (rel->r_offset % 8 == 0);
+         ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx;
+
+         /* Mark the second slot of a GD or LD entry.
+            -1 to indicate GD and -2 to indicate LD.  */
+         if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD))
+           ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -1;
+         else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD))
+           ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -2;
+         goto dodyn;
+
+       case R_PPC64_TPREL16:
+       case R_PPC64_TPREL16_LO:
+       case R_PPC64_TPREL16_HI:
+       case R_PPC64_TPREL16_HA:
+       case R_PPC64_TPREL16_DS:
+       case R_PPC64_TPREL16_LO_DS:
+       case R_PPC64_TPREL16_HIGHER:
+       case R_PPC64_TPREL16_HIGHERA:
+       case R_PPC64_TPREL16_HIGHEST:
+       case R_PPC64_TPREL16_HIGHESTA:
+         if (info->shared)
+           {
+             info->flags |= DF_STATIC_TLS;
+             goto dodyn;
            }
          break;
 
@@ -2793,6 +3881,10 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
          if (NO_OPD_RELOCS && opd_sym_map != NULL)
            break;
 
+         /* Don't propagate relocs that the dynamic linker won't relocate.  */
+         if ((sec->flags & SEC_ALLOC) == 0)
+           break;
+
          /* 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
@@ -2805,7 +3897,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
             later (it is never cleared).  In case of a weak definition,
             DEF_REGULAR may be cleared later by a strong definition in
             a shared library.  We account for that possibility below by
-            storing information in the relocs_copied field of the hash
+            storing information in the dyn_relocs field of the hash
             table entry.  A similar situation occurs when creating
             shared libraries and symbol visibility changes render the
             symbol local.
@@ -2814,16 +3906,16 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
             may need to keep relocations for symbols satisfied by a
             dynamic library if we manage to avoid copy relocs for the
             symbol.  */
+       dodyn:
          if ((info->shared
-              && (sec->flags & SEC_ALLOC) != 0
-              && (IS_ABSOLUTE_RELOC (r_type)
+              && (MUST_BE_DYN_RELOC (r_type)
                   || (h != NULL
                       && (! info->symbolic
                           || h->root.type == bfd_link_hash_defweak
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))))
-             || (!info->shared
-                 && (sec->flags & SEC_ALLOC) != 0
+             || (ELIMINATE_COPY_RELOCS
+                 && !info->shared
                  && h != NULL
                  && (h->root.type == bfd_link_hash_defweak
                      || (h->elf_link_hash_flags
@@ -2914,7 +4006,7 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs)
                }
 
              p->count += 1;
-             if (!IS_ABSOLUTE_RELOC (r_type))
+             if (!MUST_BE_DYN_RELOC (r_type))
                p->pc_count += 1;
            }
          break;
@@ -3004,137 +4096,128 @@ ppc64_elf_gc_mark_hook (sec, info, rel, h, sym)
 static bfd_boolean
 ppc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
      bfd *abfd;
-     struct bfd_link_info *info ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
      asection *sec;
      const Elf_Internal_Rela *relocs;
 {
+  struct ppc_link_hash_table *htab;
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
-  bfd_signed_vma *local_got_refcounts;
+  struct got_entry **local_got_ents;
   const Elf_Internal_Rela *rel, *relend;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
+  htab = ppc_hash_table (info);
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  local_got_refcounts = elf_local_got_refcounts (abfd);
+  local_got_ents = elf_local_got_ents (abfd);
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
     {
       unsigned long r_symndx;
       enum elf_ppc64_reloc_type r_type;
-      struct elf_link_hash_entry *h;
+      struct elf_link_hash_entry *h = NULL;
+      char tls_type = 0;
 
       r_symndx = ELF64_R_SYM (rel->r_info);
       r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
-      switch (r_type)
+      if (r_symndx >= symtab_hdr->sh_info)
        {
-       case R_PPC64_GOT16:
-       case R_PPC64_GOT16_DS:
-       case R_PPC64_GOT16_HA:
-       case R_PPC64_GOT16_HI:
-       case R_PPC64_GOT16_LO:
-       case R_PPC64_GOT16_LO_DS:
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             if (h->got.refcount > 0)
-               h->got.refcount--;
-           }
-         else
-           {
-             if (local_got_refcounts[r_symndx] > 0)
-               local_got_refcounts[r_symndx]--;
-           }
-         break;
-
-       case R_PPC64_PLT16_HA:
-       case R_PPC64_PLT16_HI:
-       case R_PPC64_PLT16_LO:
-       case R_PPC64_PLT32:
-       case R_PPC64_PLT64:
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             if (h->plt.refcount > 0)
-               h->plt.refcount--;
-           }
-         break;
-
-       case R_PPC64_REL14:
-       case R_PPC64_REL14_BRNTAKEN:
-       case R_PPC64_REL14_BRTAKEN:
-       case R_PPC64_REL24:
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             if (h->plt.refcount > 0)
-               h->plt.refcount--;
-           }
-         break;
+         struct ppc_link_hash_entry *eh;
+         struct ppc_dyn_relocs **pp;
+         struct ppc_dyn_relocs *p;
 
-       case R_PPC64_REL30:
-       case R_PPC64_REL32:
-       case R_PPC64_REL64:
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             struct ppc_link_hash_entry *eh;
-             struct ppc_dyn_relocs **pp;
-             struct ppc_dyn_relocs *p;
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct ppc_link_hash_entry *) h;
 
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             eh = (struct ppc_link_hash_entry *) h;
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
 
-             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-               if (p->sec == sec)
-                 {
-                   p->pc_count -= 1;
-                   p->count -= 1;
-                   if (p->count == 0)
-                     *pp = p->next;
-                   break;
-                 }
-           }
-         break;
+      switch (r_type)
+       {
+       case R_PPC64_GOT_TLSLD16:
+       case R_PPC64_GOT_TLSLD16_LO:
+       case R_PPC64_GOT_TLSLD16_HI:
+       case R_PPC64_GOT_TLSLD16_HA:
+         htab->tlsld_got.refcount -= 1;
+         tls_type = TLS_TLS | TLS_LD;
+         goto dogot;
+
+       case R_PPC64_GOT_TLSGD16:
+       case R_PPC64_GOT_TLSGD16_LO:
+       case R_PPC64_GOT_TLSGD16_HI:
+       case R_PPC64_GOT_TLSGD16_HA:
+         tls_type = TLS_TLS | TLS_GD;
+         goto dogot;
+
+       case R_PPC64_GOT_TPREL16_DS:
+       case R_PPC64_GOT_TPREL16_LO_DS:
+       case R_PPC64_GOT_TPREL16_HI:
+       case R_PPC64_GOT_TPREL16_HA:
+         tls_type = TLS_TLS | TLS_TPREL;
+         goto dogot;
+
+       case R_PPC64_GOT_DTPREL16_DS:
+       case R_PPC64_GOT_DTPREL16_LO_DS:
+       case R_PPC64_GOT_DTPREL16_HI:
+       case R_PPC64_GOT_DTPREL16_HA:
+         tls_type = TLS_TLS | TLS_DTPREL;
+         goto dogot;
 
-       case R_PPC64_ADDR14:
-       case R_PPC64_ADDR14_BRNTAKEN:
-       case R_PPC64_ADDR14_BRTAKEN:
-       case R_PPC64_ADDR16:
-       case R_PPC64_ADDR16_DS:
-       case R_PPC64_ADDR16_HA:
-       case R_PPC64_ADDR16_HI:
-       case R_PPC64_ADDR16_HIGHER:
-       case R_PPC64_ADDR16_HIGHERA:
-       case R_PPC64_ADDR16_HIGHEST:
-       case R_PPC64_ADDR16_HIGHESTA:
-       case R_PPC64_ADDR16_LO:
-       case R_PPC64_ADDR16_LO_DS:
-       case R_PPC64_ADDR24:
-       case R_PPC64_ADDR32:
-       case R_PPC64_ADDR64:
-       case R_PPC64_UADDR16:
-       case R_PPC64_UADDR32:
-       case R_PPC64_UADDR64:
-       case R_PPC64_TOC:
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             struct ppc_link_hash_entry *eh;
-             struct ppc_dyn_relocs **pp;
-             struct ppc_dyn_relocs *p;
+       case R_PPC64_GOT16:
+       case R_PPC64_GOT16_DS:
+       case R_PPC64_GOT16_HA:
+       case R_PPC64_GOT16_HI:
+       case R_PPC64_GOT16_LO:
+       case R_PPC64_GOT16_LO_DS:
+       dogot:
+         {
+           struct got_entry *ent;
 
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             eh = (struct ppc_link_hash_entry *) h;
+           if (h != NULL)
+             ent = h->got.glist;
+           else
+             ent = local_got_ents[r_symndx];
 
-             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-               if (p->sec == sec)
-                 {
-                   p->count -= 1;
-                   if (p->count == 0)
-                     *pp = p->next;
-                   break;
-                 }
+           for (; ent != NULL; ent = ent->next)
+             if (ent->addend == rel->r_addend
+                 && ent->tls_type == tls_type)
+               break;
+           if (ent == NULL)
+             abort ();
+           if (ent->got.refcount > 0)
+             ent->got.refcount -= 1;
+         }
+         break;
+
+       case R_PPC64_PLT16_HA:
+       case R_PPC64_PLT16_HI:
+       case R_PPC64_PLT16_LO:
+       case R_PPC64_PLT32:
+       case R_PPC64_PLT64:
+       case R_PPC64_REL14:
+       case R_PPC64_REL14_BRNTAKEN:
+       case R_PPC64_REL14_BRTAKEN:
+       case R_PPC64_REL24:
+         if (h != NULL)
+           {
+             struct plt_entry *ent;
+
+             for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+               if (ent->addend == rel->r_addend)
+                 break;
+             if (ent == NULL)
+               abort ();
+             if (ent->plt.refcount > 0)
+               ent->plt.refcount -= 1;
            }
          break;
 
@@ -3155,6 +4238,7 @@ func_desc_adjust (h, inf)
 {
   struct bfd_link_info *info;
   struct ppc_link_hash_table *htab;
+  struct plt_entry *ent;
 
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
@@ -3174,7 +4258,10 @@ func_desc_adjust (h, inf)
       && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR))
     htab->have_undefweak = TRUE;
 
-  if (h->plt.refcount > 0
+  for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+    if (ent->plt.refcount > 0)
+      break;
+  if (ent != NULL
       && h->root.root.string[0] == '.'
       && h->root.root.string[1] != '\0')
     {
@@ -3233,7 +4320,7 @@ func_desc_adjust (h, inf)
                                          | ELF_LINK_NON_GOT_REF));
          if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            {
-             fdh->plt.refcount = h->plt.refcount;
+             fdh->plt.plist = h->plt.plist;
              fdh->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
            }
          ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1;
@@ -3392,8 +4479,6 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
      struct elf_link_hash_entry *h;
 {
   struct ppc_link_hash_table *htab;
-  struct ppc_link_hash_entry * eh;
-  struct ppc_dyn_relocs *p;
   asection *s;
   unsigned int power_of_two;
 
@@ -3405,20 +4490,24 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
     {
       /* Clear procedure linkage table information for any symbol that
         won't need a .plt entry.  */
+      struct plt_entry *ent;
+      for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+       if (ent->plt.refcount > 0)
+         break;
       if (!((struct ppc_link_hash_entry *) h)->is_func_descriptor
-         || h->plt.refcount <= 0
+         || ent == NULL
          || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
          || (! info->shared
              && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
              && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0))
        {
-         h->plt.offset = (bfd_vma) -1;
+         h->plt.plist = NULL;
          h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
        }
       return TRUE;
     }
   else
-    h->plt.offset = (bfd_vma) -1;
+    h->plt.plist = NULL;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
@@ -3447,20 +4536,26 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
   if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
     return TRUE;
 
-  eh = (struct ppc_link_hash_entry *) h;
-  for (p = eh->dyn_relocs; p != NULL; p = p->next)
+  if (ELIMINATE_COPY_RELOCS)
     {
-      s = p->sec->output_section;
-      if (s != NULL && (s->flags & SEC_READONLY) != 0)
-       break;
-    }
+      struct ppc_link_hash_entry * eh;
+      struct ppc_dyn_relocs *p;
 
-  /* If we didn't find any dynamic relocs in read-only sections, then
-     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
-  if (p == NULL)
-    {
-      h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
-      return TRUE;
+      eh = (struct ppc_link_hash_entry *) h;
+      for (p = eh->dyn_relocs; p != NULL; p = p->next)
+       {
+         s = p->sec->output_section;
+         if (s != NULL && (s->flags & SEC_READONLY) != 0)
+           break;
+       }
+
+      /* If we didn't find any dynamic relocs in read-only sections, then
+        we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
+      if (p == NULL)
+       {
+         h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+         return TRUE;
+       }
     }
 
   /* We must allocate the symbol in our .dynbss section, which will
@@ -3567,17 +4662,166 @@ ppc64_elf_hide_symbol (info, h, force_local)
     }
 }
 
+static bfd_boolean
+get_sym_h (hp, symp, symsecp, tls_maskp, locsymsp, r_symndx, ibfd)
+     struct elf_link_hash_entry **hp;
+     Elf_Internal_Sym **symp;
+     asection **symsecp;
+     char **tls_maskp;
+     Elf_Internal_Sym **locsymsp;
+     unsigned long r_symndx;
+     bfd *ibfd;
+{
+  Elf_Internal_Shdr *symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
+
+  if (r_symndx >= symtab_hdr->sh_info)
+    {
+      struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (ibfd);
+      struct elf_link_hash_entry *h;
+
+      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+      while (h->root.type == bfd_link_hash_indirect
+            || h->root.type == bfd_link_hash_warning)
+       h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+      if (hp != NULL)
+       *hp = h;
+
+      if (symp != NULL)
+       *symp = NULL;
+
+      if (symsecp != NULL)
+       {
+         asection *symsec = NULL;
+         if (h->root.type == bfd_link_hash_defined
+             || h->root.type == bfd_link_hash_defweak)
+           symsec = h->root.u.def.section;
+         *symsecp = symsec;
+       }
+
+      if (tls_maskp != NULL)
+       {
+         struct ppc_link_hash_entry *eh;
+
+         eh = (struct ppc_link_hash_entry *) h;
+         *tls_maskp = &eh->tls_mask;
+       }
+    }
+  else
+    {
+      Elf_Internal_Sym *sym;
+      Elf_Internal_Sym *locsyms = *locsymsp;
+
+      if (locsyms == NULL)
+       {
+         locsyms = (Elf_Internal_Sym *) symtab_hdr->contents;
+         if (locsyms == NULL)
+           locsyms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
+                                           symtab_hdr->sh_info,
+                                           0, NULL, NULL, NULL);
+         if (locsyms == NULL)
+           return FALSE;
+         *locsymsp = locsyms;
+       }
+      sym = locsyms + r_symndx;
+
+      if (hp != NULL)
+       *hp = NULL;
+
+      if (symp != NULL)
+       *symp = sym;
+
+      if (symsecp != NULL)
+       {
+         asection *symsec = NULL;
+         if ((sym->st_shndx != SHN_UNDEF
+              && sym->st_shndx < SHN_LORESERVE)
+             || sym->st_shndx > SHN_HIRESERVE)
+           symsec = bfd_section_from_elf_index (ibfd, sym->st_shndx);
+         *symsecp = symsec;
+       }
+
+      if (tls_maskp != NULL)
+       {
+         struct got_entry **lgot_ents;
+         char *tls_mask;
+
+         tls_mask = NULL;
+         lgot_ents = elf_local_got_ents (ibfd);
+         if (lgot_ents != NULL)
+           {
+             char *lgot_masks = (char *) (lgot_ents + symtab_hdr->sh_info);
+             tls_mask = &lgot_masks[r_symndx];
+           }
+         *tls_maskp = tls_mask;
+       }
+    }
+  return TRUE;
+}
+
+/* Returns TLS_MASKP for the given REL symbol.  Function return is 0 on
+   error, 2 on a toc GD type suitable for optimization, 3 on a toc LD
+   type suitable for optimization, and 1 otherwise.  */  
+
+static int
+get_tls_mask (tls_maskp, locsymsp, rel, ibfd)
+     char **tls_maskp;
+     Elf_Internal_Sym **locsymsp;
+     const Elf_Internal_Rela *rel;
+     bfd *ibfd;
+{
+  unsigned long r_symndx;
+  unsigned int next_r;
+  struct elf_link_hash_entry *h;
+  Elf_Internal_Sym *sym;
+  asection *sec;
+  bfd_vma off;
+
+  r_symndx = ELF64_R_SYM (rel->r_info);
+  if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
+    return 0;
+
+  if ((*tls_maskp != NULL && **tls_maskp != 0)
+      || sec == NULL
+      || ppc64_elf_section_data (sec)->t_symndx == NULL)
+    return 1;
+
+  /* Look inside a TOC section too.  */
+  if (h != NULL)
+    {
+      BFD_ASSERT (h->root.type == bfd_link_hash_defined);
+      off = h->root.u.def.value;
+    }
+  else
+    off = sym->st_value;
+  off += rel->r_addend;
+  BFD_ASSERT (off % 8 == 0);
+  r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8];
+  next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1];
+  if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd))
+    return 0;
+  if (h == NULL
+      || h->root.type == bfd_link_hash_defined
+      || h->root.type == bfd_link_hash_defweak)
+    {
+      if (next_r == (unsigned) -1)
+       return 2;
+      if (next_r == (unsigned) -2
+         && (h == NULL
+             || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+       return 3;
+    }
+  return 1;
+}
+
 bfd_boolean
 ppc64_elf_edit_opd (obfd, info)
      bfd *obfd;
      struct bfd_link_info *info;
 {
   bfd *ibfd;
-  unsigned int bfd_indx;
 
-  for (bfd_indx = 0, ibfd = info->input_bfds;
-       ibfd != NULL;
-       ibfd = ibfd->link_next, bfd_indx++)
+  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
     {
       asection *sec;
       Elf_Internal_Rela *relstart, *rel, *relend;
@@ -3672,44 +4916,22 @@ ppc64_elf_edit_opd (obfd, info)
            }
 
          r_symndx = ELF64_R_SYM (rel->r_info);
-         sym_sec = NULL;
-         h = NULL;
-         sym = NULL;
-         if (r_symndx >= symtab_hdr->sh_info)
-           {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-             while (h->root.type == bfd_link_hash_indirect
-                    || h->root.type == bfd_link_hash_warning)
-               h = (struct elf_link_hash_entry *) h->root.u.i.link;
-             if (h->root.type == bfd_link_hash_defined
-                 || h->root.type == bfd_link_hash_defweak)
-               sym_sec = h->root.u.def.section;
-           }
-         else
-           {
-             if (local_syms == NULL)
-               {
-                 local_syms = (Elf_Internal_Sym *) symtab_hdr->contents;
-                 if (local_syms == NULL)
-                   local_syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr,
-                                                      symtab_hdr->sh_info, 0,
-                                                      NULL, NULL, NULL);
-                 if (local_syms == NULL)
-                   goto error_free_rel;
-               }
-             sym = local_syms + r_symndx;
-             if ((sym->st_shndx != SHN_UNDEF
-                  && sym->st_shndx < SHN_LORESERVE)
-                 || sym->st_shndx > SHN_HIRESERVE)
-               sym_sec = bfd_section_from_elf_index (ibfd, sym->st_shndx);
-           }
+         if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+                         r_symndx, ibfd))
+           goto error_free_rel;
 
          if (sym_sec == NULL || sym_sec->owner == NULL)
            {
+             const char *sym_name;
+             if (h != NULL)
+               sym_name = h->root.root.string;
+             else
+               sym_name = bfd_elf_local_sym_name (ibfd, sym);
+
              (*_bfd_error_handler)
                (_("%s: undefined sym `%s' in .opd section"),
                 bfd_archive_filename (ibfd),
-                h != NULL ? h->root.root.string : "<local symbol>");
+                sym_name);
              need_edit = FALSE;
              break;
            }
@@ -3774,28 +4996,8 @@ ppc64_elf_edit_opd (obfd, info)
                  Elf_Internal_Sym *sym;
 
                  r_symndx = ELF64_R_SYM (rel->r_info);
-                 sym_sec = NULL;
-                 h = NULL;
-                 sym = NULL;
-                 if (r_symndx >= symtab_hdr->sh_info)
-                   {
-                     h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-                     while (h->root.type == bfd_link_hash_indirect
-                            || h->root.type == bfd_link_hash_warning)
-                       h = (struct elf_link_hash_entry *) h->root.u.i.link;
-                     if (h->root.type == bfd_link_hash_defined
-                         || h->root.type == bfd_link_hash_defweak)
-                       sym_sec = h->root.u.def.section;
-                   }
-                 else
-                   {
-                     sym = local_syms + r_symndx;
-                     if ((sym->st_shndx != SHN_UNDEF
-                          && sym->st_shndx < SHN_LORESERVE)
-                         || sym->st_shndx > SHN_HIRESERVE)
-                       sym_sec = bfd_section_from_elf_index (ibfd,
-                                                             sym->st_shndx);
-                   }
+                 get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+                            r_symndx, ibfd);
 
                  skip = (sym_sec->owner != ibfd
                          || sym_sec->output_section == bfd_abs_section_ptr);
@@ -3918,13 +5120,340 @@ ppc64_elf_edit_opd (obfd, info)
   return TRUE;
 }
 
+/* Set htab->tls_sec.  */
+
+bfd_boolean
+ppc64_elf_tls_setup (obfd, info)
+     bfd *obfd;
+     struct bfd_link_info *info;
+{
+  asection *tls;
+  struct ppc_link_hash_table *htab;
+
+  for (tls = obfd->sections; tls != NULL; tls = tls->next)
+    if ((tls->flags & (SEC_THREAD_LOCAL | SEC_LOAD))
+       == (SEC_THREAD_LOCAL | SEC_LOAD))
+      break;
+
+  htab = ppc_hash_table (info);
+  htab->tls_sec = tls;
+
+  if (htab->tls_get_addr != NULL)
+    {
+      struct elf_link_hash_entry *h = htab->tls_get_addr;
+
+      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;
+
+      htab->tls_get_addr = h;
+    }
+
+  return tls != NULL;
+}
+
+/* Run through all the TLS relocs looking for optimization
+   opportunities.  The linker has been hacked (see ppc64elf.em) to do
+   a preliminary section layout so that we know the TLS segment
+   offsets.  We can't optimize earlier because some optimizations need
+   to know the tp offset, and we need to optimize before allocating
+   dynamic relocations.  */
+
+bfd_boolean
+ppc64_elf_tls_optimize (obfd, info)
+     bfd *obfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *info;
+{
+  bfd *ibfd;
+  asection *sec;
+  struct ppc_link_hash_table *htab;
+
+  if (info->relocateable || info->shared)
+    return TRUE;
+
+  htab = ppc_hash_table (info);
+  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+    {
+      Elf_Internal_Sym *locsyms = NULL;
+
+      for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+       if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
+         {
+           Elf_Internal_Rela *relstart, *rel, *relend;
+           int expecting_tls_get_addr;
+
+           /* Read the relocations.  */
+           relstart = _bfd_elf64_link_read_relocs (ibfd, sec, (PTR) NULL,
+                                                   (Elf_Internal_Rela *) NULL,
+                                                   info->keep_memory);
+           if (relstart == NULL)
+             return FALSE;
+
+           expecting_tls_get_addr = 0;
+           relend = relstart + sec->reloc_count;
+           for (rel = relstart; rel < relend; rel++)
+             {
+               enum elf_ppc64_reloc_type r_type;
+               unsigned long r_symndx;
+               struct elf_link_hash_entry *h;
+               Elf_Internal_Sym *sym;
+               asection *sym_sec;
+               char *tls_mask;
+               char tls_set, tls_clear, tls_type = 0;
+               bfd_vma value;
+               bfd_boolean ok_tprel, is_local;
+
+               r_symndx = ELF64_R_SYM (rel->r_info);
+               if (!get_sym_h (&h, &sym, &sym_sec, &tls_mask, &locsyms,
+                               r_symndx, ibfd))
+                 {
+                 err_free_rel:
+                   if (elf_section_data (sec)->relocs != relstart)
+                     free (relstart);
+                   if (locsyms != NULL
+                       && (elf_tdata (ibfd)->symtab_hdr.contents
+                           != (unsigned char *) locsyms))
+                     free (locsyms);
+                   return FALSE;
+                 }
+
+               if (h != NULL)
+                 {
+                   if (h->root.type != bfd_link_hash_defined
+                       && h->root.type != bfd_link_hash_defweak)
+                     continue;
+                   value = h->root.u.def.value;
+                 }
+               else
+                 value = sym->st_value;
+
+               ok_tprel = FALSE;
+               is_local = FALSE;
+               if (h == NULL
+                   || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+                 {
+                   is_local = TRUE;
+                   value += sym_sec->output_offset;
+                   value += sym_sec->output_section->vma;
+                   value -= htab->tls_sec->vma;
+                   ok_tprel = (value + TP_OFFSET + ((bfd_vma) 1 << 31)
+                               < (bfd_vma) 1 << 32);
+                 }
+
+               r_type
+                 = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
+               switch (r_type)
+                 {
+                 case R_PPC64_GOT_TLSLD16:
+                 case R_PPC64_GOT_TLSLD16_LO:
+                 case R_PPC64_GOT_TLSLD16_HI:
+                 case R_PPC64_GOT_TLSLD16_HA:
+                   /* These relocs should never be against a symbol
+                      defined in a shared lib.  Leave them alone if
+                      that turns out to be the case.  */
+                   htab->tlsld_got.refcount -= 1;
+                   if (!is_local)
+                     continue;
+
+                   /* LD -> LE */
+                   tls_set = 0;
+                   tls_clear = TLS_LD;
+                   tls_type = TLS_TLS | TLS_LD;
+                   expecting_tls_get_addr = 1;
+                   break;
+
+                 case R_PPC64_GOT_TLSGD16:
+                 case R_PPC64_GOT_TLSGD16_LO:
+                 case R_PPC64_GOT_TLSGD16_HI:
+                 case R_PPC64_GOT_TLSGD16_HA:
+                   if (ok_tprel)
+                     /* GD -> LE */
+                     tls_set = 0;
+                   else
+                     /* GD -> IE */
+                     tls_set = TLS_TLS | TLS_TPRELGD;
+                   tls_clear = TLS_GD;
+                   tls_type = TLS_TLS | TLS_GD;
+                   expecting_tls_get_addr = 1;
+                   break;
+
+                 case R_PPC64_GOT_TPREL16_DS:
+                 case R_PPC64_GOT_TPREL16_LO_DS:
+                 case R_PPC64_GOT_TPREL16_HI:
+                 case R_PPC64_GOT_TPREL16_HA:
+                   expecting_tls_get_addr = 0;
+                   if (ok_tprel)
+                     {
+                       /* IE -> LE */
+                       tls_set = 0;
+                       tls_clear = TLS_TPREL;
+                       tls_type = TLS_TLS | TLS_TPREL;
+                       break;
+                     }
+                   else
+                     continue;
+
+                 case R_PPC64_REL14:
+                 case R_PPC64_REL14_BRTAKEN:
+                 case R_PPC64_REL14_BRNTAKEN:
+                 case R_PPC64_REL24:
+                   if (h != NULL
+                       && h == htab->tls_get_addr)
+                     {
+                       if (!expecting_tls_get_addr
+                           && rel != relstart
+                           && ((ELF64_R_TYPE (rel[-1].r_info)
+                                == R_PPC64_TOC16)
+                               || (ELF64_R_TYPE (rel[-1].r_info)
+                                   == R_PPC64_TOC16_LO)))
+                         {
+                           /* Check for toc tls entries.  */
+                           char *toc_tls;
+                           int retval;
+
+                           retval = get_tls_mask (&toc_tls, &locsyms,
+                                                  rel - 1, ibfd);
+                           if (retval == 0)
+                             goto err_free_rel;
+                           if (toc_tls != NULL)
+                             expecting_tls_get_addr = retval > 1;
+                         }
+
+                       if (expecting_tls_get_addr)
+                         {
+                           struct plt_entry *ent;
+                           for (ent = h->plt.plist; ent; ent = ent->next)
+                             if (ent->addend == 0)
+                               {
+                                 if (ent->plt.refcount > 0)
+                                   ent->plt.refcount -= 1;
+                                 break;
+                               }
+                         }
+                     }
+                   expecting_tls_get_addr = 0;
+                   continue;
+
+                 case R_PPC64_TPREL64:
+                   expecting_tls_get_addr = 0;
+                   if (ok_tprel)
+                     {
+                       /* IE -> LE */
+                       tls_set = TLS_EXPLICIT;
+                       tls_clear = TLS_TPREL;
+                       break;
+                     }
+                   else
+                     continue;
+
+                 case R_PPC64_DTPMOD64:
+                   expecting_tls_get_addr = 0;
+                   if (rel + 1 < relend
+                       && (rel[1].r_info
+                           == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64))
+                       && rel[1].r_offset == rel->r_offset + 8)
+                     {
+                       if (ok_tprel)
+                         /* GD -> LE */
+                         tls_set = TLS_EXPLICIT | TLS_GD;
+                       else
+                         /* GD -> IE */
+                         tls_set = TLS_EXPLICIT | TLS_GD | TLS_TPRELGD;
+                       tls_clear = TLS_GD;
+                     }
+                   else
+                     {
+                       if (!is_local)
+                         continue;
+
+                       /* LD -> LE */
+                       tls_set = TLS_EXPLICIT;
+                       tls_clear = TLS_LD;
+                     }
+                   break;
+
+                 default:
+                   expecting_tls_get_addr = 0;
+                   continue;
+                 }
+
+               if ((tls_set & TLS_EXPLICIT) == 0)
+                 {
+                   struct got_entry *ent;
+
+                   /* Adjust got entry for this reloc.  */
+                   if (h != NULL)
+                     ent = h->got.glist;
+                   else
+                     ent = elf_local_got_ents (ibfd)[r_symndx];
+
+                   for (; ent != NULL; ent = ent->next)
+                     if (ent->addend == rel->r_addend
+                         && ent->tls_type == tls_type)
+                       break;
+                   if (ent == NULL)
+                     abort ();
+
+                   if (tls_set == 0)
+                     {
+                       /* We managed to get rid of a got entry.  */
+                       if (ent->got.refcount > 0)
+                         ent->got.refcount -= 1;
+                     }
+                 }
+               else if (h != NULL)
+                 {
+                   struct ppc_link_hash_entry * eh;
+                   struct ppc_dyn_relocs **pp;
+                   struct ppc_dyn_relocs *p;
+
+                   /* Adjust dynamic relocs.  */
+                   eh = (struct ppc_link_hash_entry *) h;
+                   for (pp = &eh->dyn_relocs;
+                        (p = *pp) != NULL;
+                        pp = &p->next)
+                     if (p->sec == sec)
+                       {
+                         /* If we got rid of a DTPMOD/DTPREL reloc
+                            pair then we'll lose one or two dyn
+                            relocs.  */
+                         if (tls_set == (TLS_EXPLICIT | TLS_GD))
+                           p->count -= 1;
+                         p->count -= 1;
+                         if (p->count == 0)
+                           *pp = p->next;
+                         break;
+                       }
+                 }
+
+               *tls_mask |= tls_set;
+               *tls_mask &= ~tls_clear;
+             }
+
+           if (elf_section_data (sec)->relocs != relstart)
+             free (relstart);
+         }
+
+      if (locsyms != NULL
+         && (elf_tdata (ibfd)->symtab_hdr.contents
+             != (unsigned char *) locsyms))
+       {
+         if (!info->keep_memory)
+           free (locsyms);
+         else
+           elf_tdata (ibfd)->symtab_hdr.contents = (unsigned char *) locsyms;
+       }
+    }
+  return TRUE;
+}
+
 /* This is the condition under which ppc64_elf_finish_dynamic_symbol
    will be called from elflink.h.  If elflink.h doesn't call our
    finish_dynamic_symbol routine, we'll need to do something about
    initializing any .plt and .got entries in ppc64_elf_relocate_section.  */
-#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
   ((DYN)                                                               \
-   && ((INFO)->shared                                                  \
+   && ((SHARED)                                                                \
        || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)     \
    && ((H)->dynindx != -1                                              \
        || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
@@ -3942,6 +5471,7 @@ allocate_dynrelocs (h, inf)
   asection *s;
   struct ppc_link_hash_entry *eh;
   struct ppc_dyn_relocs *p;
+  struct got_entry *gent;
 
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
@@ -3953,73 +5483,117 @@ allocate_dynrelocs (h, inf)
   htab = ppc_hash_table (info);
 
   if (htab->elf.dynamic_sections_created
-      && h->plt.refcount > 0
-      && h->dynindx != -1)
+      && h->dynindx != -1
+      && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
     {
-      BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor);
-
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
-       {
-         /* If this is the first .plt entry, make room for the special
-            first entry.  */
-         s = htab->splt;
-         if (s->_raw_size == 0)
-           s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
-
-         h->plt.offset = s->_raw_size;
-
-         /* Make room for this entry.  */
-         s->_raw_size += PLT_ENTRY_SIZE;
-
-         /* Make room for the .glink code.  */
-         s = htab->sglink;
-         if (s->_raw_size == 0)
-           s->_raw_size += GLINK_CALL_STUB_SIZE;
-         /* We need bigger stubs past index 32767.  */
-         if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
-           s->_raw_size += 4;
-         s->_raw_size += 2*4;
-
-         /* We also need to make an entry in the .rela.plt section.  */
-         s = htab->srelplt;
-         s->_raw_size += sizeof (Elf64_External_Rela);
-       }
-      else
+      struct plt_entry *pent;
+      bfd_boolean doneone = FALSE;
+      for (pent = h->plt.plist; pent != NULL; pent = pent->next)
+       if (pent->plt.refcount > 0)
+         {
+           BFD_ASSERT (((struct ppc_link_hash_entry *) h)->is_func_descriptor);
+
+           /* If this is the first .plt entry, make room for the special
+              first entry.  */
+           s = htab->splt;
+           if (s->_raw_size == 0)
+             s->_raw_size += PLT_INITIAL_ENTRY_SIZE;
+
+           pent->plt.offset = s->_raw_size;
+
+           /* Make room for this entry.  */
+           s->_raw_size += PLT_ENTRY_SIZE;
+
+           /* Make room for the .glink code.  */
+           s = htab->sglink;
+           if (s->_raw_size == 0)
+             s->_raw_size += GLINK_CALL_STUB_SIZE;
+           /* We need bigger stubs past index 32767.  */
+           if (s->_raw_size >= GLINK_CALL_STUB_SIZE + 32768*2*4)
+             s->_raw_size += 4;
+           s->_raw_size += 2*4;
+
+           /* We also need to make an entry in the .rela.plt section.  */
+           s = htab->srelplt;
+           s->_raw_size += sizeof (Elf64_External_Rela);
+           doneone = TRUE;
+         }
+       else
+         pent->plt.offset = (bfd_vma) -1;
+      if (!doneone)
        {
-         h->plt.offset = (bfd_vma) -1;
+         h->plt.plist = NULL;
          h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
        }
     }
   else
     {
-      h->plt.offset = (bfd_vma) -1;
+      h->plt.plist = NULL;
       h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
     }
 
-  if (h->got.refcount > 0)
-    {
-      bfd_boolean dyn;
-
-      /* Make sure this symbol is output as a dynamic symbol.
-        Undefined weak syms won't yet be marked as dynamic.  */
-      if (h->dynindx == -1
-         && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+  eh = (struct ppc_link_hash_entry *) h;
+  /* Run through the TLS GD got entries first if we're changing them
+     to TPREL.  */
+  if ((eh->tls_mask & TLS_TPRELGD) != 0)
+    for (gent = h->got.glist; gent != NULL; gent = gent->next)
+      if (gent->got.refcount > 0
+         && (gent->tls_type & TLS_GD) != 0)
        {
-         if (! bfd_elf64_link_record_dynamic_symbol (info, h))
-           return FALSE;
+         /* This was a GD entry that has been converted to TPREL.  If
+            there happens to be a TPREL entry we can use that one.  */
+         struct got_entry *ent;
+         for (ent = h->got.glist; ent != NULL; ent = ent->next)
+           if (ent->got.refcount > 0
+               && (ent->tls_type & TLS_TPREL) != 0
+               && ent->addend == gent->addend)
+             {
+               gent->got.refcount = 0;
+               break;
+             }
+
+         /* If not, then we'll be using our own TPREL entry.  */
+         if (gent->got.refcount != 0)
+           gent->tls_type = TLS_TLS | TLS_TPREL;
        }
 
-      s = htab->sgot;
-      h->got.offset = s->_raw_size;
-      s->_raw_size += 8;
-      dyn = htab->elf.dynamic_sections_created;
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
-       htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
-    }
-  else
-    h->got.offset = (bfd_vma) -1;
+  for (gent = h->got.glist; gent != NULL; gent = gent->next)
+    if (gent->got.refcount > 0)
+      {
+       bfd_boolean dyn;
+
+       /* Make sure this symbol is output as a dynamic symbol.
+          Undefined weak syms won't yet be marked as dynamic,
+          nor will all TLS symbols.  */
+       if (h->dynindx == -1
+           && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+         {
+           if (! bfd_elf64_link_record_dynamic_symbol (info, h))
+             return FALSE;
+         }
+
+       if ((gent->tls_type & TLS_LD) != 0
+           && !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))
+         {
+           gent->got.offset = htab->tlsld_got.offset;
+           continue;
+         }
+
+       s = htab->sgot;
+       gent->got.offset = s->_raw_size;
+       s->_raw_size
+         += (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8;
+       dyn = htab->elf.dynamic_sections_created;
+       if (info->shared
+           || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+         htab->srelgot->_raw_size
+           += (gent->tls_type & eh->tls_mask & TLS_GD
+               ? 2 * sizeof (Elf64_External_Rela)
+               : sizeof (Elf64_External_Rela));
+      }
+    else
+      gent->got.offset = (bfd_vma) -1;
 
-  eh = (struct ppc_link_hash_entry *) h;
   if (eh->dyn_relocs == NULL)
     return TRUE;
 
@@ -4048,18 +5622,15 @@ allocate_dynrelocs (h, inf)
            }
        }
     }
-  else
+  else if (ELIMINATE_COPY_RELOCS)
     {
       /* For the non-shared case, discard space for relocs against
         symbols which turn out to need copy relocs or are not
         dynamic.  */
 
       if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
-         && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-              && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-             || (htab->elf.dynamic_sections_created
-                 && (h->root.type == bfd_link_hash_undefweak
-                     || h->root.type == bfd_link_hash_undefined))))
+         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
        {
          /* Make sure this symbol is output as a dynamic symbol.
             Undefined weak syms won't yet be marked as dynamic.  */
@@ -4153,12 +5724,23 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
        }
     }
 
+  if (htab->tlsld_got.refcount > 0)
+    {
+      htab->tlsld_got.offset = htab->sgot->_raw_size;
+      htab->sgot->_raw_size += 16;
+      if (info->shared)
+       htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+    }
+  else
+    htab->tlsld_got.offset = (bfd_vma) -1;
+
   /* Set up .got offsets for local syms, and space for local dynamic
      relocs.  */
   for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
     {
-      bfd_signed_vma *local_got;
-      bfd_signed_vma *end_local_got;
+      struct got_entry **lgot_ents;
+      struct got_entry **end_lgot_ents;
+      char *lgot_masks;
       bfd_size_type locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
       asection *srel;
@@ -4193,26 +5775,53 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
            }
        }
 
-      local_got = elf_local_got_refcounts (ibfd);
-      if (!local_got)
+      lgot_ents = elf_local_got_ents (ibfd);
+      if (!lgot_ents)
        continue;
 
       symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
       locsymcount = symtab_hdr->sh_info;
-      end_local_got = local_got + locsymcount;
+      end_lgot_ents = lgot_ents + locsymcount;
+      lgot_masks = (char *) end_lgot_ents;
       s = htab->sgot;
       srel = htab->srelgot;
-      for (; local_got < end_local_got; ++local_got)
+      for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks)
        {
-         if (*local_got > 0)
-           {
-             *local_got = s->_raw_size;
-             s->_raw_size += 8;
-             if (info->shared)
-               srel->_raw_size += sizeof (Elf64_External_Rela);
-           }
-         else
-           *local_got = (bfd_vma) -1;
+         struct got_entry *ent;
+
+         for (ent = *lgot_ents; ent != NULL; ent = ent->next)
+           if (ent->got.refcount > 0)
+             {
+               if ((ent->tls_type & *lgot_masks & TLS_LD) != 0)
+                 {
+                   if (htab->tlsld_got.offset == (bfd_vma) -1)
+                     {
+                       htab->tlsld_got.offset = s->_raw_size;
+                       s->_raw_size += 16;
+                       if (info->shared)
+                         srel->_raw_size += sizeof (Elf64_External_Rela);
+                     }
+                   ent->got.offset = htab->tlsld_got.offset;
+                 }
+               else
+                 {
+                   ent->got.offset = s->_raw_size;
+                   if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
+                     {
+                       s->_raw_size += 16;
+                       if (info->shared)
+                         srel->_raw_size += 2 * sizeof (Elf64_External_Rela);
+                     }
+                   else
+                     {
+                       s->_raw_size += 8;
+                       if (info->shared)
+                         srel->_raw_size += sizeof (Elf64_External_Rela);
+                     }
+                 }
+             }
+           else
+             ent->got.offset = (bfd_vma) -1;
        }
     }
 
@@ -4228,6 +5837,10 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
       if ((s->flags & SEC_LINKER_CREATED) == 0)
        continue;
 
+      /* Reset _cooked_size since prelim layout will set it wrongly,
+        and a non-zero _cooked_size sticks.  */
+      s->_cooked_size = 0;
+
       if (s == htab->sbrlt || s == htab->srelbrlt)
        /* These haven't been allocated yet;  don't strip.  */
        continue;
@@ -4281,8 +5894,10 @@ ppc64_elf_size_dynamic_sections (output_bfd, info)
       /* Allocate memory for the section contents.  We use bfd_zalloc
         here in case unused entries are not reclaimed before the
         section's contents are written out.  This should not happen,
-        but this way if it does, we get a R_PPC64_NONE reloc instead
-        of garbage.  */
+        but this way if it does we get a R_PPC64_NONE reloc in .rela
+        sections instead of garbage.
+        We also rely on the section contents being zero when writing
+        the GOT.  */
       s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
       if (s->contents == NULL)
        return FALSE;
@@ -4364,11 +5979,16 @@ ppc_type_of_stub (input_sec, rel, hash, destination)
   if (h != NULL)
     {
       if (h->oh != NULL
-         && h->oh->plt.offset != (bfd_vma) -1
          && h->oh->dynindx != -1)
        {
-         *hash = (struct ppc_link_hash_entry *) h->oh;
-         return ppc_stub_plt_call;
+         struct plt_entry *ent;
+         for (ent = h->oh->plt.plist; ent != NULL; ent = ent->next)
+           if (ent->addend == rel->r_addend
+               && ent->plt.offset != (bfd_vma) -1)
+             {
+               *hash = (struct ppc_link_hash_entry *) h->oh;
+               return ppc_stub_plt_call;
+             }
        }
 
       if (h->elf.root.type == bfd_link_hash_undefweak
@@ -4443,6 +6063,7 @@ ppc_build_one_stub (gen_entry, in_arg)
   bfd_byte *loc;
   bfd_byte *p;
   unsigned int indx;
+  struct plt_entry *ent;
   bfd_vma off;
   int size;
 
@@ -4554,7 +6175,13 @@ ppc_build_one_stub (gen_entry, in_arg)
        }
 
       /* Now build the stub.  */
-      off = stub_entry->h->elf.plt.offset;
+      off = (bfd_vma) -1;
+      for (ent = stub_entry->h->elf.plt.plist; ent != NULL; ent = ent->next)
+       if (ent->addend == stub_entry->addend)
+         {
+           off = ent->plt.offset;
+           break;
+         }
       if (off >= (bfd_vma) -2)
        abort ();
 
@@ -4607,7 +6234,16 @@ ppc_size_one_stub (gen_entry, in_arg)
 
   if (stub_entry->stub_type == ppc_stub_plt_call)
     {
-      off = stub_entry->h->elf.plt.offset & ~(bfd_vma) 1;
+      struct plt_entry *ent;
+      off = (bfd_vma) -1;
+      for (ent = stub_entry->h->elf.plt.plist; ent != NULL; ent = ent->next)
+       if (ent->addend == stub_entry->addend)
+         {
+           off = ent->plt.offset & ~(bfd_vma) 1;
+           break;
+         }
+      if (off >= (bfd_vma) -2)
+       abort ();
       off += (htab->splt->output_offset
              + htab->splt->output_section->vma
              - elf_gp (htab->splt->output_section->owner)
@@ -4786,12 +6422,15 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
          asection *curr;
          asection *prev;
          bfd_size_type total;
+         bfd_boolean big_sec;
 
          curr = tail;
          if (tail->_cooked_size)
            total = tail->_cooked_size;
          else
            total = tail->_raw_size;
+         big_sec = total >= stub_group_size;
+
          while ((prev = PREV_SEC (curr)) != NULL
                 && ((total += curr->output_offset - prev->output_offset)
                     < stub_group_size))
@@ -4806,7 +6445,7 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
             section size.  That's a little tricky, and this way will
             only break if stubs added make the total size more than
             2^25, ie. for the default stub_group_size, if stubs total
-            more than 2834432 bytes, or over 100000 plt call stubs.  */
+            more than 2097152 bytes, or nearly 75000 plt call stubs.  */
          do
            {
              prev = PREV_SEC (tail);
@@ -4816,8 +6455,11 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
          while (tail != curr && (tail = prev) != NULL);
 
          /* But wait, there's more!  Input sections up to stub_group_size
-            bytes before the stub section can be handled by it too.  */
-         if (!stubs_always_before_branch)
+            bytes before the stub section can be handled by it too.
+            Don't do this if we have a really large section after the
+            stubs, as adding more stubs increases the chance that
+            branches may not reach into the stub section.  */
+         if (!stubs_always_before_branch && !big_sec)
            {
              total = 0;
              while (prev != NULL
@@ -4869,9 +6511,18 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
   if (stub_group_size == 1)
     {
       /* Default values.  */
-      stub_group_size = 30720000;
-      if (htab->has_14bit_branch)
-       stub_group_size = 30000;
+      if (stubs_always_before_branch)
+       {
+         stub_group_size = 0x1e00000;
+         if (htab->has_14bit_branch)
+           stub_group_size = 0x7800;
+       }
+      else
+       {
+         stub_group_size = 0x1c00000;
+         if (htab->has_14bit_branch)
+           stub_group_size = 0x7000;
+       }
     }
 
   group_sections (htab, stub_group_size, stubs_always_before_branch);
@@ -4938,6 +6589,8 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
                  bfd_vma sym_value;
                  bfd_vma destination;
                  struct ppc_link_hash_entry *hash;
+                 struct elf_link_hash_entry *h;
+                 Elf_Internal_Sym *sym;
                  char *stub_name;
                  const asection *id_sec;
 
@@ -4959,33 +6612,16 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
 
                  /* Now determine the call target, its name, value,
                     section.  */
-                 sym_sec = NULL;
-                 sym_value = 0;
                  destination = 0;
-                 hash = NULL;
-                 if (r_indx < symtab_hdr->sh_info)
+                 if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms,
+                                 r_indx, input_bfd))
+                   goto error_ret_free_internal;
+                 hash = (struct ppc_link_hash_entry *) h;
+
+                 if (hash == NULL)
                    {
                      /* It's a local symbol.  */
-                     Elf_Internal_Sym *sym;
-                     Elf_Internal_Shdr *hdr;
-
-                     if (local_syms == NULL)
-                       {
-                         local_syms
-                           = (Elf_Internal_Sym *) symtab_hdr->contents;
-                         if (local_syms == NULL)
-                           local_syms
-                             = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
-                                                     symtab_hdr->sh_info, 0,
-                                                     NULL, NULL, NULL);
-                         if (local_syms == NULL)
-                           goto error_ret_free_internal;
-                       }
-                     sym = local_syms + r_indx;
-                     hdr = elf_elfsections (input_bfd)[sym->st_shndx];
-                     sym_sec = hdr->bfd_section;
-                     if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
-                       sym_value = sym->st_value;
+                     sym_value = sym->st_value;
                      destination = (sym_value + irela->r_addend
                                     + sym_sec->output_offset
                                     + sym_sec->output_section->vma);
@@ -4993,21 +6629,10 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
                  else
                    {
                      /* It's an external symbol.  */
-                     int e_indx;
-
-                     e_indx = r_indx - symtab_hdr->sh_info;
-                     hash = ((struct ppc_link_hash_entry *)
-                             elf_sym_hashes (input_bfd)[e_indx]);
-
-                     while (hash->elf.root.type == bfd_link_hash_indirect
-                            || hash->elf.root.type == bfd_link_hash_warning)
-                       hash = ((struct ppc_link_hash_entry *)
-                               hash->elf.root.u.i.link);
-
+                     sym_value = 0;
                      if (hash->elf.root.type == bfd_link_hash_defined
                          || hash->elf.root.type == bfd_link_hash_defweak)
                        {
-                         sym_sec = hash->elf.root.u.def.section;
                          sym_value = hash->elf.root.u.def.value;
                          if (sym_sec->output_section != NULL)
                            destination = (sym_value + irela->r_addend
@@ -5031,6 +6656,23 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
                  if (stub_type == ppc_stub_none)
                    continue;
 
+                 /* __tls_get_addr calls might be eliminated.  */
+                 if (stub_type != ppc_stub_plt_call
+                     && hash != NULL
+                     && &hash->elf == htab->tls_get_addr
+                     && section->has_tls_reloc
+                     && irela != internal_relocs)
+                   {
+                     /* Get tls info.  */
+                     char *tls_mask;
+
+                     if (!get_tls_mask (&tls_mask, &local_syms,
+                                        irela - 1, input_bfd))
+                       goto error_ret_free_internal;
+                     if (*tls_mask != 0)
+                       continue;
+                   }
+
                  /* Support for grouping stub sections.  */
                  id_sec = htab->stub_group[section->id].link_sec;
 
@@ -5067,6 +6709,7 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size,
                  stub_entry->target_section = sym_sec;
                  stub_entry->stub_type = stub_type;
                  stub_entry->h = hash;
+                 stub_entry->addend = irela->r_addend;
                  stub_changed = TRUE;
                }
 
@@ -5317,7 +6960,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
   struct elf_link_hash_entry **sym_hashes;
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
-  bfd_vma *local_got_offsets;
+  Elf_Internal_Rela outrel;
+  bfd_byte *loc;
+  struct got_entry **local_got_ents;
   bfd_vma TOCstart;
   bfd_boolean ret = TRUE;
   bfd_boolean is_opd;
@@ -5332,7 +6977,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
     ppc_howto_init ();
 
   htab = ppc_hash_table (info);
-  local_got_offsets = elf_local_got_offsets (input_bfd);
+  local_got_ents = elf_local_got_ents (input_bfd);
   TOCstart = elf_gp (output_bfd);
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
@@ -5343,7 +6988,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
   for (; rel < relend; rel++)
     {
       enum elf_ppc64_reloc_type r_type;
-      bfd_vma offset;
       bfd_vma addend;
       bfd_reloc_status_type r;
       Elf_Internal_Sym *sym;
@@ -5352,6 +6996,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
       struct elf_link_hash_entry *fdh;
       const char *sym_name;
       unsigned long r_symndx;
+      char tls_mask, tls_gd, tls_type;
       bfd_vma relocation;
       bfd_boolean unresolved_reloc;
       bfd_boolean warned;
@@ -5362,9 +7007,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 
       r_type = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel->r_info);
       r_symndx = ELF64_R_SYM (rel->r_info);
-      offset = rel->r_offset;
-      addend = rel->r_addend;
-      r = bfd_reloc_other;
       sym = (Elf_Internal_Sym *) 0;
       sec = (asection *) 0;
       h = (struct elf_link_hash_entry *) 0;
@@ -5382,12 +7024,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          /* It's a local symbol.  */
          sym = local_syms + r_symndx;
          sec = local_sections[r_symndx];
-         sym_name = "<local symbol>";
-
+         sym_name = bfd_elf_local_sym_name (input_bfd, sym);
          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
-         /* rel may have changed, update our copy of addend.  */
-         addend = rel->r_addend;
-
          if (elf_section_data (sec) != NULL)
            {
              long *opd_sym_adjust;
@@ -5424,7 +7062,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            ;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            ;
@@ -5432,15 +7069,323 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            {
              if (! ((*info->callbacks->undefined_symbol)
                     (info, h->root.root.string, input_bfd, input_section,
-                     offset, (!info->shared
-                              || info->no_undefined
-                              || ELF_ST_VISIBILITY (h->other)))))
+                     rel->r_offset, (!info->shared
+                                     || info->no_undefined
+                                     || ELF_ST_VISIBILITY (h->other)))))
                return FALSE;
              warned = TRUE;
            }
        }
 
-      /* First handle relocations that tweak non-addend part of insn.  */
+      /* TLS optimizations.  Replace instruction sequences and relocs
+        based on information we collected in tls_optimize.  We edit
+        RELOCS so that --emit-relocs will output something sensible
+        for the final instruction stream.  */
+      tls_mask = 0;
+      tls_gd = 0;
+      if (IS_PPC64_TLS_RELOC (r_type))
+       {
+         if (h != NULL)
+           tls_mask = ((struct ppc_link_hash_entry *) h)->tls_mask;
+         else if (local_got_ents != NULL)
+           {
+             char *lgot_masks;
+             lgot_masks = (char *) (local_got_ents + symtab_hdr->sh_info);
+             tls_mask = lgot_masks[r_symndx];
+           }
+       }
+
+      /* Ensure reloc mapping code below stays sane.  */
+      if (R_PPC64_TOC16_LO_DS != R_PPC64_TOC16_DS + 1
+         || R_PPC64_TOC16_LO != R_PPC64_TOC16 + 1
+         || (R_PPC64_GOT_TLSLD16 & 3)    != (R_PPC64_GOT_TLSGD16 & 3)
+         || (R_PPC64_GOT_TLSLD16_LO & 3) != (R_PPC64_GOT_TLSGD16_LO & 3)
+         || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TLSGD16_HI & 3)
+         || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TLSGD16_HA & 3)
+         || (R_PPC64_GOT_TLSLD16 & 3)    != (R_PPC64_GOT_TPREL16_DS & 3)
+         || (R_PPC64_GOT_TLSLD16_LO & 3) != (R_PPC64_GOT_TPREL16_LO_DS & 3)
+         || (R_PPC64_GOT_TLSLD16_HI & 3) != (R_PPC64_GOT_TPREL16_HI & 3)
+         || (R_PPC64_GOT_TLSLD16_HA & 3) != (R_PPC64_GOT_TPREL16_HA & 3))
+       abort ();
+      switch (r_type)
+       {
+       default:
+         break;
+
+       case R_PPC64_TOC16:
+       case R_PPC64_TOC16_LO:
+       case R_PPC64_TOC16_DS:
+       case R_PPC64_TOC16_LO_DS:
+         {
+           /* Check for toc tls entries.  */
+           char *toc_tls;
+           int retval;
+
+           retval = get_tls_mask (&toc_tls, &local_syms, rel, input_bfd);
+           if (retval == 0)
+             return FALSE;
+
+           if (toc_tls)
+             {
+               tls_mask = *toc_tls;
+               if (r_type == R_PPC64_TOC16_DS
+                   || r_type == R_PPC64_TOC16_LO_DS)
+                 goto toctprel;
+               else
+                 {
+                   /* If we found a GD reloc pair, then we might be
+                      doing a GD->IE transition.  */
+                   if (retval == 2)
+                     {
+                       tls_gd = TLS_TPRELGD;
+                       if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+                         goto tls_get_addr_check;
+                     }
+                   else if (retval == 3)
+                     {
+                       if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+                         goto tls_get_addr_check;
+                     }
+                 }
+             }
+         }
+         break;
+
+       case R_PPC64_GOT_TPREL16_DS:
+       case R_PPC64_GOT_TPREL16_LO_DS:
+       toctprel:
+         if (tls_mask != 0
+             && (tls_mask & TLS_TPREL) == 0)
+           {
+             bfd_vma insn;
+             insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2);
+             insn &= 31 << 21;
+             insn |= 0x3c0d0000;       /* addis 0,13,0 */
+             bfd_put_32 (output_bfd, insn, contents + rel->r_offset - 2);
+             r_type = R_PPC64_TPREL16_HA;
+             rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+           }
+         break;
+
+       case R_PPC64_TLS:
+         if (tls_mask == 0)
+           {
+             /* Check for toc tls entries.  */
+             char *toc_tls;
+
+             if (!get_tls_mask (&toc_tls, &local_syms, rel, input_bfd))
+               return FALSE;
+
+             if (toc_tls)
+               tls_mask = *toc_tls;
+           }
+         if (tls_mask != 0
+             && (tls_mask & TLS_TPREL) == 0)
+           {
+             bfd_vma insn, rtra;
+             insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+             if ((insn & ((31 << 26) | (31 << 11)))
+                 == ((31 << 26) | (13 << 11)))
+               rtra = insn & ((1 << 26) - (1 << 16));
+             else if ((insn & ((31 << 26) | (31 << 16)))
+                      == ((31 << 26) | (13 << 16)))
+               rtra = (insn & (31 << 21)) | ((insn & (31 << 11)) << 5);
+             else
+               abort ();
+             if ((insn & ((1 << 11) - (1 << 1))) == 266 << 1)
+               /* add -> addi.  */
+               insn = 14 << 26;
+             else if ((insn & (31 << 1)) == 23 << 1
+                      && ((insn & (31 << 6)) < 14 << 6
+                          || ((insn & (31 << 6)) >= 16 << 6
+                              && (insn & (31 << 6)) < 24 << 6)))
+               /* load and store indexed -> dform.  */
+               insn = (32 | ((insn >> 6) & 31)) << 26;
+             else if ((insn & (31 << 1)) == 21 << 1
+                      && (insn & (0x1a << 6)) == 0)
+               /* ldx, ldux, stdx, stdux -> ld, ldu, std, stdu.  */
+               insn = (((58 | ((insn >> 6) & 4)) << 26)
+                       | ((insn >> 6) & 1));
+             else if ((insn & (31 << 1)) == 21 << 1
+                      && (insn & ((1 << 11) - (1 << 1))) == 341 << 1)
+               /* lwax -> lwa.  */
+               insn = (58 << 26) | 2;
+             else
+               abort ();
+             insn |= rtra;
+             bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+             r_type = R_PPC64_TPREL16_LO;
+             rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+             /* Was PPC64_TLS which sits on insn boundary, now
+                PPC64_TPREL16_LO which is at insn+2.  */
+             rel->r_offset += 2;
+           }
+         break;
+
+       case R_PPC64_GOT_TLSGD16_HI:
+       case R_PPC64_GOT_TLSGD16_HA:
+         tls_gd = TLS_TPRELGD;
+         if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+           goto tls_gdld_hi;
+         break;
+
+       case R_PPC64_GOT_TLSLD16_HI:
+       case R_PPC64_GOT_TLSLD16_HA:
+         if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+           {
+           tls_gdld_hi:
+             if ((tls_mask & tls_gd) != 0)
+               r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
+                         + R_PPC64_GOT_TPREL16_DS);
+             else
+               {
+                 bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+                 rel->r_offset -= 2;
+                 r_type = R_PPC64_NONE;
+               }
+             rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+           }
+         break;
+
+       case R_PPC64_GOT_TLSGD16:
+       case R_PPC64_GOT_TLSGD16_LO:
+         tls_gd = TLS_TPRELGD;
+         if (tls_mask != 0 && (tls_mask & TLS_GD) == 0)
+           goto tls_get_addr_check;
+         break;
+
+       case R_PPC64_GOT_TLSLD16:
+       case R_PPC64_GOT_TLSLD16_LO:
+         if (tls_mask != 0 && (tls_mask & TLS_LD) == 0)
+           {
+           tls_get_addr_check:
+             if (rel + 1 < relend)
+               {
+                 enum elf_ppc64_reloc_type r_type2;
+                 unsigned long r_symndx2;
+                 struct elf_link_hash_entry *h2;
+                 bfd_vma insn1, insn2, insn3;
+                 bfd_vma offset;
+
+                 /* The next instruction should be a call to
+                    __tls_get_addr.  Peek at the reloc to be sure.  */
+                 r_type2
+                   = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel[1].r_info);
+                 r_symndx2 = ELF64_R_SYM (rel[1].r_info);
+                 if (r_symndx2 < symtab_hdr->sh_info
+                     || (r_type2 != R_PPC64_REL14
+                         && r_type2 != R_PPC64_REL14_BRTAKEN
+                         && r_type2 != R_PPC64_REL14_BRNTAKEN
+                         && r_type2 != R_PPC64_REL24))
+                   break;
+
+                 h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info];
+                 while (h2->root.type == bfd_link_hash_indirect
+                        || h2->root.type == bfd_link_hash_warning)
+                   h2 = (struct elf_link_hash_entry *) h2->root.u.i.link;
+                 if (h2 == NULL || h2 != htab->tls_get_addr)
+                   break;
+
+                 /* OK, it checks out.  Replace the call.  */
+                 offset = rel[1].r_offset;
+                 insn1 = bfd_get_32 (output_bfd,
+                                     contents + rel->r_offset - 2);
+                 insn3 = bfd_get_32 (output_bfd,
+                                     contents + offset + 4);
+                 if ((tls_mask & tls_gd) != 0)
+                   {
+                     /* IE */
+                     insn1 &= (1 << 26) - (1 << 2);
+                     insn1 |= 58 << 26;        /* ld */
+                     insn2 = 0x7c636a14;       /* add 3,3,13 */
+                     rel[1].r_info = ELF64_R_INFO (r_symndx2, R_PPC64_NONE);
+                     if ((tls_mask & TLS_EXPLICIT) == 0)
+                       r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
+                                 + R_PPC64_GOT_TPREL16_DS);
+                     else
+                       r_type += R_PPC64_TOC16_DS - R_PPC64_TOC16;
+                     rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+                   }
+                 else
+                   {
+                     /* LE */
+                     insn1 = 0x3c6d0000;       /* addis 3,13,0 */
+                     insn2 = 0x38630000;       /* addi 3,3,0 */
+                     if (tls_gd == 0)
+                       {
+                         /* Was an LD reloc.  */
+                         r_symndx = 0;
+                         rel->r_addend = htab->tls_sec->vma + DTP_OFFSET;
+                         rel[1].r_addend = htab->tls_sec->vma + DTP_OFFSET;
+                       }
+                     r_type = R_PPC64_TPREL16_HA;
+                     rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+                     rel[1].r_info = ELF64_R_INFO (r_symndx,
+                                                   R_PPC64_TPREL16_LO);
+                     rel[1].r_offset += 2;
+                   }
+                 if (insn3 == NOP
+                     || insn3 == CROR_151515 || insn3 == CROR_313131)
+                   {
+                     insn3 = insn2;
+                     insn2 = NOP;
+                     rel[1].r_offset += 4;
+                   }
+                 bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2);
+                 bfd_put_32 (output_bfd, insn2, contents + offset);
+                 bfd_put_32 (output_bfd, insn3, contents + offset + 4);
+                 if (tls_gd == 0)
+                   {
+                     /* We changed the symbol on an LD reloc.  Start over
+                        in order to get h, sym, sec etc. right.  */ 
+                     rel--;
+                     continue;
+                   }
+               }
+           }
+         break;
+
+       case R_PPC64_DTPMOD64:
+         if (rel + 1 < relend
+             && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)
+             && rel[1].r_offset == rel->r_offset + 8)
+           {
+             if ((tls_mask & TLS_GD) == 0)
+               {
+                 rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_NONE);
+                 if ((tls_mask & TLS_TPRELGD) != 0)
+                   r_type = R_PPC64_TPREL64;
+                 else
+                   {
+                     bfd_put_64 (output_bfd, (bfd_vma) 1,
+                                 contents + rel->r_offset);
+                     r_type = R_PPC64_NONE;
+                   }
+                 rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+               }
+           }
+         else
+           {
+             if ((tls_mask & TLS_LD) == 0)
+               {
+                 bfd_put_64 (output_bfd, (bfd_vma) 1,
+                             contents + rel->r_offset);
+                 r_type = R_PPC64_NONE;
+                 rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+               }
+           }
+         break;
+
+       case R_PPC64_TPREL64:
+         if ((tls_mask & TLS_TPREL) == 0)
+           {
+             r_type = R_PPC64_NONE;
+             rel->r_info = ELF64_R_INFO (r_symndx, r_type);
+           }
+         break;
+       }
+
+      /* Handle other relocations that tweak non-addend part of insn.  */
       insn = 0;
       switch (r_type)
        {
@@ -5456,7 +7401,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          /* Branch not taken prediction relocations.  */
        case R_PPC64_ADDR14_BRNTAKEN:
        case R_PPC64_REL14_BRNTAKEN:
-         insn |= bfd_get_32 (output_bfd, contents + offset) & ~(0x01 << 21);
+         insn |= bfd_get_32 (output_bfd,
+                             contents + rel->r_offset) & ~(0x01 << 21);
          if (is_power4)
            {
              /* Set 'a' bit.  This is 0b00010 in BO field for branch
@@ -5471,16 +7417,16 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else
            {
-             from = (offset
+             from = (rel->r_offset
                      + input_section->output_offset
                      + input_section->output_section->vma);
 
              /* Invert 'y' bit if not the default.  */
-             if ((bfd_signed_vma) (relocation + addend - from) < 0)
+             if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
                insn ^= 0x01 << 21;
            }
 
-         bfd_put_32 (output_bfd, (bfd_vma) insn, contents + offset);
+         bfd_put_32 (output_bfd, (bfd_vma) insn, contents + rel->r_offset);
          break;
 
        case R_PPC64_REL24:
@@ -5491,20 +7437,20 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
             need for a PLT entry.  */
          if (h != NULL
              && (fdh = ((struct ppc_link_hash_entry *) h)->oh) != NULL
-             && fdh->plt.offset != (bfd_vma) -1
+             && fdh->plt.plist != NULL
              && (stub_entry = ppc_get_stub_entry (input_section, sec, fdh,
                                                   rel, htab)) != NULL)
            {
              bfd_boolean can_plt_call = 0;
 
-             if (offset + 8 <= input_section->_cooked_size)
+             if (rel->r_offset + 8 <= input_section->_cooked_size)
                {
-                 insn = bfd_get_32 (input_bfd, contents + offset + 4);
+                 insn = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
                  if (insn == NOP
                      || insn == CROR_151515 || insn == CROR_313131)
                    {
                      bfd_put_32 (input_bfd, (bfd_vma) LD_R2_40R1,
-                                 contents + offset + 4);
+                                 contents + rel->r_offset + 4);
                      can_plt_call = 1;
                    }
                }
@@ -5513,7 +7459,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                {
                  /* If this is a plain branch rather than a branch
                     and link, don't require a nop.  */
-                 insn = bfd_get_32 (input_bfd, contents + offset);
+                 insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
                  if ((insn & 1) == 0)
                    can_plt_call = 1;
                }
@@ -5523,7 +7469,6 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  relocation = (stub_entry->stub_offset
                                + stub_entry->stub_sec->output_offset
                                + stub_entry->stub_sec->output_section->vma);
-                 addend = 0;
                  unresolved_reloc = FALSE;
                }
            }
@@ -5531,7 +7476,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          if (h != NULL
              && h->root.type == bfd_link_hash_undefweak
              && relocation == 0
-             && addend == 0)
+             && rel->r_addend == 0)
            {
              /* Tweak calls to undefined weak functions to point at a
                 blr.  We can thus call a weak function without first
@@ -5541,7 +7486,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              relocation = (htab->sfpr->_raw_size - 4
                            + htab->sfpr->output_offset
                            + htab->sfpr->output_section->vma);
-             from = (offset
+             from = (rel->r_offset
                      + input_section->output_offset
                      + input_section->output_section->vma);
 
@@ -5555,6 +7500,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        }
 
       /* Set `addend'.  */
+      tls_type = 0;
+      addend = rel->r_addend;
       switch (r_type)
        {
        default:
@@ -5567,103 +7514,179 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          continue;
 
        case R_PPC64_NONE:
+       case R_PPC64_TLS:
        case R_PPC64_GNU_VTINHERIT:
        case R_PPC64_GNU_VTENTRY:
          continue;
 
          /* GOT16 relocations.  Like an ADDR16 using the symbol's
             address in the GOT as relocation value instead of the
-            symbols value itself.  Also, create a GOT entry for the
+            symbol's value itself.  Also, create a GOT entry for the
             symbol and put the symbol value there.  */
+       case R_PPC64_GOT_TLSGD16:
+       case R_PPC64_GOT_TLSGD16_LO:
+       case R_PPC64_GOT_TLSGD16_HI:
+       case R_PPC64_GOT_TLSGD16_HA:
+         tls_type = TLS_TLS | TLS_GD;
+         goto dogot;
+
+       case R_PPC64_GOT_TLSLD16:
+       case R_PPC64_GOT_TLSLD16_LO:
+       case R_PPC64_GOT_TLSLD16_HI:
+       case R_PPC64_GOT_TLSLD16_HA:
+         tls_type = TLS_TLS | TLS_LD;
+         goto dogot;
+
+       case R_PPC64_GOT_TPREL16_DS:
+       case R_PPC64_GOT_TPREL16_LO_DS:
+       case R_PPC64_GOT_TPREL16_HI:
+       case R_PPC64_GOT_TPREL16_HA:
+         tls_type = TLS_TLS | TLS_TPREL;
+         goto dogot;
+
+       case R_PPC64_GOT_DTPREL16_DS:
+       case R_PPC64_GOT_DTPREL16_LO_DS:
+       case R_PPC64_GOT_DTPREL16_HI:
+       case R_PPC64_GOT_DTPREL16_HA:
+         tls_type = TLS_TLS | TLS_DTPREL;
+         goto dogot;
+
        case R_PPC64_GOT16:
        case R_PPC64_GOT16_LO:
        case R_PPC64_GOT16_HI:
        case R_PPC64_GOT16_HA:
        case R_PPC64_GOT16_DS:
        case R_PPC64_GOT16_LO_DS:
+       dogot:
          {
            /* Relocation is to the entry for this symbol in the global
               offset table.  */
+           bfd_vma *offp;
            bfd_vma off;
+           unsigned long indx = 0;
 
            if (htab->sgot == NULL)
              abort ();
 
-           if (h != NULL)
+           if (tls_type == (TLS_TLS | TLS_LD)
+               && (h == NULL
+                   || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)))
+             offp = &htab->tlsld_got.offset;
+           else
              {
-               bfd_boolean dyn;
-
-               off = h->got.offset;
-               dyn = htab->elf.dynamic_sections_created;
-               if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
-                   || (info->shared
-                       && (info->symbolic
-                           || h->dynindx == -1
-                           || (h->elf_link_hash_flags
-                               & ELF_LINK_FORCED_LOCAL))
-                       && (h->elf_link_hash_flags
-                           & ELF_LINK_HASH_DEF_REGULAR)))
+               struct got_entry *ent;
+
+               if (h != NULL)
                  {
-                   /* This is actually a static link, or it is a
-                      -Bsymbolic link and the symbol is defined
-                      locally, or the symbol was forced to be local
-                      because of a version file.  We must initialize
-                      this entry in the global offset table.  Since the
-                      offset must always be a multiple of 8, 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 finish_dynamic_symbol routine.  */
-                   if ((off & 1) != 0)
-                     off &= ~1;
+                   bfd_boolean dyn = htab->elf.dynamic_sections_created;
+                   if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+                       || (info->shared
+                           && (info->symbolic
+                               || h->dynindx == -1
+                               || (h->elf_link_hash_flags
+                                   & ELF_LINK_FORCED_LOCAL))
+                           && (h->elf_link_hash_flags
+                               & ELF_LINK_HASH_DEF_REGULAR)))
+                     /* This is actually a static link, or it is a
+                        -Bsymbolic link and the symbol is defined
+                        locally, or the symbol was forced to be local
+                        because of a version file.  */
+                     ;
                    else
                      {
-                       bfd_put_64 (output_bfd, relocation,
-                                   htab->sgot->contents + off);
-                       h->got.offset |= 1;
+                       indx = h->dynindx;
+                       unresolved_reloc = FALSE;
                      }
+                   ent = h->got.glist;
                  }
                else
-                 unresolved_reloc = FALSE;
+                 {
+                   if (local_got_ents == NULL)
+                     abort ();
+                   ent = local_got_ents[r_symndx];
+                 }
+
+               for (; ent != NULL; ent = ent->next)
+                 if (ent->addend == rel->r_addend
+                     && ent->tls_type == tls_type)
+                   break;
+               if (ent == NULL)
+                 abort ();
+               offp = &ent->got.offset;
              }
+
+           /* The offset must always be a multiple of 8.  We use the
+              least significant bit to record whether we have already
+              processed this entry.  */
+           off = *offp;
+           if ((off & 1) != 0)
+             off &= ~1;
            else
              {
-               if (local_got_offsets == NULL)
-                 abort ();
-
-               off = local_got_offsets[r_symndx];
+               /* Generate relocs for the dynamic linker, except in
+                  the case of TLSLD where we'll use one entry per
+                  module.  */
+               *offp = off | 1;
+               if (info->shared || indx != 0)
+                 {
+                   outrel.r_offset = (htab->sgot->output_section->vma
+                                      + htab->sgot->output_offset
+                                      + off);
+                   if (tls_type & (TLS_LD | TLS_GD))
+                     {
+                       outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64);
+                       outrel.r_addend = 0;
+                       if (tls_type == (TLS_TLS | TLS_GD))
+                         {
+                           loc = htab->srelgot->contents;
+                           loc += (htab->srelgot->reloc_count++
+                                   * sizeof (Elf64_External_Rela));
+                           bfd_elf64_swap_reloca_out (output_bfd,
+                                                      &outrel, loc);
+                           outrel.r_info
+                             = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
+                           outrel.r_offset += 8;
+                         }
+                     }
+                   else if (tls_type == (TLS_TLS | TLS_DTPREL))
+                     outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
+                   else if (tls_type == (TLS_TLS | TLS_TPREL))
+                     outrel.r_info = ELF64_R_INFO (indx, R_PPC64_TPREL64);
+                   else if (indx == 0)
+                     outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
+                   else
+                     outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT);
+                   outrel.r_addend = rel->r_addend;
+                   if (indx == 0)
+                     outrel.r_addend += relocation;
+                   loc = htab->srelgot->contents;
+                   loc += (htab->srelgot->reloc_count++
+                           * sizeof (Elf64_External_Rela));
+                   bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+                 }
 
-               /* The offset must always be a multiple of 8.  We use
-                  the least significant bit to record whether we have
-                  already processed this entry.  */
-               if ((off & 1) != 0)
-                 off &= ~1;
+               /* Init the .got section contents if we're not
+                  emitting a reloc.  */
                else
                  {
-                   bfd_put_64 (output_bfd, relocation,
-                               htab->sgot->contents + off);
-
-                   if (info->shared)
+                   relocation += rel->r_addend;
+                   if (tls_type != 0)
                      {
-                       Elf_Internal_Rela outrel;
-                       bfd_byte *loc;
-
-                       /* We need to generate a R_PPC64_RELATIVE reloc
-                          for the dynamic linker.  */
-                       outrel.r_offset = (htab->sgot->output_section->vma
-                                          + htab->sgot->output_offset
-                                          + off);
-                       outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
-                       outrel.r_addend = relocation;
-                       loc = htab->srelgot->contents;
-                       loc += (htab->srelgot->reloc_count++
-                               * sizeof (Elf64_External_Rela));
-                       bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+                       relocation -= htab->tls_sec->vma + DTP_OFFSET;
+                       if ((tls_type & TLS_TPREL) != 0)
+                         relocation += DTP_OFFSET - TP_OFFSET;
                      }
 
-                   local_got_offsets[r_symndx] |= 1;
+                   if ((tls_type & TLS_GD) != 0)
+                     {
+                       bfd_put_64 (output_bfd, relocation,
+                                   htab->sgot->contents + off + 8);
+                       relocation = 1;
+                     }
+                   else if (tls_type == (TLS_TLS | TLS_LD))
+                     relocation = 1;
+                   bfd_put_64 (output_bfd, relocation,
+                               htab->sgot->contents + off);
                  }
              }
 
@@ -5673,7 +7696,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            relocation = htab->sgot->output_offset + off;
 
            /* TOC base (r2) is TOC start plus 0x8000.  */
-           addend -= TOC_BASE_OFF;
+           addend = - TOC_BASE_OFF;
          }
          break;
 
@@ -5690,19 +7713,23 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          if (h == NULL)
            break;
 
-         if (h->plt.offset == (bfd_vma) -1
-             || htab->splt == NULL)
+         /* It's possible that we didn't make a PLT entry for this
+            symbol.  This happens when statically linking PIC code,
+            or when using -Bsymbolic.  Go find a match if there is a
+            PLT entry.  */
+         if (htab->splt != NULL)
            {
-             /* We didn't make a PLT entry for this symbol.  This
-                happens when statically linking PIC code, or when
-                using -Bsymbolic.  */
-             break;
+             struct plt_entry *ent;
+             for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+               if (ent->addend == rel->r_addend
+                   && ent->plt.offset != (bfd_vma) -1)
+                 {
+                   relocation = (htab->splt->output_section->vma
+                                 + htab->splt->output_offset
+                                 + ent->plt.offset);
+                   unresolved_reloc = FALSE;
+                 }
            }
-
-         relocation = (htab->splt->output_section->vma
-                       + htab->splt->output_offset
-                       + h->plt.offset);
-         unresolved_reloc = FALSE;
          break;
 
          /* TOC16 relocs.  We want the offset relative to the TOC base,
@@ -5735,8 +7762,48 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_PPC64_REL24:
          break;
 
+       case R_PPC64_TPREL16:
+       case R_PPC64_TPREL16_LO:
+       case R_PPC64_TPREL16_HI:
+       case R_PPC64_TPREL16_HA:
+       case R_PPC64_TPREL16_DS:
+       case R_PPC64_TPREL16_LO_DS:
+       case R_PPC64_TPREL16_HIGHER:
+       case R_PPC64_TPREL16_HIGHERA:
+       case R_PPC64_TPREL16_HIGHEST:
+       case R_PPC64_TPREL16_HIGHESTA:
+         addend -= htab->tls_sec->vma + TP_OFFSET;
+         if (info->shared)
+           /* The TPREL16 relocs shouldn't really be used in shared
+              libs as they will result in DT_TEXTREL being set, but
+              support them anyway.  */
+           goto dodyn;
+         break;
+
+       case R_PPC64_DTPREL16:
+       case R_PPC64_DTPREL16_LO:
+       case R_PPC64_DTPREL16_HI:
+       case R_PPC64_DTPREL16_HA:
+       case R_PPC64_DTPREL16_DS:
+       case R_PPC64_DTPREL16_LO_DS:
+       case R_PPC64_DTPREL16_HIGHER:
+       case R_PPC64_DTPREL16_HIGHERA:
+       case R_PPC64_DTPREL16_HIGHEST:
+       case R_PPC64_DTPREL16_HIGHESTA:
+         addend -= htab->tls_sec->vma + DTP_OFFSET;
+         break;
+
+       case R_PPC64_TPREL64:
+         addend -= htab->tls_sec->vma + TP_OFFSET;
+         goto dodyn;
+
+       case R_PPC64_DTPREL64:
+         addend -= htab->tls_sec->vma + DTP_OFFSET;
+         /* Fall thru */
+
          /* Relocations that may need to be propagated if this is a
             dynamic object.  */
+       case R_PPC64_DTPMOD64:
        case R_PPC64_REL30:
        case R_PPC64_REL32:
        case R_PPC64_REL64:
@@ -5762,6 +7829,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          /* r_symndx will be zero only for relocs against symbols
             from removed linkonce sections, or sections discarded by
             a linker script.  */
+       dodyn:
          if (r_symndx == 0)
            break;
          /* Fall thru.  */
@@ -5774,22 +7842,19 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            break;
 
          if ((info->shared
-              && (IS_ABSOLUTE_RELOC (r_type)
+              && (MUST_BE_DYN_RELOC (r_type)
                   || (h != NULL
                       && h->dynindx != -1
                       && (! info->symbolic
                           || (h->elf_link_hash_flags
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))))
-             || (!info->shared
+             || (ELIMINATE_COPY_RELOCS
+                 && !info->shared
                  && h != NULL
                  && h->dynindx != -1
                  && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
-                 && (((h->elf_link_hash_flags
-                       & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-                      && (h->elf_link_hash_flags
-                          & ELF_LINK_HASH_DEF_REGULAR) == 0)
-                     || h->root.type == bfd_link_hash_undefweak
-                     || h->root.type == bfd_link_hash_undefined)))
+                 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+                 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0))
            {
              Elf_Internal_Rela outrel;
              bfd_boolean skip, relocate;
@@ -5812,14 +7877,14 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                skip = TRUE, relocate = TRUE;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
-             outrel.r_addend = addend;
+             outrel.r_addend = rel->r_addend;
 
              if (skip)
                memset (&outrel, 0, sizeof outrel);
              else if (h != NULL
                       && h->dynindx != -1
                       && !is_opd
-                      && (!IS_ABSOLUTE_RELOC (r_type)
+                      && (!MUST_BE_DYN_RELOC (r_type)
                           || !info->shared
                           || !info->symbolic
                           || (h->elf_link_hash_flags
@@ -5831,6 +7896,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                     or this is an opd section reloc which must point
                     at a local function.  */
                  outrel.r_addend += relocation;
+                 /* ??? why? */
                  relocate = TRUE;
                  if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
                    {
@@ -5902,7 +7968,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_PPC64_RELATIVE:
          /* We shouldn't ever see these dynamic relocs in relocatable
             files.  */
-         /* Fall thru */
+         /* Fall through.  */
 
        case R_PPC64_PLTGOT16:
        case R_PPC64_PLTGOT16_DS:
@@ -5938,6 +8004,20 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_PPC64_PLT16_HA:
        case R_PPC64_TOC16_HA:
        case R_PPC64_SECTOFF_HA:
+       case R_PPC64_TPREL16_HA:
+       case R_PPC64_DTPREL16_HA:
+       case R_PPC64_GOT_TLSGD16_HA:
+       case R_PPC64_GOT_TLSLD16_HA:
+       case R_PPC64_GOT_TPREL16_HA:
+       case R_PPC64_GOT_DTPREL16_HA:
+       case R_PPC64_TPREL16_HIGHER:
+       case R_PPC64_TPREL16_HIGHERA:
+       case R_PPC64_TPREL16_HIGHEST:
+       case R_PPC64_TPREL16_HIGHESTA:
+       case R_PPC64_DTPREL16_HIGHER:
+       case R_PPC64_DTPREL16_HIGHERA:
+       case R_PPC64_DTPREL16_HIGHEST:
+       case R_PPC64_DTPREL16_HIGHESTA:
          /* It's just possible that this symbol is a weak symbol
             that's not actually defined anywhere. In that case,
             'sec' would be NULL, and we should leave the symbol
@@ -5958,6 +8038,14 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_PPC64_TOC16_LO_DS:
        case R_PPC64_PLTGOT16_DS:
        case R_PPC64_PLTGOT16_LO_DS:
+       case R_PPC64_GOT_TPREL16_DS:
+       case R_PPC64_GOT_TPREL16_LO_DS:
+       case R_PPC64_GOT_DTPREL16_DS:
+       case R_PPC64_GOT_DTPREL16_LO_DS:
+       case R_PPC64_TPREL16_DS:
+       case R_PPC64_TPREL16_LO_DS:
+       case R_PPC64_DTPREL16_DS:
+       case R_PPC64_DTPREL16_LO_DS:
          if (((relocation + addend) & 3) != 0)
            {
              (*_bfd_error_handler)
@@ -5982,7 +8070,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        branch_check:
          /* If the branch is out of reach, then redirect the
             call to the local stub for this function.  */
-         from = (offset
+         from = (rel->r_offset
                  + input_section->output_offset
                  + input_section->output_section->vma);
          if (relocation + addend - from + max_br_offset >= 2 * max_br_offset
@@ -6019,17 +8107,20 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                                    input_bfd,
                                    input_section,
                                    contents,
-                                   offset,
+                                   rel->r_offset,
                                    relocation,
                                    addend);
 
       if (r != bfd_reloc_ok)
        {
-         const char *name;
-
-         if (h != NULL)
+         if (sym_name == NULL)
+           sym_name = "(null)";
+         if (r == bfd_reloc_overflow)
            {
-             if (h->root.type == bfd_link_hash_undefweak
+             if (warned)
+               continue;
+             if (h != NULL
+                 && h->root.type == bfd_link_hash_undefweak
                  && ppc64_elf_howto_table[(int) r_type]->pc_relative)
                {
                  /* Assume this is a call protected by other code that
@@ -6041,26 +8132,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  continue;
                }
 
-             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 (r == bfd_reloc_overflow)
-           {
-             if (warned)
-               continue;
              if (!((*info->callbacks->reloc_overflow)
-                   (info, name, ppc64_elf_howto_table[(int) r_type]->name,
-                    rel->r_addend, input_bfd, input_section, offset)))
+                   (info, sym_name, ppc64_elf_howto_table[(int) r_type]->name,
+                    rel->r_addend, input_bfd, input_section, rel->r_offset)))
                return FALSE;
            }
          else
@@ -6069,7 +8143,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                (_("%s(%s+0x%lx): reloc against `%s': error %d"),
                 bfd_archive_filename (input_bfd),
                 bfd_get_section_name (input_bfd, input_section),
-                (long) rel->r_offset, name, (int) r);
+                (long) rel->r_offset, sym_name, (int) r);
              ret = FALSE;
            }
        }
@@ -6094,79 +8168,36 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
   htab = ppc_hash_table (info);
   dynobj = htab->elf.dynobj;
 
-  if (h->plt.offset != (bfd_vma) -1
-      && ((struct ppc_link_hash_entry *) h)->is_func_descriptor)
-    {
-      Elf_Internal_Rela rela;
-      bfd_byte *loc;
-
-      /* This symbol has an entry in the procedure linkage table.  Set
-        it up.  */
-
-      if (htab->splt == NULL
-         || htab->srelplt == NULL
-         || htab->sglink == NULL)
-       abort ();
-
-      /* Create a JMP_SLOT reloc to inform the dynamic linker to
-        fill in the PLT entry.  */
-
-      rela.r_offset = (htab->splt->output_section->vma
-                      + htab->splt->output_offset
-                      + h->plt.offset);
-      rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
-      rela.r_addend = 0;
-
-      loc = htab->srelplt->contents;
-      loc += ((h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
-             * sizeof (Elf64_External_Rela));
-      bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
-    }
-
-  if (h->got.offset != (bfd_vma) -1)
+  if (((struct ppc_link_hash_entry *) h)->is_func_descriptor)
     {
+      struct plt_entry *ent;
       Elf_Internal_Rela rela;
       bfd_byte *loc;
 
-      /* This symbol has an entry in the global offset table.  Set it
-        up.  */
-
-      if (htab->sgot == NULL || htab->srelgot == NULL)
-       abort ();
+      for (ent = h->plt.plist; ent != NULL; ent = ent->next)
+       if (ent->plt.offset != (bfd_vma) -1)
+         {
+           /* This symbol has an entry in the procedure linkage
+              table.  Set it up.  */
 
-      rela.r_offset = (htab->sgot->output_section->vma
-                      + htab->sgot->output_offset
-                      + (h->got.offset &~ (bfd_vma) 1));
-
-      /* If this is a static link, or it is a -Bsymbolic link and the
-        symbol is defined locally or was forced to be local because
-        of a version file, we just want to emit a RELATIVE reloc.
-        The entry in the global offset table will already have been
-        initialized in the relocate_section function.  */
-      if (info->shared
-         && (info->symbolic
-             || h->dynindx == -1
-             || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
-       {
-         BFD_ASSERT((h->got.offset & 1) != 0);
-         rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
-         rela.r_addend = (h->root.u.def.value
-                          + h->root.u.def.section->output_section->vma
-                          + h->root.u.def.section->output_offset);
-       }
-      else
-       {
-         BFD_ASSERT ((h->got.offset & 1) == 0);
-         bfd_put_64 (output_bfd, (bfd_vma) 0,
-                     htab->sgot->contents + h->got.offset);
-         rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_GLOB_DAT);
-         rela.r_addend = 0;
-       }
+           if (htab->splt == NULL
+               || htab->srelplt == NULL
+               || htab->sglink == NULL)
+             abort ();
 
-      loc = htab->srelgot->contents;
-      loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
-      bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+           /* Create a JMP_SLOT reloc to inform the dynamic linker to
+              fill in the PLT entry.  */
+           rela.r_offset = (htab->splt->output_section->vma
+                            + htab->splt->output_offset
+                            + ent->plt.offset);
+           rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
+           rela.r_addend = ent->addend;
+
+           loc = htab->srelplt->contents;
+           loc += ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
+                   * sizeof (Elf64_External_Rela));
+           bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+         }
     }
 
   if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
index 3115ea5..4b80cc5 100644 (file)
@@ -1,5 +1,5 @@
 /* PowerPC64-specific support for 64-bit ELF.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -21,6 +21,10 @@ bfd_boolean ppc64_elf_mark_entry_syms
   PARAMS ((struct bfd_link_info *));
 bfd_boolean ppc64_elf_edit_opd
   PARAMS ((bfd *, struct bfd_link_info *));
+bfd_boolean ppc64_elf_tls_setup
+  PARAMS ((bfd *, struct bfd_link_info *));
+bfd_boolean ppc64_elf_tls_optimize
+  PARAMS ((bfd *, struct bfd_link_info *));
 bfd_vma ppc64_elf_toc
   PARAMS ((bfd *));
 int ppc64_elf_setup_section_lists
index 1c81edf..e3c7f22 100644 (file)
@@ -1,5 +1,5 @@
 /* IBM S/390-specific support for 64-bit ELF
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -373,7 +373,7 @@ elf_s390_info_to_howto (abfd, cache_ptr, dst)
 /* A relocation function which doesn't do anything.  */
 static bfd_reloc_status_type
 s390_tls_reloc (abfd, reloc_entry, symbol, data, input_section,
-                      output_bfd, error_message)
+               output_bfd, error_message)
      bfd *abfd ATTRIBUTE_UNUSED;
      arelent *reloc_entry;
      asymbol *symbol ATTRIBUTE_UNUSED;
@@ -986,7 +986,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
          /* Fall through */
 
        case R_390_GOT12:
-        case R_390_GOT16:
+       case R_390_GOT16:
        case R_390_GOT32:
        case R_390_GOT64:
        case R_390_GOTENT:
@@ -1292,9 +1292,6 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  int r_type;
-  struct elf_link_hash_entry *h;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
@@ -1305,16 +1302,31 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
     {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
+
       r_symndx = ELF64_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct elf_s390_link_hash_entry *eh;
+         struct elf_s390_dyn_relocs **pp;
+         struct elf_s390_dyn_relocs *p;
 
-      if (r_symndx < symtab_hdr->sh_info)
-       h = NULL;
-      else
-       h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct elf_s390_link_hash_entry *) h;
 
-      r_type = elf_s390_tls_transition (info,
-                                       ELF64_R_TYPE (rel->r_info),
-                                       r_symndx >= symtab_hdr->sh_info);
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
+
+      r_type = ELF64_R_TYPE (rel->r_info);
+      r_type = elf_s390_tls_transition (info, r_type, h != NULL);
       switch (r_type)
        {
        case R_390_TLS_LDM64:
@@ -1347,14 +1359,7 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
              if (local_got_refcounts[r_symndx] > 0)
                local_got_refcounts[r_symndx] -= 1;
            }
-         if (r_type != R_390_TLS_IE64)
-           break;
-         /* Fall through */
-         
-       case R_390_TLS_LE64:
-         if (!info->shared)
-           break;
-         /* Fall through */
+         break;
 
        case R_390_8:
        case R_390_12:
@@ -1366,33 +1371,9 @@ elf_s390_gc_sweep_hook (abfd, info, sec, relocs)
        case R_390_PC32:
        case R_390_PC32DBL:
        case R_390_PC64:
-         if (h != NULL)
-           {
-             struct elf_s390_link_hash_entry *eh;
-             struct elf_s390_dyn_relocs **pp;
-             struct elf_s390_dyn_relocs *p;
-             
-             if (!info->shared && h->plt.refcount > 0)
-               h->plt.refcount -= 1;
-             
-             eh = (struct elf_s390_link_hash_entry *) h;
-             
-             for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-               if (p->sec == sec)
-                 {
-                   if (ELF64_R_TYPE (rel->r_info) == R_390_PC16
-                       || ELF64_R_TYPE (rel->r_info) == R_390_PC16DBL
-                       || ELF64_R_TYPE (rel->r_info) == R_390_PC32
-                       || ELF64_R_TYPE (rel->r_info) == R_390_PC32DBL
-                       || ELF64_R_TYPE (rel->r_info) == R_390_PC64)
-                     p->pc_count -= 1;
-                   p->count -= 1;
-                   if (p->count == 0)
-                     *pp = p->next;
-                   break;
-                 }
-           }
-         break;
+         if (info->shared)
+           break;
+         /* Fall through */
 
        case R_390_PLT16DBL:
        case R_390_PLT32:
@@ -2226,7 +2207,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
@@ -2266,14 +2246,14 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                 Current offset - size first entry / entry size.  */
              plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) /
                PLT_ENTRY_SIZE;
-             
+
              /* Offset in GOT is PLT index plus GOT headers(3) times 4,
                 addr & GOT addr.  */
              relocation = (plt_index + 3) * GOT_ENTRY_SIZE;
              unresolved_reloc = FALSE;
 
              if (r_type == R_390_GOTPLTENT)
-               relocation += htab->sgot->output_section->vma;      
+               relocation += htab->sgot->output_section->vma;
              break;
            }
          /* Fall through.  */
@@ -2371,12 +2351,10 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 
          relocation = htab->sgot->output_offset + off;
 
-         /*
-          * For @GOTENT the relocation is against the offset between
-          * the instruction and the symbols entry in the GOT and not
-          * between the start of the GOT and the symbols entry. We
-          * add the vma of the GOT to get the correct value.
-          */
+         /* For @GOTENT the relocation is against the offset between
+            the instruction and the symbols entry in the GOT and not
+            between the start of the GOT and the symbols entry. We
+            add the vma of the GOT to get the correct value.  */
          if (   r_type == R_390_GOTENT
              || r_type == R_390_GOTPLTENT)
            relocation += htab->sgot->output_section->vma;
@@ -2429,17 +2407,17 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
                        + htab->splt->output_offset
                        + h->plt.offset);
          unresolved_reloc = FALSE;
-          break;
+         break;
 
        case R_390_PLTOFF16:
        case R_390_PLTOFF32:
        case R_390_PLTOFF64:
-          /* Relocation is to the entry for this symbol in the
-             procedure linkage table relative to the start of the GOT.  */
+         /* Relocation is to the entry for this symbol in the
+            procedure linkage table relative to the start of the GOT.  */
 
          /* For local symbols or if we didn't make a PLT entry for
             this symbol resolve the symbol directly.  */
-          if (   h == NULL
+         if (   h == NULL
              || h->plt.offset == (bfd_vma) -1
              || htab->splt == NULL)
            {
@@ -2447,9 +2425,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              break;
            }
 
-          relocation = (htab->splt->output_section->vma
-                        + htab->splt->output_offset
-                        + h->plt.offset
+         relocation = (htab->splt->output_section->vma
+                       + htab->splt->output_offset
+                       + h->plt.offset
                        - htab->sgot->output_section->vma);
          unresolved_reloc = FALSE;
          break;
@@ -2500,7 +2478,6 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              /* When generating a shared object, these relocations
                 are copied into the output file to be resolved at run
                 time.  */
-
              skip = FALSE;
              relocate = FALSE;
 
@@ -2577,7 +2554,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
              bfd_elf64_swap_reloc_out (output_bfd, &outrel, loc);
            }
-         /* Fall through */
+         /* Fall through */
 
        case R_390_TLS_GD64:
        case R_390_TLS_GOTIE64:
@@ -2621,7 +2598,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
 
          if ((off & 1) != 0)
            off &= ~1;
-          else
+         else
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
@@ -2756,7 +2733,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
              htab->tls_ldm_got.offset |= 1;
            }
          relocation = htab->sgot->output_offset + off;
-         unresolved_reloc = FALSE;       
+         unresolved_reloc = FALSE;
          break;
 
        case R_390_TLS_LE64:
@@ -3067,7 +3044,6 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
 
       /* This symbol has an entry in the global offset table.  Set it
         up.  */
-
       if (htab->sgot == NULL || htab->srelgot == NULL)
        abort ();
 
@@ -3278,11 +3254,9 @@ elf_s390_finish_dynamic_sections (output_bfd, info)
   return TRUE;
 }
 
-/*
- * Why was the hash table entry size definition changed from
- * ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
- * this is the only reason for the s390_elf64_size_info structure.
- */
+/* Why was the hash table entry size definition changed from
+   ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
+   this is the only reason for the s390_elf64_size_info structure.  */
 
 const struct elf_size_info s390_elf64_size_info =
 {
@@ -3294,10 +3268,10 @@ const struct elf_size_info s390_elf64_size_info =
   sizeof (Elf64_External_Sym),
   sizeof (Elf64_External_Dyn),
   sizeof (Elf_External_Note),
-  8,           /* hash-table entry size */
-  1,           /* internal relocations per external relocations */
-  64,          /* arch_size */
-  8,           /* file_align */
+  8,           /* hash-table entry size */
+  1,           /* internal relocations per external relocations */
+  64,          /* arch_size */
+  8,           /* file_align */
   ELFCLASS64, EV_CURRENT,
   bfd_elf64_write_out_phdrs,
   bfd_elf64_write_shdrs_and_ehdr,
index 7164be2..e4f04b5 100644 (file)
@@ -2,21 +2,21 @@
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    2003 Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -1925,7 +1925,7 @@ struct sparc64_elf_section_data
 };
 
 #define sec_do_relax(sec) \
-  ((struct sparc64_elf_section_data *) (sec)->used_by_bfd)->do_relax
+  ((struct sparc64_elf_section_data *) elf_section_data (sec))->do_relax
 
 static bfd_boolean
 sparc64_elf_new_section_hook (abfd, sec)
@@ -2067,7 +2067,6 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            ;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            ;
@@ -2083,7 +2082,6 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
              /* To avoid generating warning messages about truncated
                 relocations, set the relocation's address to be the same as
                 the start of this section.  */
-
              if (input_section->output_section != NULL)
                relocation = input_section->output_section->vma;
              else
@@ -2615,7 +2613,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                    }
                }
            }
-         /* FALLTHROUGH */
+         /* Fall through.  */
 
        default:
        do_default:
@@ -2820,7 +2818,6 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
       bfd_byte *loc;
 
       /* This symbols needs a copy reloc.  Set it up.  */
-
       BFD_ASSERT (h->dynindx != -1);
 
       s = bfd_get_section_by_name (h->root.u.def.section->owner,
@@ -2923,10 +2920,8 @@ sparc64_elf_finish_dynamic_sections (output_bfd, info)
 
       /* Initialize the contents of the .plt section.  */
       if (splt->_raw_size > 0)
-       {
-         sparc64_elf_build_plt (output_bfd, splt->contents,
-                                (int) (splt->_raw_size / PLT_ENTRY_SIZE));
-       }
+       sparc64_elf_build_plt (output_bfd, splt->contents,
+                              (int) (splt->_raw_size / PLT_ENTRY_SIZE));
 
       elf_section_data (splt->output_section)->this_hdr.sh_entsize =
        PLT_ENTRY_SIZE;
@@ -3137,14 +3132,14 @@ const struct elf_size_info sparc64_elf_size_info =
   sizeof (Elf64_External_Sym),
   sizeof (Elf64_External_Dyn),
   sizeof (Elf_External_Note),
-  4,           /* hash-table entry size */
-  /* internal relocations per external relocations.
+  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 */
+  64,          /* arch_size */
+  8,           /* file_align */
   ELFCLASS64,
   EV_CURRENT,
   bfd_elf64_write_out_phdrs,
index a3c36ff..f13b4d2 100644 (file)
@@ -1,22 +1,22 @@
 /* X86-64 specific support for 64-bit ELF
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Jan Hubicka <jh@suse.cz>.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -1091,9 +1091,6 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs)
   struct elf_link_hash_entry **sym_hashes;
   bfd_signed_vma *local_got_refcounts;
   const Elf_Internal_Rela *rel, *relend;
-  unsigned long r_symndx;
-  int r_type;
-  struct elf_link_hash_entry *h;
 
   elf_section_data (sec)->local_dynrel = NULL;
 
@@ -1103,85 +1100,79 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs)
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
-    switch ((r_type = elf64_x86_64_tls_transition (info,
-                                                  ELF64_R_TYPE (rel->r_info),
-                                                  ELF64_R_SYM (rel->r_info)
-                                                  >= symtab_hdr->sh_info)))
-      {
-      case R_X86_64_TLSLD:
-       if (elf64_x86_64_hash_table (info)->tls_ld_got.refcount > 0)
-         elf64_x86_64_hash_table (info)->tls_ld_got.refcount -= 1;
-       break;
-
-      case R_X86_64_TLSGD:
-      case R_X86_64_GOTTPOFF:
-      case R_X86_64_GOT32:
-      case R_X86_64_GOTPCREL:
-       r_symndx = ELF64_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->got.refcount > 0)
-             h->got.refcount -= 1;
-         }
-       else if (local_got_refcounts != NULL)
-         {
-           if (local_got_refcounts[r_symndx] > 0)
-             local_got_refcounts[r_symndx] -= 1;
-         }
-       break;
+    {
+      unsigned long r_symndx;
+      unsigned int r_type;
+      struct elf_link_hash_entry *h = NULL;
 
-      case R_X86_64_8:
-      case R_X86_64_16:
-      case R_X86_64_32:
-      case R_X86_64_64:
-      case R_X86_64_32S:
-      case R_X86_64_PC8:
-      case R_X86_64_PC16:
-      case R_X86_64_PC32:
-       r_symndx = ELF64_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           struct elf64_x86_64_link_hash_entry *eh;
-           struct elf64_x86_64_dyn_relocs **pp;
-           struct elf64_x86_64_dyn_relocs *p;
+      r_symndx = ELF64_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         struct elf64_x86_64_link_hash_entry *eh;
+         struct elf64_x86_64_dyn_relocs **pp;
+         struct elf64_x86_64_dyn_relocs *p;
 
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         eh = (struct elf64_x86_64_link_hash_entry *) h;
 
-           if (!info->shared && h->plt.refcount > 0)
-             h->plt.refcount -= 1;
+         for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
+           if (p->sec == sec)
+             {
+               /* Everything must go for SEC.  */
+               *pp = p->next;
+               break;
+             }
+       }
 
-           eh = (struct elf64_x86_64_link_hash_entry *) h;
+      r_type = ELF64_R_TYPE (rel->r_info);
+      r_type = elf64_x86_64_tls_transition (info, r_type, h != NULL);
+      switch (r_type)
+       {
+       case R_X86_64_TLSLD:
+         if (elf64_x86_64_hash_table (info)->tls_ld_got.refcount > 0)
+           elf64_x86_64_hash_table (info)->tls_ld_got.refcount -= 1;
+         break;
 
-           for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
-             if (p->sec == sec)
-               {
-                 if (ELF64_R_TYPE (rel->r_info) == R_X86_64_PC8
-                     || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC16
-                     || ELF64_R_TYPE (rel->r_info) == R_X86_64_PC32)
-                   p->pc_count -= 1;
-                 p->count -= 1;
-                 if (p->count == 0)
-                   *pp = p->next;
-                 break;
-               }
-         }
-       break;
+       case R_X86_64_TLSGD:
+       case R_X86_64_GOTTPOFF:
+       case R_X86_64_GOT32:
+       case R_X86_64_GOTPCREL:
+         if (h != NULL)
+           {
+             if (h->got.refcount > 0)
+               h->got.refcount -= 1;
+           }
+         else if (local_got_refcounts != NULL)
+           {
+             if (local_got_refcounts[r_symndx] > 0)
+               local_got_refcounts[r_symndx] -= 1;
+           }
+         break;
 
+       case R_X86_64_8:
+       case R_X86_64_16:
+       case R_X86_64_32:
+       case R_X86_64_64:
+       case R_X86_64_32S:
+       case R_X86_64_PC8:
+       case R_X86_64_PC16:
+       case R_X86_64_PC32:
+         if (info->shared)
+           break;
+         /* Fall thru */
 
-      case R_X86_64_PLT32:
-       r_symndx = ELF64_R_SYM (rel->r_info);
-       if (r_symndx >= symtab_hdr->sh_info)
-         {
-           h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-           if (h->plt.refcount > 0)
-             h->plt.refcount -= 1;
-         }
-       break;
+       case R_X86_64_PLT32:
+         if (h != NULL)
+           {
+             if (h->plt.refcount > 0)
+               h->plt.refcount -= 1;
+           }
+         break;
 
-      default:
-       break;
-      }
+       default:
+         break;
+       }
+    }
 
   return TRUE;
 }
@@ -1921,7 +1912,6 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
@@ -2106,7 +2096,6 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
              /* When generating a shared object, these relocations
                 are copied into the output file to be resolved at run
                 time.  */
-
              skip = FALSE;
              relocate = FALSE;
 
@@ -2330,7 +2319,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
 
          if ((off & 1) != 0)
            off &= ~1;
-          else
+         else
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
@@ -2408,12 +2397,12 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
                 addq foo@gottpoff(%rip), %rax */
              BFD_ASSERT (rel->r_offset >= 4);
              for (i = 0; i < 4; i++)
-               BFD_ASSERT (bfd_get_8 (input_bfd,
+               BFD_ASSERT (bfd_get_8 (input_bfd,
                                       contents + rel->r_offset - 4 + i)
                            == tlsgd[i]);
              BFD_ASSERT (rel->r_offset + 12 <= input_section->_raw_size);
              for (i = 0; i < 4; i++)
-               BFD_ASSERT (bfd_get_8 (input_bfd,
+               BFD_ASSERT (bfd_get_8 (input_bfd,
                                       contents + rel->r_offset + 4 + i)
                            == tlsgd[i+4]);
              BFD_ASSERT (rel + 1 < relend);
@@ -2592,7 +2581,6 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
 
       /* This symbol has an entry in the procedure linkage table.  Set
         it up.  */
-
       if (h->dynindx == -1
          || htab->splt == NULL
          || htab->sgotplt == NULL
@@ -2671,7 +2659,6 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
 
       /* This symbol has an entry in the global offset table.  Set it
         up.  */
-
       if (htab->sgot == NULL || htab->srelgot == NULL)
        abort ();
 
index 4f9fcf7..724d607 100644 (file)
@@ -1,22 +1,22 @@
 /* ELF core file support for BFD.
-   Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002
+   Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 char*
 elf_core_file_failing_command (abfd)
@@ -48,11 +48,11 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
     }
 
   /* See if the name in the corefile matches the executable name.  */
-
   corename = elf_tdata (core_bfd)->core_program;
   if (corename != NULL)
     {
       const char* execname = strrchr (exec_bfd->filename, '/');
+
       execname = execname ? execname + 1 : exec_bfd->filename;
 
       if (strcmp(execname, corename) != 0)
@@ -71,17 +71,15 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
     register set) and the floating point register set are stored in a
     segment of type PT_NOTE.  We handcraft a couple of extra bfd sections
     that allow standard bfd access to the general registers (.reg) and the
-    floating point registers (.reg2).
-
- */
+    floating point registers (.reg2).  */
 
 const bfd_target *
 elf_core_file_p (abfd)
      bfd *abfd;
 {
-  Elf_External_Ehdr x_ehdr;    /* Elf file header, external form */
-  Elf_Internal_Ehdr *i_ehdrp;  /* Elf file header, internal form */
-  Elf_Internal_Phdr *i_phdrp;  /* Elf program header, internal form */
+  Elf_External_Ehdr x_ehdr;    /* Elf file header, external form */
+  Elf_Internal_Ehdr *i_ehdrp;  /* Elf file header, internal form */
+  Elf_Internal_Phdr *i_phdrp;  /* Elf program header, internal form */
   unsigned int phindex;
   struct elf_backend_data *ebd;
   struct bfd_preserve preserve;
@@ -103,7 +101,7 @@ elf_core_file_p (abfd)
   if (! elf_file_p (&x_ehdr))
     goto wrong;
 
-  /* FIXME: Check EI_VERSION here ! */
+  /* FIXME: Check EI_VERSION here !  */
 
   /* Check the address size ("class").  */
   if (x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
@@ -112,11 +110,11 @@ elf_core_file_p (abfd)
   /* Check the byteorder.  */
   switch (x_ehdr.e_ident[EI_DATA])
     {
-    case ELFDATA2MSB:          /* Big-endian */
+    case ELFDATA2MSB:          /* Big-endian */
       if (! bfd_big_endian (abfd))
        goto wrong;
       break;
-    case ELFDATA2LSB:          /* Little-endian */
+    case ELFDATA2LSB:          /* Little-endian */
       if (! bfd_little_endian (abfd))
        goto wrong;
       break;
@@ -168,7 +166,11 @@ elf_core_file_p (abfd)
          if ((*target_ptr)->flavour != bfd_target_elf_flavour)
            continue;
          back = (struct elf_backend_data *) (*target_ptr)->backend_data;
-         if (back->elf_machine_code == i_ehdrp->e_machine)
+         if (back->elf_machine_code == i_ehdrp->e_machine
+             || (back->elf_machine_alt1 != 0
+                 && i_ehdrp->e_machine == back->elf_machine_alt1)
+             || (back->elf_machine_alt2 != 0
+                 && i_ehdrp->e_machine == back->elf_machine_alt2))
            {
              /* target_ptr is an ELF backend which matches this
                 object file, so reject the generic ELF target.  */
@@ -203,6 +205,7 @@ elf_core_file_p (abfd)
   for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
     {
       Elf_External_Phdr x_phdr;
+
       if (bfd_bread ((PTR) &x_phdr, (bfd_size_type) sizeof (x_phdr), abfd)
          != sizeof (x_phdr))
        goto fail;
@@ -222,21 +225,17 @@ elf_core_file_p (abfd)
 
   /* Process each program header.  */
   for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
-    {
-      if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
-       goto fail;
-    }
+    if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
+      goto fail;
 
   /* Save the entry point from the ELF header.  */
   bfd_get_start_address (abfd) = i_ehdrp->e_entry;
 
   /* Let the backend double check the format and override global
      information.  */
-  if (ebd->elf_backend_object_p)
-    {
-      if (! (*ebd->elf_backend_object_p) (abfd))
-       goto wrong;
-    }
+  if (ebd->elf_backend_object_p
+      && (! (*ebd->elf_backend_object_p) (abfd)))
+    goto wrong;
 
   bfd_preserve_finish (abfd, &preserve);
   return abfd->xvec;
index 3170035..962c104 100644 (file)
@@ -1,5 +1,5 @@
 /* ELF linking support for BFD.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -31,14 +31,15 @@ _bfd_elf_create_got_section (abfd, info)
      struct bfd_link_info *info;
 {
   flagword flags;
-  register asection *s;
+  asection *s;
   struct elf_link_hash_entry *h;
   struct bfd_link_hash_entry *bh;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
   int ptralign;
 
   /* This function may be called more than once.  */
-  if (bfd_get_section_by_name (abfd, ".got") != NULL)
+  s = bfd_get_section_by_name (abfd, ".got");
+  if (s != NULL && (s->flags & SEC_LINKER_CREATED) != 0)
     return TRUE;
 
   switch (bed->s->arch_size)
@@ -111,7 +112,7 @@ _bfd_elf_create_dynamic_sections (abfd, info)
      struct bfd_link_info *info;
 {
   flagword flags, pltflags;
-  register asection *s;
+  asection *s;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
   int ptralign;
 
@@ -272,7 +273,7 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
        }
 
       /* We don't put any version information in the dynamic string
-         table.  */
+        table.  */
       name = h->root.root.string;
       p = strchr (name, ELF_VER_CHR);
       if (p == NULL)
@@ -525,18 +526,19 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
 
       s->_raw_size = align_power (s->_raw_size, lsect->alignment);
 
-      /* Is there a hole we have to provide?  If so check whether the segment is
-        too big already */
+      /* Is there a hole we have to provide?  If so check whether the
+        segment is too big already */
       if (lsect->hole_size)
        {
          lsect->hole_offset = s->_raw_size;
          s->_raw_size += lsect->hole_size;
          if (lsect->hole_offset > lsect->max_hole_offset)
            {
-             (*_bfd_error_handler) (_("%s: Section %s is too large to add hole of %ld bytes"),
-                                    bfd_get_filename (abfd),
-                                    lsect->name,
-                                    (long) lsect->hole_size);
+             (*_bfd_error_handler)
+               (_("%s: Section %s is too large to add hole of %ld bytes"),
+                bfd_get_filename (abfd),
+                lsect->name,
+                (long) lsect->hole_size);
 
              bfd_set_error (bfd_error_bad_value);
              return (elf_linker_section_t *)0;
index 060b129..7d2d2e2 100644 (file)
@@ -1,22 +1,22 @@
 /* ELF linker support.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* ELF linker code.  */
 
@@ -1168,6 +1168,8 @@ elf_link_add_object_symbols (abfd, info)
   Elf_External_Versym *extversym = NULL;
   Elf_External_Versym *ever;
   struct elf_link_hash_entry *weaks;
+  struct elf_link_hash_entry **nondeflt_vers = NULL;
+  bfd_size_type nondeflt_vers_cnt = 0;
   Elf_Internal_Sym *isymbuf = NULL;
   Elf_Internal_Sym *isym;
   Elf_Internal_Sym *isymend;
@@ -1304,7 +1306,7 @@ elf_link_add_object_symbols (abfd, info)
         Test for --just-symbols by looking at info set up by
         _bfd_elf_link_just_syms.  */
       if ((s = abfd->sections) != NULL
-         && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+         && s->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
        goto error_return;
 
       /* Find the name to use in a DT_NEEDED entry that refers to this
@@ -1997,6 +1999,23 @@ elf_link_add_object_symbols (abfd, info)
                                          override, dt_needed))
              goto error_free_vers;
 
+         if (definition && (abfd->flags & DYNAMIC) == 0)
+           {
+             char *p = strchr (name, ELF_VER_CHR);
+             if (p != NULL && p[1] != ELF_VER_CHR)
+               {
+                 /* Queue non-default versions so that .symver x, x@FOO
+                    aliases can be checked.  */
+                 if (! nondeflt_vers)
+                   {
+                     amt = (isymend - isym + 1)
+                           * sizeof (struct elf_link_hash_entry *);
+                     nondeflt_vers = bfd_malloc (amt);
+                   }
+                 nondeflt_vers [nondeflt_vers_cnt++] = h;
+               }
+           }
+
          if (dynsym && h->dynindx == -1)
            {
              if (! _bfd_elf_link_record_dynamic_symbol (info, h))
@@ -2071,6 +2090,55 @@ elf_link_add_object_symbols (abfd, info)
        }
     }
 
+  /* Now that all the symbols from this input file are created, handle
+     .symver foo, foo@BAR such that any relocs against foo become foo@BAR.  */
+  if (nondeflt_vers != NULL)
+    {
+      bfd_size_type cnt, symidx;
+
+      for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt)
+       {
+         struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi;
+         char *shortname, *p;
+
+         p = strchr (h->root.root.string, ELF_VER_CHR);
+         if (p == NULL
+             || (h->root.type != bfd_link_hash_defined
+                 && h->root.type != bfd_link_hash_defweak))
+           continue;
+
+         amt = p - h->root.root.string;
+         shortname = bfd_malloc (amt + 1);
+         memcpy (shortname, h->root.root.string, amt);
+         shortname[amt] = '\0';
+
+         hi = (struct elf_link_hash_entry *)
+              bfd_link_hash_lookup (info->hash, shortname,
+                                    FALSE, FALSE, FALSE);
+         if (hi != NULL
+             && hi->root.type == h->root.type
+             && hi->root.u.def.value == h->root.u.def.value
+             && hi->root.u.def.section == h->root.u.def.section)
+           {
+             (*bed->elf_backend_hide_symbol) (info, hi, TRUE);
+             hi->root.type = bfd_link_hash_indirect;
+             hi->root.u.i.link = (struct bfd_link_hash_entry *) h;
+             (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi);
+             sym_hash = elf_sym_hashes (abfd);
+             if (sym_hash)
+               for (symidx = 0; symidx < extsymcount; ++symidx)
+                 if (sym_hash[symidx] == hi)
+                   {
+                     sym_hash[symidx] = h;
+                     break;
+                   }
+           }
+         free (shortname);
+       }
+      free (nondeflt_vers);
+      nondeflt_vers = NULL;
+    }
+
   if (extversym != NULL)
     {
       free (extversym);
@@ -2234,7 +2302,7 @@ elf_link_add_object_symbols (abfd, info)
                                             &secdata->sec_info))
                goto error_return;
              if (secdata->sec_info)
-               secdata->sec_info_type = ELF_INFO_TYPE_STABS;
+               stab->sec_info_type = ELF_INFO_TYPE_STABS;
            }
        }
     }
@@ -2256,7 +2324,7 @@ elf_link_add_object_symbols (abfd, info)
                                      s, &secdata->sec_info))
              goto error_return;
            else if (secdata->sec_info)
-             secdata->sec_info_type = ELF_INFO_TYPE_MERGE;
+             s->sec_info_type = ELF_INFO_TYPE_MERGE;
          }
     }
 
@@ -2277,6 +2345,8 @@ elf_link_add_object_symbols (abfd, info)
   return TRUE;
 
  error_free_vers:
+  if (nondeflt_vers != NULL)
+    free (nondeflt_vers);
   if (extversym != NULL)
     free (extversym);
  error_free_sym:
@@ -2509,7 +2579,10 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
   else if (shdr->sh_entsize == sizeof (Elf_External_Rela))
     swap_in = bed->s->swap_reloca_in;
   else
-    abort ();
+    {
+      bfd_set_error (bfd_error_wrong_format);
+      return FALSE;
+    }
 
   erela = external_relocs;
   erelaend = erela + NUM_SHDR_ENTRIES (shdr) * shdr->sh_entsize;
@@ -2902,7 +2975,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
 
   /* Any syms created from now on start with -1 in
      got.refcount/offset and plt.refcount/offset.  */
-  elf_hash_table (info)->init_refcount = -1;
+  elf_hash_table (info)->init_refcount = elf_hash_table (info)->init_offset;
 
   /* The backend may have to create some sections regardless of whether
      we're dynamic or not.  */
@@ -3909,10 +3982,13 @@ elf_adjust_dynamic_symbol (h, data)
   bfd *dynobj;
   struct elf_backend_data *bed;
 
+  if (! is_elf_hash_table (eif->info))
+    return FALSE;
+
   if (h->root.type == bfd_link_hash_warning)
     {
-      h->plt.offset = (bfd_vma) -1;
-      h->got.offset = (bfd_vma) -1;
+      h->plt = elf_hash_table (eif->info)->init_offset;
+      h->got = elf_hash_table (eif->info)->init_offset;
 
       /* When warning symbols are created, they **replace** the "real"
         entry in the hash table, thus we never get to see the real
@@ -3924,9 +4000,6 @@ elf_adjust_dynamic_symbol (h, data)
   if (h->root.type == bfd_link_hash_indirect)
     return TRUE;
 
-  if (! is_elf_hash_table (eif->info))
-    return FALSE;
-
   /* Fix the symbol flags.  */
   if (! elf_fix_symbol_flags (h, eif))
     return FALSE;
@@ -3944,7 +4017,7 @@ elf_adjust_dynamic_symbol (h, data)
          || ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
              && (h->weakdef == NULL || h->weakdef->dynindx == -1))))
     {
-      h->plt.offset = (bfd_vma) -1;
+      h->plt = elf_hash_table (eif->info)->init_offset;
       return TRUE;
     }
 
@@ -4878,18 +4951,24 @@ elf_bfd_final_link (abfd, info)
   merged = FALSE;
   for (o = abfd->sections; o != (asection *) NULL; o = o->next)
     {
+      struct bfd_elf_section_data *esdo = elf_section_data (o);
       o->reloc_count = 0;
 
       for (p = o->link_order_head; p != NULL; p = p->next)
        {
+         unsigned int reloc_count = 0;
+         struct bfd_elf_section_data *esdi = NULL;
+         unsigned int *rel_count1;
+
          if (p->type == bfd_section_reloc_link_order
              || p->type == bfd_symbol_reloc_link_order)
-           ++o->reloc_count;
+           reloc_count = 1;
          else if (p->type == bfd_indirect_link_order)
            {
              asection *sec;
 
              sec = p->u.indirect.section;
+             esdi = elf_section_data (sec);
 
              /* Mark all sections which are to be included in the
                 link.  This will normally be every section.  We need
@@ -4901,7 +4980,7 @@ elf_bfd_final_link (abfd, info)
                merged = TRUE;
 
              if (info->relocateable || info->emitrelocations)
-               o->reloc_count += sec->reloc_count;
+               reloc_count = sec->reloc_count;
              else if (bed->elf_backend_count_relocs)
                {
                  Elf_Internal_Rela * relocs;
@@ -4910,8 +4989,7 @@ elf_bfd_final_link (abfd, info)
                            (abfd, sec, (PTR) NULL,
                             (Elf_Internal_Rela *) NULL, info->keep_memory));
 
-                 o->reloc_count
-                   += (*bed->elf_backend_count_relocs) (sec, relocs);
+                 reloc_count = (*bed->elf_backend_count_relocs) (sec, relocs);
 
                  if (elf_section_data (o)->relocs != relocs)
                    free (relocs);
@@ -4954,6 +5032,56 @@ elf_bfd_final_link (abfd, info)
                    }
                }
            }
+
+         if (reloc_count == 0)
+           continue;
+
+         o->reloc_count += reloc_count;
+
+         /* MIPS may have a mix of REL and RELA relocs on sections.
+            To support this curious ABI we keep reloc counts in
+            elf_section_data too.  We must be careful to add the
+            relocations from the input section to the right output
+            count.  FIXME: Get rid of one count.  We have
+            o->reloc_count == esdo->rel_count + esdo->rel_count2.  */
+         rel_count1 = &esdo->rel_count;
+         if (esdi != NULL)
+           {
+             bfd_boolean same_size;
+             bfd_size_type entsize1;
+
+             entsize1 = esdi->rel_hdr.sh_entsize;
+             BFD_ASSERT (entsize1 == sizeof (Elf_External_Rel)
+                         || entsize1 == sizeof (Elf_External_Rela));
+             same_size = (!o->use_rela_p
+                          == (entsize1 == sizeof (Elf_External_Rel)));
+
+             if (!same_size)
+               rel_count1 = &esdo->rel_count2;
+
+             if (esdi->rel_hdr2 != NULL)
+               {
+                 bfd_size_type entsize2 = esdi->rel_hdr2->sh_entsize;
+                 unsigned int alt_count;
+                 unsigned int *rel_count2;
+
+                 BFD_ASSERT (entsize2 != entsize1
+                             && (entsize2 == sizeof (Elf_External_Rel)
+                                 || entsize2 == sizeof (Elf_External_Rela)));
+
+                 rel_count2 = &esdo->rel_count2;
+                 if (!same_size)
+                   rel_count2 = &esdo->rel_count;
+
+                 /* The following is probably too simplistic if the
+                    backend counts output relocs unusually.  */
+                 BFD_ASSERT (bed->elf_backend_count_relocs == NULL);
+                 alt_count = NUM_SHDR_ENTRIES (esdi->rel_hdr2);
+                 *rel_count2 += alt_count;
+                 reloc_count -= alt_count;
+               }
+           }
+         *rel_count1 += reloc_count;
        }
 
       if (o->reloc_count > 0)
@@ -4987,63 +5115,6 @@ elf_bfd_final_link (abfd, info)
   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 (emit_relocs)
-    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;
-             bfd_size_type entsize;
-             bfd_size_type entsize2;
-
-             /* We must be careful to add the relocations from the
-                input section to the right output count.  */
-             entsize = esdi->rel_hdr.sh_entsize;
-             entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0;
-             BFD_ASSERT ((entsize == sizeof (Elf_External_Rel)
-                          || entsize == sizeof (Elf_External_Rela))
-                         && entsize2 != entsize
-                         && (entsize2 == 0
-                             || entsize2 == sizeof (Elf_External_Rel)
-                             || entsize2 == sizeof (Elf_External_Rela)));
-             if (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 += NUM_SHDR_ENTRIES (& esdi->rel_hdr);
-             if (esdi->rel_hdr2)
-               *rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2);
-             output_section->flags |= SEC_RELOC;
-           }
-       }
-
   /* 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)
@@ -5916,7 +5987,7 @@ elf_link_sec_merge_syms (h, data)
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
       && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
-      && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
+      && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
     {
       bfd *output_bfd = (bfd *) data;
 
@@ -6096,8 +6167,7 @@ elf_link_output_extsym (h, data)
      referenced by regular files, because we will already have issued
      warnings for them.  */
   if (! finfo->info->relocateable
-      && ! finfo->info->allow_shlib_undefined
-      && ! finfo->info->shared
+      && (! finfo->info->shared || ! finfo->info->allow_shlib_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
@@ -6522,7 +6592,7 @@ elf_link_input_bfd (finfo, input_bfd)
        {
          isec = section_from_elf_index (input_bfd, isym->st_shndx);
          if (isec
-             && elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
+             && isec->sec_info_type == ELF_INFO_TYPE_MERGE
              && ELF_ST_TYPE (isym->st_info) != STT_SECTION)
            isym->st_value =
              _bfd_merged_section_offset (output_bfd, &isec,
@@ -7015,7 +7085,7 @@ elf_link_input_bfd (finfo, input_bfd)
        {
          /* Section written out.  */
        }
-      else switch (elf_section_data (o)->sec_info_type)
+      else switch (o->sec_info_type)
        {
        case ELF_INFO_TYPE_STABS:
          if (! (_bfd_write_section_stabs
@@ -8268,7 +8338,7 @@ elf_bfd_discard_info (output_bfd, info)
       if (stab != NULL
          && (stab->_raw_size == 0
              || bfd_is_abs_section (stab->output_section)
-             || elf_section_data (stab)->sec_info_type != ELF_INFO_TYPE_STABS))
+             || stab->sec_info_type != ELF_INFO_TYPE_STABS))
        stab = NULL;
 
       if (stab == NULL
@@ -8374,7 +8444,7 @@ elf_section_ignore_discarded_relocs (sec)
 {
   struct elf_backend_data *bed;
 
-  switch (elf_section_data (sec)->sec_info_type)
+  switch (sec->sec_info_type)
     {
     case ELF_INFO_TYPE_STABS:
     case ELF_INFO_TYPE_EH_FRAME:
index 00a0e88..b2d745b 100644 (file)
@@ -275,9 +275,11 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -772,9 +774,11 @@ static reloc_howto_type elf_mips_howto_table_rela[] =
         0x0000ffff,            /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* 16 bit PC relative reference.  */
+  /* 16 bit PC relative reference.  Note that the ABI document has a typo
+     and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
+     We do the right thing here.  */
   HOWTO (R_MIPS_PC16,          /* type */
-        0,                     /* rightshift */
+        2,                     /* rightshift */
         2,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         TRUE,                  /* pc_relative */
@@ -1837,7 +1841,7 @@ static const struct elf_reloc_map mips_reloc_map[] =
   /* There is no BFD reloc for R_MIPS_REL32.  */
   { BFD_RELOC_CTOR, R_MIPS_32 },
   { BFD_RELOC_64, R_MIPS_64 },
-  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   { BFD_RELOC_HI16_S, R_MIPS_HI16 },
   { BFD_RELOC_LO16, R_MIPS_LO16 },
   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
index 7097de0..6678dd6 100644 (file)
@@ -102,6 +102,7 @@ struct elfNN_ia64_dyn_sym_info
 
   /* TRUE for the different kinds of linker data we want created.  */
   unsigned want_got : 1;
+  unsigned want_gotx : 1;
   unsigned want_fptr : 1;
   unsigned want_ltoff_fptr : 1;
   unsigned want_plt : 1;
@@ -154,6 +155,12 @@ struct elfNN_ia64_link_hash_table
   struct elfNN_ia64_local_hash_table loc_hash_table;
 };
 
+struct elfNN_ia64_allocate_data
+{
+  struct bfd_link_info *info;
+  bfd_size_type ofs;
+};
+
 #define elfNN_ia64_hash_table(p) \
   ((struct elfNN_ia64_link_hash_table *) ((p)->hash))
 
@@ -169,6 +176,8 @@ static void elfNN_ia64_info_to_howto
 static bfd_boolean elfNN_ia64_relax_section
   PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
          bfd_boolean *again));
+static void elfNN_ia64_relax_ldxmov
+  PARAMS((bfd *abfd, bfd_byte *contents, bfd_vma off));
 static bfd_boolean is_unwind_section_name
   PARAMS ((bfd *abfd, const char *));
 static bfd_boolean elfNN_ia64_section_from_shdr
@@ -299,6 +308,8 @@ static bfd_vma elfNN_ia64_dtprel_base
   PARAMS ((struct bfd_link_info *info));
 static int elfNN_ia64_unwind_entry_compare
   PARAMS ((const PTR, const PTR));
+static bfd_boolean elfNN_ia64_choose_gp
+  PARAMS ((bfd *abfd, struct bfd_link_info *info));
 static bfd_boolean elfNN_ia64_final_link
   PARAMS ((bfd *abfd, struct bfd_link_info *info));
 static bfd_boolean elfNN_ia64_relocate_section
@@ -671,11 +682,7 @@ static const bfd_byte oor_ip[48] =
 };
 #endif
 \f
-/* These functions do relaxation for IA-64 ELF.
-
-   This is primarily to support branches to targets out of range;
-   relaxation of R_IA64_LTOFF22X and R_IA64_LDXMOV is handled in
-   relocate_section directly.  */
+/* These functions do relaxation for IA-64 ELF.  */
 
 static bfd_boolean
 elfNN_ia64_relax_section (abfd, sec, link_info, again)
@@ -701,6 +708,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
   struct one_fixup *fixups = NULL;
   bfd_boolean changed_contents = FALSE;
   bfd_boolean changed_relocs = FALSE;
+  bfd_boolean changed_got = FALSE;
+  bfd_vma gp = 0;
 
   /* Assume we're not going to change any sizes, and we'll only need
      one pass.  */
@@ -728,24 +737,6 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
   ia64_info = elfNN_ia64_hash_table (link_info);
   irelend = internal_relocs + sec->reloc_count;
 
-  for (irel = internal_relocs; irel < irelend; irel++)
-    {
-      unsigned long r_type = ELFNN_R_TYPE (irel->r_info);
-      if (r_type == R_IA64_PCREL21B
-         || r_type == R_IA64_PCREL21BI
-         || r_type == R_IA64_PCREL21M
-         || r_type == R_IA64_PCREL21F)
-       break;
-    }
-
-  /* No branch-type relocations.  */
-  if (irel == irelend)
-    {
-      if (elf_section_data (sec)->relocs != internal_relocs)
-       free (internal_relocs);
-      return TRUE;
-    }
-
   /* Get the section contents.  */
   if (elf_section_data (sec)->this_hdr.contents != NULL)
     contents = elf_section_data (sec)->this_hdr.contents;
@@ -760,19 +751,33 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
        goto error_return;
     }
 
-  for (; irel < irelend; irel++)
+  for (irel = internal_relocs; irel < irelend; irel++)
     {
       unsigned long r_type = ELFNN_R_TYPE (irel->r_info);
       bfd_vma symaddr, reladdr, trampoff, toff, roff;
       asection *tsec;
       struct one_fixup *f;
       bfd_size_type amt;
+      bfd_boolean is_branch;
+      struct elfNN_ia64_dyn_sym_info *dyn_i;
 
-      if (r_type != R_IA64_PCREL21B
-         && r_type != R_IA64_PCREL21BI
-         && r_type != R_IA64_PCREL21M
-         && r_type != R_IA64_PCREL21F)
-       continue;
+      switch (r_type)
+       {
+       case R_IA64_PCREL21B:
+       case R_IA64_PCREL21BI:
+       case R_IA64_PCREL21M:
+       case R_IA64_PCREL21F:
+         is_branch = TRUE;
+         break;
+
+       case R_IA64_LTOFF22X:
+       case R_IA64_LDXMOV:
+         is_branch = FALSE;
+         break;
+
+       default:
+         continue;
+       }
 
       /* Get the value of the symbol referred to by the reloc.  */
       if (ELFNN_R_SYM (irel->r_info) < symtab_hdr->sh_info)
@@ -805,12 +810,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
            tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
 
          toff = isym->st_value;
+         dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
        }
       else
        {
          unsigned long indx;
          struct elf_link_hash_entry *h;
-          struct elfNN_ia64_dyn_sym_info *dyn_i;
 
          indx = ELFNN_R_SYM (irel->r_info) - symtab_hdr->sh_info;
          h = elf_sym_hashes (abfd)[indx];
@@ -824,7 +829,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
 
          /* For branches to dynamic symbols, we're interested instead
             in a branch to the PLT entry.  */
-         if (dyn_i && dyn_i->want_plt2)
+         if (is_branch && dyn_i && dyn_i->want_plt2)
            {
              /* Internal branches shouldn't be sent to the PLT.
                 Leave this for now and we'll give an error later.  */
@@ -834,6 +839,11 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
              tsec = ia64_info->plt_sec;
              toff = dyn_i->plt2_offset;
            }
+
+         /* Can't do anything else with dynamic symbols.  */
+         else if (elfNN_ia64_dynamic_symbol_p (h, link_info))
+           continue;
+
          else
            {
              /* We can't do anthing with undefined symbols.  */
@@ -852,103 +862,152 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
                 + irel->r_addend);
 
       roff = irel->r_offset;
-      reladdr = (sec->output_section->vma
-                + sec->output_offset
-                + roff) & (bfd_vma) -4;
-
-      /* If the branch is in range, no need to do anything.  */
-      if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000
-         && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0)
-       continue;
 
-      /* If the branch and target are in the same section, you've
-        got one honking big section and we can't help you.  You'll
-        get an error message later.  */
-      if (tsec == sec)
-       continue;
+      if (is_branch)
+       {
+         reladdr = (sec->output_section->vma
+                    + sec->output_offset
+                    + roff) & (bfd_vma) -4;
 
-      /* Look for an existing fixup to this address.  */
-      for (f = fixups; f ; f = f->next)
-       if (f->tsec == tsec && f->toff == toff)
-         break;
+         /* If the branch is in range, no need to do anything.  */
+         if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000
+             && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0)
+           continue;
 
-      if (f == NULL)
-       {
-         /* Two alternatives: If it's a branch to a PLT entry, we can
-            make a copy of the FULL_PLT entry.  Otherwise, we'll have
-            to use a `brl' insn to get where we're going.  */
+         /* If the branch and target are in the same section, you've
+            got one honking big section and we can't help you.  You'll
+            get an error message later.  */
+         if (tsec == sec)
+           continue;
 
-         size_t size;
+         /* Look for an existing fixup to this address.  */
+         for (f = fixups; f ; f = f->next)
+           if (f->tsec == tsec && f->toff == toff)
+             break;
 
-         if (tsec == ia64_info->plt_sec)
-           size = sizeof (plt_full_entry);
-         else
+         if (f == NULL)
            {
+             /* Two alternatives: If it's a branch to a PLT entry, we can
+                make a copy of the FULL_PLT entry.  Otherwise, we'll have
+                to use a `brl' insn to get where we're going.  */
+
+             size_t size;
+
+             if (tsec == ia64_info->plt_sec)
+               size = sizeof (plt_full_entry);
+             else
+               {
 #ifdef USE_BRL
-             size = sizeof (oor_brl);
+                 size = sizeof (oor_brl);
 #else
-             size = sizeof (oor_ip);
+                 size = sizeof (oor_ip);
 #endif
-           }
+               }
 
-         /* Resize the current section to make room for the new branch.  */
-         trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
-         amt = trampoff + size;
-         contents = (bfd_byte *) bfd_realloc (contents, amt);
-         if (contents == NULL)
-           goto error_return;
-         sec->_cooked_size = amt;
+             /* Resize the current section to make room for the new branch. */
+             trampoff = (sec->_cooked_size + 15) & (bfd_vma) -16;
+             amt = trampoff + size;
+             contents = (bfd_byte *) bfd_realloc (contents, amt);
+             if (contents == NULL)
+               goto error_return;
+             sec->_cooked_size = amt;
 
-         if (tsec == ia64_info->plt_sec)
-           {
-             memcpy (contents + trampoff, plt_full_entry, size);
+             if (tsec == ia64_info->plt_sec)
+               {
+                 memcpy (contents + trampoff, plt_full_entry, size);
 
-             /* Hijack the old relocation for use as the PLTOFF reloc.  */
-             irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
-                                          R_IA64_PLTOFF22);
-             irel->r_offset = trampoff;
-           }
-         else
-           {
+                 /* Hijack the old relocation for use as the PLTOFF reloc.  */
+                 irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+                                              R_IA64_PLTOFF22);
+                 irel->r_offset = trampoff;
+               }
+             else
+               {
 #ifdef USE_BRL
-             memcpy (contents + trampoff, oor_brl, size);
-             irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
-                                          R_IA64_PCREL60B);
-             irel->r_offset = trampoff + 2;
+                 memcpy (contents + trampoff, oor_brl, size);
+                 irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+                                              R_IA64_PCREL60B);
+                 irel->r_offset = trampoff + 2;
 #else
-             memcpy (contents + trampoff, oor_ip, size);
-             irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
-                                          R_IA64_PCREL64I);
-             irel->r_addend -= 16;
-             irel->r_offset = trampoff + 2;
+                 memcpy (contents + trampoff, oor_ip, size);
+                 irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+                                              R_IA64_PCREL64I);
+                 irel->r_addend -= 16;
+                 irel->r_offset = trampoff + 2;
 #endif
+               }
+
+             /* Record the fixup so we don't do it again this section.  */
+             f = (struct one_fixup *)
+               bfd_malloc ((bfd_size_type) sizeof (*f));
+             f->next = fixups;
+             f->tsec = tsec;
+             f->toff = toff;
+             f->trampoff = trampoff;
+             fixups = f;
            }
+         else
+           {
+             /* Nop out the reloc, since we're finalizing things here.  */
+             irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
+           }
+
+         /* Fix up the existing branch to hit the trampoline.  Hope like
+            hell this doesn't overflow too.  */
+         if (elfNN_ia64_install_value (abfd, contents + roff,
+                                       f->trampoff - (roff & (bfd_vma) -4),
+                                       r_type) != bfd_reloc_ok)
+           goto error_return;
 
-         /* Record the fixup so we don't do it again this section.  */
-         f = (struct one_fixup *) bfd_malloc ((bfd_size_type) sizeof (*f));
-         f->next = fixups;
-         f->tsec = tsec;
-         f->toff = toff;
-         f->trampoff = trampoff;
-         fixups = f;
+         changed_contents = TRUE;
+         changed_relocs = TRUE;
        }
       else
        {
-         /* Nop out the reloc, since we're finalizing things here.  */
-         irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
-       }
+         /* Fetch the gp.  */
+         if (gp == 0)
+           {
+             bfd *obfd = sec->output_section->owner;
+             gp = _bfd_get_gp_value (obfd);
+             if (gp == 0)
+               {
+                 if (!elfNN_ia64_choose_gp (obfd, link_info))
+                   goto error_return;
+                 gp = _bfd_get_gp_value (obfd);
+               }
+           }
 
-      /* Fix up the existing branch to hit the trampoline.  Hope like
-        hell this doesn't overflow too.  */
-      if (elfNN_ia64_install_value (abfd, contents + roff,
-                                   f->trampoff - (roff & (bfd_vma) -4),
-                                   r_type) != bfd_reloc_ok)
-       goto error_return;
+         /* If the data is out of range, do nothing.  */
+         if ((bfd_signed_vma) (symaddr - gp) >= 0x200000
+             ||(bfd_signed_vma) (symaddr - gp) < -0x200000)
+           continue;
 
-      changed_contents = TRUE;
-      changed_relocs = TRUE;
+         if (r_type == R_IA64_LTOFF22X)
+           {
+             irel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (irel->r_info),
+                                          R_IA64_GPREL22);
+             changed_relocs = TRUE;
+             if (dyn_i->want_gotx)
+               {
+                 dyn_i->want_gotx = 0;
+                 changed_got |= !dyn_i->want_got;
+               }
+           }
+         else
+           {
+             elfNN_ia64_relax_ldxmov (abfd, contents, roff);
+             irel->r_info = ELFNN_R_INFO (0, R_IA64_NONE);
+             changed_contents = TRUE;
+             changed_relocs = TRUE;
+           }
+       }
     }
 
+  /* ??? If we created fixups, this may push the code segment large
+     enough that the data segment moves, which will change the GP.
+     Reset the GP so that we re-calculate next round.  We need to
+     do this at the _beginning_ of the next round; now will not do.  */
+      
   /* Clean up and go home.  */
   while (fixups)
     {
@@ -989,6 +1048,21 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
        elf_section_data (sec)->relocs = internal_relocs;
     }
 
+  if (changed_got)
+    {
+      struct elfNN_ia64_allocate_data data;
+      data.info = link_info;
+      data.ofs = 0;
+
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data);
+      elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data);
+      ia64_info->got_sec->_raw_size = data.ofs;
+      ia64_info->got_sec->_cooked_size = data.ofs;
+
+      /* ??? Resize .rela.got too.  */
+    }
+
   *again = changed_contents || changed_relocs;
   return TRUE;
 
@@ -1003,6 +1077,39 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
     free (internal_relocs);
   return FALSE;
 }
+
+static void
+elfNN_ia64_relax_ldxmov (abfd, contents, off)
+     bfd *abfd;
+     bfd_byte *contents;
+     bfd_vma off;
+{
+  int shift, r1, r3;
+  bfd_vma dword, insn;
+
+  switch ((int)off & 0x3)
+    {
+    case 0: shift =  5; break;
+    case 1: shift = 14; off += 3; break;
+    case 2: shift = 23; off += 6; break;
+    case 3:
+      abort ();
+    }
+
+  dword = bfd_get_64 (abfd, contents + off);
+  insn = (dword >> shift) & 0x1ffffffffffLL;
+
+  r1 = (insn >> 6) & 127;
+  r3 = (insn >> 20) & 127;
+  if (r1 == r3)
+    insn = 0x8000000;                             /* nop */
+  else
+    insn = (insn & 0x7f01fff) | 0x10800000000LL;   /* (qp) mov r1 = r3 */
+
+  dword &= ~(0x1ffffffffffLL << shift);
+  dword |= (insn << shift);
+  bfd_put_64 (abfd, dword, contents + off);
+}
 \f
 /* Return TRUE if NAME is an unwind table section name.  */
 
@@ -2125,15 +2232,16 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
     {
       enum {
        NEED_GOT = 1,
-       NEED_FPTR = 2,
-       NEED_PLTOFF = 4,
-       NEED_MIN_PLT = 8,
-       NEED_FULL_PLT = 16,
-       NEED_DYNREL = 32,
-       NEED_LTOFF_FPTR = 64,
-       NEED_TPREL = 128,
-       NEED_DTPMOD = 256,
-       NEED_DTPREL = 512
+       NEED_GOTX = 2,
+       NEED_FPTR = 4,
+       NEED_PLTOFF = 8,
+       NEED_MIN_PLT = 16,
+       NEED_FULL_PLT = 32,
+       NEED_DYNREL = 64,
+       NEED_LTOFF_FPTR = 128,
+       NEED_TPREL = 256,
+       NEED_DTPMOD = 512,
+       NEED_DTPREL = 1024
       };
 
       struct elf_link_hash_entry *h = NULL;
@@ -2230,11 +2338,14 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
          break;
 
        case R_IA64_LTOFF22:
-       case R_IA64_LTOFF22X:
        case R_IA64_LTOFF64I:
          need_entry = NEED_GOT;
          break;
 
+       case R_IA64_LTOFF22X:
+         need_entry = NEED_GOTX;
+         break;
+
        case R_IA64_PLTOFF22:
        case R_IA64_PLTOFF64I:
        case R_IA64_PLTOFF64MSB:
@@ -2316,7 +2427,8 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
       dyn_i->h = h;
 
       /* Create what's needed.  */
-      if (need_entry & (NEED_GOT | NEED_TPREL | NEED_DTPMOD | NEED_DTPREL))
+      if (need_entry & (NEED_GOT | NEED_GOTX | NEED_TPREL
+                       | NEED_DTPMOD | NEED_DTPREL))
        {
          if (!got)
            {
@@ -2326,6 +2438,8 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
            }
          if (need_entry & NEED_GOT)
            dyn_i->want_got = 1;
+         if (need_entry & NEED_GOTX)
+           dyn_i->want_gotx = 1;
          if (need_entry & NEED_TPREL)
            dyn_i->want_tprel = 1;
          if (need_entry & NEED_DTPMOD)
@@ -2385,12 +2499,6 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs)
   return TRUE;
 }
 
-struct elfNN_ia64_allocate_data
-{
-  struct bfd_link_info *info;
-  bfd_size_type ofs;
-};
-
 /* For cleanliness, and potentially faster dynamic loading, allocate
    external GOT entries first.  */
 
@@ -2401,7 +2509,7 @@ allocate_global_data_got (dyn_i, data)
 {
   struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
-  if (dyn_i->want_got
+  if ((dyn_i->want_got || dyn_i->want_gotx)
       && ! dyn_i->want_fptr
       && (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
          || (elfNN_ia64_aix_vec (x->info->hash->creator)
@@ -2473,7 +2581,7 @@ allocate_local_got (dyn_i, data)
 {
   struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
 
-  if (dyn_i->want_got
+  if ((dyn_i->want_got || dyn_i->want_gotx)
       && ! (elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info)
            || elfNN_ia64_aix_vec (x->info->hash->creator)))
     {
@@ -2699,7 +2807,7 @@ allocate_dynrel_entries (dyn_i, data)
 
   /* Take care of the GOT and PLT relocations.  */
 
-  if (((dynamic_symbol || shared) && dyn_i->want_got)
+  if (((dynamic_symbol || shared) && (dyn_i->want_got || dyn_i->want_gotx))
       || (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1))
     ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela);
   if ((dynamic_symbol || shared) && dyn_i->want_tprel)
@@ -3516,125 +3624,148 @@ elfNN_ia64_unwind_entry_compare (a, b)
   return (av < bv ? -1 : av > bv ? 1 : 0);
 }
 
+/* Make sure we've got ourselves a nice fat __gp value.  */
 static bfd_boolean
-elfNN_ia64_final_link (abfd, info)
+elfNN_ia64_choose_gp (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
+  bfd_vma min_vma = (bfd_vma) -1, max_vma = 0;
+  bfd_vma min_short_vma = min_vma, max_short_vma = 0;
+  struct elf_link_hash_entry *gp;
+  bfd_vma gp_val;
+  asection *os;
   struct elfNN_ia64_link_hash_table *ia64_info;
-  asection *unwind_output_sec;
 
   ia64_info = elfNN_ia64_hash_table (info);
 
-  /* Make sure we've got ourselves a nice fat __gp value.  */
-  if (!info->relocateable)
+  /* Find the min and max vma of all sections marked short.  Also collect
+     min and max vma of any type, for use in selecting a nice gp.  */
+  for (os = abfd->sections; os ; os = os->next)
     {
-      bfd_vma min_vma = (bfd_vma) -1, max_vma = 0;
-      bfd_vma min_short_vma = min_vma, max_short_vma = 0;
-      struct elf_link_hash_entry *gp;
-      bfd_vma gp_val;
-      asection *os;
+      bfd_vma lo, hi;
+
+      if ((os->flags & SEC_ALLOC) == 0)
+       continue;
+
+      lo = os->vma;
+      hi = os->vma + os->_raw_size;
+      if (hi < lo)
+       hi = (bfd_vma) -1;
 
-      /* Find the min and max vma of all sections marked short.  Also
-        collect min and max vma of any type, for use in selecting a
-        nice gp.  */
-      for (os = abfd->sections; os ; os = os->next)
+      if (min_vma > lo)
+       min_vma = lo;
+      if (max_vma < hi)
+       max_vma = hi;
+      if (os->flags & SEC_SMALL_DATA)
        {
-         bfd_vma lo, hi;
+         if (min_short_vma > lo)
+           min_short_vma = lo;
+         if (max_short_vma < hi)
+           max_short_vma = hi;
+       }
+    }
 
-         if ((os->flags & SEC_ALLOC) == 0)
-           continue;
+  /* See if the user wants to force a value.  */
+  gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
+                            FALSE, FALSE);
 
-         lo = os->vma;
-         hi = os->vma + os->_raw_size;
-         if (hi < lo)
-           hi = (bfd_vma) -1;
+  if (gp
+      && (gp->root.type == bfd_link_hash_defined
+         || gp->root.type == bfd_link_hash_defweak))
+    {
+      asection *gp_sec = gp->root.u.def.section;
+      gp_val = (gp->root.u.def.value
+               + gp_sec->output_section->vma
+               + gp_sec->output_offset);
+    }
+  else
+    {
+      /* Pick a sensible value.  */
 
-         if (min_vma > lo)
-           min_vma = lo;
-         if (max_vma < hi)
-           max_vma = hi;
-         if (os->flags & SEC_SMALL_DATA)
-           {
-             if (min_short_vma > lo)
-               min_short_vma = lo;
-             if (max_short_vma < hi)
-               max_short_vma = hi;
-           }
+      asection *got_sec = ia64_info->got_sec;
+
+      /* Start with just the address of the .got.  */
+      if (got_sec)
+       gp_val = got_sec->output_section->vma;
+      else if (max_short_vma != 0)
+       gp_val = min_short_vma;
+      else
+       gp_val = min_vma;
+
+      /* If it is possible to address the entire image, but we
+        don't with the choice above, adjust.  */
+      if (max_vma - min_vma < 0x400000
+         && max_vma - gp_val <= 0x200000
+         && gp_val - min_vma > 0x200000)
+       gp_val = min_vma + 0x200000;
+      else if (max_short_vma != 0)
+       {
+         /* If we don't cover all the short data, adjust.  */
+         if (max_short_vma - gp_val >= 0x200000)
+           gp_val = min_short_vma + 0x200000;
+
+         /* If we're addressing stuff past the end, adjust back.  */
+         if (gp_val > max_vma)
+           gp_val = max_vma - 0x200000 + 8;
        }
+    }
 
-      /* See if the user wants to force a value.  */
-      gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
-                                FALSE, FALSE);
+  /* Validate whether all SHF_IA_64_SHORT sections are within
+     range of the chosen GP.  */
 
-      if (gp
-         && (gp->root.type == bfd_link_hash_defined
-             || gp->root.type == bfd_link_hash_defweak))
+  if (max_short_vma != 0)
+    {
+      if (max_short_vma - min_short_vma >= 0x400000)
        {
-         asection *gp_sec = gp->root.u.def.section;
-         gp_val = (gp->root.u.def.value
-                   + gp_sec->output_section->vma
-                   + gp_sec->output_offset);
+         (*_bfd_error_handler)
+           (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
+            bfd_get_filename (abfd),
+            (unsigned long) (max_short_vma - min_short_vma));
+         return FALSE;
        }
-      else
+      else if ((gp_val > min_short_vma
+               && gp_val - min_short_vma > 0x200000)
+              || (gp_val < max_short_vma
+                  && max_short_vma - gp_val >= 0x200000))
        {
-         /* Pick a sensible value.  */
+         (*_bfd_error_handler)
+           (_("%s: __gp does not cover short data segment"),
+            bfd_get_filename (abfd));
+         return FALSE;
+       }
+    }
 
-         asection *got_sec = ia64_info->got_sec;
+  _bfd_set_gp_value (abfd, gp_val);
 
-         /* Start with just the address of the .got.  */
-         if (got_sec)
-           gp_val = got_sec->output_section->vma;
-         else if (max_short_vma != 0)
-           gp_val = min_short_vma;
-         else
-           gp_val = min_vma;
-
-         /* If it is possible to address the entire image, but we
-            don't with the choice above, adjust.  */
-         if (max_vma - min_vma < 0x400000
-             && max_vma - gp_val <= 0x200000
-             && gp_val - min_vma > 0x200000)
-           gp_val = min_vma + 0x200000;
-         else if (max_short_vma != 0)
-           {
-             /* If we don't cover all the short data, adjust.  */
-             if (max_short_vma - gp_val >= 0x200000)
-               gp_val = min_short_vma + 0x200000;
+  return TRUE;
+}
 
-             /* If we're addressing stuff past the end, adjust back.  */
-             if (gp_val > max_vma)
-               gp_val = max_vma - 0x200000 + 8;
-           }
-       }
+static bfd_boolean
+elfNN_ia64_final_link (abfd, info)
+     bfd *abfd;
+     struct bfd_link_info *info;
+{
+  struct elfNN_ia64_link_hash_table *ia64_info;
+  asection *unwind_output_sec;
 
-      /* Validate whether all SHF_IA_64_SHORT sections are within
-        range of the chosen GP.  */
+  ia64_info = elfNN_ia64_hash_table (info);
+
+  /* Make sure we've got ourselves a nice fat __gp value.  */
+  if (!info->relocateable)
+    {
+      bfd_vma gp_val = _bfd_get_gp_value (abfd);
+      struct elf_link_hash_entry *gp;
 
-      if (max_short_vma != 0)
+      if (gp_val == 0)
        {
-         if (max_short_vma - min_short_vma >= 0x400000)
-           {
-             (*_bfd_error_handler)
-               (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
-                bfd_get_filename (abfd),
-                (unsigned long) (max_short_vma - min_short_vma));
-             return FALSE;
-           }
-         else if ((gp_val > min_short_vma
-                   && gp_val - min_short_vma > 0x200000)
-                  || (gp_val < max_short_vma
-                      && max_short_vma - gp_val >= 0x200000))
-           {
-             (*_bfd_error_handler)
-               (_("%s: __gp does not cover short data segment"),
-                bfd_get_filename (abfd));
-             return FALSE;
-           }
+         if (! elfNN_ia64_choose_gp (abfd, info))
+           return FALSE;
+         gp_val = _bfd_get_gp_value (abfd);
        }
 
-      _bfd_set_gp_value (abfd, gp_val);
-
+      gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", FALSE,
+                                FALSE, FALSE);
       if (gp)
        {
          gp->root.type = bfd_link_hash_defined;
@@ -3763,8 +3894,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
          value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
          if ((sym_sec->flags & SEC_MERGE)
              && ELF_ST_TYPE (sym->st_info) == STT_SECTION
-             && (elf_section_data (sym_sec)->sec_info_type
-                 == ELF_INFO_TYPE_MERGE))
+             && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
            {
              struct elfNN_ia64_local_hash_entry *loc_h;
 
@@ -3829,7 +3959,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
          else if (h->root.type == bfd_link_hash_undefweak)
            undef_weak_ref = TRUE;
          else if (info->shared
-                  && (!info->symbolic || info->allow_shlib_undefined)
                   && !info->no_undefined
                   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            ;
@@ -3927,7 +4056,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
                                            srel, rel->r_offset, dyn_r_type,
                                            dynindx, addend);
            }
-         /* FALLTHRU */
+         /* Fall through.  */
 
        case R_IA64_LTV32MSB:
        case R_IA64_LTV32LSB:
@@ -4537,7 +4666,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info)
          bfd_elfNN_swap_dyn_out (abfd, &dyn, dyncon);
        }
 
-      /* Initialize the PLT0 entry */
+      /* Initialize the PLT0 entry */
       if (ia64_info->plt_sec)
        {
          bfd_byte *loc = ia64_info->plt_sec->contents;
@@ -4556,7 +4685,7 @@ elfNN_ia64_finish_dynamic_sections (abfd, info)
   return TRUE;
 }
 \f
-/* ELF file flag handling: */
+/* ELF file flag handling:  */
 
 /* Function to keep IA-64 specific file flags.  */
 static bfd_boolean
index 22cc8a2..6ca4f06 100644 (file)
@@ -9,21 +9,21 @@
    Traditional MIPS targets support added by Koundinya.K, Dansk Data
    Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This file handles functionality common to the different MIPS ABI's.  */
 
@@ -148,7 +148,7 @@ struct _mips_elf_section_data
 };
 
 #define mips_elf_section_data(sec) \
-  ((struct _mips_elf_section_data *) (sec)->used_by_bfd)
+  ((struct _mips_elf_section_data *) elf_section_data (sec))
 
 /* This structure is passed to mips_elf_sort_hash_table_f when sorting
    the dynamic symbols.  */
@@ -359,17 +359,17 @@ typedef struct
    loader for use by the static exception system.  */
 
 typedef struct runtime_pdr {
-       bfd_vma adr;            /* memory address of start of procedure */
-       long    regmask;        /* save register mask */
-       long    regoffset;      /* save register offset */
-       long    fregmask;       /* save floating point register mask */
-       long    fregoffset;     /* save floating point register offset */
-       long    frameoffset;    /* frame size */
-       short   framereg;       /* frame pointer register */
-       short   pcreg;          /* offset or reg of return pc */
-       long    irpss;          /* index into the runtime string table */
+       bfd_vma adr;            /* Memory address of start of procedure.  */
+       long    regmask;        /* Save register mask.  */
+       long    regoffset;      /* Save register offset.  */
+       long    fregmask;       /* Save floating point register mask.  */
+       long    fregoffset;     /* Save floating point register offset.  */
+       long    frameoffset;    /* Frame size.  */
+       short   framereg;       /* Frame pointer register.  */
+       short   pcreg;          /* Offset or reg of return pc.  */
+       long    irpss;          /* Index into the runtime string table.  */
        long    reserved;
-       struct exception_info *exception_info;/* pointer to exception array */
+       struct exception_info *exception_info;/* Pointer to exception array.  */
 } RPDR, *pRPDR;
 #define cbRPDR sizeof (RPDR)
 #define rpdNil ((pRPDR) 0)
@@ -496,7 +496,6 @@ static struct mips_got_info *mips_elf_got_for_ibfd
 static bfd *reldyn_sorting_bfd;
 
 /* Nonzero if ABFD is using the N32 ABI.  */
-
 #define ABI_N32_P(abfd) \
   ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
 
@@ -2130,7 +2129,7 @@ mips_elf_bfd2got_entry_eq (entry1, entry2)
   return e1->bfd == e2->bfd;
 }
 
-/* In a multi-got link, determine the GOT to be used for IBDF.  G must
+/* In a multi-got link, determine the GOT to be used for IBFD.  G must
    be the master GOT data.  */
 
 static struct mips_got_info *
@@ -3095,7 +3094,6 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
           addresses.  */
        symbol = 0;
       else if (info->shared
-              && (!info->symbolic || info->allow_shlib_undefined)
               && !info->no_undefined
               && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT)
        symbol = 0;
@@ -3317,12 +3315,6 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
       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:
       /* Instead of subtracting 'p' here, we should be subtracting the
         equivalent value for the LO part of the reloc, since the value
@@ -3451,8 +3443,10 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info,
       break;
 
     case R_MIPS_PC16:
-      value = mips_elf_sign_extend (addend, 16) + symbol - p;
-      overflowed_p = mips_elf_overflow_p (value, 16);
+    case R_MIPS_GNU_REL16_S2:
+      value = mips_elf_sign_extend (addend << 2, 18) + symbol - p;
+      overflowed_p = mips_elf_overflow_p (value, 18);
+      value = (value >> 2) & howto->dst_mask;
       break;
 
     case R_MIPS_GOT_HI16:
@@ -4600,8 +4594,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec)
       esd->rel_hdr2 = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt);
       if (!esd->rel_hdr2)
        return FALSE;
-      _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec,
-                               !elf_section_data (sec)->use_rela_p);
+      _bfd_elf_init_reloc_shdr (abfd, esd->rel_hdr2, sec, !sec->use_rela_p);
     }
 
   return TRUE;
index 8cc7b7a..9af6efc 100644 (file)
@@ -1,23 +1,23 @@
 /* Generic BFD support for file formats.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /*
 SECTION
@@ -52,7 +52,7 @@ FUNCTION
        bfd_check_format
 
 SYNOPSIS
-       bfd_boolean bfd_check_format(bfd *abfd, bfd_format format);
+       bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
 
 DESCRIPTION
        Verify if the file attached to the BFD @var{abfd} is compatible
@@ -98,7 +98,8 @@ FUNCTION
        bfd_check_format_matches
 
 SYNOPSIS
-       bfd_boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching);
+       bfd_boolean bfd_check_format_matches (bfd *abfd, bfd_format format,
+                                             char ***matching);
 
 DESCRIPTION
        Like <<bfd_check_format>>, except when it returns FALSE with
@@ -210,7 +211,7 @@ bfd_check_format_matches (abfd, format, matching)
       if (*target == &binary_vec)
        continue;
 
-      abfd->xvec = *target;    /* Change BFD's target temporarily */
+      abfd->xvec = *target;    /* Change BFD's target temporarily */
 
       if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
        return FALSE;
@@ -224,7 +225,8 @@ bfd_check_format_matches (abfd, format, matching)
       temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
 
       if (temp)
-       {               /* This format checks out as ok!  */
+       {
+         /* This format checks out as ok!  */
          right_targ = temp;
 
          /* If this is the default target, accept it, even if other
@@ -279,6 +281,7 @@ bfd_check_format_matches (abfd, format, matching)
     {
       /* Try partial matches.  */
       right_targ = ar_right_targ;
+
       if (right_targ == bfd_default_vector[0])
        {
          match_count = 1;
@@ -286,12 +289,11 @@ bfd_check_format_matches (abfd, format, matching)
       else
        {
          match_count = ar_match_index - _bfd_target_vector_entries;
+
          if (matching && match_count > 1)
-           {
-             memcpy (matching_vector,
-                     matching_vector + _bfd_target_vector_entries,
-                     sizeof (*matching_vector) * match_count);
-           }
+           memcpy (matching_vector,
+                   matching_vector + _bfd_target_vector_entries,
+                   sizeof (*matching_vector) * match_count);
        }
     }
 
@@ -361,7 +363,7 @@ FUNCTION
        bfd_set_format
 
 SYNOPSIS
-       bfd_boolean bfd_set_format(bfd *abfd, bfd_format format);
+       bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
 
 DESCRIPTION
        This function sets the file format of the BFD @var{abfd} to the
@@ -402,7 +404,7 @@ FUNCTION
        bfd_format_string
 
 SYNOPSIS
-       const char *bfd_format_string(bfd_format format);
+       const char *bfd_format_string (bfd_format format);
 
 DESCRIPTION
        Return a pointer to a const string
index 779fd71..0811952 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for ieee-695 objects.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    Written by Steve Chamberlain of Cygnus Support.
@@ -2074,7 +2074,7 @@ ieee_slurp_section_data (abfd)
 
   for (s = abfd->sections; s != (asection *) NULL; s = s->next)
     {
-      ieee_per_section_type *per = (ieee_per_section_type *) s->used_by_bfd;
+      ieee_per_section_type *per = ieee_per_section (s);
       if ((s->flags & SEC_DEBUGGING) != 0)
        continue;
       per->data = (bfd_byte *) bfd_alloc (ieee->h.abfd, s->_raw_size);
@@ -2098,7 +2098,7 @@ ieee_slurp_section_data (abfd)
          section_number = must_parse_int (&(ieee->h));
          s = ieee->section_table[section_number];
          s->flags |= SEC_LOAD | SEC_HAS_CONTENTS;
-         current_map = (ieee_per_section_type *) s->used_by_bfd;
+         current_map = ieee_per_section (s);
          location_ptr = current_map->data - s->vma;
          /* The document I have says that Microtec's compilers reset */
          /* this after a sec section, even though the standard says not */
@@ -2192,8 +2192,8 @@ ieee_new_section_hook (abfd, newsect)
      bfd *abfd;
      asection *newsect;
 {
-  newsect->used_by_bfd = (PTR)
-    bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
+  newsect->used_by_bfd
+    = (PTR) bfd_alloc (abfd, (bfd_size_type) sizeof (ieee_per_section_type));
   if (!newsect->used_by_bfd)
     return FALSE;
   ieee_per_section (newsect)->data = (bfd_byte *) NULL;
@@ -2221,7 +2221,7 @@ ieee_get_section_contents (abfd, section, location, offset, count)
      file_ptr offset;
      bfd_size_type count;
 {
-  ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;
+  ieee_per_section_type *p = ieee_per_section (section);
   if ((section->flags & SEC_DEBUGGING) != 0)
     return _bfd_generic_get_section_contents (abfd, section, location,
                                              offset, count);
@@ -2237,7 +2237,6 @@ ieee_canonicalize_reloc (abfd, section, relptr, symbols)
      arelent **relptr;
      asymbol **symbols;
 {
-/*  ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;*/
   ieee_reloc_type *src = (ieee_reloc_type *) (section->relocation);
   ieee_data_type *ieee = IEEE_DATA (abfd);
 
index 4ee9d87..14978ba 100644 (file)
@@ -850,6 +850,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_LO16",
   "BFD_RELOC_PCREL_HI16_S",
   "BFD_RELOC_PCREL_LO16",
+  "BFD_RELOC_MIPSEMB_16_PCREL_S2",
   "BFD_RELOC_MIPS_LITERAL",
   "BFD_RELOC_MIPS_GOT16",
   "BFD_RELOC_MIPS_CALL16",
@@ -991,6 +992,46 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_PPC64_TOC16_LO_DS",
   "BFD_RELOC_PPC64_PLTGOT16_DS",
   "BFD_RELOC_PPC64_PLTGOT16_LO_DS",
+  "BFD_RELOC_PPC_TLS",
+  "BFD_RELOC_PPC_DTPMOD",
+  "BFD_RELOC_PPC_TPREL16",
+  "BFD_RELOC_PPC_TPREL16_LO",
+  "BFD_RELOC_PPC_TPREL16_HI",
+  "BFD_RELOC_PPC_TPREL16_HA",
+  "BFD_RELOC_PPC_TPREL",
+  "BFD_RELOC_PPC_DTPREL16",
+  "BFD_RELOC_PPC_DTPREL16_LO",
+  "BFD_RELOC_PPC_DTPREL16_HI",
+  "BFD_RELOC_PPC_DTPREL16_HA",
+  "BFD_RELOC_PPC_DTPREL",
+  "BFD_RELOC_PPC_GOT_TLSGD16",
+  "BFD_RELOC_PPC_GOT_TLSGD16_LO",
+  "BFD_RELOC_PPC_GOT_TLSGD16_HI",
+  "BFD_RELOC_PPC_GOT_TLSGD16_HA",
+  "BFD_RELOC_PPC_GOT_TLSLD16",
+  "BFD_RELOC_PPC_GOT_TLSLD16_LO",
+  "BFD_RELOC_PPC_GOT_TLSLD16_HI",
+  "BFD_RELOC_PPC_GOT_TLSLD16_HA",
+  "BFD_RELOC_PPC_GOT_TPREL16",
+  "BFD_RELOC_PPC_GOT_TPREL16_LO",
+  "BFD_RELOC_PPC_GOT_TPREL16_HI",
+  "BFD_RELOC_PPC_GOT_TPREL16_HA",
+  "BFD_RELOC_PPC_GOT_DTPREL16",
+  "BFD_RELOC_PPC_GOT_DTPREL16_LO",
+  "BFD_RELOC_PPC_GOT_DTPREL16_HI",
+  "BFD_RELOC_PPC_GOT_DTPREL16_HA",
+  "BFD_RELOC_PPC64_TPREL16_DS",
+  "BFD_RELOC_PPC64_TPREL16_LO_DS",
+  "BFD_RELOC_PPC64_TPREL16_HIGHER",
+  "BFD_RELOC_PPC64_TPREL16_HIGHERA",
+  "BFD_RELOC_PPC64_TPREL16_HIGHEST",
+  "BFD_RELOC_PPC64_TPREL16_HIGHESTA",
+  "BFD_RELOC_PPC64_DTPREL16_DS",
+  "BFD_RELOC_PPC64_DTPREL16_LO_DS",
+  "BFD_RELOC_PPC64_DTPREL16_HIGHER",
+  "BFD_RELOC_PPC64_DTPREL16_HIGHERA",
+  "BFD_RELOC_PPC64_DTPREL16_HIGHEST",
+  "BFD_RELOC_PPC64_DTPREL16_HIGHESTA",
   "BFD_RELOC_I370_D12",
   "BFD_RELOC_CTOR",
   "BFD_RELOC_ARM_PCREL_BRANCH",
index c0279e5..1beec22 100644 (file)
@@ -866,7 +866,8 @@ typedef struct
 #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
   ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
 #define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
-  ((coff_backend_info (abfd)->_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, section, flags_ptr)\
   ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
@@ -891,7 +892,8 @@ typedef struct
   ((coff_backend_info (abfd)->_bfd_coff_print_aux)\
    (abfd, file, base, symbol, aux, indaux))
 
-#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
+#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
+                                     reloc, data, src_ptr, dst_ptr)\
   ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
    (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
 
@@ -919,7 +921,8 @@ typedef struct
 #define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
   ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
    (obfd, info, ibfd, sec, rel, adjustedp))
-#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
+#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
+                                     value, string, cp, coll, hashp)\
   ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
    (info, abfd, name, flags, section, value, string, cp, coll, hashp))
 
index f734fa9..56c9746 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -1,5 +1,5 @@
 /* BFD back-end for mmo objects (MMIX-specific object-format).
-   Copyright 2001, 2002
+   Copyright 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Hans-Peter Nilsson (hp@bitrange.com).
    Infrastructure and other bits originally copied from srec.c and
@@ -335,6 +335,9 @@ struct mmo_section_data_struct
     mmo_data_list_type *tail;
   };
 
+#define mmo_section_data(sec) \
+  ((struct mmo_section_data_struct *) (sec)->used_by_bfd)
+
 /* These structures are used in bfd_map_over_sections constructs.  */
 
 /* Used when writing out sections; all but the register contents section
@@ -1177,12 +1180,11 @@ mmo_get_spec_section (abfd, spec_data_number)
     }
 
   loc->next = NULL;
-  if (((struct mmo_section_data_struct *) (sec->used_by_bfd))->tail != NULL)
-    ((struct mmo_section_data_struct *) (sec->used_by_bfd))->tail->next
-      = loc;
+  if (mmo_section_data (sec)->tail != NULL)
+    mmo_section_data (sec)->tail->next = loc;
   else
-    ((struct mmo_section_data_struct *) (sec->used_by_bfd))->head = loc;
-  ((struct mmo_section_data_struct *) (sec->used_by_bfd))->tail = loc;
+    mmo_section_data (sec)->head = loc;
+  mmo_section_data (sec)->tail = loc;
   loc->where = section_vma;
 
   return sec;
@@ -1517,8 +1519,7 @@ mmo_get_loc (sec, vma, size)
      int size;
 {
   bfd_size_type allocated_size;
-  struct mmo_section_data_struct *sdatap
-    = (struct mmo_section_data_struct *) sec->used_by_bfd;
+  struct mmo_section_data_struct *sdatap = mmo_section_data (sec);
   struct mmo_data_list_struct *datap = sdatap->head;
   struct mmo_data_list_struct *entry;
 
@@ -2463,15 +2464,9 @@ mmo_internal_write_section (abfd, sec)
 
   if (strcmp (sec->name, MMO_TEXT_SECTION_NAME) == 0)
     /* FIXME: Output source file name and line number.  */
-    return
-      mmo_write_loc_chunk_list (abfd,
-                               ((struct mmo_section_data_struct *)
-                                (sec->used_by_bfd))->head);
+    return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head);
   else if (strcmp (sec->name, MMO_DATA_SECTION_NAME) == 0)
-    return
-      mmo_write_loc_chunk_list (abfd,
-                               ((struct mmo_section_data_struct *)
-                                (sec->used_by_bfd))->head);
+    return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head);
   else if (strcmp (sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0)
     /* Not handled here.  */
     {
@@ -2486,9 +2481,7 @@ mmo_internal_write_section (abfd, sec)
       int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX));
       mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_SPEC << 16) | n);
       return (! abfd->tdata.mmo_data->have_error
-             && mmo_write_chunk_list (abfd,
-                                      ((struct mmo_section_data_struct *)
-                                       (sec->used_by_bfd))->head));
+             && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
     }
   /* Ignore sections that are just allocated or empty; we write out
      _contents_ here.  */
@@ -2605,16 +2598,11 @@ EXAMPLE
       /* Writing a LOP_LOC ends the LOP_SPEC data, and makes data actually
         loaded.  */
       if (bfd_get_section_flags (abfd, sec) & SEC_LOAD)
-         return
-           ! abfd->tdata.mmo_data->have_error
-           && mmo_write_loc_chunk_list (abfd,
-                                        ((struct mmo_section_data_struct *)
-                                         (sec->used_by_bfd))->head);
-      return
-       ! abfd->tdata.mmo_data->have_error
-       && mmo_write_chunk_list (abfd,
-                                ((struct mmo_section_data_struct *)
-                                 (sec->used_by_bfd))->head);
+       return (! abfd->tdata.mmo_data->have_error
+               && mmo_write_loc_chunk_list (abfd,
+                                            mmo_section_data (sec)->head));
+      return (! abfd->tdata.mmo_data->have_error
+             && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
     }
   return TRUE;
 }
index 494e155..3c39386 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for oasys objects.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002
-   Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001,
+   2002, 2003 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.
@@ -864,7 +864,7 @@ oasys_get_section_contents (abfd, section, location, offset, count)
      file_ptr offset;
      bfd_size_type count;
 {
-  oasys_per_section_type *p = (oasys_per_section_type *) section->used_by_bfd;
+  oasys_per_section_type *p = oasys_per_section (section);
   oasys_slurp_section_data (abfd);
   if (! p->initialized)
     {
index 89ed7d0..cf0121a 100644 (file)
@@ -1,12 +1,12 @@
 # Danish messages for bfd.
 # Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-# Keld Simonsen <keld@dkuug.dk>, 2002
+# Keld Simonsen <keld@dkuug.dk>, 2002-2003
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: bfd 2.12.91\n"
 "POT-Creation-Date: 2002-07-23 15:55-0400\n"
-"PO-Revision-Date: 2002-11-09 23:25+0100\n"
+"PO-Revision-Date: 2003-03-01 23:25+0100\n"
 "Last-Translator: Keld Simonsen <keld@dkuug.dk>\n"
 "Language-Team: Danish <dansk@klid.dk>\n"
 "MIME-Version: 1.0\n"
@@ -1179,14 +1179,14 @@ msgid "%s: error: unaligned relocation type %d at %08x reloc %08x\n"
 msgstr "%s: fejl: ujusteret relokeringstype %d pÃ¥ %08x relokering %08x\n"
 
 #: elf32-sh64.c:677
-#, fuzzy, c-format
+#, c-format
 msgid "%s: could not write out added .cranges entries"
-msgstr "%s: kunne ikke udskrive tilføjede .crangives-poster"
+msgstr "%s: kunne ikke udskrive tilføjede .cranges-poster"
 
 #: elf32-sh64.c:739
-#, fuzzy, c-format
+#, c-format
 msgid "%s: could not write out sorted .cranges entries"
-msgstr "%s: kunne ikke udskrive sorterede crangives-poster"
+msgstr "%s: kunne ikke udskrive sorterede cranges-poster"
 
 #: elf32-sparc.c:1535 elf64-sparc.c:2224
 #, c-format
@@ -1204,22 +1204,22 @@ msgid "%s: linking little endian files with big endian files"
 msgstr "%s: lænker little endian-filer med big endian-filer"
 
 #: elf32-v850.c:682
-#, fuzzy, c-format
+#, c-format
 msgid "Variable `%s' cannot occupy in multiple small data regions"
 msgstr "Variabel \"%s\" kan ikke befinde sig i flere smÃ¥ dataomrÃ¥der"
 
 #: elf32-v850.c:685
-#, fuzzy, c-format
+#, c-format
 msgid "Variable `%s' can only be in one of the small, zero, and tiny data regions"
-msgstr "Variabel \"%s\" kan kun være i et af de smÃ¥, tomme og bittesmÃ¥ dataomrÃ¥der"
+msgstr "Variabel \"%s\" kan kun være i Ã©t af de smÃ¥, tomme og bittesmÃ¥ dataomrÃ¥der"
 
 #: elf32-v850.c:688
-#, fuzzy, c-format
+#, c-format
 msgid "Variable `%s' cannot be in both small and zero data regions simultaneously"
 msgstr "Variabel \"%s\" kan ikke være i bÃ¥de smÃ¥ og tomme dataomrÃ¥der samtidigt"
 
 #: elf32-v850.c:691
-#, fuzzy, c-format
+#, c-format
 msgid "Variable `%s' cannot be in both small and tiny data regions simultaneously"
 msgstr "Variabel \"%s\" kan ikke være i bÃ¥de smÃ¥ og bittesmÃ¥ dataomrÃ¥der samtidigt"
 
index 147b746..45660c8 100644 (file)
@@ -2080,7 +2080,10 @@ ENUM
   BFD_RELOC_PCREL_LO16
 ENUMDOC
   Like BFD_RELOC_LO16, but PC relative.
-
+ENUM
+  BFD_RELOC_MIPSEMB_16_PCREL_S2
+ENUMDOC
+  Like BFD_RELOC_16_PCREL_S2, but for MIPS Embedded PIC.
 ENUM
   BFD_RELOC_MIPS_LITERAL
 ENUMDOC
@@ -2150,7 +2153,6 @@ ENUMX
 ENUMDOC
   Fujitsu Frv Relocations.
 COMMENT
-COMMENT
 ENUMDOC
   MIPS ELF relocations.
 
@@ -2393,6 +2395,89 @@ ENUMDOC
   Power(rs6000) and PowerPC relocations.
 
 ENUM
+  BFD_RELOC_PPC_TLS
+ENUMX
+  BFD_RELOC_PPC_DTPMOD
+ENUMX
+  BFD_RELOC_PPC_TPREL16
+ENUMX
+  BFD_RELOC_PPC_TPREL16_LO
+ENUMX
+  BFD_RELOC_PPC_TPREL16_HI
+ENUMX
+  BFD_RELOC_PPC_TPREL16_HA
+ENUMX
+  BFD_RELOC_PPC_TPREL
+ENUMX
+  BFD_RELOC_PPC_DTPREL16
+ENUMX
+  BFD_RELOC_PPC_DTPREL16_LO
+ENUMX
+  BFD_RELOC_PPC_DTPREL16_HI
+ENUMX
+  BFD_RELOC_PPC_DTPREL16_HA
+ENUMX
+  BFD_RELOC_PPC_DTPREL
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSGD16
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSGD16_LO
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSGD16_HI
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSGD16_HA
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSLD16
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSLD16_LO
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSLD16_HI
+ENUMX
+  BFD_RELOC_PPC_GOT_TLSLD16_HA
+ENUMX
+  BFD_RELOC_PPC_GOT_TPREL16
+ENUMX
+  BFD_RELOC_PPC_GOT_TPREL16_LO
+ENUMX
+  BFD_RELOC_PPC_GOT_TPREL16_HI
+ENUMX
+  BFD_RELOC_PPC_GOT_TPREL16_HA
+ENUMX
+  BFD_RELOC_PPC_GOT_DTPREL16
+ENUMX
+  BFD_RELOC_PPC_GOT_DTPREL16_LO
+ENUMX
+  BFD_RELOC_PPC_GOT_DTPREL16_HI
+ENUMX
+  BFD_RELOC_PPC_GOT_DTPREL16_HA
+ENUMX
+  BFD_RELOC_PPC64_TPREL16_DS
+ENUMX
+  BFD_RELOC_PPC64_TPREL16_LO_DS
+ENUMX
+  BFD_RELOC_PPC64_TPREL16_HIGHER
+ENUMX
+  BFD_RELOC_PPC64_TPREL16_HIGHERA
+ENUMX
+  BFD_RELOC_PPC64_TPREL16_HIGHEST
+ENUMX
+  BFD_RELOC_PPC64_TPREL16_HIGHESTA
+ENUMX
+  BFD_RELOC_PPC64_DTPREL16_DS
+ENUMX
+  BFD_RELOC_PPC64_DTPREL16_LO_DS
+ENUMX
+  BFD_RELOC_PPC64_DTPREL16_HIGHER
+ENUMX
+  BFD_RELOC_PPC64_DTPREL16_HIGHERA
+ENUMX
+  BFD_RELOC_PPC64_DTPREL16_HIGHEST
+ENUMX
+  BFD_RELOC_PPC64_DTPREL16_HIGHESTA
+ENUMDOC
+  PowerPC and PowerPC64 thread-local storage relocations.
+
+ENUM
   BFD_RELOC_I370_D12
 ENUMDOC
   IBM 370/390 relocations
index 35a0e5a..89f8126 100644 (file)
@@ -1,6 +1,6 @@
 /* Object file "section" support for the BFD library.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -377,10 +377,35 @@ CODE_FRAGMENT
 .  {* A mark flag used by some linker backends for garbage collection.  *}
 .  unsigned int gc_mark : 1;
 .
-.  {* Used by the ELF code to mark sections which have been allocated
-.     to segments.  *}
+.  {* The following flags are used by the ELF linker. *}
+.
+.  {* Mark sections which have been allocated to segments.  *}
 .  unsigned int segment_mark : 1;
 .
+.  {* Type of sec_info information.  *}
+.  unsigned int sec_info_type:3;
+.#define ELF_INFO_TYPE_NONE      0
+.#define ELF_INFO_TYPE_STABS     1
+.#define ELF_INFO_TYPE_MERGE     2
+.#define ELF_INFO_TYPE_EH_FRAME  3
+.#define ELF_INFO_TYPE_JUST_SYMS 4
+.
+.  {* Nonzero if this section uses RELA relocations, rather than REL.  *}
+.  unsigned int use_rela_p:1;
+.
+.  {* Bits used by various backends.  *}
+.  unsigned int has_tls_reloc:1;
+.
+.  {* Usused bits.  *}
+.  unsigned int flag11:1;
+.  unsigned int flag12:1;
+.  unsigned int flag13:1;
+.  unsigned int flag14:1;
+.  unsigned int flag15:1;
+.  unsigned int flag16:4;
+.  unsigned int flag20:4;
+.  unsigned int flag24:8;
+.
 .  {* End of internal packed boolean fields.  *}
 .
 .  {*  The virtual memory address of the section - where it will be
@@ -590,6 +615,12 @@ static const asymbol global_syms[] =
     /* linker_mark, linker_has_input, gc_mark, segment_mark,         */        \
        0,           0,                1,       0,                      \
                                                                        \
+    /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12,     */ \
+       0,            0,          0,             0,      0,             \
+                                                                       \
+    /* flag13, flag14, flag15, flag16, flag20, flag24,               */ \
+       0,      0,      0,      0,      0,      0,                      \
+                                                                       \
     /* vma, lma, _cooked_size, _raw_size,                            */        \
        0,   0,   0,            0,                                      \
                                                                        \
index d95589b..d65a868 100644 (file)
@@ -1,24 +1,24 @@
 /* Generic symbol-table support for the BFD library.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /*
 SECTION
@@ -74,9 +74,9 @@ SUBSECTION
 |         if (storage_needed < 0)
 |           FAIL
 |
-|        if (storage_needed == 0) {
-|           return ;
-|        }
+|        if (storage_needed == 0)
+|          return;
+|        
 |        symbol_table = (asymbol **) xmalloc (storage_needed);
 |          ...
 |        number_of_symbols =
@@ -85,9 +85,8 @@ SUBSECTION
 |         if (number_of_symbols < 0)
 |           FAIL
 |
-|        for (i = 0; i < number_of_symbols; i++) {
-|           process_symbol (symbol_table[i]);
-|        }
+|        for (i = 0; i < number_of_symbols; i++)
+|          process_symbol (symbol_table[i]);
 
        All storage for the symbols themselves is in an objalloc
        connected to the BFD; it is freed when the BFD is closed.
@@ -108,25 +107,26 @@ SUBSECTION
        example showing the creation of a symbol table with only one element:
 
 |      #include "bfd.h"
-|      main()
+|      int main (void)
 |      {
 |        bfd *abfd;
 |        asymbol *ptrs[2];
 |        asymbol *new;
 |
-|        abfd = bfd_openw("foo","a.out-sunos-big");
-|        bfd_set_format(abfd, bfd_object);
-|        new = bfd_make_empty_symbol(abfd);
+|        abfd = bfd_openw ("foo","a.out-sunos-big");
+|        bfd_set_format (abfd, bfd_object);
+|        new = bfd_make_empty_symbol (abfd);
 |        new->name = "dummy_symbol";
-|        new->section = bfd_make_section_old_way(abfd, ".text");
+|        new->section = bfd_make_section_old_way (abfd, ".text");
 |        new->flags = BSF_GLOBAL;
 |        new->value = 0x12345;
 |
 |        ptrs[0] = new;
 |        ptrs[1] = (asymbol *)0;
 |
-|        bfd_set_symtab(abfd, ptrs, 1);
-|        bfd_close(abfd);
+|        bfd_set_symtab (abfd, ptrs, 1);
+|        bfd_close (abfd);
+|        return 0;
 |      }
 |
 |      ./makesym
@@ -192,7 +192,7 @@ CODE_FRAGMENT
 .     instead, except that some symbols point to the global sections
 .     bfd_{abs,com,und}_section.  This could be fixed by making
 .     these globals be per-bfd (or per-target-flavor).  FIXME.  *}
-.  struct _bfd *the_bfd; {* Use bfd_asymbol_bfd(sym) to access this field.  *}
+.  struct bfd *the_bfd; {* Use bfd_asymbol_bfd(sym) to access this field.  *}
 .
 .  {* The text of the symbol. The name is left alone, and not copied; the
 .     application may not alter it.  *}
@@ -346,7 +346,7 @@ FUNCTION
        bfd_is_local_label
 
 SYNOPSIS
-        bfd_boolean bfd_is_local_label(bfd *abfd, asymbol *sym);
+        bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
 
 DESCRIPTION
        Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
@@ -438,7 +438,7 @@ FUNCTION
        bfd_print_symbol_vandf
 
 SYNOPSIS
-       void bfd_print_symbol_vandf(bfd *abfd, PTR file, asymbol *symbol);
+       void bfd_print_symbol_vandf (bfd *abfd, PTR file, asymbol *symbol);
 
 DESCRIPTION
        Print the value and flags of the @var{symbol} supplied to the
@@ -451,16 +451,14 @@ bfd_print_symbol_vandf (abfd, arg, symbol)
      asymbol *symbol;
 {
   FILE *file = (FILE *) arg;
+
   flagword type = symbol->flags;
+
   if (symbol->section != (asection *) NULL)
-    {
-      bfd_fprintf_vma (abfd, file,
-                      symbol->value + symbol->section->vma);
-    }
+    bfd_fprintf_vma (abfd, file,
+                    symbol->value + symbol->section->vma);
   else
-    {
-      bfd_fprintf_vma (abfd, file, symbol->value);
-    }
+    bfd_fprintf_vma (abfd, file, symbol->value);
 
   /* This presumes that a symbol can not be both BSF_DEBUGGING and
      BSF_DYNAMIC, nor more than one of BSF_FUNCTION, BSF_FILE, and
@@ -504,7 +502,7 @@ FUNCTION
        _bfd_generic_make_empty_symbol
 
 SYNOPSIS
-       asymbol *_bfd_generic_make_empty_symbol (bfd *);
+       asymbol * _bfd_generic_make_empty_symbol (bfd *);
 
 DESCRIPTION
        Create a new <<asymbol>> structure for the BFD @var{abfd}
@@ -634,7 +632,7 @@ DESCRIPTION
        class of @var{symbol}, or '?' for an unknown class.
 
 SYNOPSIS
-       int bfd_decode_symclass(asymbol *symbol);
+       int bfd_decode_symclass (asymbol *symbol);
 */
 int
 bfd_decode_symclass (symbol)
@@ -726,7 +724,7 @@ DESCRIPTION
        calling this function.
 
 SYNOPSIS
-       void bfd_symbol_info(asymbol *symbol, symbol_info *ret);
+       void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
 */
 
 void
@@ -749,7 +747,7 @@ FUNCTION
        bfd_copy_private_symbol_data
 
 SYNOPSIS
-       bfd_boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
+       bfd_boolean bfd_copy_private_symbol_data (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
 
 DESCRIPTION
        Copy private symbol information from @var{isym} in the BFD
@@ -816,7 +814,6 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep)
    an asymbol.  We don't worry about the sym argument we are passed;
    we just return the asymbol the minisymbol points to.  */
 
-/*ARGSUSED*/
 asymbol *
 _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym)
      bfd *abfd ATTRIBUTE_UNUSED;
@@ -1245,12 +1242,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
   else
 #endif
     {
-      /* Cache non-existant or invalid.  Do binary search on
-         indextable.  */
-
       long low, high;
       long mid = -1;
 
+      /* Cache non-existant or invalid.  Do binary search on
+         indextable.  */
       indexentry = NULL;
 
       low = 0;
@@ -1305,9 +1301,11 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
        case N_SLINE:
        case N_DSLINE:
        case N_BSLINE:
-         /* A line number.  The value is relative to the start of the
-             current function.  */
-         val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
+         /* A line number.  If the function was specified, then the value
+            is relative to the start of the function.  Otherwise, the
+            value is an absolute address.  */
+         val = ((indexentry->function_name ? indexentry->val : 0)
+                + bfd_get_32 (abfd, stab + VALOFF));
          /* If this line starts before our desired offset, or if it's
             the first line we've been able to find, use it.  The
             !saw_line check works around a bug in GCC 2.95.3, which emits
@@ -1376,7 +1374,6 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound,
       /* This will typically be something like main:F(0,1), so we want
          to clobber the colon.  It's OK to change the name, since the
          string is in our own local storage anyhow.  */
-
       s = strchr (indexentry->function_name, ':');
       if (s != NULL)
        *s = '\0';
index c541c11..2211e12 100644 (file)
@@ -763,7 +763,7 @@ static const bfd_target * const _bfd_target_vector[] = {
 #endif
        &aout0_big_vec,
 #if 0
-       /* We have no way of distinguishing these from other a.out variants */
+       /* We have no way of distinguishing these from other a.out variants */
        &aout_arm_big_vec,
        &aout_arm_little_vec,
        /* No one seems to use this.  */
@@ -909,7 +909,7 @@ static const bfd_target * const _bfd_target_vector[] = {
        &bfd_powerpcle_pei_vec,
        &cris_aout_vec,
 #ifdef BFD64
-       &demo_64_vec,   /* Only compiled if host has long-long support */
+       &demo_64_vec,   /* Only compiled if host has long-long support */
 #endif
        &ecoff_big_vec,
        &ecoff_biglittle_vec,
@@ -1011,7 +1011,7 @@ static const bfd_target * const _bfd_target_vector[] = {
 #endif
        &ppcboot_vec,
 #if 0
-       /* We have no way of distinguishing these from other a.out variants */
+       /* We have no way of distinguishing these from other a.out variants */
        &riscix_vec,
 #endif
 #ifdef BFD64
@@ -1221,7 +1221,7 @@ FUNCTION
        bfd_find_target
 
 SYNOPSIS
-       const bfd_target *bfd_find_target(const char *target_name, bfd *abfd);
+       const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
 
 DESCRIPTION
        Return a pointer to the transfer vector for the object target
@@ -1274,7 +1274,7 @@ FUNCTION
        bfd_target_list
 
 SYNOPSIS
-       const char **bfd_target_list(void);
+       const char ** bfd_target_list (void);
 
 DESCRIPTION
        Return a freshly malloced NULL-terminated
@@ -1319,7 +1319,9 @@ FUNCTION
        bfd_seach_for_target
 
 SYNOPSIS
-       const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);
+       const bfd_target * bfd_search_for_target (int (* search_func)
+                                                 (const bfd_target *, void *),
+                                                 void *);
 
 DESCRIPTION
        Return a pointer to the first transfer vector in the list of
index 727b55b..3a264cb 100644 (file)
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20030203
+#define BFD_VERSION_DATE 20030303
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING @bfd_version_string@
index ca12b79..4fc21ec 100755 (executable)
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-01-03'
+timestamp='2003-01-30'
 
 # 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
@@ -242,65 +242,47 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        if test $UNAME_RELEASE = "V4.0"; then
                UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
        fi
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
        # A Vn.n version is a released version.
        # 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.
-       eval $set_cc_for_build
-       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
-       $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
-       if test "$?" = 0 ; then
-               case `$dummy` in
-                       0-0)
-                               UNAME_MACHINE="alpha"
-                               ;;
-                       1-0)
-                               UNAME_MACHINE="alphaev5"
-                               ;;
-                       1-1)
-                               UNAME_MACHINE="alphaev56"
-                               ;;
-                       1-101)
-                               UNAME_MACHINE="alphapca56"
-                               ;;
-                       2-303)
-                               UNAME_MACHINE="alphaev6"
-                               ;;
-                       2-307)
-                               UNAME_MACHINE="alphaev67"
-                               ;;
-                       2-1307)
-                               UNAME_MACHINE="alphaev68"
-                               ;;
-                       3-1307)
-                               UNAME_MACHINE="alphaev7"
-                               ;;
-               esac
-       fi
        echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
        exit 0 ;;
     Alpha\ *:Windows_NT*:*)
@@ -1152,7 +1134,11 @@ EOF
        echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
        exit 0 ;;
     *:Darwin:*:*)
-       echo `uname -p`-apple-darwin${UNAME_RELEASE}
+       case `uname -p` in
+           *86) UNAME_PROCESSOR=i686 ;;
+           powerpc) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
        exit 0 ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
        UNAME_PROCESSOR=`uname -p`
index 04baf3d..5f94062 100755 (executable)
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-01-03'
+timestamp='2003-02-03'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -257,7 +257,7 @@ case $basic_machine in
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
-       | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
        | strongarm \
@@ -296,7 +296,7 @@ case $basic_machine in
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
        | avr-* \
        | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
        | clipper-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
        | elxsi-* \
@@ -329,11 +329,13 @@ case $basic_machine in
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
        | pyramid-* \
        | romp-* | rs6000-* \
-       | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+       | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
        | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
        | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
        | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
@@ -925,6 +927,14 @@ case $basic_machine in
                basic_machine=tic54x-unknown
                os=-coff
                ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
@@ -1027,7 +1037,7 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+       sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
                basic_machine=sh-unknown
                ;;
        sh64)
@@ -1227,6 +1237,12 @@ case $os in
        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
                os=-mint
                ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
        -none)
                ;;
        *)
index a6fc0f0..80edfe1 100755 (executable)
--- a/configure
+++ b/configure
@@ -16,6 +16,9 @@ ac_help="$ac_help
                           Don't force sequential configuration of
                           sub-packages for the host, target or build
                          machine, or of any sub-packages at all"
+ac_help="$ac_help
+  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -574,7 +577,7 @@ 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:578: checking host system type" >&5
+echo "configure:592: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -595,7 +598,7 @@ 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:599: checking target system type" >&5
+echo "configure:613: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -613,7 +616,7 @@ 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:617: checking build system type" >&5
+echo "configure:631: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -792,7 +795,7 @@ fi
 
 # these libraries are used by various programs built for the host environment
 #
-host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk itcl tix libgui zlib"
+host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib"
 
 libstdcxx_version="target-libstdc++-v3"
 
@@ -801,7 +804,7 @@ libstdcxx_version="target-libstdc++-v3"
 # know that we are building the simulator.
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
-host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator gettext zip fastjar"
+host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -915,7 +918,7 @@ esac
 
 # Some tools are only suitable for building in a "native" situation.
 # Remove these if host!=target.  
-native_only="autoconf automake libtool fileutils find gawk gettext grep gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms snavigator gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
 
 # Similarly, some are only suitable for cross toolchains.
 # Remove these if host=target.
@@ -956,13 +959,13 @@ case "${host}" in
     noconfigdirs="$noconfigdirs byacc"
     ;;
   i[3456]86-*-vsta)
-    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv gettext"
+    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext"
     ;;
   i[3456]86-*-go32* | i[3456]86-*-msdosdjgpp*)
-    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix db snavigator gnuserv libffi"
+    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi"
        ;;
   i[3456]86-*-mingw32*)
-    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv"
+    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv"
      noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool"
        ;;
   i[3456]86-*-beos*)
@@ -975,7 +978,7 @@ case "${host}" in
     noconfigdirs="rcs"
     ;;
   ppc*-*-pe)
-     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix db snavigator gnuserv"
+     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
@@ -1005,9 +1008,20 @@ case "${target}" in
   *-*-chorusos)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;;
+  *-*-darwin*)
+    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
+    noconfigdirs="$noconfigdirs target-libobjc ${libgcj}"
+    ;;
   *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;;
+  *-*-kaos*)
+    # Remove unsupported stuff on all kaOS configurations.
+    skipdirs="target-libiberty ${libgcj} ${libstdcxx_version} target-libf2c target-librx"
+    skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf"
+    skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib"
+    noconfigdirs="$noconfigdirs target-libgloss"
+    ;;
   *-*-netbsd*)
     # Skip some stuff on all NetBSD configurations.
     noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
@@ -1192,7 +1206,7 @@ case "${target}" in
     # Can't build gdb for mingw32 if not native.
     case "${host}" in
       i[3456]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
-      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
+      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix gnuserv"
          ;;
     esac
     ;;    
@@ -1205,7 +1219,7 @@ case "${target}" in
     # Can't build gdb for Cygwin if not native.
     case "${host}" in
       *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
-      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
+      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui gnuserv"
          ;;
     esac
     ;;    
@@ -1258,20 +1272,17 @@ case "${target}" in
     ;;
   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
     target_configdirs="$target_configdirs target-winsup"
-    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv ${libgcj}"
+    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix gnuserv ${libgcj}"
     # always build newlib.
     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
     ;;
     # This is temporary until we can link against shared libraries
   powerpcle-*-solaris*)
-    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv ${libgcj}"
+    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix gnuserv ${libgcj}"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
     ;;
-  powerpc-*-darwin*)
-    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof ${libgcj}"
-    ;;
   powerpc-*-eabi)
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
@@ -2737,7 +2748,7 @@ test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
   # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2741: checking for $ac_word" >&5
+echo "configure:2763: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2770,7 +2781,7 @@ if test -z "$ac_cv_prog_AR" ; then
     # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2774: checking for $ac_word" >&5
+echo "configure:2796: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2809,7 +2820,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2813: checking for $ac_word" >&5
+echo "configure:2835: 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
@@ -2842,7 +2853,7 @@ if test -z "$ac_cv_prog_AS" ; 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:2846: checking for $ac_word" >&5
+echo "configure:2868: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2881,7 +2892,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2885: checking for $ac_word" >&5
+echo "configure:2907: 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
@@ -2914,7 +2925,7 @@ if test -z "$ac_cv_prog_DLLTOOL" ; 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:2918: checking for $ac_word" >&5
+echo "configure:2940: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2953,7 +2964,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2957: checking for $ac_word" >&5
+echo "configure:2979: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2986,7 +2997,7 @@ if test -z "$ac_cv_prog_LD" ; then
     # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2990: checking for $ac_word" >&5
+echo "configure:3012: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3025,7 +3036,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3029: checking for $ac_word" >&5
+echo "configure:3051: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3058,7 +3069,7 @@ if test -z "$ac_cv_prog_NM" ; then
     # Extract the first word of "nm", so it can be a program name with args.
 set dummy nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3062: checking for $ac_word" >&5
+echo "configure:3084: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3097,7 +3108,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3101: checking for $ac_word" >&5
+echo "configure:3123: 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
@@ -3130,7 +3141,7 @@ if test -z "$ac_cv_prog_RANLIB" ; then
     # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3134: checking for $ac_word" >&5
+echo "configure:3156: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3169,7 +3180,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3173: checking for $ac_word" >&5
+echo "configure:3195: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3202,7 +3213,7 @@ if test -z "$ac_cv_prog_WINDRES" ; then
     # Extract the first word of "windres", so it can be a program name with args.
 set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3206: checking for $ac_word" >&5
+echo "configure:3228: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3241,7 +3252,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}objcopy; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3245: checking for $ac_word" >&5
+echo "configure:3267: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3274,7 +3285,7 @@ if test -z "$ac_cv_prog_OBJCOPY" ; then
     # Extract the first word of "objcopy", so it can be a program name with args.
 set dummy objcopy; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3278: checking for $ac_word" >&5
+echo "configure:3300: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3313,7 +3324,7 @@ fi
   # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args.
 set dummy ${ncn_tool_prefix}objdump; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3317: checking for $ac_word" >&5
+echo "configure:3339: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3346,7 +3357,7 @@ if test -z "$ac_cv_prog_OBJDUMP" ; then
     # Extract the first word of "objdump", so it can be a program name with args.
 set dummy objdump; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3350: checking for $ac_word" >&5
+echo "configure:3372: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3394,7 +3405,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3398: checking for $ac_word" >&5
+echo "configure:3420: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3427,7 +3438,7 @@ if test -z "$ac_cv_prog_AR_FOR_TARGET" ; then
     # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3431: checking for $ac_word" >&5
+echo "configure:3453: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3466,7 +3477,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3470: checking for $ac_word" >&5
+echo "configure:3492: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3499,7 +3510,7 @@ if test -z "$ac_cv_prog_AS_FOR_TARGET" ; 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:3503: checking for $ac_word" >&5
+echo "configure:3525: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3538,7 +3549,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3542: checking for $ac_word" >&5
+echo "configure:3564: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3571,7 +3582,7 @@ if test -z "$ac_cv_prog_DLLTOOL_FOR_TARGET" ; 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:3575: checking for $ac_word" >&5
+echo "configure:3597: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3610,7 +3621,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3614: checking for $ac_word" >&5
+echo "configure:3636: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3643,7 +3654,7 @@ if test -z "$ac_cv_prog_LD_FOR_TARGET" ; then
     # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3647: checking for $ac_word" >&5
+echo "configure:3669: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3682,7 +3693,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3686: checking for $ac_word" >&5
+echo "configure:3708: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3715,7 +3726,7 @@ if test -z "$ac_cv_prog_NM_FOR_TARGET" ; then
     # Extract the first word of "nm", so it can be a program name with args.
 set dummy nm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3719: checking for $ac_word" >&5
+echo "configure:3741: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3754,7 +3765,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3758: checking for $ac_word" >&5
+echo "configure:3780: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3787,7 +3798,7 @@ if test -z "$ac_cv_prog_RANLIB_FOR_TARGET" ; then
     # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3791: checking for $ac_word" >&5
+echo "configure:3813: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3826,7 +3837,7 @@ fi
   # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ncn_target_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3830: checking for $ac_word" >&5
+echo "configure:3852: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3859,7 +3870,7 @@ if test -z "$ac_cv_prog_WINDRES_FOR_TARGET" ; then
     # Extract the first word of "windres", so it can be a program name with args.
 set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3863: checking for $ac_word" >&5
+echo "configure:3885: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES_FOR_TARGET'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3925,6 +3936,28 @@ AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
 
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:3952: 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"
+  USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+
+
+if test "$USE_MAINTAINER_MODE" = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi     
+MAINT=$MAINTAINER_MODE_TRUE
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -3991,34 +4024,15 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
 # Transform confdefs.h into DEFS.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then we branch to the quote section.  Otherwise,
-# look for a macro that doesn't take arguments.
-cat >confdef2opt.sed <<\_ACEOF
-t clear
-: clear
-s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
-t quote
-s,^[   ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\),-D\1=\2,g
-t quote
-d
-: quote
-s,[    `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
-p
-_ACEOF
-# We use echo to avoid assuming a particular line-breaking character.
-# The extra dot is to prevent the shell from consuming trailing
-# line-breaks from the sub-command output.  A line-break within
-# single-quotes doesn't work because, if this script is created in a
-# platform that uses two characters for line-breaks (e.g., DOS), tr
-# would break.
-ac_LF_and_DOT=`echo; echo .`
-DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
-rm -f confdef2opt.sed
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[    `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
 
 
 # Without the "./", some shells look in PATH for config.status.
@@ -4200,6 +4214,9 @@ s%@CXX_FOR_TARGET@%$CXX_FOR_TARGET%g
 s%@RAW_CXX_FOR_TARGET@%$RAW_CXX_FOR_TARGET%g
 s%@CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%$CXX_FOR_TARGET_FOR_RECURSIVE_MAKE%g
 s%@RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%$RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE%g
+s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
+s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
+s%@MAINT@%$MAINT%g
 
 CEOF
 EOF
index 4fd42ed..2cd0997 100644 (file)
@@ -135,7 +135,7 @@ fi
 
 # these libraries are used by various programs built for the host environment
 #
-host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk itcl tix libgui zlib"
+host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl tix libgui zlib"
 
 libstdcxx_version="target-libstdc++-v3"
 
@@ -144,7 +144,7 @@ libstdcxx_version="target-libstdc++-v3"
 # know that we are building the simulator.
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
-host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool grep diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils snavigator gettext zip fastjar"
+host_tools="texinfo byacc flex bison binutils gas ld gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -258,7 +258,7 @@ esac
 
 # Some tools are only suitable for building in a "native" situation.
 # Remove these if host!=target.  
-native_only="autoconf automake libtool fileutils find gawk gettext grep gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms snavigator gnuserv target-gperf"
+native_only="autoconf automake libtool fileutils find gawk gettext gzip hello indent m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl time ash bash bzip2 prms gnuserv target-gperf"
 
 # Similarly, some are only suitable for cross toolchains.
 # Remove these if host=target.
@@ -299,13 +299,13 @@ case "${host}" in
     noconfigdirs="$noconfigdirs byacc"
     ;;
   i[[3456]]86-*-vsta)
-    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv gettext"
+    noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff guile perl itcl tix gnuserv gettext"
     ;;
   i[[3456]]86-*-go32* | i[[3456]]86-*-msdosdjgpp*)
-    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix db snavigator gnuserv libffi"
+    noconfigdirs="tcl tk expect dejagnu send-pr uudecode guile itcl tix gnuserv libffi"
        ;;
   i[[3456]]86-*-mingw32*)
-    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix db snavigator gnuserv"
+    # noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr uudecode dejagnu diff guile perl itcl tix gnuserv"
      noconfigdirs="expect dejagnu autoconf automake send-pr rcs guile perl texinfo libtool"
        ;;
   i[[3456]]86-*-beos*)
@@ -318,7 +318,7 @@ case "${host}" in
     noconfigdirs="rcs"
     ;;
   ppc*-*-pe)
-     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix db snavigator gnuserv"
+     noconfigdirs="patch diff make tk tcl expect dejagnu autoconf automake texinfo bison send-pr gprof rcs guile perl itcl tix gnuserv"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs tk itcl tix libgui gdb dejagnu readline"
@@ -348,9 +348,20 @@ case "${target}" in
   *-*-chorusos)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;;
+  *-*-darwin*)
+    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
+    noconfigdirs="$noconfigdirs target-libobjc ${libgcj}"
+    ;;
   *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
     noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
     ;;
+  *-*-kaos*)
+    # Remove unsupported stuff on all kaOS configurations.
+    skipdirs="target-libiberty ${libgcj} ${libstdcxx_version} target-libf2c target-librx"
+    skipdirs="$skipdirs target-libobjc target-examples target-groff target-gperf"
+    skipdirs="$skipdirs zlib fastjar target-libjava target-boehm-gc target-zlib"
+    noconfigdirs="$noconfigdirs target-libgloss"
+    ;;
   *-*-netbsd*)
     # Skip some stuff on all NetBSD configurations.
     noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
@@ -535,7 +546,7 @@ case "${target}" in
     # Can't build gdb for mingw32 if not native.
     case "${host}" in
       i[[3456]]86-*-mingw32) ;; # keep gdb tcl tk expect etc.
-      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix db snavigator gnuserv"
+      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix gnuserv"
          ;;
     esac
     ;;    
@@ -548,7 +559,7 @@ case "${target}" in
     # Can't build gdb for Cygwin if not native.
     case "${host}" in
       *-*-cygwin*) ;; # keep gdb tcl tk expect etc.
-      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui db snavigator gnuserv"
+      *) noconfigdirs="$noconfigdirs gdb tcl tk expect itcl tix libgui gnuserv"
          ;;
     esac
     ;;    
@@ -601,20 +612,17 @@ case "${target}" in
     ;;
   powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
     target_configdirs="$target_configdirs target-winsup"
-    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix db snavigator gnuserv ${libgcj}"
+    noconfigdirs="$noconfigdirs gdb tcl tk make expect target-libgloss itcl tix gnuserv ${libgcj}"
     # always build newlib.
     skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
     ;;
     # This is temporary until we can link against shared libraries
   powerpcle-*-solaris*)
-    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix db snavigator gnuserv ${libgcj}"
+    noconfigdirs="$noconfigdirs gdb sim make tcl tk expect itcl tix gnuserv ${libgcj}"
     ;;
   powerpc-*-beos*)
     noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
     ;;
-  powerpc-*-darwin*)
-    noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof ${libgcj}"
-    ;;
   powerpc-*-eabi)
     noconfigdirs="$noconfigdirs ${libgcj}"
     ;;
@@ -2126,4 +2134,23 @@ AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
 RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
 NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
 
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+AC_MSG_RESULT($USE_MAINTAINER_MODE)
+AC_SUBST(MAINTAINER_MODE_TRUE)
+AC_SUBST(MAINTAINER_MODE_FALSE)
+if test "$USE_MAINTAINER_MODE" = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi     
+MAINT=$MAINTAINER_MODE_TRUE
+AC_SUBST(MAINT)dnl
+
 AC_OUTPUT(Makefile)
index ab8db86..49ad68f 100644 (file)
+2003-03-03  Andrew Cagney  <cagney@redhat.com>
+
+       Make MAX_REGISTER_RAW_SIZE and MAX_REGISTER_VIRTUAL_SIZE optional.
+       * gdbarch.sh (DEPRECATED_MAX_REGISTER_RAW_SIZE): Variable with
+       predicate.  Replace MAX_REGISTER_RAW_SIZE.
+       (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE): Ditto for
+       MAX_REGISTER_VIRTUAL_SIZE.
+       * regcache.c (legacy_max_register_raw_size): New function.
+       (legacy_max_register_virtual_size): New function.
+       * defs.h (MAX_REGISTER_VIRTUAL_SIZE): Define.
+       (MAX_REGISTER_RAW_SIZE): Define.
+       (legacy_max_register_raw_size): Declare.
+       (legacy_max_register_virtual_size): Declare.
+       * config/sparc/tm-sparc.h (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+       (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE): Update.
+       * config/sparc/tm-sp64.h (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+       (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE): Ditto.
+       * config/pa/tm-hppa.h (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+       (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE): Ditto.
+       * config/pa/tm-hppa64.h (DEPRECATED_MAX_REGISTER_RAW_SIZE): Ditto.
+       * config/ia64/tm-ia64.h (DEPRECATED_MAX_REGISTER_RAW_SIZE): Ditto.
+       * config/i386/tm-ptx.h (DEPRECATED_MAX_REGISTER_RAW_SIZE): Ditto.
+       * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+       * vax-tdep.c (vax_gdbarch_init): Update.
+       * v850-tdep.c (v850_gdbarch_init): Update.
+       * sparc-tdep.c (sparc_gdbarch_init): Update.
+       * sh-tdep.c (sh_gdbarch_init): Update.
+       * s390-tdep.c (s390_gdbarch_init): Update.
+       * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+       * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+       * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+       * mips-tdep.c (mips_gdbarch_init): Update.
+       * mcore-tdep.c (mcore_gdbarch_init): Update.
+       * m68k-tdep.c (m68k_gdbarch_init): Update.
+       * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+       * ia64-tdep.c (ia64_gdbarch_init): Update.
+       * i386-tdep.c (i386_gdbarch_init): Update.
+       * hppa-tdep.c (hppa_gdbarch_init): Update.
+       * h8300-tdep.c (h8300_gdbarch_init): Update.
+       * frv-tdep.c (frv_gdbarch_init): Update.
+       * cris-tdep.c (cris_gdbarch_init): Update.
+       * avr-tdep.c (avr_gdbarch_init): Update.
+       * arm-tdep.c (arm_gdbarch_init): Update.
+       * alpha-tdep.c (alpha_gdbarch_init): Update.
+       * d10v-tdep.c (d10v_gdbarch_init): Do not set
+       max_register_raw_size or max_register_virtual_size.
+
+2003-03-03  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.h (DEPRECATED_SYMBOL_MATCHES_NAME): Rename from
+       SYMBOL_MATCHES_NAME, add comment.
+       (SYMBOL_MATCHES_NATURAL_NAME): New.
+       * minsyms.c (lookup_minimal_symbol_solib_trampoline): Replace
+       SYMBOL_MATCHES_NAME with DEPRECATED_SYMBOL_MATCHES_NAME.
+       (lookup_minimal_symbol, lookup_minimal_symbol_text): Ditto.
+       * symtab.c (lookup_partial_symbol): Use
+       SYMBOL_MATCHES_NATURAL_NAME, not SYMBOL_MATCHES_NAME.  Delete
+       unhelpful comment.
+       (lookup_block_symbol): Use SYMBOL_MATCHES_NATURAL_NAME, not
+       SYMBOL_MATCHES_NAME.
+       Fix for PR c++/33.
+
+2003-03-03  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.h (SYMBOL_MATCHES_REGEXP): Delete.
+       * symtab.c (search_symbols): Replace uses of SYMBOL_MATCHES_REGEXP
+       by regexp matching against SYMBOL_NATURAL_NAME.
+
+2003-03-03  David Carlton  <carlton@math.stanford.edu>
+
+       * linespec.c (find_method): Extract code into collect_methods.
+       (collect_methods): New.
+
+2003-03-02  Mark Kettenis  <kettenis@gnu.org>
+
+       * i386bsd-tdep.c (i386bsd_sigcontext_addr): Use get_next_frame and
+       get_frame_base.
+
+       * i386-tdep.c (i386_pe_skip_trampoline_code): Replace usage of
+       DEPRECATED_SYMBOL_NAME with SYMBOL_LINKAGE_NAME.
+
+2003-03-02  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * arch-utils.c (generic_register_byte): Fix to use the loop index 
+       and not regnum when summing the size of all registers up to regnum.
+
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * gdbarch.sh (DEPRECATED_FRAME_INIT_SAVED_REGS): Rename
+       FRAME_INIT_SAVED_REGS.
+       * gdbarch.h, gdbarch.c: Regenerate.
+       * stack.c (frame_info): Update.
+       * sh-tdep.c (sh_find_callers_reg, sh64_get_saved_pr): Update.
+       (sh_init_extra_frame_info, sh64_init_extra_frame_info): Update.
+       (sh64_get_saved_register, sh_pop_frame, sh64_pop_frame): Update.
+       * ns32k-tdep.c (ns32k_pop_frame): Update.
+       * mips-tdep.c (mips_pop_frame): Update.
+       * m68hc11-tdep.c (m68hc11_pop_frame): Update.
+       * ia64-tdep.c (ia64_frame_chain): Update.
+       (ia64_frame_saved_pc, ia64_get_saved_register): Update.
+       (ia64_frameless_function_invocation): Update.
+       (ia64_init_extra_frame_info): Update.
+       (ia64_pop_frame_regular): Update.
+       * frame.h (struct frame_info): Update comment.
+       (DEPRECATED_FRAME_INIT_SAVED_REGS): Rename macro.
+       * frame.c (frame_saved_regs_register_unwind): Update.
+       (frame_saved_regs_register_unwind): Update.
+       (deprecated_generic_get_saved_register): Update.
+       * cris-tdep.c: Update comment.
+       * config/sparc/tm-sparc.h (DEPRECATED_FRAME_INIT_SAVED_REGS):
+       Rename macro.
+       * xstormy16-tdep.c (xstormy16_gdbarch_init): Update.
+       * x86-64-tdep.c (x86_64_init_abi): Update.
+       * vax-tdep.c (vax_gdbarch_init): Update.
+       * v850-tdep.c (v850_gdbarch_init): Update.
+       * sparc-tdep.c (sparc_gdbarch_init): Update.
+       * sh-tdep.c (sh_gdbarch_init): Update.
+       * s390-tdep.c (s390_gdbarch_init): Update.
+       * rs6000-tdep.c (rs6000_gdbarch_init): Update.
+       * ppc-linux-tdep.c (ppc_linux_init_abi): Update.
+       * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+       * mn10300-tdep.c (mn10300_gdbarch_init): Update.
+       * mips-tdep.c (mips_gdbarch_init): Update.
+       * mcore-tdep.c (mcore_gdbarch_init): Update.
+       * m68k-tdep.c (m68k_gdbarch_init): Update.
+       * m68hc11-tdep.c (m68hc11_gdbarch_init): Update.
+       * ia64-tdep.c (ia64_gdbarch_init): Update.
+       * i386-tdep.c (i386_gdbarch_init): Update.
+       * frv-tdep.c (frv_gdbarch_init): Update.
+       * avr-tdep.c (avr_gdbarch_init): Update.
+       * arm-tdep.c (arm_gdbarch_init): Update.
+       * alpha-tdep.c (alpha_gdbarch_init): Update.
+       
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * main.c (captured_main): Add OPT_WINDOWS and OPT_NOWINDOWS to
+       option enum and switch.  When no windows, set the interpreter to
+       INTERP_CONSOLE.
+       
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * main.c (captured_main): Replace magic option characters with an
+       enum.
+
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * gdbarch.sh (DEPRECATED_INIT_EXTRA_FRAME_INFO): Rename
+       INIT_EXTRA_FRAME_INFO.
+       * gdbarch.h, gdbarch.c: Regenerate.
+       * arm-tdep.c: Update comments.
+       * sh-tdep.c, mcore-tdep.c, m68hc11-tdep.c: Ditto.
+       * i386-interix-tdep.c, hppa-tdep.c, h8300-tdep.c: Ditto.
+       * frame.h, avr-tdep.c: Ditto.
+       * frame.c (get_prev_frame): DEPRECATED_INIT_EXTRA_FRAME_INFO.
+       (create_new_frame, legacy_get_prev_frame): Ditto.
+       * config/sparc/tm-sparc.h (DEPRECATED_INIT_EXTRA_FRAME_INFO): Rename.
+       * config/pa/tm-hppa.h (DEPRECATED_INIT_EXTRA_FRAME_INFO): Rename.
+       * xstormy16-tdep.c (xstormy16_gdbarch_init): Initialize
+       deprecated_init_extra_frame_info instead of init_extra_frame_info.
+       * x86-64-tdep.c (x86_64_init_abi): Ditto.
+       * v850-tdep.c (v850_gdbarch_init): Ditto.
+       * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+       * sh-tdep.c (sh_gdbarch_init): Ditto.
+       * s390-tdep.c (s390_gdbarch_init): Ditto.
+       * ppc-linux-tdep.c (ppc_linux_init_abi): Ditto.
+       * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+       * mips-tdep.c (mips_gdbarch_init): Ditto.
+       * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+       * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+       * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+       * i386-interix-tdep.c (i386_interix_init_abi): Ditto.
+       * hppa-tdep.c (hppa_gdbarch_init): Ditto.
+       * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+       * frv-tdep.c (frv_gdbarch_init): Ditto.
+       * cris-tdep.c (cris_gdbarch_init): Ditto.
+       * avr-tdep.c (avr_gdbarch_init): Ditto.
+       * arm-tdep.c (arm_gdbarch_init): Ditto.
+       * alpha-tdep.c (alpha_gdbarch_init): Ditto.
+       * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * gdbarch.sh (register_type): New function with predicate.
+       (REGISTER_VIRTUAL_TYPE): Change to function with predicate.
+       * gdbarch.h, gdbarch.c: Re-generate.
+       * arch-utils.c (generic_register_byte): Use generic_register_size.
+       (generic_register_size): When available, use
+       gdbarch_register_type.
+       * regcache.c (init_regcache_descr): When available, initialize the
+       register type array using gdbarch_register_type.  If the
+       architecture supplies gdbarch_register_type, do not use the legacy
+       regcache layout.
+       * d10v-tdep.c (d10v_register_type): Replace
+       d10v_register_virtual_type.
+       (d10v_gdbarch_init): Set register_type instead of
+       register_virtual_type.
+
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * Makefile.in (ax-gdb.o): Update dependencies.
+       * ax-gdb.c: Include "regcache.h".
+       (gen_expr): Use register_type instead of REGISTER_VIRTUAL_TYPE.
+       * findvar.c (value_of_register): Ditto.
+       * infcmd.c (default_print_registers_info): Ditto.
+
+2003-03-01  Mark Kettenis  <kettenis@gnu.org>
+
+       * i386-linux-tdep.c (find_minsym_and_objfile): Replace usage of
+       DEPRECATED_SYMBOL_NAME with SYMBOL_LINKAGE_NAME.
+
+2003-03-01  Mark Kettenis  <kettenis@gnu.org>
+
+       * i386-linux-tdep.c (find_minsym_and_objfile): Use strcmp instead
+       of STREQ.
+
+2003-02-28  Daniel Jacobowitz  <drow@mvista.com>
+
+       * Makefile.in (dwarf2loc.o): Update dependencies.
+       * ax-gdb.c (gen_var_ref): Handle LOC_COMPUTED and LOC_COMPUTED_ARG.
+       * dwarf2expr.c (read_uleb128, read_sleb128): Make non-static.
+       * dwarf2expr.h (read_uleb128, read_sleb128): Add prototypes.
+       * dwarf2loc.c: Include "ax.h" and "ax-gdb.h".
+       (locexpr_tracepoint_var_ref): New function.
+       (dwarf2_locexpr_funcs): Add locexpr_tracepoint_var_ref.
+
+2003-02-28  Andrew Cagney  <cagney@redhat.com>
+
+       * regcache.c (register_size): New function.
+       * regcache.h (register_size): Declare
+       * d10v-tdep.c: Use register_size instead of REGISTER_RAW_SIZE, use
+       max_register_size instead of MAX_REGISTER_RAW_SIZE.
+
+2003-02-28  David Carlton  <carlton@math.stanford.edu>
+
+       * linespec.c (decode_compound): Extract code into find_method.
+       (find_method): New.
+
+2003-02-28  J. Brobecker  <brobecker@gnat.com>
+
+       * Makefile.in: Add rules to build and link in observer.o.
+
+2003-02-27  J. Brobecker  <brobecker@gnat.com>
+
+       * observer.c: Minor comments edits.
+
+2003-02-27  J. Brobecker  <brobecker@gnat.com>
+
+       * observer.h, observer.c: New file.
+
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * arm-tdep.c (gdb_print_insn_arm): Rename _bfd to just bfd.
+
+2003-02-27  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * m68hc11-tdep.c (M6811_OP_LDX_EXT, M6811_OP_STS_EXT): New defines.
+       (M6812_OP_STS_EXT): Likewise.
+       (m6811_prologue): Use the above to recognize prologue.
+       (m6812_prologue): Likewise.
+
+2003-02-27  David Carlton  <carlton@math.stanford.edu>
+
+       * symfile.c (compare_symbols): Use SYMBOL_NATURAL_NAME, not
+       SYMBOL_PRINT_NAME.
+       (compare_psymbols): Ditto.
+       * symtab.c (lookup_partial_symbol, lookup_block_symbol): Ditto.
+
+2003-02-27  Michael Snyder  <msnyder@redhat.com>
+
+       * f-lang.c (build_fortran_types): New function.
+       (_initialize_f_language): Gdbarch-register built-in fortran types.
+
+       * doublest.c (extract_floating): Fix warning text.
+
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * gdbarch.sh (DEPRECATED_PUSH_DUMMY_FRAME): Procedure with
+       predicate.  Replaces PUSH_DUMMY_FRAME.
+       * gdbarch.h, gdbarch.c: Regnerate.
+       * valops.c (hand_function_call): Update.  Call
+       generic_push_dummy_frame directly.
+       * vax-tdep.c (vax_gdbarch_init): Update.
+       * sparc-tdep.c (sparc_gdbarch_init): Update.
+       * ns32k-tdep.c (ns32k_gdbarch_init): Update.
+       * m68k-tdep.c (m68k_gdbarch_init): Update.
+       * hppa-tdep.c (hppa_gdbarch_init): Update.
+       * alpha-tdep.c (alpha_gdbarch_init): Update.
+       * config/sparc/tm-sparc.h (DEPRECATED_PUSH_DUMMY_FRAME): Update.
+       * config/pa/tm-hppa.h (DEPRECATED_PUSH_DUMMY_FRAME): Update.
+       * inferior.h (PUSH_DUMMY_FRAME): Delete definition.
+       * xstormy16-tdep.c (xstormy16_gdbarch_init): Don't set
+       push_dummy_frame to generic_push_dummy_frame.
+       * v850-tdep.c (v850_gdbarch_init): Ditto.
+       * sh-tdep.c (sh_gdbarch_init): Ditto.
+       * s390-tdep.c (s390_gdbarch_init): Ditto.
+       * rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
+       * mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
+       * mips-tdep.c (mips_gdbarch_init): Ditto.
+       * mcore-tdep.c (mcore_gdbarch_init): Ditto.
+       * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+       * ia64-tdep.c (ia64_gdbarch_init): Ditto.
+       * i386-tdep.c (i386_gdbarch_init): Ditto.
+       * h8300-tdep.c (h8300_gdbarch_init): Ditto.
+       * frv-tdep.c (frv_gdbarch_init): Ditto.
+       * d10v-tdep.c (d10v_gdbarch_init): Ditto.
+       * cris-tdep.c (cris_gdbarch_init): Ditto.
+       * avr-tdep.c (avr_gdbarch_init): Ditto.
+       * arm-tdep.c (arm_gdbarch_init): Ditto.
+       
+2003-02-26  Kevin Buettner  <kevinb@redhat.com>
+
+       * mips-tdep.c (show_mips_abi): New function.
+       (_initialize_mips_tdep): Use show_mips_abi() to implement the
+       command ``show mips abi''.
+
+2003-02-26  Jeff Johnston  <jjohnstn@redhat.com>
+       From Elena Zannoni  <ezannoni@redhat.com>
+       * dbxread.c (process_one_symbol): Only record line 0 if one or 
+       more sline entries have been seen for the function.
+
+2003-02-26  Michael Chastain  <mec@shout.net>
+
+       * configure: Regenerate with autoconf 000227.
+
+2003-02-26  Michael Chastain  <mec@shout.net>
+
+       Close PR build/660.
+       * PROBLEMS (i[3456]86-*-linux*): Note explicit error message
+       for old libc5/glibc.
+       * gdb_thread_db.h: Die if not HAVE_UINTPTR_T.
+
+2003-02-26  Kris Warkentin  <kewarken@qnx.com>
+
+       * defs.h (gdb_osabi): Add GDB_OSABI_QNXNTO.
+       * osabi.c (gdb_osabi_names): Add "QNX Neutrino".
+
+2003-02-26  Michael Chastain  <mec@shout.net>
+
+       * configure.in: New variable HAVE_UINTPTR_T.
+       * configure, config.in: Regenerated.
+
+2003-02-26  Daniel Jacobowitz  <drow@mvista.com>
+
+       Fix PR build/1097.
+       * utils.c (gdb_realpath): Move closing brace outwards one #endif.
+
+2003-02-25  Andrew Cagney  <cagney@redhat.com>
+
+       * frame.c (get_prev_frame): Add comment on check for
+       inside_entry_func. Only check for inside_entry_file when not a
+       dummy and not a sentinel.  Check that the new frame is not inner
+       to the old frame.
+
+2003-02-25  Andrew Cagney  <cagney@redhat.com>
+
+       * frame.c (frame_debug): New variable.
+       (_initialize_frame): Add "set/show debug frame" command.
+       (get_prev_frame): When frame_debug, print reason why unwind
+       failed.
+
+2003-02-25  Michael Chastain  <mec@shout.net>
+
+       * PROBLEMS (i[3456]86-*-linux*): Require glibc 2.1.3 or later
+       to avoid uintptr_t definition problems.
+
+2003-02-25  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.h (SYMBOL_NATURAL_NAME): New macro.
+       (SYMBOL_LINKAGE_NAME): Ditto.
+       (SYMBOL_PRINT_NAME): Use SYMBOL_NATURAL_NAME and
+       SYMBOL_LINKAGE_NAME.
+       (struct general_symbol_info): Expand comment.
+       (DEPRECATED_SYMBOL_NAME): Rename from SYMBOL_NAME.
+       (SYMBOL_MATCHES_NAME): Use DEPRECATED_SYMBOL_NAME.
+       (SYMBOL_MATCHES_REGEXP): Ditto.
+       * symtab.c (symbol_natural_name): New function.
+       * objfiles.h: Replace all uses of SYMBOL_NAME by
+       DEPRECATED_SYMBOL_NAME.
+       * xcoffread.c, valops.c, typeprint.c, tracepoint.c: Ditto.
+       * symtab.c, symmisc.c, symfile.c, stack.c, stabsread.c: Ditto.
+       * somsolib.c, sol-thread.c, rs6000-tdep.c, p-valprint.c: Ditto.
+       * printcmd.c, objfiles.c, objc-lang.c, mipsread.c: Ditto.
+       * minsyms.c, mdebugread.c, linespec.c, jv-lang.c: Ditto.
+       * i386-tdep.c, i386-linux-tdep.c, hpread.c, hppa-tdep.c: Ditto.
+       * gnu-v2-abi.c, f-valprint.c, findvar.c, expprint.c: Ditto.
+       * dwarfread.c, dwarf2read.c, dbxread.c, c-valprint.c: Ditto.
+       * cp-valprint.c, coffread.c, buildsym.c, breakpoint.c: Ditto.
+       * blockframe.c, ax-gdb.c, arm-linux-tdep.c, ada-lang.c: Ditto.
+       * ada-exp.y: Ditto.
+       * ada-exp.y: Update copyright.
+       * sol-thread.c, mipsread.c, jv-lang.c, f-valprint.c: Ditto.
+       * cp-valprint.c: Ditto.
+
+2003-02-25  Jeff Johnston  <jjohnstn@redhat.com>
+
+       * infptrace.c (detach): Do not flag error if ptrace detach fails
+       and errno is set to ESRCH.
+
+2003-02-24  Andrew Cagney  <cagney@redhat.com>
+
+       * infptrace.c (udot_info): Change type of udot_off to long.  Use
+       paddr when printing udot_off's value.
+
+2003-02-24  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.c (make_symbol_overload_list): Only read in partial
+       symtabs containing a matching partial symbol.
+
+2003-02-24  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.c (lookup_partial_symbol): Use strcmp_iw_ordered to
+       do the comparison, not strcmp.
+       * symfile.c (compare_psymbols): Ditto.
+       * defs.h: Declare strcmp_iw_ordered.
+       * utils.c (strcmp_iw_ordered): New function.
+
+2003-02-24  Jim Blandy  <jimb@redhat.com>
+
+       * MAINTAINERS (GNU/Linux/x86, linespec, breakpoints, Scheme
+       support, shared libs): Remove my name from here, to better reflect
+       reality.
+
+2003-02-24  Kris Warkentin  <kewarken@qnx.com>
+
+       * target.h: (HAVE_CONTINUABLE_WATCHPOINT): Define.
+       (target_ops): Add to_have_continuable_watchpoint.
+       * target.c (update_current_target): Add INHERIT line for
+       to_have_continuable_watchpoint.
+       * infrun.c: Remove HAVE_CONTINUABLE_WATCHPOINT defines.
+       * config/i386/nm-i386.h, config/i386/nm-i386sco5.h,
+       config/i386/nm-i386sol2.h, config/s390/nm-linux.h,
+       config/sparc/nm-sun4sol2.h: HAVE_CONTINUABLE_WATCHPOINT defined as 1.
+
+2003-02-24  Elena Zannoni  <ezannoni@redhat.com>
+
+       * MAINTAINERS (Core): Drop main.c and top.c. Clarify event loop
+       maintainership.
+
+2003-02-24  Kris Warkentin  <kewarken@qnx.com>
+
+       * solib.c (solib_open): Call target defined search function after
+       failing with solib-search-path.
+       * solist.h (target_so_ops): Add find_and_open_solib function hook and
+       create define TARGET_SO_FIND_AND_OPEN_SOLIB.
+
+2003-02-24  Kris Warkentin  <kewarken@qnx.com>
+
+       * MAINTAINERS: Add myself to Write After section.
+
+2003-02-23  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * m68hc11-tdep.c (m68hc11_gdbarch_init): long double is 64-bit wide.
+
+2003-02-22  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * m68hc11-tdep.c (m68hc11_init_reggroups): New function.
+       (m68hc11_add_reggroups): New function.
+       (m68hc11_register_reggroup_p): New to register hard/soft reggroups.
+       (m68hc11_gdbarch_init): Install the reggroups.
+       (_initialize_m68hc11_tdep): Initialize them.
+
+2003-02-21  James E Wilson  <wilson@tuliptree.org>
+
+       * MAINTAINERS: Update my email address.
+
+2003-02-21  David Carlton  <carlton@math.stanford.edu>
+
+       * arm-tdep.c (arm_gdbarch_init): Add break after default label.
+
+2003-02-21  Daniel Jacobowitz  <drow@mvista.com>
+
+       Based on a patch from Daniel Berlin (dberlin@dberlin.org).
+       * symtab.h: Add opaque declarations of struct axs_value and
+       struct agent_expr.
+       (enum address_class): Add LOC_COMPUTED and LOC_COMPUTED_ARG.
+       (struct location_funcs): New type.
+       (struct symbol): Add "loc" to aux_value.
+       (SYMBOL_LOCATION_BATON, SYMBOL_LOCATION_FUNCS): New macros.
+       * dwarf2read.c: Include "dwarf2expr.h".
+       (dwarf2_symbol_mark_computed): New function.
+       (read_func_scope): Use it.
+       (var_decode_location): New function.
+       (new_symbol): Use it.
+       * dwarf2expr.c, dwarf2expr.h, dwarf2loc.c, dwarf2loc.h: New files.
+
+       * Makefile.in (SFILES): Add dwarf2loc.c and dwarf2expr.c.
+       (dwarf2expr_h, dwarf2loc_h): New variables.
+       (COMMON_OBS): Add dwarf2expr.o and dwarf2loc.o.
+       (dwarf2expr.o, dwarf2loc.o): New rules.
+       (dwarf2read.o): Add $(dwarf2expr_h) and $(dwarf2loc_h).
+       * buildsym.c (finish_block): Handle LOC_COMPUTED and
+       LOC_COMPUTED_ARG.
+       * findvar.c (symbol_read_needs_frame, read_var_value): Likewise.
+       * m2-exp.y (yylex): Likewise.
+       * printcmd.c (address_info, print_frame_args): Likewise.
+       * stack.c (print_block_frame_locals, print_frame_arg_vars): Likewise.
+       * symmisc.c (print_symbol, print_partial_symbols): Likewise.
+       * ada-lang.c (ada_resolve_subexp, symtab_for_sym)
+       (ada_add_block_symbols, fill_in_ada_prototype): Likewise.
+       * symtab.c (lookup_block_symbol): Likewise.
+
+2003-02-20  Adam Fedor  <fedor@gnu.org>
+
+       * symtab.h: Remove objc_specific struct
+       (SYMBOL_OBJC_DEMANGLED_NAME): Remove.
+       * symtab.c (symbol_init_language_specific, symbol_demangled_name):
+       Have language_objc use cplus_specific struct.
+
+2003-02-20  Tom Tromey  <tromey@redhat.com>
+
+       * jv-valprint.c (java_value_print): Look at TYPE_TAG_NAME, not
+       TYPE_NAME, when printing a String value.  PR java/1075.
+
+2003-02-20  Adam Fedor  <fedor@gnu.org>
+
+       * objc-lang.h (find_methods): Remove declaration.
+        * objc-lang.c (find_methods): Make static.
+
+2003-02-20  Christopher Faylor  <cgf@redhat.com>
+
+       * win32-nat.c (get_image_name): Check return value from
+       ReadProcessMemory.
+       (child_xfer_memory): Ditto.
+
+2003-02-20  Alexandre Oliva  <aoliva@redhat.com>
+
+       * configure.in (TARGET_SYSTEM_ROOT): Set default to
+       ${exec_prefix}/${target_alias}/sys-root.  Match explicit
+       '${exec_prefix}' (in addition to the expansion thereof) as
+       relocatable.
+       * configure: Rebuilt.
+
+2003-02-20  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.c (search_symbols): Revert the search_symbols part of my
+       2002-12-23 patch.  Add comment.
+
+2002-02-20  Daniel Jacobowitz  <drow@mvista.com>
+
+       * coffread.c (coff_symfile_read): Clean up minimal symbols earlier.
+       * dbxread.c (elfstab_build_psymtabs): Don't call
+       install_minimal_symbols.
+       (stabsect_build_psymtabs): Likewise.
+       * elfread.c (elf_symfile_read): Call install_minimal_symbols
+       earlier.
+       * somread.c (som_symfile_read): Call install_minimal_symbols
+       and do_cleanups earlier.
+       * nlmread.c (nlm_symfile_read): Likewise.
+       * mdebugread.c (elfmdebug_build_psymtabs): Call
+       install_minimal_symbols and make appropriate cleanups.
+
+2003-02-20  Kevin Buettner  <kevinb@redhat.com>
+
+       * solib.c (reload_shared_libraries): New function.
+       (_initialize_solib): Add callbacks for ``set solib-search-path''
+       and ``set solib-absolute-prefix''.
+
+2003-02-20  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.h (SYMBOL_PRINT_NAME): Rename from SYMBOL_SOURCE_NAME;
+       expand comment.
+       * ada-lang.c (user_select_syms, ada_finish_decode_line_1): Replace
+       SYMBOL_PRINT_NAME with SYMBOL_SOURCE_NAME.
+       * ada-typeprint.c (ada_typedef_print): Ditto.
+       * ax-gdb.c (gen_var_ref): Ditto.
+       * breakpoint.c (print_one_breakpoint): Ditto.
+       * buildsym.c (finish_block): Ditto.
+       * c-valprint.c (c_val_print): Ditto.
+       * expprint.c (print_subexp): Ditto.
+       * findvar.c (locate_var_value): Ditto.
+       * infcmd.c (jump_command): Ditto. 
+       * linespec.c (decode_line_2, decode_compound): Ditto. 
+       * maint.c (maintenance_translate_address): Ditto. 
+       * objc-lang.c (compare_selectors, compare_classes): Ditto. 
+       * printcmd.c (build_address_symbolic, sym_info, print_frame_args):
+       Ditto.
+       * p-valprint.c (pascal_val_print): Ditto. 
+       * stabsread.c (define_symbol): Ditto. 
+       * stack.c (print_frame, frame_info, print_block_frame_locals)
+       (print_frame_arg_vars, return_command): Ditto. 
+       * symfile.c (compare_symbols, compare_psymbols): Ditto. 
+       * symmisc.c (print_symbol): Ditto. 
+       * symtab.c (lookup_partial_symbol, lookup_block_symbol)
+       (compare_search_syms, print_symbol_info, print_msymbol_info)
+       (rbreak_command): Ditto. 
+       * tracepoint.c (tracepoints_info): Ditto. 
+       * typeprint.c (typedef_print): Ditto. 
+       * valops.c (value_of_variable, hand_function_call): Ditto. 
+       * cli/cli-cmds.c (edit_command, list_command): Ditto.
+       * ada-typeprint.c: Update Copyright.
+       * infcmd.c, objc-lang.c, p-valprint.c, symmisc.c: Ditto.
+       * tracepoint.c, cli/cli-cmds.c: Ditto.
+
+2003-02-20  Kevin Buettner  <kevinb@redhat.com>
+
+       * frame.c (generic_unwind_get_saved_register): Make non-static.
+       * frame.h (generic_unwind_get_saved_register): Declare.
+       * mips-tdep.c (read_next_frame_reg): Fetch register from
+       current regcache when frame is NULL.
+       (mips_init_extra_frame_info): Pass NULL explicitly for parameter
+       that must be NULL.
+       (mips_get_saved_register): Call generic_unwind_get_saved_register()
+       instead of frame_register_unwind().
+
+2003-02-20  Andrew Cagney  <ac131313@redhat.com>
+
+       * remote-sim.c (gdbsim_insert_breakpoint)
+       (gdbsim_remove_breakpoint): Delete #ifdef SIM_HAS_BREAKPOINTS
+       code.
+
+2003-02-20  Andrew Cagney  <ac131313@redhat.com>
+
+       * remote.c (_initialize_remote): Add commands "set/show remote
+       hardware-watchpoint-limit" and "set/show remote
+       hardware-breakpoint-limit".
+       (remote_hw_watchpoint_limit): Initialize to -1.
+       (remote_hw_breakpoint_limit): Ditto.
+       (remote_check_watch_resources): Treat a limit of -1 as unlimited.
+
+2003-02-19  Raoul Gough  <RaoulGough@yahoo.co.uk>
+
+       * coff-pe-read.c: New file - support reading of minimal symbols from a
+       portable executable using the export table.
+       * coff-pe-read.h: New file.
+       * coffread.c: Include coff-pe-read.h.
+       (coff_symtab_read): Call read_pe_exported_syms iff no recognized
+       debugging symbols found.
+       * Makefile.in (SFILES): Add coff-pe-read.o.
+       (coff_pe_read_h): Define.
+       (COMMON_OBS): Add coff-pe-read.o.
+       (coffread.o): Add coff_pe_read_h dependency.
+       (coff-pe-read.o): New target.
+
+2003-02-19  David Carlton  <carlton@math.stanford.edu>
+
+       * Makefile.in (SFILES): Add block.c.
+       (block_h): New.
+       (COMMON_OBS): Add block.o.
+       (block.o): New.
+       (x86-64-tdep.o): Add $(block_h).
+       (values.o, valops.o, tracepoint.o, symtab.o, symmisc.o, symfile.o)
+       (stack.o, printcmd.o, p-exp.tab.o, parse.o, objfiles.o)
+       (objc-exp.tab.o, objc-lang.o, nlmread.o, mips-tdep.o, mdebugread.o)
+       (m2-exp.tab.o, linespec.o, jv-lang.o, jv-exp.tab.o, infcmd.o)
+       (f-valprint.o, findvar.o, f-exp.tab.o, expprint.o, coffread.o)
+       (c-exp.tab.o, buildsym.o, breakpoint.o, blockframe.o, ax-gdb.o)
+       (alpha-tdep.o, ada-lang.o, ada-exp.tab.o, mi-cmd-stack.o): Ditto.
+       * value.h: Add opaque declaration for struct block.
+       * parser-defs.h, objc-lang.h, buildsym.h, breakpoint.h: Ditto.
+       * ada-lang.h: Ditto.
+       * x86-64-tdep.c: #include "block.h"
+       * values.c, valops.c, tracepoint.c, symtab.c, symmisc.c: Ditto.
+       * symfile.c, stack.c, printcmd.c, p-exp.y, parse.c: Ditto.
+       * objfiles.c, objc-exp.y, objc-lang.c, nlmread.c: Ditto.
+       * mips-tdep.c, mdebugread.c, m2-exp.y, linespec.c: Ditto.
+       * jv-lang.c, jv-exp.y, infcmd.c, f-valprint.c: Ditto.
+       * findvar.c, f-exp.y, expprint.c, coffread.c, c-exp.y: Ditto.
+       * buildsym.c, breakpoint.c, blockframe.c, ax-gdb.c: Ditto.
+       * alpha-tdep.c, ada-lang.c, ada-exp.y: Ditto.
+       * blockframe.c (blockvector_for_pc_sect): Move to "block.c".
+       (blockvector_for_pc, block_for_pc_sect, block_for_pc): Ditto.
+       * symtab.c (block_function): Ditto.
+       (contained_in): Ditto.
+       * frame.h: Move block_for_pc and block_for_pc_sect declarations to
+       block.h.  Add opaque declaration for struct block.
+       * symtab.h: Move block_function and contained_in declarations to
+       block.h.  Add opaque declarations for struct block, struct
+       blockvector.
+       (struct block): Move to block.h.
+       (struct blockvector): Ditto.
+       (BLOCK_START, BLOCK_END, BLOCK_FUNCTION, BLOCK_SUPERBLOCK)
+       (BLOCK_GCC_COMPILED, BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM)
+       (BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE)
+       (ALL_BLOCK_SYMBOLS, BLOCK_SHOULD_SORT, BLOCKVECTOR_NBLOCKS)
+       (BLOCKVECTOR_BLOCK, GLOBAL_BLOCK, STATIC_BLOCK, FIRST_LOCAL_BLOCK):
+       Ditto.
+       * block.c: New file.
+       * block.h: New file.
+
+2003-02-19  Theodore A. Roth  <troth@openavr.org>
+
+       * avr-tdep.c (avr_extract_return_value): Remove function.
+       (avr_store_return_value): Remove function.
+       (avr_extract_struct_value_address): Remove function.
+       (avr_gdbarch_init): Remove set_gdbarch_deprecated_*() calls.
+
+2003-02-19  Andrew Cagney  <ac131313@redhat.com>
+
+       * rs6000-tdep.c: Include "gdb_assert.h".
+       (registers_e500): Add "acc" and "spefscr".
+       (PPC_GPRS_PSEUDO_REGS): Remove trailing comma.
+       (rs6000_gdbarch_init): Update initialization of ppc_gp0_regnum,
+       ppc_gplast_regnum, sp_regnum and fp_regnum.  Check that gp0_regnum
+       really is "r0".
+       (registers_e500): Mark the "acc" as a 64 bit (from Jim Willson).
+
+2003-02-18  Keith Seitz  <keiths@redhat.com>
+
+       * Makefile.in: Add gdbtk-interps.c.
+
+2003-02-18  Kevin Buettner  <kevinb@redhat.com>
+
+       * sparc-tdep.c (sparc_frame_chain): Adjust return value.
+       * config/sparc/tm-sparc.h (init_frame_pc_noop): Declare.
+
+2003-02-18  Andrew Cagney  <cagney@redhat.com>
+
+       * symtab.h (struct objfile): Add opaque declaration.
+
+2003-02-18  Elena Zannoni  <ezannoni@redhat.com>
+
+       From Jim Ingham   <jingham@apple.com>:
+        * dbxread.c (process_one_symbol): Use last_function_start rather
+        than function_start_offset to find the real beginning of the
+        current function.  The latter is just the text section offset on
+        some systems, the former is always the real function start.
+
+2003-02-17  Andrew Cagney  <cagney@redhat.com>
+
+       * configure.in: Revert ${target} != ${host}.
+
+2003-02-17  Andrew Cagney  <ac131313@redhat.com>
+
+       * configure.in (Makefile): Use the test ${target} != ${host},
+       instead of the absence of the "nm.h" file, to determine of the
+       configuration non-native.
+       * configure: Regenerate.
+       
+2003-02-14  Elena Zannoni  <ezannoni@redhat.com>
+
+        From Brian Ford  <ford@vss.fsi.com>
+
+       * cli/cli-decode.c (lookup_cmd_composition) [TUI]: Properly
+       conditionalize tui_active test.
+       (lookup_cmd_1): Ditto.
+
+2003-02-14  Mark Kettenis  <kettenis@gnu.org>
+
+       * configure.in: Add check for _etext.
+       * maint.c (maintenance_set_profile_cmd): Use etext if _etext isn't
+       available.
+       * config.in, configure: regenerated.
+
+2003-02-14  Daniel Jacobowitz  <drow@mvista.com>
+
+       * dwarf2read.c (dwarf2_get_pc_bounds): Offset addresses by base.
+
+2003-02-14  Andrew Cagney  <ac131313@redhat.com>
+
+       * main.c (tui_version): Delete variable.
+       (captured_main): When --tui, set interpreter_p to "tui" instead of
+       enabling tui_version.
+       * printcmd.c (display_command) [TUI]: Test tui_active instead of
+       tui_version.
+       * cli/cli-decode.c (lookup_cmd_composition): Ditto.
+       * cli/cli-cmds.c (disassemble_command): Ditto.
+       * defs.h (tui_version): Delete declaration.
+       * Makefile.in (SUBDIR_TUI_SRCS): Add "tui/tui-interp.c".
+       (tui-interp.o): Add rules.
+       (SUBDIR_TUI_OBS): Add "tui-interp.o".
+
+2003-02-14  Christopher Faylor  <cgf@redhat.com>
+
+       * win32-nat.c (register_loaded_dll): Correctly set address range for
+       just-loaded dll.
+
+2003-02-12  Jason Molenda  (jmolenda@apple.com)
+
+        * symmisc.c (print_objfile_statistics): Include information about
+        the number of psymtabs and symtabs in each object file.
+
+2003-02-13  Keith R Seitz  <keiths@redhat.com>
+
+       * main.h (struct captured_main_args): Add interpreter_p.
+       * main.c (captured_main): Initialize interpreter_p from context.
+       * gdb.c (main): Set interpreter_p argument.
+       * Makefile.in (gdb.o): Add dependency for interps.h.
+
+2003-02-12  Andrew Cagney  <ac131313@redhat.com>
+
+       * event-top.c (cli_command_loop): Delete declaration.
+       (_initialize_event_loop): Delete function setting event_loop_hook.
+       * event-top.h (cli_command_loop): Declare.  Update copyright.
+       (EVENT_TOP_H): Define.  Wrap header in #ifdef EVENT_TOP_H.
+       * interps.c (current_interp_command_loop): When event_loop_p, call
+       cli_command_loop.
+
+2003-02-12  Andrew Cagney  <ac131313@redhat.com>
+
+       * interps.h (interp_command_loop_ftype): Change return type to
+       void.
+
+2003-02-12  Michal Ludvig  <mludvig@suse.cz>
+
+       * x86-64-tdep.c (x86_64_extract_return_value)
+       (x86_64_store_return_value): Use regcache instead of regbuf.
+       (x86_64_gdbarch_init): Change related set_gdbarch_* functions.
+       * x86-64-linux-nat.c (fill_gregset): Use regcache.
+
+2003-02-11  Andrew Cagney  <ac131313@redhat.com>
+
+       * acinclude.m4 (no_tcl): SUBST TCL_CC_SEARCH_FLAGS.
+       * aclocal.m4: Regenerate.
+       * configure: Regenerate.
+
+       * Makefile.in (TCL): Use TCL_CC_SEARCH_FLAGS instead of
+       TCL_LD_SEARCH_FLAGS.
+
+2003-02-10  Michal Ludvig  <mludvig@suse.cz>
+
+       * dwarf2cfi.c: Reindented.
+
+2003-02-09  Andrew Cagney  <ac131313@redhat.com>
+
+       * interps.c (clear_interpreter_hooks): Convert function definition
+       to ISO C.
+
+2003-02-07  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb_mbuild.sh: Delete extra shift after parsing '-f'.
+
+2003-02-07  Kevin Buettner  <kevinb@redhat.com>
+
+       * gdbtypes.h (struct main_type): Move ``length'' field from here...
+       (struct type): ...to here.
+       (TYPE_LENGTH): Adjust to reflect different location of ``length''
+       field.
+       * gdbtypes.c (make_qualified_type): Set length on newly created type.
+       (replace_type): Set length on all type variants for a given type.
+
+2003-02-07  Andrew Cagney  <ac131313@redhat.com>
+
+       * sol-thread.c, hpux-thread.c: Include "gdb_stat.h" instead of
+       <sys/stat.h>.
+       * Makefile.in (sol-thread.o, hpux-thread.o): Update dependencies.
+       
+2003-02-06  Andrew Cagney  <ac131313@redhat.com>
+
+       * Makefile.in (symm-nat.o): Update dependencies.
+       (sparc-nat.o, procfs.o, proc-api.o, ppc-linux-nat.o): Ditto.
+       (lynx-nat.o, ia64-linux-nat.): Ditto.
+       * symm-nat.c, sparc-nat.c, procfs.c, proc-api.c: Include
+       "gdb_wait.h" instead of <wait.h> or <sys/wait.h>.
+       * ppc-linux-nat.c, lynx-nat.c, ia64-linux-nat.c: Ditto.
+
+       * Makefile.in (inflow_h): Define.
+       (procfs.o, inflow.o, procfs.o): Update dependencies.
+       * inftarg.c (child_stop): Delete extern declaration of
+       inferior_process_group.  Include "inflow.h".
+       * procfs.c (procfs_stop): Ditto.  Include "inflow.h".
+       * inflow.c (PROCESS_GROUP_TYPE): Move definitions from here ...
+       * inflow.h (PROCESS_GROUP_TYPE): ... to here.  New file.
+       (our_process_group, inferior_process_group): Extern declarations.
+
+       * procfs.c: Include "gdb_assert.h".
+
+       * linux-proc.c: Include "gdb_stat.h" instead of <sys/stat.h>.
+       * cp-valprint.c (cp_print_value_fields): Eliminate STREQN.
+       * jv-typeprint.c (java_type_print_base): Ditto.
+       * typeprint.c (typedef_print): Eliminate STREQ.
+       * cli/cli-script.c (define_command, define_command): Ditto.
+       * main.c (captured_main): Ditto.
+       * values.c (lookup_internalvar): Ditto.
+       * utils.c (safe_strerror, parse_escape): Eliminate assignment
+       within `if' conditional.
+       * linespec.c (decode_line_2): Ditto.
+       * cli/cli-dump.c (bfd_openr_with_cleanup): Ditto.
+       (bfd_openw_with_cleanup): Ditto.
+
+2003-02-07  Mark Kettenis  <kettenis@gnu.org>
+
+       * x86-64-tdep.c (x86_64_init_abi): Set extract_return_value to
+       legacy_extract_return_value and store_return_value to
+       legacy_return_value.
+
+2003-02-06  Raoul Gough  <RaoulGough@yahoo.co.uk>
+
+       * win32-nat.c (get_relocated_section_addrs): New function.  Find
+       section load addresses for symbol handling in relocated DLLs.
+       (solib_symbols_add): Open a bfd and call get_relocated_section_addrs.
+
+2003-02-05  Fred Fish  <fnf@intrinsity.com>
+
+       * remote-e7000.c (e7000_drain_command): Fix precedence problem with
+       '=' and '!='.
+       * rdi-share/ardi.c (wait_for_debug_message): Fix precedence problem
+       with '&' and '=='.
+       (angel_RDI_info): Ditto.
+       * infttrace.c (threads_continue_all_but_one): Fix precedence problem
+       with '&' and '!='.
+       (threads_continue_all_with_signals): Ditto.
+  
+2003-02-05  Jim Ingham <jingham@apple.com>
+            Keith Seitz  <keiths@redhat.com>
+            Elena Zannoni  <ezannoni@redhat.com>
+            Andrew Cagney  <ac131313@redhat.com>
+
+       * Makefile.in (SUBDIR_CLI_OBS): Add "cli-interp.o".
+       (SUBDIR_CLI_SRCS): Add "cli/cli-interp.c".
+       (SUBDIR_MI_OBS): Add "mi-interp.o".
+       (SUBDIR_MI_SRCS): Add "mi/mi-interp.c".
+       (SFILES): Add "interps.c".
+       (COMMON_OBS): Add "interps.o".
+       (interps_h, mi_main_h): Define.
+       (interps.o, cli-interp.o, mi-interp.o): Add dependencies.
+       (mi-main.o, main.o, event-top.o): Update dependencies.
+       * cli/cli-interp.c: New file.
+       * interps.h, interps.c: New files.
+       * top.c: (gdb_init): Don't install the default interpreter, handed
+       by captured_main.
+       * main.c: Include "interps.h".
+       (interpreter_p): Note that it should malloc'ed.
+       (captured_command_loop): Call current_interp_command_loop.
+       (captured_main): Initialize interpreter_p to INTERP_CONSOLE.  Use
+       xfree and xstrdup when updating interpreter_p.  Install the
+       default interpreter.  Add hack to stop mi1's copyright notice
+       being encoded.
+       * event-top.h (gdb_setup_readline): Declare.
+       (gdb_disable_readline): Declare.
+       * event-top.c: Include "interps.h".
+       (display_gdb_prompt): Call current_interp_display_prompt_p.
+       (gdb_setup_readline): Initialize gdb_stdout, gdb_stderr,
+       gdb_stdlog, and gdb_stdtarg.
+       (_initialize_event_loop): Don't call gdb_setup_readline.
+       * cli-out.c (cli_out_set_stream): New function.
+       * cli-out.h (cli_out_set_stream): Declare.
+
+2003-02-06  Mark Kettenis  <kettenis@gnu.org>
+
+       * configure.tgt (i[3456]86-*-sysv4.2*, i[3456]86-*-sysv4*,
+       i[3456]86-*-sysv5*, i[3456]86-*-sco3.2v5*): Remove.  These are all
+       handled fine by i[3456]86-*sco* and i[3456]86-sysv*.
+       * config/i386/i386sco5.mt, config/i386/i386v4.mt,
+       config/i386/i386v42mp.mt: Removed.
+
+2003-02-05  Mark Kettenis  <kettenis@gnu.org>
+
+       * configure.tgt (*-*-solaris*): Set gdb_osabi to
+       GDB_OSABI_SOLARIS.
+
+2003-02-05  Michael Chastain  <mec@shout.net>
+
+       * PROBLEMS (i[3456]86-*-linux*): Warn about binutils
+       2.12.1 and earlier versions.
+
+2003-02-05  Andrew Cagney  <ac131313@redhat.com>
+
+       Remove orphaned hosts, targets and files.
+       * config/i386/gdbserve.mt, config/m68k/nm-apollo68b.h: Delete.
+       * config/m68k/nm-hp300bsd.h, config/m68k/tm-apollo68b.h: Delete.
+       * config/m68k/tm-es1800.h, config/m68k/tm-hp300bsd.h: Delete.
+       * config/m68k/tm-mac.h, config/m68k/xm-apollo68b.h: Delete.
+       * config/pa/hpux1020.mt, config/pa/hpux11.mt: Delete.
+       * config/pa/hpux11w.mt, config/powerpc/gdbserve.mt: Delete.
+       * config/powerpc/ppcle-eabi.mt, config/powerpc/ppcle-sim.mt: Delete.
+       * config/powerpc/tm-ppc-sim.h, config/sparc/sp64sim.mt: Delete.
+       * config/sparc/tm-sp64sim.h: Delete.
+       * configure.host: Delete strongarm-*-*, xscale-*-*, and arm*-*-*
+       hosts.
+       * configure.tgt: Delete i[3456]86-*-sco3.2v4*, and
+       mips*-dec-mach3* targets.
+
+2003-02-04  Michael Chastain  <mec@shout.net>
+
+       * NEWS: Fix typo: sepcifying -> specifying.
+
+2003-02-04  Michael Chastain  <mec@shout.net>
+
+       * dwarfread.c: Add documentation on the state of dwarf-1,
+       looking towards obsoletion.
+
+2003-02-03  Michael Chastain  <mec@shout.net>
+
+       * config/djgpp/fnchange.lst: Add gdb/testsuite/gdb.c++/pr-1023.cc,
+       gdb/testsuite/gdb.c++/pr-1023.exp.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * values.c: Delete code conditional on IS_TRAPPED_INTERNALVAR.
+       * TODO: Delete reference to IS_TRAPPED_INTERNALVAR.
+
+       * utils.c (init_page_info): Delete reference to MPW in comments.
+       * main.c (captured_main): Delete #ifdef MPW.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * NEWS: Note that the m32r-*-elf* is obsolete. 
+       * monitor.c (monitor_expect): Obsolete reference to m32r.
+       * configure.tgt: Mark m32r-*-elf* as obsolete.
+       * MAINTAINERS: Mark m32k as obsolete.
+       * m32r-rom.c: Obsolete file.
+       * config/m32r/m32r.mt: Obsolete file.
+       * config/m32r/tm-m32r.h: Obsolete file.
+       * m32r-stub.c: Obsolete file.
+       * m32r-tdep.c: Obsolete file.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * NEWS: Mention that the z8k-zilog-none is obsolete.
+       * MAINTAINERS: Mark z8k as obsolete.
+       * configure.tgt: Obsolete the z8k-*-coff* target.
+       * config/z8k/z8k.mt: Obsolete file.
+       * config/z8k/tm-z8k.h: Obsolete file.
+       * z8k-tdep.c: Obsolete file.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * NEWS: Mention that the mn10200-elf is obsolete.
+       * configure.tgt: Obsolete mn10200-*-* target.
+       * breakpoint.c (update_breakpoints_after_exec): Update comment to
+       mention that the mn10200 is obsolete.
+       * breakpoint.h: Ditto.
+       * MAINTAINERS: Mark the mn10200-elf as obsolete.
+       * config/mn10200/mn10200.mt: Obsolete file.
+       * config/mn10200/tm-mn10200.h: Obsolete file.
+       * mn10200-tdep.c: Obsolete file.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * MAINTAINERS: Mark h8500 as obsolete.
+       * configure.tgt (h8500-*-*): Mark h8500 code as obsolete.
+       * findvar.c (value_from_register): Ditto.
+       * h8500-tdep.c: Mark file as obsolete.
+       * config/h8500/h8500.mt: Ditto.
+       * config/h8500/tm-h8500.h: Ditto.
+       * NEWS: Mention that h8500 is obsolete.
+
+2003-02-04  David Carlton  <carlton@math.stanford.edu>
+
+       * objfiles.c (allocate_objfile): Always set name.  Add comment at
+       start of function.
+       * jv-lang.c (get_dynamics_objfile): Add comment.
+
+2003-02-04  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.h (SYMBOL_LINKAGE_NAME): Delete.
+       * printcmd.c (build_address_symbolic): Replace uses of
+       SYMBOL_LINKAGE_NAME by equivalent uses of SYMBOL_SOURCE_NAME,
+       SYMBOL_NAME, and asm_demangle.
+       Update copyright.
+
+2003-02-04  David Carlton  <carlton@math.stanford.edu>
+
+       * linespec.c (decode_compound): Extract code into
+       lookup_prefix_sym.
+       (lookup_prefix_sym): New function.
+
+2003-02-04  David Carlton  <carlton@math.stanford.edu>
+
+       * gdbtypes.h: Delete INTEGER_COERCION_BADNESS,
+       FLOAT_COERCION_BADNESS.
+       * gdbtypes.c (rank_one_type): Replace all uses of
+       INTEGER_COERCION_BADNESS by INTEGER_CONVERSION_BADNESS.
+
+2003-02-04  Jim Blandy  <jimb@redhat.com>
+
+       * dwarf2read.c (dwarf2_locate_sections): When we find a macro info
+       section, let dwarf_macinfo_section point to it, not
+       dwarf_loc_section.
+
+2003-02-04  Daniel Jacobowitz  <drow@mvista.com>
+
+       Pointed out by Anton Blanchard <anton@samba.org>.
+       * ppc-linux-tdep.c (insn_is_sigreturn): New function.
+       (ppc_linux_at_sigtramp_return_path): Use it.
+
+2003-02-04  Daniel Jacobowitz  <drow@mvista.com>
+
+       * defs.h (streq): Add prototype.
+       * utils.c (streq): New function.
+
+       * dwarf2read.c (new_symbol): Use SYMBOL_SET_NAMES instead of
+       SYMBOL_NAME and SYMBOL_INIT_DEMANGLED_NAME.
+       * mdebugread.c (new_symbol): Likewise.
+       * stabsread.c (define_symbol): Likewise.
+       * coffread.c (process_coff_symbol): Likewise.
+       * dwarfread.c (new_symbol): Likewise.
+
+       * minsyms.c (prim_record_minimal_symbol_and_info): Use
+       SYMBOL_SET_NAMES instead of setting SYMBOL_NAME.  Set the language
+       here.
+       (install_minimal_symbols): Don't set SYMBOL_LANGUAGE or call
+       SYMBOL_INIT_DEMANGLED_NAME.
+       * objfiles.c: Include "hashtab.h".
+       (allocate_objfile): Call htab_set_functions_ex for the
+       demangled_names_hash.
+       (free_objfile): Call htab_delete for the demangled_names_hash.
+       * objfiles.h (struct htab): Add declaration.
+       (struct objfile): Add demangled_names_hash.
+       * symfile.c: Include "hashtab.h".
+       (reread_symbols): Call htab_delete for the demangled_names_hash.
+       (add_psymbol_to_list): Use SYMBOL_SET_NAMES instead of putting
+       SYMBOL_NAME in the bcache.
+       * symtab.c: Include "hashtab.h".  Update comments.
+       (create_demangled_names_hash, symbol_set_names): New functions.
+       (symbol_find_demangled_name): New function, broken out from
+       symbol_init_demangled_names.
+       (symbol_init_demangled_names): Use it.
+       * symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Add missing parentheses.
+       (SYMBOL_SET_NAMES): New macro.
+       (symbol_set_names): Add prototype.
+
+2003-02-03  Jim Blandy  <jimb@redhat.com>
+
+       Use a single, consistent representation for an empty minimal
+       symbol table in an objfile.
+       * objfiles.c (terminate_minimal_symbol_table): New function.
+       (allocate_objfile): Call it.
+       * objfiles.h (terminate_minimal_symbol_table): New declaration.
+       (ALL_MSYMBOLS): No need to test whether (objfile)->msymbols is
+       non-NULL. 
+       * minsyms.c (lookup_minimal_symbol_by_pc_section): To see whether
+       objfile has minimal symbols, compare minimal_symbol_count to zero,
+       instead of comparing msymbols with NULL.
+       * objfiles.c (have_minimal_symbols): Same.
+       * solib-sunos.c (solib_add_common_symbols): Call
+       terminate_minimal_symbol_table.
+       * symfile.c (reread_symbols): Same.
+       
+2003-02-03  Kevin Buettner  <kevinb@redhat.com>
+
+       * s390-tdep.c (s390_address_class_type_flags)
+       (s390_address_class_type_flags_to_name)
+       (s390_address_class_name_to_type_flags): New functions.
+       (s390_gdbarch_init): Define ADDRESS_CLASS_TYPE_FLAGS_TO_NAME,
+       ADDRESS_CLASS_NAME_TO_TYPE_FLAGS, and ADDRESS_CLASS_TYPE_FLAGS.
+
+2003-02-03  Michael Snyder  <msnyder@redhat.com>
+
+       * arm-tdep.c: Fix spell-o in comment.
+
+2003-02-03  Michal Ludvig  <mludvig@suse.cz>
+
+       * dwarf2cfi.c (pointer_encoding): Added new parameter.
+       * dwarf2cfi.c, dwarf2read.c: Changed all warnings and
+       error messages to contain BFD filename. 
+
+2003-02-02  Elena Zannoni  <ezannoni@redhat.com>
+
+       Fix PR gdb/742 gdb/743 gdb/877
+       * disasm.c (dump_insns): Use make_cleanup_ui_out_tuple_begin_end.
+       (do_mixed_source_and_assembly): Use
+       make_cleanup_ui_out_tuple_begin_end and
+       make_cleanup_ui_out_tuple_begin_end.
+       (do_mixed_source_and_assembly): Ditto.
+       * thread.c (do_captured_list_thread_ids): Ditto.
+       * ui-out.h (ui_out_table_begin, ui_out_list_begin,
+       ui_out_tuple_begin, ui_out_table_end, ui_out_list_end,
+       ui_out_tuple_end): Delete prototypes.
+       * ui-out.c (ui_out_list_begin, ui_out_tuple_begin,
+       ui_out_list_end, ui_out_tuple_end): Delete.
+
+       From Kevin Buettner  <kevinb@redhat.com>:
+       * ui-out.h (make_cleanup_ui_out_table_begin_end): New function.
+        * ui-out.c (make_cleanup_ui_out_table_begin_end)
+        (do_cleanup_table_end):  New functions.
+        * breakpoint.c (print_it_typical, print_one_breakpoint, mention):
+        Use cleanups to invoke_ui_out_tuple_end().
+        (breakpoint_1): Use cleanup to invoke ui_out_table_end().
+       * cli/cli-setshow.c (cmd_show_list): Use
+       make_cleanup_ui_out_tuple_begin_end.
+       
 2003-02-02  Andrew Cagney  <ac131313@redhat.com>
 
        * frame.c (frame_unwind_register): New function.
        * config.in: Regenerated.
        * configure: Regenerated.
 
+2003-01-24  Nick Clifton  <nickc@redhat.com>
+
+       * Add sh2e support:
+
+       2002-04-02  Elena Zannoni  <ezannoni@redhat.com>
+
+               * gdb/sh-tdep.c (sh_sh2e_register_name): New.
+               (sh2e_show_regs): New.
+               (sh_gdbarch_init): Handle bfd_mach_sh2e.
+               * config/sh/tm-sh.h: Added sh2e to comments.
+
 2003-01-23  Jim Blandy  <jimb@redhat.com>
 
        * symfile.c (syms_from_objfile): Don't print the "(no debugging
 
 2003-01-14  Elena Zannoni  <ezannoni@redhat.com>
 
+       Fix PR gdb/898
        * breakpoint.c (until_break_command): Add new argument.  Use it to
        decide whether to stop only at the current frame or not.
        * breakpoint.h (until_break_command): Update prototype.
index cc6b053..ff00626 100644 (file)
@@ -83,9 +83,7 @@ maintainer works with the native maintainer when resolving API issues.
        h8300           --target=h8300hms ,-Werror
                        Maintenance only
 
-       h8500           (--target=h8500hms broken)
-                       Maintenance only
-                       Not multi-arch, work in progress
+       h8500           (--target=h8500hms OBSOLETE)
 
        i386            --target=i386-elf ,-Werror
                        Mark Kettenis           kettenis@gnu.org
@@ -96,9 +94,7 @@ maintainer works with the native maintainer when resolving API issues.
                        (--target=ia64-elf broken)
                        Kevin Buettner          kevinb@redhat.com
 
-       m32r            (--target=m32r-elf broken)
-                       Michael Snyder          msnyder@redhat.com
-                       OBSOLETE candidate, not multi-arch
+       m32r            (--target=m32r-elf OBSOLETE)
 
        m68hc11         --target=m68hc11-elf ,-Werror ,
                        Stephane Carrez         stcarrez@nerim.fr
@@ -114,9 +110,7 @@ maintainer works with the native maintainer when resolving API issues.
        mips            --target=mips-elf ,-Werror
                        Andrew Cagney           cagney@redhat.com
 
-       mn10200         --target=mn10200-elf ,-Werror
-                       Maintenance only
-                       OBSOLETE candidate, not multi-arch
+       mn10200         (--target=mn10200-elf OBSOLETE)
 
        mn10300         --target=mn10300-elf ,-Werror
                        Maintenance only
@@ -156,10 +150,7 @@ maintainer works with the native maintainer when resolving API issues.
        xstormy16       --target=xstormy16-elf ,-Werror
                        Corinna Vinschen        vinschen@redhat.com
 
-       z8k             --target=z8k-coff ,-Werror
-                       Known problem in 5.1
-                       Maintenance only
-                       OBSOLETE candidate, not multi-arch
+       z8k             (--target=z8k-coff OBSOLETE)
 
 All developers recognized by this file can make arbitrary changes to
 OBSOLETE targets.
@@ -194,7 +185,6 @@ MS Windows (NT, '00, 9x, Me, XP) host & native
                        Chris Faylor            cgf@redhat.com
 GNU/Linux/x86 native & host
                        Mark Kettenis           kettenis@gnu.org
-                       Jim Blandy              jimb@redhat.com
 GNU/Linux PPC native   Kevin Buettner          kevinb@redhat.com
 GNU/Linux MIPS native & host
                        Daniel Jacobowitz       dan@debian.org
@@ -218,8 +208,10 @@ generic arch support       Andrew Cagney           cagney@redhat.com
                        Any host/target maintainer can add to
                        gdbarch.{c,h,sh}.  Send tricky ones to cagney.
 target vector          Andrew Cagney           cagney@redhat.com
-main (main.c, top.c)   Elena Zannoni           ezannoni@redhat.com
+
 event loop             Elena Zannoni           ezannoni@redhat.com
+                        For the part of top.c related to the event loop,
+                        send questions to ezannoni@redhat.com
 
 generic symtabs                Jim Blandy              jimb@redhat.com
                        Elena Zannoni           ezannoni@redhat.com
@@ -232,8 +224,7 @@ generic symtabs             Jim Blandy              jimb@redhat.com
   coff reader          Philippe De Muyter      phdm@macqel.be
   xcoff reader         Any maintainer can modify this; please send tricky
                        ones to Kevin Buettner <kevinb@redhat.com>
-  linespec             Jim Blandy              jimb@redhat.com
-                       Elena Zannoni           ezannoni@redhat.com
+  linespec             Elena Zannoni           ezannoni@redhat.com
                        Fernando Nasser         fnasser@redhat.com
   HP/UX readers                Any [past] maintainer can modify this.
                        Please send tricky ones to the symtabs maintainers.
@@ -243,15 +234,12 @@ tracing                   Michael Snyder          msnyder@redhat.com
 threads                        Michael Snyder          msnyder@redhat.com
                        Mark Kettenis           kettenis@gnu.org
 breakpoints            Michael Snyder          msnyder@redhat.com
-                       Jim Blandy              jimb@redhat.com
 language support       (Blanket Write Privs Maintainers)
   C++                  Daniel Jacobowitz       dan@debian.org
   Java support         (Global Maintainers)
   Pascal support       Pierre Muller           muller@sources.redhat.com
-  Scheme support       Jim Blandy              jimb@redhat.com
 
-shared libs (devolved) Jim Blandy              jimb@redhat.com
-                       Kevin Buettner          kevinb@redhat.com
+shared libs (devolved) Kevin Buettner          kevinb@redhat.com
   xcoffsolib           Peter Schauer           Peter.Schauer@regent.e-technik.tu-muenchen.de
 
 remote.c               Andrew Cagney           cagney@redhat.com
@@ -400,7 +388,8 @@ Jason Thorpe                                        thorpej@wasabisystems.com
 Tom Tromey                                     tromey@redhat.com
 Corinna Vinschen                               vinschen@redhat.com
 Keith Walker                                   keith.walker@arm.com
-Jim Wilson                                     wilson@redhat.com
+Kris Warkentin                                 kewarken@qnx.com
+Jim Wilson                                     wilson@tuliptree.org
 Elena Zannoni                                  ezannoni@redhat.com
 Eli Zaretskii                                  eliz@gnu.org
 
index 8eee1c2..e0e812e 100644 (file)
@@ -145,10 +145,12 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
 #
 SUBDIR_CLI_OBS = \
        cli-dump.o \
-       cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o
+       cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o \
+       cli-interp.o
 SUBDIR_CLI_SRCS = \
        cli/cli-dump.c \
        cli/cli-decode.c cli/cli-script.c cli/cli-cmds.c cli/cli-setshow.c \
+       cli/cli-interp.c \
        cli/cli-utils.c
 SUBDIR_CLI_DEPS =
 SUBDIR_CLI_INITS = \
@@ -167,12 +169,14 @@ SUBDIR_MI_OBS = \
        mi-out.o mi-console.o \
        mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
        mi-cmd-disas.o \
+       mi-interp.o \
        mi-main.o mi-parse.o mi-getopt.o
 SUBDIR_MI_SRCS = \
        mi/mi-out.c mi/mi-console.c \
        mi/mi-cmds.c mi/mi-cmd-env.c \
        mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
        mi/mi-cmd-disas.c \
+       mi/mi-interp.c \
        mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
 SUBDIR_MI_DEPS =
 SUBDIR_MI_INITS = \
@@ -190,11 +194,13 @@ SUBDIR_MI_UNINSTALL=
 #
 SUBDIR_TUI_OBS = \
        tui-file.o tui.o tuiData.o tuiSource.o tuiStack.o tuiIO.o \
+       tui-interp.o \
        tuiGeneralWin.o tuiLayout.o tuiWin.o tuiCommand.o \
        tuiDisassem.o tuiSourceWin.o tuiRegs.o tuiDataWin.o \
        tui-out.o tui-hooks.o
 SUBDIR_TUI_SRCS = \
        tui/tui-file.c tui/tui.c tui/tuiData.c tui/tuiSource.c \
+       tui/tui-interp.c \
        tui/tuiStack.c tui/tuiIO.c \
        tui/tuiGeneralWin.c tui/tuiLayout.c \
        tui/tuiWin.c tui/tuiCommand.c \
@@ -236,9 +242,8 @@ WIN32LIBS = @WIN32LIBS@
 LIB_INSTALL_DIR = $(libdir)
 # This variable is needed when doing dynamic linking.
 LIB_RUNTIME_DIR = $(libdir)
-TCL = @TCL_LD_SEARCH_FLAGS@ @TCL_BUILD_LIB_SPEC@
+TCL = @TCL_CC_SEARCH_FLAGS@ @TCL_BUILD_LIB_SPEC@
 TCL_CFLAGS = @TCLHDIR@
-TCL_DEPS = @TCL_DEPS@
 GDBTKLIBS = @GDBTKLIBS@
 # Extra flags that the GDBTK files need:
 GDBTK_CFLAGS = @GDBTK_CFLAGS@
@@ -246,17 +251,14 @@ GDBTK_CFLAGS = @GDBTK_CFLAGS@
 # Where is the TK library?  Typically in ../tk.
 TK = @TK_BUILD_LIB_SPEC@
 TK_CFLAGS = @TKHDIR@ @TK_BUILD_INCLUDES@
-TK_DEPS = @TK_DEPS@
 
 # Where is Itcl?  Typically in ../itcl/itcl.
 ITCL_CFLAGS = @ITCLHDIR@
 ITCL = @ITCLLIB@
-ITCL_DEPS = @ITCL_DEPS@ 
 
 # Where is Itk?  Typically in ../itcl/itk.
 ITK_CFLAGS = @ITKHDIR@
 ITK = @ITKLIB@
-ITK_DEPS = @ITK_DEPS@ 
 
 X11_CFLAGS = @TK_XINCLUDES@
 X11_LDFLAGS =
@@ -278,17 +280,17 @@ GDBTK_LIBRARY = $(datadir)/insight$(GDBTK_VERSION)
 GDBTK_SRC_DIR = @GDBTK_SRC_DIR@
 
 SUBDIR_GDBTK_OBS = \
-       gdbtk.o gdbtk-bp.o gdbtk-cmds.o gdbtk-hooks.o \
+       gdbtk.o gdbtk-bp.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-interp.o \
        gdbtk-register.o gdbtk-stack.o gdbtk-varobj.o gdbtk-wrapper.o
 SUBDIR_GDBTK_SRCS = \
        gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-bp.c \
-       gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c \
+       gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk-interp.c \
        gdbtk/generic/gdbtk-register.c gdbtk/generic/gdbtk-stack.c \
        gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c \
        gdbtk/generic/gdbtk-main.c
 SUBDIR_GDBTK_DEPS = \
        $(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TK_DEPS) $(TCL_DEPS)
-SUBDIR_GDBTK_INITS = gdbtk/generic/gdbtk.c
+SUBDIR_GDBTK_INITS = gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-interp.c
 SUBDIR_GDBTK_LDFLAGS=
 SUBDIR_GDBTK_CFLAGS= -DGDBTK
 SUBDIR_GDBTK_ALL= all-gdbtk
@@ -505,18 +507,20 @@ TARGET_FLAGS_TO_PASS = \
 
 SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
        ax-general.c ax-gdb.c \
-       bcache.c blockframe.c breakpoint.c buildsym.c builtin-regs.c \
+       bcache.c block.c blockframe.c breakpoint.c buildsym.c builtin-regs.c \
        c-exp.y c-lang.c c-typeprint.c c-valprint.c \
-       charset.c cli-out.c coffread.c complaints.c completer.c corefile.c \
+       charset.c cli-out.c coffread.c coff-pe-read.c \
+       complaints.c completer.c corefile.c \
        cp-abi.c cp-support.c cp-valprint.c \
        dbxread.c demangle.c disasm.c doublest.c \
-       dummy-frame.c dwarfread.c dwarf2read.c \
+       dummy-frame.c dwarfread.c dwarf2expr.c dwarf2loc.c dwarf2read.c \
        elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \
        f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \
        frame-unwind.c \
        gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \
        hpacc-abi.c \
        inf-loop.c infcmd.c inflow.c infrun.c \
+       interps.c \
        jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \
        kod.c kod-cisco.c \
        language.c linespec.c \
@@ -525,7 +529,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
        mdebugread.c memattr.c mem-break.c minsyms.c mipsread.c \
        nlmread.c \
        objc-exp.y objc-lang.c \
-       objfiles.c osabi.c \
+       objfiles.c osabi.c observer.c \
        p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \
        regcache.c reggroups.c remote.c \
        scm-exp.c scm-lang.c scm-valprint.c \
@@ -599,6 +603,7 @@ arm_tdep_h = arm-tdep.h
 ax_gdb_h = ax-gdb.h
 ax_h = ax.h $(doublest_h)
 bcache_h = bcache.h
+block_h = block.h
 breakpoint_h = breakpoint.h $(frame_h) $(value_h) $(gdb_events_h)
 buildsym_h = buildsym.h
 builtin_regs_h = builtin-regs.h
@@ -607,6 +612,7 @@ call_cmds_h = call-cmds.h
 ch_lang_h = ch-lang.h
 cli_out_h = cli-out.h
 coff_solib_h = coff-solib.h
+coff_pe_read_h = coff-pe-read.h
 command_h = command.h
 complaints_h = complaints.h
 completer_h = completer.h
@@ -622,6 +628,8 @@ doublest_h = doublest.h $(floatformat_h)
 dst_h = dst.h
 dummy_frame_h = dummy-frame.h
 dwarf2cfi_h = dwarf2cfi.h
+dwarf2expr_h = dwarf2expr.h
+dwarf2loc_h = dwarf2loc.h
 environ_h = environ.h
 event_loop_h = event-loop.h
 event_top_h = event-top.h
@@ -655,6 +663,8 @@ i386_tdep_h = i386-tdep.h
 i387_tdep_h = i387-tdep.h
 inf_loop_h = inf-loop.h
 inferior_h = inferior.h $(breakpoint_h) $(target_h) $(frame_h)
+inflow_h = inflow.h $(terminal_h)
+interps_h = interps.h
 jv_lang_h = jv-lang.h
 kod_h = kod.h
 language_h = language.h
@@ -674,6 +684,7 @@ nbsd_tdep_h = nbsd-tdep.h
 ns32k_tdep_h = ns32k-tdep.h
 objc_lang_h = objc-lang.h
 objfiles_h = objfiles.h $(gdb_obstack_h) $(symfile_h)
+observer_h = observer.h
 ocd_h = ocd.h
 osabi_h = osabi.h
 p_lang_h = p-lang.h
@@ -740,6 +751,7 @@ cli_utils_h = $(srcdir)/cli/cli-utils.h
 mi_cmds_h = $(srcdir)/mi/mi-cmds.h
 mi_console_h = $(srcdir)/mi/mi-console.h
 mi_getopt_h = $(srcdir)/mi/mi-getopt.h
+mi_main_h = $(srcdir)/mi/mi-main.h
 mi_out_h = $(srcdir)/mi/mi-out.h
 mi_parse_h = $(srcdir)/mi/mi-parse.h
 
@@ -814,8 +826,9 @@ TAGFILES_WITH_SRCDIR = $(HFILES_WITH_SRCDIR)
 COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \
        charset.o disasm.o dummy-frame.o \
        source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
-       symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
+       block.o symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \
        expprint.o environ.o stack.o thread.o \
+       interps.o \
        macrotab.o macrocmd.o macroexp.o macroscope.o \
        event-loop.o event-top.o inf-loop.o completer.o \
        gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o $(DEPFILES) \
@@ -824,9 +837,10 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \
        signals.o \
        kod.o kod-cisco.o \
        gdb-events.o \
-       exec.o bcache.o objfiles.o minsyms.o maint.o demangle.o \
-       dbxread.o coffread.o elfread.o \
+       exec.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \
+       dbxread.o coffread.o coff-pe-read.o elfread.o \
        dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
+       dwarf2expr.o dwarf2loc.o \
        c-lang.o f-lang.o \
        ui-out.o cli-out.o \
        varobj.o wrapper.o \
@@ -1420,32 +1434,32 @@ z8k-tdep.o: $(srcdir)/z8k-tdep.c
 c-exp.tab.o: c-exp.tab.c $(defs_h) $(gdb_string_h) $(expression_h) \
        $(value_h) $(parser_defs_h) $(language_h) $(c_lang_h) $(bfd_h) \
        $(charset_h) \
-       $(symfile_h) $(objfiles_h)
+       $(symfile_h) $(objfiles_h) $(block_h)
 
 objc-exp.tab.o: objc-exp.tab.c $(objc_lang_h) $(defs_h) $(expression_h) \
        $(gdbtypes_h) $(language_h) $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 jv-exp.tab.o: jv-exp.tab.c jv-lang.h $(defs_h) $(expression_h) \
        $(gdbtypes_h) $(language_h) $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 f-exp.tab.o: f-exp.tab.c f-lang.h $(defs_h) $(expression_h) \
        $(language_h) $(parser_defs_h) $(value_h) $(bfd_h) $(objfiles_h) \
-       $(symfile_h)
+       $(symfile_h) $(block_h)
 
 m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
        $(language_h) m2-lang.h $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 p-exp.tab.o: p-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \
        $(language_h) p-lang.h $(parser_defs_h) $(symtab_h) $(value_h) \
-       $(bfd_h) $(objfiles_h) $(symfile_h)
+       $(bfd_h) $(objfiles_h) $(symfile_h) $(block_h)
 
 ada-exp.tab.o: ada-exp.tab.c ada-lex.c ada-lang.h \
        $(defs_h) $(expression_h) \
        $(gdbtypes_h) language.h parser-defs.h $(symtab_h) $(value_h) \
-       $(bfd_h) objfiles.h symfile.h
+       $(bfd_h) objfiles.h symfile.h $(block_h)
 
 #
 # The dependencies.  In aphabetic order.
@@ -1456,7 +1470,7 @@ abug-rom.o: abug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 ada-lang.o: ada-lang.c $(gdb_string_h) $(demangle_h) $(defs_h) $(symtab_h) \
        $(gdbtypes_h) $(gdbcmd_h) $(expression_h) $(parser_defs_h) \
        $(language_h) $(c_lang_h) $(inferior_h) $(symfile_h) $(objfiles_h) \
-       $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(ui_out_h)
+       $(breakpoint_h) $(gdbcore_h) $(ada_lang_h) $(ui_out_h) $(block_h)
 ada-tasks.o: ada-tasks.c $(defs_h) $(command_h) $(value_h) $(language_h) \
        $(inferior_h) $(symtab_h) $(target_h) $(gdbcore_h) $(gregset_h) \
        $(ada_lang_h)
@@ -1480,7 +1494,7 @@ alpha-tdep.o: alpha-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
        $(value_h) $(gdbcmd_h) $(gdbcore_h) $(dis_asm_h) $(symfile_h) \
        $(objfiles_h) $(gdb_string_h) $(linespec_h) $(regcache_h) \
        $(doublest_h) $(arch_utils_h) $(elf_bfd_h) $(alpha_tdep_h) \
-       $(osabi_h)
+       $(osabi_h) $(block_h)
 alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(alpha_tdep_h) $(alphabsd_tdep_h) $(gregset_h)
 alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) $(alpha_tdep_h) \
@@ -1516,24 +1530,27 @@ avr-tdep.o: avr-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
        $(symfile_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h)
 ax-gdb.o: ax-gdb.c $(defs_h) $(symtab_h) $(symfile_h) $(gdbtypes_h) \
        $(value_h) $(expression_h) $(command_h) $(gdbcmd_h) $(frame_h) \
-       $(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h)
+       $(target_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h) $(block_h) \
+       $(regcache_h)
 ax-general.o: ax-general.c $(defs_h) $(ax_h) $(value_h) $(gdb_string_h)
 bcache.o: bcache.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(gdb_string_h)
+block.o: block.c $(defs_h) $(block_h) $(symtab_h) $(symfile_h)
 blockframe.o: blockframe.c $(defs_h) $(symtab_h) $(bfd_h) $(symfile_h) \
        $(objfiles_h) $(frame_h) $(gdbcore_h) $(value_h) $(target_h) \
        $(inferior_h) $(annotate_h) $(regcache_h) $(gdb_assert_h) \
-       $(dummy_frame_h) $(command_h) $(gdbcmd_h)
+       $(dummy_frame_h) $(command_h) $(gdbcmd_h) $(block_h)
 breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \
        $(gdbtypes_h) $(expression_h) $(gdbcore_h) $(gdbcmd_h) $(value_h) \
        $(command_h) $(inferior_h) $(gdbthread_h) $(target_h) $(language_h) \
        $(gdb_string_h) $(demangle_h) $(annotate_h) $(symfile_h) \
        $(objfiles_h) $(linespec_h) $(completer_h) $(gdb_h) $(ui_out_h) \
-       $(cli_script_h) $(gdb_events_h) $(source_h) $(gdb_assert_h)
+       $(cli_script_h) $(gdb_events_h) $(source_h) $(gdb_assert_h) \
+       $(block_h)
 buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
        $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
        $(complaints_h) $(gdb_string_h) $(expression_h) $(language_h) \
        $(bcache_h) $(filenames_h) $(macrotab_h) $(demangle_h) $(buildsym_h) \
-       $(stabsread_h)
+       $(stabsread_h) $(block_h)
 builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \
        $(gdb_string_h) $(gdb_assert_h)
 c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
@@ -1556,7 +1573,9 @@ coffread.o: coffread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(demangle_h) \
        $(breakpoint_h) $(bfd_h) $(gdb_obstack_h) $(gdb_string_h) \
        $(coff_internal_h) $(libcoff_h) $(symfile_h) $(objfiles_h) \
        $(buildsym_h) $(gdb_stabs_h) $(stabsread_h) $(complaints_h) \
-       $(target_h) $(gdb_assert_h)
+       $(target_h) $(gdb_assert_h) $(block_h) $(coff_pe_read_h)
+coff-pe-read.o: coff-pe-read.c $(bfd_h) $(defs_h) $(symtab_h) \
+       $(gdbtypes_h) $(symfile_h) $(objfiles_h) $(coff_pe_read_h)
 complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdb_assert_h) \
        $(command_h) $(gdbcmd_h)
 completer.o: completer.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
@@ -1618,11 +1637,16 @@ dve3900-rom.o: dve3900-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 dwarf2cfi.o: dwarf2cfi.c $(defs_h) $(gdbcore_h) $(symtab_h) $(symfile_h) \
        $(objfiles_h) $(target_h) $(elf_dwarf2_h) $(inferior_h) \
        $(regcache_h) $(dwarf2cfi_h) $(gdb_assert_h)
+dwarf2expr.o: dwarf2expr.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) \
+        $(gdbcore_h) $(dwarf2expr_h)
+dwarf2loc.o: dwarf2loc.c $(defs_h) $(ui_out_h) $(value_h) $(frame_h) \
+       $(gdbcore_h) $(target_h) $(inferior_h) $(dwarf2expr_h) \
+       $(dwarf2loc_h) $(ax_h) $(ax_gdb_h) $(gdb_string_h)
 dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
        $(symfile_h) $(objfiles_h) $(elf_dwarf2_h) $(buildsym_h) \
        $(demangle_h) $(expression_h) $(filenames_h) $(macrotab_h) \
-       $(language_h) $(complaints_h) $(bcache_h) $(gdb_string_h) \
-       $(gdb_assert_h)
+       $(language_h) $(complaints_h) $(bcache_h) $(dwarf2expr_h) \
+       $(dwarf2loc_h) $(gdb_string_h) $(gdb_assert_h)
 dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \
        $(objfiles_h) $(elf_dwarf_h) $(buildsym_h) $(demangle_h) \
        $(expression_h) $(language_h) $(complaints_h) $(gdb_string_h)
@@ -1636,13 +1660,15 @@ eval.o: eval.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
 event-loop.o: event-loop.c $(defs_h) $(event_loop_h) $(event_top_h) \
        $(gdb_string_h)
 event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
-       $(terminal_h) $(event_loop_h) $(event_top_h) $(gdbcmd_h) $(readline_h)
+       $(terminal_h) $(event_loop_h) $(event_top_h) $(interps_h) \
+       $(gdbcmd_h)
 exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
        $(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \
        $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) $(xcoffsolib_h) \
        $(readline_h)
 expprint.o: expprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
-       $(value_h) $(language_h) $(parser_defs_h) $(target_h) $(gdb_string_h)
+       $(value_h) $(language_h) $(parser_defs_h) $(target_h) $(gdb_string_h) \
+       $(block_h)
 f-lang.o: f-lang.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(expression_h) $(parser_defs_h) $(language_h) $(f_lang_h) \
        $(valprint_h)
@@ -1651,13 +1677,13 @@ f-typeprint.o: f-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
        $(f_lang_h) $(gdb_string_h)
 f-valprint.o: f-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \
-       $(f_lang_h) $(frame_h) $(gdbcore_h) $(command_h)
+       $(f_lang_h) $(frame_h) $(gdbcore_h) $(command_h) $(block_h)
 fbsd-proc.o: fbsd-proc.c $(defs_h) $(gdbcore_h) $(inferior_h) \
        $(gdb_string_h) $(elf_bfd_h) $(gregset_h)
 findvar.o: findvar.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(frame_h) \
        $(value_h) $(gdbcore_h) $(inferior_h) $(target_h) $(gdb_string_h) \
        $(gdb_assert_h) $(floatformat_h) $(symfile_h) $(regcache_h) \
-       $(builtin_regs_h)
+       $(builtin_regs_h) $(block_h)
 fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \
        $(inferior_h) $(target_h) $(gdb_wait_h) $(gdb_vfork_h) $(gdbcore_h) \
        $(terminal_h) $(gdbthread_h) $(command_h)
@@ -1672,7 +1698,7 @@ frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \
        $(arch_utils_h) $(regcache_h)
 gcore.o: gcore.c $(defs_h) $(cli_decode_h) $(inferior_h) $(gdbcore_h) \
        $(elf_bfd_h) $(symfile_h) $(objfiles_h)
-gdb.o: gdb.c $(defs_h) $(main_h) $(gdb_string_h)
+gdb.o: gdb.c $(defs_h) $(main_h) $(gdb_string_h) $(interps_h)
 gdb-events.o: gdb-events.c $(defs_h) $(gdb_events_h) $(gdbcmd_h)
 gdbarch.o: gdbarch.c $(defs_h) $(arch_utils_h) $(gdbcmd_h) $(inferior_h) \
        $(gdb_string_h) $(symtab_h) $(frame_h) $(inferior_h) $(breakpoint_h) \
@@ -1720,7 +1746,7 @@ hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \
        $(complaints_h) $(gdb_stabs_h) $(gdbtypes_h) $(demangle_h) \
        $(gdb_string_h)
 hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
-       $(inferior_h) $(regcache_h) $(gdbcore_h)
+       $(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h)
 i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
        $(regcache_h) $(gdb_assert_h) $(gdb_string_h) $(gregset_h) \
        $(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h)
@@ -1767,8 +1793,8 @@ ia64-aix-nat.o: ia64-aix-nat.c $(defs_h) $(inferior_h) $(target_h) \
        $(gdbcore_h) $(regcache_h) $(symtab_h) $(bfd_h) $(symfile_h) \
        $(objfiles_h) $(gdb_stat_h)
 ia64-aix-tdep.o: ia64-aix-tdep.c $(defs_h)
-ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(inferior_h) $(target_h) \
-       $(gdbcore_h) $(regcache_h) $(gregset_h) $(gdb_string_h)
+ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
+       $(target_h) $(gdbcore_h) $(regcache_h) $(gdb_wait_h) $(gregset_h)
 ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(arch_utils_h)
 ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \
        $(arch_utils_h) $(floatformat_h) $(regcache_h) $(doublest_h) \
@@ -1779,9 +1805,10 @@ infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(frame_h) $(inferior_h) $(environ_h) $(value_h) $(gdbcmd_h) \
        $(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \
        $(objfiles_h) $(completer_h) $(ui_out_h) $(event_top_h) \
-       $(parser_defs_h) $(regcache_h)
+       $(parser_defs_h) $(regcache_h) $(block_h)
 inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \
-       $(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h)
+       $(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \
+       $(inflow_h)
 infptrace.o: infptrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
        $(gdb_string_h) $(regcache_h) $(gdb_wait_h) $(command_h) \
        $(gdb_dirent_h) $(gdbcore_h) $(gdb_stat_h)
@@ -1790,9 +1817,12 @@ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
        $(cli_script_h) $(target_h) $(gdbthread_h) $(annotate_h) \
        $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h)
 inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
-       $(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h)
+       $(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h)
 infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
        $(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbcore_h)
+interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
+       $(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
+       $(gdb_events_h) $(gdb_assert_h) $(top_h)
 irix4-nat.o: irix4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) \
        $(gregset_h)
 irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
@@ -1800,7 +1830,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
 jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
        $(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \
        $(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \
-       $(jv_lang_h) $(gdbcore_h)
+       $(jv_lang_h) $(gdbcore_h) $(block_h)
 jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \
        $(c_lang_h) $(cp_abi_h)
@@ -1817,7 +1847,7 @@ lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
        $(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
 linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
        $(symfile_h) $(objfiles_h) $(demangle_h) $(value_h) $(completer_h) \
-       $(cp_abi_h) $(source_h) $(parser_defs_h)
+       $(cp_abi_h) $(source_h) $(parser_defs_h) $(block_h)
 linux-proc.o: linux-proc.c $(defs_h) $(inferior_h) $(regcache_h) \
        $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(elf_bfd_h) \
        $(cli_decode_h) $(gdb_string_h)
@@ -1868,7 +1898,7 @@ macrotab.o: macrotab.c $(defs_h) $(gdb_obstack_h) $(splay_tree_h) \
        $(bcache_h) $(complaints_h)
 main.o: main.c $(defs_h) $(top_h) $(target_h) $(inferior_h) $(symfile_h) \
        $(gdbcore_h) $(getopt_h) $(gdb_stat_h) $(gdb_string_h) \
-       $(event_loop_h) $(ui_out_h) $(main_h)
+       $(event_loop_h) $(ui_out_h) $(interps_h) $(main_h)
 maint.o: maint.c $(defs_h) $(command_h) $(gdbcmd_h) $(symtab_h) \
        $(gdbtypes_h) $(demangle_h) $(gdbcore_h) $(expression_h) \
        $(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h)
@@ -1880,6 +1910,7 @@ mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
 mdebugread.o: mdebugread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
        $(symfile_h) $(objfiles_h) $(gdb_obstack_h) $(buildsym_h) \
        $(stabsread_h) $(complaints_h) $(demangle_h) $(gdb_assert_h) \
+       $(block_h) \
        $(coff_sym_h) $(coff_symconst_h) $(gdb_stat_h) $(gdb_string_h) \
        $(bfd_h) $(coff_ecoff_h) $(libaout_h) $(aout_aout64_h) \
        $(aout_stab_gnu_h) $(expression_h) $(language_h)
@@ -1898,7 +1929,7 @@ mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h)
 mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
        $(symtab_h) $(value_h) $(gdbcmd_h) $(language_h) $(gdbcore_h) \
        $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(target_h) $(arch_utils_h) \
-       $(regcache_h) $(osabi_h) $(mips_tdep_h) $(opcode_mips_h) \
+       $(regcache_h) $(osabi_h) $(mips_tdep_h) $(block_h) $(opcode_mips_h) \
        $(elf_mips_h) $(elf_bfd_h) $(symcat_h)
 mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h)
 mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
@@ -1923,7 +1954,7 @@ monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
        $(gdb_regex_h) $(srec_h) $(regcache_h)
 nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h)
 nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
-       $(objfiles_h) $(buildsym_h) $(stabsread_h)
+       $(objfiles_h) $(buildsym_h) $(stabsread_h) $(block_h)
 ns32k-tdep.o: ns32k-tdep.c $(defs_h) $(frame_h) $(gdbtypes_h) $(gdbcore_h) \
        $(inferior_h) $(regcache_h) $(target_h) $(arch_utils_h) \
        $(ns32k_tdep_h) $(gdb_string_h) $(osabi_h)
@@ -1935,10 +1966,12 @@ objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
        $(parser_defs_h) $(language_h) $(c_lang_h) $(objc_lang_h) \
        $(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) \
        $(gdb_string_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(frame_h) \
-       $(gdb_regex_h) $(regcache_h)
+       $(gdb_regex_h) $(regcache_h) $(block_h)
 objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
        $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \
-       $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h)
+       $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) \
+       $(block_h)
+observer.o: observer.c $(observer_h) $(defs_h)
 ocd.o: ocd.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
        $(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) $(objfiles_h) \
        $(gdb_stabs_h) $(serial_h) $(ocd_h) $(regcache_h)
@@ -1963,13 +1996,14 @@ pa64solib.o: pa64solib.c $(defs_h) $(frame_h) $(bfd_h) $(libhppa_h) \
 parse.o: parse.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(frame_h) $(expression_h) $(value_h) $(command_h) $(language_h) \
        $(parser_defs_h) $(gdbcmd_h) $(symfile_h) $(inferior_h) \
-       $(doublest_h) $(builtin_regs_h) $(gdb_assert_h)
+       $(doublest_h) $(builtin_regs_h) $(gdb_assert_h) $(block_h)
 ppc-bdm.o: ppc-bdm.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) \
        $(inferior_h) $(bfd_h) $(symfile_h) $(target_h) $(gdbcmd_h) \
        $(objfiles_h) $(gdb_stabs_h) $(serial_h) $(ocd_h) $(ppc_tdep_h) \
        $(regcache_h)
-ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(frame_h) $(inferior_h) \
-       $(gdbcore_h) $(regcache_h) $(gregset_h) $(ppc_tdep_h) $(gdb_string_h)
+ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdb_string_h) $(frame_h) \
+       $(inferior_h) $(gdbcore_h) $(regcache_h) $(gdb_wait_h) $(gregset_h) \
+       $(ppc_tdep_h)
 ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
        $(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
        $(objfiles_h) $(regcache_h) $(value_h) $(solib_svr4_h) $(ppc_tdep_h) \
@@ -1987,16 +2021,18 @@ printcmd.o: printcmd.c $(defs_h) $(gdb_string_h) $(frame_h) $(symtab_h) \
        $(gdbtypes_h) $(value_h) $(language_h) $(expression_h) $(gdbcore_h) \
        $(gdbcmd_h) $(target_h) $(breakpoint_h) $(demangle_h) $(valprint_h) \
        $(annotate_h) $(symfile_h) $(objfiles_h) $(completer_h) $(ui_out_h) \
-       $(gdb_assert_h)
-proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(proc_utils_h)
+       $(gdb_assert_h) $(block_h)
+proc-api.o: proc-api.c $(defs_h) $(gdbcmd_h) $(completer_h) $(gdb_wait_h) \
+       $(proc_utils_h)
 proc-events.o: proc-events.c $(defs_h)
 proc-flags.o: proc-flags.c $(defs_h)
 proc-service.o: proc-service.c $(defs_h) $(gdb_proc_service_h) $(inferior_h) \
        $(symtab_h) $(target_h) $(gregset_h)
 proc-why.o: proc-why.c $(defs_h) $(proc_utils_h)
 procfs.o: procfs.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
-       $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) $(gdb_dirent_h) $(X_OK) \
-       $(gdb_stat_h) $(proc_utils_h) $(gregset_h)
+       $(elf_bfd_h) $(gdbcmd_h) $(gdbthread_h) $(gdb_wait_h) $(gdb_assert_h) \
+       $(inflow_h) $(gdb_dirent_h) $(X_OK) $(gdb_stat_h) $(proc_utils_h) \
+       $(gregset_h)
 regcache.o: regcache.c $(defs_h) $(inferior_h) $(target_h) $(gdbarch_h) \
        $(gdbcmd_h) $(regcache_h) $(reggroups_h) $(gdb_assert_h) \
        $(gdb_string_h) $(gdbcmd_h)
@@ -2109,8 +2145,8 @@ sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) $(shnbsd_tdep_h)
 shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(value_h) \
        $(solib_svr4_h) $(nbsd_tdep_h) $(sh_tdep_h) $(shnbsd_tdep_h) $(osabi_h)
-sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) \
-       $(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) $(symfile_h) \
+sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
+       $(gdb_stat_h) $(gdbcmd_h) $(gdbcore_h) $(regcache_h) $(symfile_h) \
        $(gregset_h)
 solib-aix5.o: solib-aix5.c $(defs_h) $(gdb_string_h) $(elf_external_h) \
        $(symtab_h) $(bfd_h) $(symfile_h) $(objfiles_h) $(gdbcore_h) \
@@ -2145,7 +2181,7 @@ source.o: source.c $(defs_h) $(symtab_h) $(expression_h) $(language_h) \
        $(filenames_h) $(completer_h) $(ui_out_h) $(readline_h)
 sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(regcache_h) $(gregset_h)
 sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
-       $(regcache_h)
+       $(regcache_h) $(gdb_wait_h)
 sparc-stub.o: sparc-stub.c
 sparc-tdep.o: sparc-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
        $(inferior_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \
@@ -2172,7 +2208,7 @@ stabsread.o: stabsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(gdb_obstack_h) \
 stack.o: stack.c $(defs_h) $(gdb_string_h) $(value_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(language_h) $(frame_h) $(gdbcmd_h) \
        $(gdbcore_h) $(target_h) $(breakpoint_h) $(demangle_h) $(inferior_h) \
-       $(annotate_h) $(ui_out_h) $(source_h)
+       $(annotate_h) $(ui_out_h) $(source_h) $(block_h)
 standalone.o: standalone.c $(gdb_stat_h) $(defs_h) $(symtab_h) $(frame_h) \
        $(inferior_h) $(gdb_wait_h)
 std-regs.o: std-regs.c $(defs_h) $(builtin_regs_h) $(frame_h) $(gdbtypes_h) \
@@ -2184,21 +2220,22 @@ symfile.o: symfile.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
        $(gdbcmd_h) $(breakpoint_h) $(language_h) $(complaints_h) \
        $(demangle_h) $(inferior_h) $(gdb_stabs_h) $(gdb_obstack_h) \
        $(completer_h) $(bcache_h) $(gdb_string_h) $(gdb_stat_h) $(source_h) \
-       $(gdb_assert_h) $(readline_h) $(filenames_h)
+       $(gdb_assert_h) $(readline_h) $(filenames_h) $(block_h)
 symm-nat.o: symm-nat.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
-       $(target_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) $(gdbcore_h)
+       $(target_h) $(regcache_h) $(gdb_wait_h) $(gdb_stat_h) $(gdbcore_h) \
+       $(gdbcore_h)
 symm-tdep.o: symm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_h) \
        $(gdb_stat_h) $(gdbcore_h)
 symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \
        $(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \
        $(gdb_obstack_h) $(language_h) $(bcache_h) $(gdb_string_h) \
-       $(readline_h)
+       $(readline_h) $(block_h)
 symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
        $(frame_h) $(target_h) $(value_h) $(symfile_h) $(objfiles_h) \
        $(gdbcmd_h) $(call_cmds_h) $(gdb_regex_h) $(expression_h) \
        $(language_h) $(demangle_h) $(inferior_h) $(linespec_h) \
        $(filenames_h) $(gdb_obstack_h) $(gdb_string_h) $(gdb_stat_h) \
-       $(cp_abi_h) $(source_h)
+       $(cp_abi_h) $(source_h) $(block_h)
 target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
        $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
        $(gdb_wait_h) $(dcache_h) $(regcache_h)
@@ -2218,8 +2255,8 @@ top.o: top.c $(defs_h) $(gdbcmd_h) $(call_cmds_h) $(cli_cmds_h) \
 tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(gdbtypes_h) \
        $(expression_h) $(gdbcmd_h) $(value_h) $(target_h) $(language_h) \
        $(gdb_string_h) $(inferior_h) $(tracepoint_h) $(remote_h) \
-       $(linespec_h) $(regcache_h) $(completer_h) $(gdb_events_h) $(ax_h) \
-       $(ax_gdb_h) $(readline_h)
+       $(linespec_h) $(regcache_h) $(completer_h) $(gdb_events_h) \
+       $(block_h) $(ax_h) $(ax_gdb_h) $(readline_h)
 typeprint.o: typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
        $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(command_h) \
        $(gdbcmd_h) $(target_h) $(language_h) $(cp_abi_h) $(gdb_string_h)
@@ -2244,14 +2281,14 @@ valarith.o: valarith.c $(defs_h) $(value_h) $(symtab_h) $(gdbtypes_h) \
 valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \
        $(inferior_h) $(gdbcore_h) $(target_h) $(demangle_h) $(language_h) \
        $(gdbcmd_h) $(regcache_h) $(cp_abi_h) $(gdb_string_h) \
-       $(gdb_assert_h)
+       $(gdb_assert_h) $(block_h)
 valprint.o: valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(language_h) \
        $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h)
 values.o: values.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcore_h) $(command_h) $(gdbcmd_h) $(target_h) \
        $(language_h) $(scm_lang_h) $(demangle_h) $(doublest_h) \
-       $(gdb_assert_h) $(regcache_h)
+       $(gdb_assert_h) $(regcache_h) $(block_h)
 varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \
        $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h)
 vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \
@@ -2276,7 +2313,7 @@ x86-64-linux-tdep.o: x86-64-linux-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
        $(osabi_h)
 x86-64-tdep.o: x86-64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
        $(gdbcmd_h) $(arch_utils_h) $(regcache_h) $(symfile_h) $(objfiles_h) \
-       $(x86_64_tdep_h) $(dwarf2cfi_h) $(gdb_assert_h)
+       $(x86_64_tdep_h) $(dwarf2cfi_h) $(gdb_assert_h) $(block_h)
 xcoffread.o: xcoffread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(gdb_stat_h) \
        $(coff_internal_h) $(libcoff_h) $(coff_xcoff_h) $(libxcoff_h) \
        $(coff_rs6000_h) $(symtab_h) $(gdbtypes_h) $(symfile_h) \
@@ -2311,6 +2348,9 @@ cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) \
        $(cli_decode_h) $(cli_cmds_h) $(value_h) $(completer_h) \
        $(cli_dump_h) $(gdb_assert_h) $(target_h) $(readline_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-dump.c
+cli-interp.o: $(srcdir)/cli/cli-interp.c $(defs_h) $(interps_h) $(wrapper_h) \
+       $(event_top_h) $(ui_out_h) $(cli_out_h) $(top_h) $(gdb_string_h)
+       $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-interp.c
 cli-script.o: $(srcdir)/cli/cli-script.c $(defs_h) $(value_h) $(language_h) \
        $(ui_out_h) $(gdb_string_h) $(top_h) $(cli_cmds_h) $(cli_decode_h) \
        $(cli_script_h)
@@ -2425,6 +2465,14 @@ gdbtk-hooks.o: $(srcdir)/gdbtk/generic/gdbtk-hooks.c \
        $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
                $(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\"
 
+gdbtk-interp.o: $(srcdir)/gdbtk/generic/gdbtk-interp.c \
+       $(defs_h) $(interps_h) $(ui_out_h) $(ui_file_h) \
+       $(cli_out_h) $(gdb_string_h) $(cli_cmds_h) $(cli_decode_h) \
+       $(srcdir)/gdbtk/generic/gdbtk.h
+       $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) \
+       $(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS) \
+               $(srcdir)/gdbtk/generic/gdbtk-interp.c
+
 gdbtk-main.o: $(srcdir)/gdbtk/generic/gdbtk-main.c $(defs_h) $(main_h) \
        $(gdb_string_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS)  \
@@ -2481,7 +2529,7 @@ mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c $(defs_h) $(inferior_h) $(value_h) \
        $(environ_h) $(command_h) $(ui_out_h) $(top_h) $(gdb_string_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-env.c
 mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \
-       $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h)
+       $(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c
 mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
        $(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h)
@@ -2495,9 +2543,13 @@ mi-console.o: $(srcdir)/mi/mi-console.c $(defs_h) $(mi_console_h) \
 mi-getopt.o: $(srcdir)/mi/mi-getopt.c $(defs_h) $(mi_getopt_h) \
        $(gdb_string_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-getopt.c
+mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(gdb_string_h) $(interps_h) \
+       $(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) $(top_h) \
+       $(mi_main_h) $(mi_cmds_h) $(mi_out_h) $(mi_console_h)
+       $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-interp.c
 mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(target_h) $(inferior_h) \
        $(gdb_string_h) $(top_h) $(gdbthread_h) $(mi_cmds_h) $(mi_parse_h) \
-       $(mi_getopt_h) $(mi_console_h) $(ui_out_h) $(mi_out_h) \
+       $(mi_getopt_h) $(mi_console_h) $(ui_out_h) $(mi_out_h) $(interps_h) \
        $(event_loop_h) $(event_top_h) $(gdbcore_h) $(value_h) $(regcache_h) \
        $(gdb_h) $(frame_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-main.c
@@ -2548,6 +2600,10 @@ tui-hooks.o: $(srcdir)/tui/tui-hooks.c $(config_h) $(defs_h) $(symtab_h) \
        $(tuiRegs_h) $(tuiWin_h) $(tuiStack_h) $(tuiDataWin_h) \
        $(tuiSourceWin_h) $(readline_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-hooks.c
+tui-interp.o: $(srcdir)/tui/tui-interp.c $(defs_h) $(interps_h) $(top_h) \
+       $(event_top_h) $(event_loop_h) $(ui_out_h) $(tui_tuiData_h) \
+       $(readline_h) $(tui_tuiWin_h) $(tui_h) $(tui_tuiIO_h)
+       $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-interp.c
 tui-out.o: $(srcdir)/tui/tui-out.c $(defs_h) $(ui_out_h) $(tui_h) \
        $(gdb_string_h) $(gdb_assert_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-out.c
index 6bb4508..eaefeff 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -20,7 +20,7 @@ data, for more informative profiling results.
 
 The default MI (machine interface) syntax, enabled by the command line
 option "-i=mi", has been changed to "mi2".  The previous MI syntax,
-"mi1", can be enabled by sepcifying the option "-i=mi1".
+"mi1", can be enabled by specifying the option "-i=mi1".
 
 Support for the original "mi0" syntax (included in GDB 5.0) has been
 removed.
@@ -37,6 +37,11 @@ been commented out.  Unless there is activity to revive these
 configurations, the next release of GDB will have their sources
 permanently REMOVED.
 
+Mitsubishi M32R/D w/simulator                  m32r-*-elf*
+Z8000 simulator                                z8k-zilog-none    or z8ksim
+Matsushita MN10200 w/simulator                 mn10200-*-*
+H8/500 simulator                       h8500-hitachi-hms or h8500hms
+
 * REMOVED configurations and files
 
 V850EA ISA                             
index b2f45d8..8511263 100644 (file)
@@ -65,3 +65,16 @@ building GDB vis:
 
     $ make CFLAGS='-O2 -D__digital__'
 
+
+i[3456]86-*-linux*
+------------------
+
+gdb/660: gdb does not build with GNU/Linux libc5.  The symptom is a
+parse error before `uintptr_t' or an error message about `uintptr_t'.
+Upgrade to glibc 2.1.3 or later, which defines uintptr_t.
+
+gdb/1030: GNU binutils 2.12.1 and earlier versions do not work properly
+with gdb.  If you use GNU binutils, upgrade to version 2.13 or later.
+You can check the version of binutils with the command:
+
+    $ ld --version
index 5dc2ee7..2a9c665 100644 (file)
--- a/gdb/TODO
+++ b/gdb/TODO
@@ -175,10 +175,6 @@ Deprecate, if not delete, the following:
                The size of the cache can be computed
                on the fly.
 
-       IS_TRAPPED_INTERNALVAR
-               The pseudo registers should eventually make
-               this redundant.
-
 --
 
 Obsolete the targets:
index e8951df..d3c00ae 100644 (file)
@@ -259,6 +259,7 @@ dnl not used, don't export to save symbols
     AC_SUBST(TCL_LD_FLAGS)
 dnl don't export, not used outside of configure
     AC_SUBST(TCL_LD_SEARCH_FLAGS)
+    AC_SUBST(TCL_CC_SEARCH_FLAGS)
     AC_SUBST(TCL_COMPAT_OBJS)
     AC_SUBST(TCL_RANLIB)
     AC_SUBST(TCL_BUILD_LIB_SPEC)
index d925c33..51e94f2 100644 (file)
@@ -271,6 +271,7 @@ dnl not used, don't export to save symbols
     AC_SUBST(TCL_LD_FLAGS)
 dnl don't export, not used outside of configure
     AC_SUBST(TCL_LD_SEARCH_FLAGS)
+    AC_SUBST(TCL_CC_SEARCH_FLAGS)
     AC_SUBST(TCL_COMPAT_OBJS)
     AC_SUBST(TCL_RANLIB)
     AC_SUBST(TCL_BUILD_LIB_SPEC)
index 70a4b58..70e6e08 100644 (file)
@@ -1,5 +1,5 @@
 /* YACC parser for Ada expressions, for GDB.
-   Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1997, 2000
+   Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1997, 2000, 2003
    Free Software Foundation, Inc.
 
 This file is part of GDB.
@@ -49,6 +49,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "frame.h"
+#include "block.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
@@ -801,7 +802,7 @@ write_object_renaming (orig_left_context, renaming)
      struct block* orig_left_context;
      struct symbol* renaming;
 {
-  const char* qualification = SYMBOL_NAME (renaming);
+  const char* qualification = DEPRECATED_SYMBOL_NAME (renaming);
   const char* simple_tail;
   const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0);
   const char* suffix;
@@ -943,7 +944,7 @@ write_object_renaming (orig_left_context, renaming)
 
  BadEncoding:
   error ("Internal error in encoding of renaming declaration: %s",
-        SYMBOL_NAME (renaming));
+        DEPRECATED_SYMBOL_NAME (renaming));
 }
 
 /* Convert the character literal whose ASCII value would be VAL to the
index 5d5aaf8..bf0e6df 100644 (file)
@@ -1,5 +1,6 @@
 /* Ada language support routines for GDB, the GNU debugger.  Copyright
-   1992, 1993, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   1992, 1993, 1994, 1997, 1998, 1999, 2000, 2003
+   Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -37,6 +38,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "gdbcore.h"
 #include "ada-lang.h"
 #include "ui-out.h"
+#include "block.h"
 
 struct cleanup *unresolved_names;
 
@@ -705,7 +707,7 @@ ada_suppress_symbol_printing (struct symbol *sym)
   if (SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE)
     return 1;
   else
-    return is_suppressed_name (SYMBOL_NAME (sym));
+    return is_suppressed_name (DEPRECATED_SYMBOL_NAME (sym));
 }
 \f
 
@@ -2170,6 +2172,8 @@ ada_resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
    case LOC_LOCAL_ARG:
    case LOC_BASEREG:
    case LOC_BASEREG_ARG:
+   case LOC_COMPUTED:
+   case LOC_COMPUTED_ARG:
    goto FoundNonType;
    default:
    break;
@@ -2561,8 +2565,8 @@ sort_choices (struct symbol *syms[], struct block *blocks[], int nsyms)
 
       for (j = i - 1; j >= 0; j -= 1)
        {
-         if (mangled_ordered_before (SYMBOL_NAME (syms[j]),
-                                     SYMBOL_NAME (sym)))
+         if (mangled_ordered_before (DEPRECATED_SYMBOL_NAME (syms[j]),
+                                     DEPRECATED_SYMBOL_NAME (sym)))
            break;
          syms[j + 1] = syms[j];
          blocks[j + 1] = blocks[j];
@@ -2612,7 +2616,7 @@ user_select_syms (struct symbol *syms[], struct block *blocks[], int nsyms,
          struct symtab_and_line sal = find_function_start_sal (syms[i], 1);
          printf_unfiltered ("[%d] %s at %s:%d\n",
                             i + first_choice,
-                            SYMBOL_SOURCE_NAME (syms[i]),
+                            SYMBOL_PRINT_NAME (syms[i]),
                             sal.symtab == NULL
                             ? "<no source file available>"
                             : sal.symtab->filename, sal.line);
@@ -2629,28 +2633,28 @@ user_select_syms (struct symbol *syms[], struct block *blocks[], int nsyms,
          if (SYMBOL_LINE (syms[i]) != 0 && symtab != NULL)
            printf_unfiltered ("[%d] %s at %s:%d\n",
                               i + first_choice,
-                              SYMBOL_SOURCE_NAME (syms[i]),
+                              SYMBOL_PRINT_NAME (syms[i]),
                               symtab->filename, SYMBOL_LINE (syms[i]));
          else if (is_enumeral && TYPE_NAME (SYMBOL_TYPE (syms[i])) != NULL)
            {
              printf_unfiltered ("[%d] ", i + first_choice);
              ada_print_type (SYMBOL_TYPE (syms[i]), NULL, gdb_stdout, -1, 0);
              printf_unfiltered ("'(%s) (enumeral)\n",
-                                SYMBOL_SOURCE_NAME (syms[i]));
+                                SYMBOL_PRINT_NAME (syms[i]));
            }
          else if (symtab != NULL)
            printf_unfiltered (is_enumeral
                               ? "[%d] %s in %s (enumeral)\n"
                               : "[%d] %s at %s:?\n",
                               i + first_choice,
-                              SYMBOL_SOURCE_NAME (syms[i]),
+                              SYMBOL_PRINT_NAME (syms[i]),
                               symtab->filename);
          else
            printf_unfiltered (is_enumeral
                               ? "[%d] %s (enumeral)\n"
                               : "[%d] %s at ?\n",
                               i + first_choice,
-                              SYMBOL_SOURCE_NAME (syms[i]));
+                              SYMBOL_PRINT_NAME (syms[i]));
        }
     }
 
@@ -3238,8 +3242,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
       {
        struct type *type0 = SYMBOL_TYPE (sym0);
        struct type *type1 = SYMBOL_TYPE (sym1);
-       char *name0 = SYMBOL_NAME (sym0);
-       char *name1 = SYMBOL_NAME (sym1);
+       char *name0 = DEPRECATED_SYMBOL_NAME (sym0);
+       char *name1 = DEPRECATED_SYMBOL_NAME (sym1);
        int len0 = strlen (name0);
        return
          TYPE_CODE (type0) == TYPE_CODE (type1)
@@ -3317,7 +3321,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
          struct partial_symbol *psym = start[i];
 
          if (SYMBOL_NAMESPACE (psym) == namespace &&
-             wild_match (name, name_len, SYMBOL_NAME (psym)))
+             wild_match (name, name_len, DEPRECATED_SYMBOL_NAME (psym)))
            return psym;
        }
       return NULL;
@@ -3333,11 +3337,11 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
            {
              int M = (U + i) >> 1;
              struct partial_symbol *psym = start[M];
-             if (SYMBOL_NAME (psym)[0] < name[0])
+             if (DEPRECATED_SYMBOL_NAME (psym)[0] < name[0])
                i = M + 1;
-             else if (SYMBOL_NAME (psym)[0] > name[0])
+             else if (DEPRECATED_SYMBOL_NAME (psym)[0] > name[0])
                U = M - 1;
-             else if (strcmp (SYMBOL_NAME (psym), name) < 0)
+             else if (strcmp (DEPRECATED_SYMBOL_NAME (psym), name) < 0)
                i = M + 1;
              else
                U = M;
@@ -3352,7 +3356,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
 
          if (SYMBOL_NAMESPACE (psym) == namespace)
            {
-             int cmp = strncmp (name, SYMBOL_NAME (psym), name_len);
+             int cmp = strncmp (name, DEPRECATED_SYMBOL_NAME (psym), name_len);
 
              if (cmp < 0)
                {
@@ -3360,7 +3364,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
                    break;
                }
              else if (cmp == 0
-                      && is_name_suffix (SYMBOL_NAME (psym) + name_len))
+                      && is_name_suffix (DEPRECATED_SYMBOL_NAME (psym) + name_len))
                return psym;
            }
          i += 1;
@@ -3375,11 +3379,11 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
            {
              int M = (U + i) >> 1;
              struct partial_symbol *psym = start[M];
-             if (SYMBOL_NAME (psym)[0] < '_')
+             if (DEPRECATED_SYMBOL_NAME (psym)[0] < '_')
                i = M + 1;
-             else if (SYMBOL_NAME (psym)[0] > '_')
+             else if (DEPRECATED_SYMBOL_NAME (psym)[0] > '_')
                U = M - 1;
-             else if (strcmp (SYMBOL_NAME (psym), "_ada_") < 0)
+             else if (strcmp (DEPRECATED_SYMBOL_NAME (psym), "_ada_") < 0)
                i = M + 1;
              else
                U = M;
@@ -3396,12 +3400,12 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
            {
              int cmp;
 
-             cmp = (int) '_' - (int) SYMBOL_NAME (psym)[0];
+             cmp = (int) '_' - (int) DEPRECATED_SYMBOL_NAME (psym)[0];
              if (cmp == 0)
                {
-                 cmp = strncmp ("_ada_", SYMBOL_NAME (psym), 5);
+                 cmp = strncmp ("_ada_", DEPRECATED_SYMBOL_NAME (psym), 5);
                  if (cmp == 0)
-                   cmp = strncmp (name, SYMBOL_NAME (psym) + 5, name_len);
+                   cmp = strncmp (name, DEPRECATED_SYMBOL_NAME (psym) + 5, name_len);
                }
 
              if (cmp < 0)
@@ -3410,7 +3414,7 @@ ada_lookup_partial_symbol (struct partial_symtab *pst, const char *name,
                    break;
                }
              else if (cmp == 0
-                      && is_name_suffix (SYMBOL_NAME (psym) + name_len + 5))
+                      && is_name_suffix (DEPRECATED_SYMBOL_NAME (psym) + name_len + 5))
                return psym;
            }
          i += 1;
@@ -3464,6 +3468,8 @@ symtab_for_sym (struct symbol *sym)
       case LOC_LOCAL_ARG:
       case LOC_BASEREG:
       case LOC_BASEREG_ARG:
+      case LOC_COMPUTED:
+      case LOC_COMPUTED_ARG:
        for (j = FIRST_LOCAL_BLOCK;
             j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1)
          {
@@ -3491,7 +3497,7 @@ ada_lookup_minimal_symbol (const char *name)
 
   ALL_MSYMBOLS (objfile, msymbol)
   {
-    if (ada_match_name (SYMBOL_NAME (msymbol), name, wild_match)
+    if (ada_match_name (DEPRECATED_SYMBOL_NAME (msymbol), name, wild_match)
        && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
       return msymbol;
   }
@@ -3525,7 +3531,7 @@ add_symbols_from_enclosing_procs (const char *name, namespace_enum namespace,
       /* Initialize the local variable symbol that stands for the
        * static link (when it exists). */
       static_link = &static_link_sym;
-      SYMBOL_NAME (static_link) = "";
+      DEPRECATED_SYMBOL_NAME (static_link) = "";
       SYMBOL_LANGUAGE (static_link) = language_unknown;
       SYMBOL_CLASS (static_link) = LOC_LOCAL;
       SYMBOL_NAMESPACE (static_link) = VAR_NAMESPACE;
@@ -3594,15 +3600,15 @@ remove_extra_symbols (struct symbol **syms, struct block **blocks, int nsyms)
   i = 0;
   while (i < nsyms)
     {
-      if (SYMBOL_NAME (syms[i]) != NULL
+      if (DEPRECATED_SYMBOL_NAME (syms[i]) != NULL
          && SYMBOL_CLASS (syms[i]) == LOC_STATIC
          && is_nondebugging_type (SYMBOL_TYPE (syms[i])))
        {
          for (j = 0; j < nsyms; j += 1)
            {
              if (i != j
-                 && SYMBOL_NAME (syms[j]) != NULL
-                 && STREQ (SYMBOL_NAME (syms[i]), SYMBOL_NAME (syms[j]))
+                 && DEPRECATED_SYMBOL_NAME (syms[j]) != NULL
+                 && STREQ (DEPRECATED_SYMBOL_NAME (syms[i]), DEPRECATED_SYMBOL_NAME (syms[j]))
                  && SYMBOL_CLASS (syms[i]) == SYMBOL_CLASS (syms[j])
                  && SYMBOL_VALUE_ADDRESS (syms[i])
                  == SYMBOL_VALUE_ADDRESS (syms[j]))
@@ -3697,7 +3703,7 @@ ada_lookup_symbol_list (const char *name, struct block *block0,
     {
       ALL_MSYMBOLS (objfile, msymbol)
       {
-       if (ada_match_name (SYMBOL_NAME (msymbol), name, wild_match))
+       if (ada_match_name (DEPRECATED_SYMBOL_NAME (msymbol), name, wild_match))
          {
            switch (MSYMBOL_TYPE (msymbol))
              {
@@ -3712,13 +3718,13 @@ ada_lookup_symbol_list (const char *name, struct block *block0,
                    bv = BLOCKVECTOR (s);
                    block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
                    ada_add_block_symbols (block,
-                                          SYMBOL_NAME (msymbol),
+                                          DEPRECATED_SYMBOL_NAME (msymbol),
                                           namespace, objfile, wild_match);
                    if (ndefns == old_ndefns)
                      {
                        block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
                        ada_add_block_symbols (block,
-                                              SYMBOL_NAME (msymbol),
+                                              DEPRECATED_SYMBOL_NAME (msymbol),
                                               namespace, objfile,
                                               wild_match);
                      }
@@ -3958,7 +3964,7 @@ ada_add_block_symbols (struct block *block, const char *name,
       ALL_BLOCK_SYMBOLS (block, i, sym)
       {
        if (SYMBOL_NAMESPACE (sym) == namespace &&
-           wild_match (name, name_len, SYMBOL_NAME (sym)))
+           wild_match (name, name_len, DEPRECATED_SYMBOL_NAME (sym)))
          {
            switch (SYMBOL_CLASS (sym))
              {
@@ -3968,6 +3974,7 @@ ada_add_block_symbols (struct block *block, const char *name,
              case LOC_REGPARM:
              case LOC_REGPARM_ADDR:
              case LOC_BASEREG_ARG:
+             case LOC_COMPUTED_ARG:
                arg_sym = sym;
                break;
              case LOC_UNRESOLVED:
@@ -3992,11 +3999,11 @@ ada_add_block_symbols (struct block *block, const char *name,
            {
              int M = (U + i) >> 1;
              struct symbol *sym = BLOCK_SYM (block, M);
-             if (SYMBOL_NAME (sym)[0] < name[0])
+             if (DEPRECATED_SYMBOL_NAME (sym)[0] < name[0])
                i = M + 1;
-             else if (SYMBOL_NAME (sym)[0] > name[0])
+             else if (DEPRECATED_SYMBOL_NAME (sym)[0] > name[0])
                U = M - 1;
-             else if (strcmp (SYMBOL_NAME (sym), name) < 0)
+             else if (strcmp (DEPRECATED_SYMBOL_NAME (sym), name) < 0)
                i = M + 1;
              else
                U = M;
@@ -4010,7 +4017,7 @@ ada_add_block_symbols (struct block *block, const char *name,
          {
            if (SYMBOL_NAMESPACE (sym) == namespace)
              {
-               int cmp = strncmp (name, SYMBOL_NAME (sym), name_len);
+               int cmp = strncmp (name, DEPRECATED_SYMBOL_NAME (sym), name_len);
 
                if (cmp < 0)
                  {
@@ -4021,7 +4028,7 @@ ada_add_block_symbols (struct block *block, const char *name,
                      }
                  }
                else if (cmp == 0
-                        && is_name_suffix (SYMBOL_NAME (sym) + name_len))
+                        && is_name_suffix (DEPRECATED_SYMBOL_NAME (sym) + name_len))
                  {
                    switch (SYMBOL_CLASS (sym))
                      {
@@ -4031,6 +4038,7 @@ ada_add_block_symbols (struct block *block, const char *name,
                      case LOC_REGPARM:
                      case LOC_REGPARM_ADDR:
                      case LOC_BASEREG_ARG:
+                     case LOC_COMPUTED_ARG:
                        arg_sym = sym;
                        break;
                      case LOC_UNRESOLVED:
@@ -4066,11 +4074,11 @@ ada_add_block_symbols (struct block *block, const char *name,
            {
              int M = (U + i) >> 1;
              struct symbol *sym = BLOCK_SYM (block, M);
-             if (SYMBOL_NAME (sym)[0] < '_')
+             if (DEPRECATED_SYMBOL_NAME (sym)[0] < '_')
                i = M + 1;
-             else if (SYMBOL_NAME (sym)[0] > '_')
+             else if (DEPRECATED_SYMBOL_NAME (sym)[0] > '_')
                U = M - 1;
-             else if (strcmp (SYMBOL_NAME (sym), "_ada_") < 0)
+             else if (strcmp (DEPRECATED_SYMBOL_NAME (sym), "_ada_") < 0)
                i = M + 1;
              else
                U = M;
@@ -4088,12 +4096,12 @@ ada_add_block_symbols (struct block *block, const char *name,
              {
                int cmp;
 
-               cmp = (int) '_' - (int) SYMBOL_NAME (sym)[0];
+               cmp = (int) '_' - (int) DEPRECATED_SYMBOL_NAME (sym)[0];
                if (cmp == 0)
                  {
-                   cmp = strncmp ("_ada_", SYMBOL_NAME (sym), 5);
+                   cmp = strncmp ("_ada_", DEPRECATED_SYMBOL_NAME (sym), 5);
                    if (cmp == 0)
-                     cmp = strncmp (name, SYMBOL_NAME (sym) + 5, name_len);
+                     cmp = strncmp (name, DEPRECATED_SYMBOL_NAME (sym) + 5, name_len);
                  }
 
                if (cmp < 0)
@@ -4105,7 +4113,7 @@ ada_add_block_symbols (struct block *block, const char *name,
                      }
                  }
                else if (cmp == 0
-                        && is_name_suffix (SYMBOL_NAME (sym) + name_len + 5))
+                        && is_name_suffix (DEPRECATED_SYMBOL_NAME (sym) + name_len + 5))
                  {
                    switch (SYMBOL_CLASS (sym))
                      {
@@ -4115,6 +4123,7 @@ ada_add_block_symbols (struct block *block, const char *name,
                      case LOC_REGPARM:
                      case LOC_REGPARM_ADDR:
                      case LOC_BASEREG_ARG:
+                     case LOC_COMPUTED_ARG:
                        arg_sym = sym;
                        break;
                      case LOC_UNRESOLVED:
@@ -4190,7 +4199,7 @@ fill_in_ada_prototype (struct symbol *func)
        TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0;
        TYPE_FIELD_TYPE (ftype, nargs) =
          lookup_pointer_type (check_typedef (SYMBOL_TYPE (sym)));
-       TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym);
+       TYPE_FIELD_NAME (ftype, nargs) = DEPRECATED_SYMBOL_NAME (sym);
        nargs += 1;
 
        break;
@@ -4199,11 +4208,12 @@ fill_in_ada_prototype (struct symbol *func)
       case LOC_REGPARM:
       case LOC_LOCAL_ARG:
       case LOC_BASEREG_ARG:
+      case LOC_COMPUTED_ARG:
        TYPE_FIELD_BITPOS (ftype, nargs) = nargs;
        TYPE_FIELD_BITSIZE (ftype, nargs) = 0;
        TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0;
        TYPE_FIELD_TYPE (ftype, nargs) = check_typedef (SYMBOL_TYPE (sym));
-       TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym);
+       TYPE_FIELD_NAME (ftype, nargs) = DEPRECATED_SYMBOL_NAME (sym);
        nargs += 1;
 
        break;
@@ -4472,7 +4482,7 @@ ada_finish_decode_line_1 (char **spec, struct symtab *file_table,
       for (i = 0; i < selected.nelts; i += 1)
        (*canonical)[i] =
          extended_canonical_line_spec (selected.sals[i],
-                                       SYMBOL_SOURCE_NAME (symbols[i]));
+                                       SYMBOL_PRINT_NAME (symbols[i]));
     }
 
   discard_cleanups (old_chain);
@@ -4755,7 +4765,7 @@ debug_print_block (struct block *b)
   fprintf (stderr, "Block: %p; [0x%lx, 0x%lx]",
           b, BLOCK_START (b), BLOCK_END (b));
   if (BLOCK_FUNCTION (b) != NULL)
-    fprintf (stderr, " Function: %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
+    fprintf (stderr, " Function: %s", DEPRECATED_SYMBOL_NAME (BLOCK_FUNCTION (b)));
   fprintf (stderr, "\n");
   fprintf (stderr, "\t    Superblock: %p\n", BLOCK_SUPERBLOCK (b));
   fprintf (stderr, "\t    Symbols:");
@@ -4763,7 +4773,7 @@ debug_print_block (struct block *b)
   {
     if (i > 0 && i % 4 == 0)
       fprintf (stderr, "\n\t\t    ");
-    fprintf (stderr, " %s", SYMBOL_NAME (sym));
+    fprintf (stderr, " %s", DEPRECATED_SYMBOL_NAME (sym));
   }
   fprintf (stderr, "\n");
 }
index d2b426c..45c156a 100644 (file)
@@ -23,6 +23,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "value.h"
 #include "gdbtypes.h"
 
+struct block;
+
 /* A macro to reorder the bytes of an address depending on the endiannes
    of the target */
 #define EXTRACT_ADDRESS(x) ((void *) extract_address (&(x), sizeof (x)))
index c18aa85..1939354 100644 (file)
@@ -1,5 +1,6 @@
 /* Support for printing Ada types for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1997 Free Software Foundation, Inc.
+   Copyright 1986, 1988, 1989, 1991, 1997, 2003 Free Software
+   Foundation, Inc.
 
 This file is part of GDB.
 
@@ -124,8 +125,8 @@ ada_typedef_print (struct type *type, struct symbol *new,
                   struct ui_file *stream)
 {
   fprintf_filtered (stream, "type %.*s is ",
-                   ada_name_prefix_len (SYMBOL_SOURCE_NAME (new)),
-                   SYMBOL_SOURCE_NAME (new));
+                   ada_name_prefix_len (SYMBOL_PRINT_NAME (new)),
+                   SYMBOL_PRINT_NAME (new));
   type_print (type, "", stream, 1);
 }
 
index cf5abc8..3d1d96e 100644 (file)
@@ -35,6 +35,7 @@
 #include "doublest.h"
 #include "arch-utils.h"
 #include "osabi.h"
+#include "block.h"
 
 #include "elf-bfd.h"
 
@@ -68,13 +69,10 @@ static gdbarch_skip_prologue_ftype alpha_skip_prologue;
 static gdbarch_saved_pc_after_call_ftype alpha_saved_pc_after_call;
 static gdbarch_frame_chain_ftype alpha_frame_chain;
 static gdbarch_frame_saved_pc_ftype alpha_frame_saved_pc;
-static gdbarch_frame_init_saved_regs_ftype alpha_frame_init_saved_regs;
 
 static gdbarch_push_arguments_ftype alpha_push_arguments;
-static gdbarch_push_dummy_frame_ftype alpha_push_dummy_frame;
 static gdbarch_pop_frame_ftype alpha_pop_frame;
 static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
-static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info;
 
 static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
 
@@ -1821,9 +1819,9 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, ALPHA_REGISTER_BYTES);
   set_gdbarch_register_byte (gdbarch, alpha_register_byte);
   set_gdbarch_register_raw_size (gdbarch, alpha_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, ALPHA_MAX_REGISTER_RAW_SIZE);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, ALPHA_MAX_REGISTER_RAW_SIZE);
   set_gdbarch_register_virtual_size (gdbarch, alpha_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch,
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch,
                                          ALPHA_MAX_REGISTER_VIRTUAL_SIZE);
   set_gdbarch_register_virtual_type (gdbarch, alpha_register_virtual_type);
 
@@ -1846,7 +1844,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_chain (gdbarch, alpha_frame_chain);
   set_gdbarch_frame_saved_pc (gdbarch, alpha_frame_saved_pc);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, alpha_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, alpha_frame_init_saved_regs);
 
   set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
   set_gdbarch_deprecated_extract_return_value (gdbarch, alpha_extract_return_value);
@@ -1871,7 +1869,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sizeof_call_dummy_words (gdbarch, 0);
   set_gdbarch_frame_args_address (gdbarch, alpha_frame_args_address);
   set_gdbarch_frame_locals_address (gdbarch, alpha_frame_locals_address);
-  set_gdbarch_init_extra_frame_info (gdbarch, alpha_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, alpha_init_extra_frame_info);
 
   /* Alpha OSF/1 inhibits execution of code on the stack.  But there is
      no need for a dummy on the Alpha.  PUSH_ARGUMENTS takes care of all
@@ -1882,7 +1880,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_push_dummy_frame (gdbarch, alpha_push_dummy_frame);
+  set_gdbarch_deprecated_push_dummy_frame (gdbarch, alpha_push_dummy_frame);
   set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy);
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
   set_gdbarch_deprecated_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
index 1202df9..1016ba1 100644 (file)
@@ -440,7 +440,13 @@ int
 generic_register_size (int regnum)
 {
   gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
-  return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
+  if (gdbarch_register_type_p (current_gdbarch))
+    return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
+  else
+    /* FIXME: cagney/2003-03-01: Once all architectures implement
+       gdbarch_register_type(), this entire function can go away.  It
+       is made obsolete by register_size().  */
+    return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum)); /* OK */
 }
 
 /* Assume all registers are adjacent.  */
@@ -454,7 +460,7 @@ generic_register_byte (int regnum)
   byte = 0;
   for (i = 0; i < regnum; i++)
     {
-      byte += TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (i));
+      byte += generic_register_size (i);
     }
   return byte;
 }
index e0d8a93..1ebe600 100644 (file)
@@ -363,8 +363,8 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p)
 
       ALL_OBJFILE_MSYMBOLS (objfile, msym)
        {
-         if (SYMBOL_NAME (msym)
-             && strcmp (SYMBOL_NAME (msym), name) == 0)
+         if (DEPRECATED_SYMBOL_NAME (msym)
+             && strcmp (DEPRECATED_SYMBOL_NAME (msym), name) == 0)
            {
              *objfile_p = objfile;
              return msym;
index 7ff473f..11b2350 100644 (file)
@@ -1014,7 +1014,7 @@ arm_find_callers_reg (struct frame_info *fi, int regnum)
 }
 /* Function: frame_chain Given a GDB frame, determine the address of
    the calling function's frame.  This will be used to create a new
-   GDB frame struct, and then INIT_EXTRA_FRAME_INFO and
+   GDB frame struct, and then DEPRECATED_INIT_EXTRA_FRAME_INFO and
    DEPRECATED_INIT_FRAME_PC will be called for the new frame.  For
    ARM, we save the frame size when we initialize the frame_info.  */
 
@@ -1112,7 +1112,7 @@ arm_init_extra_frame_info (int fromleaf, struct frame_info *fi)
   /* Determine whether or not we're in a sigtramp frame.
      Unfortunately, it isn't sufficient to test (get_frame_type (fi)
      == SIGTRAMP_FRAME) because this value is sometimes set after
-     invoking INIT_EXTRA_FRAME_INFO.  So we test *both*
+     invoking DEPRECATED_INIT_EXTRA_FRAME_INFO.  So we test *both*
      (get_frame_type (fi) == SIGTRAMP_FRAME) and PC_IN_SIGTRAMP to
      determine if we need to use the sigcontext addresses for the
      saved registers.
@@ -1503,7 +1503,7 @@ arm_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
        }
     }
 
-  /* Return the botom of the argument list (pointed to by fp).  */
+  /* Return the bottom of the argument list (pointed to by fp).  */
   return fp;
 }
 
@@ -2101,7 +2101,7 @@ gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info)
       static asymbol *asym;
       static combined_entry_type ce;
       static struct coff_symbol_struct csym;
-      static struct _bfd fake_bfd;
+      static struct bfd fake_bfd;
       static bfd_target fake_target;
 
       if (csym.native == NULL)
@@ -2834,6 +2834,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
        default:
          /* Leave it as "unknown".  */
+         break;
        }
     }
 
@@ -2903,7 +2904,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame handling.  */
   set_gdbarch_frame_chain_valid (gdbarch, arm_frame_chain_valid);
-  set_gdbarch_init_extra_frame_info (gdbarch, arm_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, arm_init_extra_frame_info);
   set_gdbarch_read_fp (gdbarch, arm_read_fp);
   set_gdbarch_frame_chain (gdbarch, arm_frame_chain);
   set_gdbarch_frameless_function_invocation
@@ -2913,8 +2914,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_locals_address (gdbarch, arm_frame_locals_address);
   set_gdbarch_frame_num_args (gdbarch, arm_frame_num_args);
   set_gdbarch_frame_args_skip (gdbarch, 0);
-  set_gdbarch_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, arm_frame_init_saved_regs);
   set_gdbarch_pop_frame (gdbarch, arm_pop_frame);
 
   /* Address manipulation.  */
@@ -2950,8 +2950,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SREGS);
   set_gdbarch_register_raw_size (gdbarch, arm_register_raw_size);
   set_gdbarch_register_virtual_size (gdbarch, arm_register_virtual_size);
-  set_gdbarch_max_register_raw_size (gdbarch, FP_REGISTER_RAW_SIZE);
-  set_gdbarch_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, FP_REGISTER_RAW_SIZE);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE);
   set_gdbarch_register_virtual_type (gdbarch, arm_register_type);
 
   /* Internal <-> external register number maps.  */
index a4893ba..952b4e4 100644 (file)
@@ -418,7 +418,8 @@ avr_convert_from_func_ptr_addr (CORE_ADDR addr)
   return addr * 2;
 }
 
-/* avr_scan_prologue is also used as the frame_init_saved_regs().
+/* avr_scan_prologue is also used as the
+   deprecated_frame_init_saved_regs().
 
    Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
@@ -892,34 +893,6 @@ avr_saved_pc_after_call (struct frame_info *frame)
   return (m2 | (m1 << 8)) * 2;
 }
 
-/* Figure out where in REGBUF the called function has left its return value.
-   Copy that into VALBUF. */
-
-static void
-avr_extract_return_value (struct type *type, char *regbuf, char *valbuf)
-{
-  int wordsize, len;
-
-  wordsize = 2;
-
-  len = TYPE_LENGTH (type);
-
-  switch (len)
-    {
-    case 1:                    /* (char) */
-    case 2:                    /* (short), (int) */
-      memcpy (valbuf, regbuf + REGISTER_BYTE (24), 2);
-      break;
-    case 4:                    /* (long), (float) */
-      memcpy (valbuf, regbuf + REGISTER_BYTE (22), 4);
-      break;
-    case 8:                    /* (double) (doesn't seem to happen, which is good,
-                                  because this almost certainly isn't right.  */
-      error ("I don't know how a double is returned.");
-      break;
-    }
-}
-
 /* Returns the return address for a dummy. */
 
 static CORE_ADDR
@@ -928,35 +901,6 @@ avr_call_dummy_address (void)
   return entry_point_address ();
 }
 
-/* Place the appropriate value in the appropriate registers.
-   Primarily used by the RETURN command.  */
-
-static void
-avr_store_return_value (struct type *type, char *valbuf)
-{
-  int wordsize, len, regval;
-
-  wordsize = 2;
-
-  len = TYPE_LENGTH (type);
-  switch (len)
-    {
-    case 1:                    /* char */
-    case 2:                    /* short, int */
-      regval = extract_address (valbuf, len);
-      write_register (0, regval);
-      break;
-    case 4:                    /* long, float */
-      regval = extract_address (valbuf, len);
-      write_register (0, regval >> 16);
-      write_register (1, regval & 0xffff);
-      break;
-    case 8:                    /* presumeably double, but doesn't seem to happen */
-      error ("I don't know how to return a double.");
-      break;
-    }
-}
-
 /* Setup the return address for a dummy frame, as called by
    call_function_by_hand.  Only necessary when you are using an empty
    CALL_DUMMY. */
@@ -1031,8 +975,8 @@ avr_frame_address (struct frame_info *fi)
 
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame.
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame.
 
    For us, the frame address is its stack pointer value, so we look up
    the function prologue to determine the caller's sp value, and return it.  */
@@ -1067,17 +1011,6 @@ avr_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
   write_register (0, addr);
 }
 
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one). */
-
-static CORE_ADDR
-avr_extract_struct_value_address (char *regbuf)
-{
-  return (extract_address ((regbuf) + REGISTER_BYTE (0),
-                          REGISTER_RAW_SIZE (0)) | AVR_SMEM_START);
-}
-
 /* Setup the function arguments for calling a function in the inferior.
 
    On the AVR architecture, there are 18 registers (R25 to R8) which are
@@ -1227,9 +1160,9 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, AVR_NUM_REG_BYTES);
   set_gdbarch_register_byte (gdbarch, avr_register_byte);
   set_gdbarch_register_raw_size (gdbarch, avr_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
   set_gdbarch_register_virtual_size (gdbarch, avr_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_register_virtual_type (gdbarch, avr_register_virtual_type);
 
   set_gdbarch_print_insn (gdbarch, print_insn_avr);
@@ -1248,23 +1181,16 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
   set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
-  set_gdbarch_deprecated_extract_return_value (gdbarch, avr_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, avr_push_arguments);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, avr_push_return_address);
   set_gdbarch_pop_frame (gdbarch, avr_pop_frame);
 
-  set_gdbarch_deprecated_store_return_value (gdbarch, avr_store_return_value);
-
   set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention);
   set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return);
-  set_gdbarch_deprecated_extract_struct_value_address
-    (gdbarch, avr_extract_struct_value_address);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, avr_scan_prologue);
-  set_gdbarch_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, avr_scan_prologue);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, avr_init_extra_frame_info);
   set_gdbarch_skip_prologue (gdbarch, avr_skip_prologue);
-/*    set_gdbarch_prologue_frameless_p (gdbarch, avr_prologue_frameless_p); */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
index e38e675..5692c35 100644 (file)
@@ -33,6 +33,8 @@
 #include "ax.h"
 #include "ax-gdb.h"
 #include "gdb_string.h"
+#include "block.h"
+#include "regcache.h"
 
 /* To make sense of this file, you should read doc/agentexpr.texi.
    Then look at the types and enums in ax-gdb.h.  For the code itself,
@@ -578,7 +580,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
 
     case LOC_TYPEDEF:
       error ("Cannot compute value of typedef `%s'.",
-            SYMBOL_SOURCE_NAME (var));
+            SYMBOL_PRINT_NAME (var));
       break;
 
     case LOC_BLOCK:
@@ -607,9 +609,9 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
     case LOC_UNRESOLVED:
       {
        struct minimal_symbol *msym
-       = lookup_minimal_symbol (SYMBOL_NAME (var), NULL, NULL);
+       = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (var), NULL, NULL);
        if (!msym)
-         error ("Couldn't resolve symbol `%s'.", SYMBOL_SOURCE_NAME (var));
+         error ("Couldn't resolve symbol `%s'.", SYMBOL_PRINT_NAME (var));
 
        /* Push the address of the variable.  */
        ax_const_l (ax, SYMBOL_VALUE_ADDRESS (msym));
@@ -617,14 +619,19 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
       }
       break;
 
+    case LOC_COMPUTED:
+    case LOC_COMPUTED_ARG:
+      (*SYMBOL_LOCATION_FUNCS (var)->tracepoint_var_ref) (var, ax, value);
+      break;
+
     case LOC_OPTIMIZED_OUT:
       error ("The variable `%s' has been optimized out.",
-            SYMBOL_SOURCE_NAME (var));
+            SYMBOL_PRINT_NAME (var));
       break;
 
     default:
       error ("Cannot find value of botched symbol `%s'.",
-            SYMBOL_SOURCE_NAME (var));
+            SYMBOL_PRINT_NAME (var));
       break;
     }
 }
@@ -1589,7 +1596,7 @@ gen_expr (union exp_element **pc, struct agent_expr *ax,
        (*pc) += 3;
        value->kind = axs_lvalue_register;
        value->u.reg = reg;
-       value->type = REGISTER_VIRTUAL_TYPE (reg);
+       value->type = register_type (current_gdbarch, reg);
       }
       break;
 
diff --git a/gdb/block.c b/gdb/block.c
new file mode 100644 (file)
index 0000000..8aa08fb
--- /dev/null
@@ -0,0 +1,141 @@
+/* Block-related functions for the GNU debugger, GDB.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "block.h"
+#include "symtab.h"
+#include "symfile.h"
+
+/* Return Nonzero if block a is lexically nested within block b,
+   or if a and b have the same pc range.
+   Return zero otherwise. */
+
+int
+contained_in (struct block *a, struct block *b)
+{
+  if (!a || !b)
+    return 0;
+  return BLOCK_START (a) >= BLOCK_START (b)
+    && BLOCK_END (a) <= BLOCK_END (b);
+}
+
+
+/* Return the symbol for the function which contains a specified
+   lexical block, described by a struct block BL.  */
+
+struct symbol *
+block_function (struct block *bl)
+{
+  while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
+    bl = BLOCK_SUPERBLOCK (bl);
+
+  return BLOCK_FUNCTION (bl);
+}
+
+/* Return the blockvector immediately containing the innermost lexical block
+   containing the specified pc value and section, or 0 if there is none.
+   PINDEX is a pointer to the index value of the block.  If PINDEX
+   is NULL, we don't pass this information back to the caller.  */
+
+struct blockvector *
+blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section,
+                        int *pindex, struct symtab *symtab)
+{
+  register struct block *b;
+  register int bot, top, half;
+  struct blockvector *bl;
+
+  if (symtab == 0)             /* if no symtab specified by caller */
+    {
+      /* First search all symtabs for one whose file contains our pc */
+      if ((symtab = find_pc_sect_symtab (pc, section)) == 0)
+       return 0;
+    }
+
+  bl = BLOCKVECTOR (symtab);
+  b = BLOCKVECTOR_BLOCK (bl, 0);
+
+  /* Then search that symtab for the smallest block that wins.  */
+  /* Use binary search to find the last block that starts before PC.  */
+
+  bot = 0;
+  top = BLOCKVECTOR_NBLOCKS (bl);
+
+  while (top - bot > 1)
+    {
+      half = (top - bot + 1) >> 1;
+      b = BLOCKVECTOR_BLOCK (bl, bot + half);
+      if (BLOCK_START (b) <= pc)
+       bot += half;
+      else
+       top = bot + half;
+    }
+
+  /* Now search backward for a block that ends after PC.  */
+
+  while (bot >= 0)
+    {
+      b = BLOCKVECTOR_BLOCK (bl, bot);
+      if (BLOCK_END (b) > pc)
+       {
+         if (pindex)
+           *pindex = bot;
+         return bl;
+       }
+      bot--;
+    }
+  return 0;
+}
+
+/* Return the blockvector immediately containing the innermost lexical block
+   containing the specified pc value, or 0 if there is none.
+   Backward compatibility, no section.  */
+
+struct blockvector *
+blockvector_for_pc (register CORE_ADDR pc, int *pindex)
+{
+  return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
+                                 pindex, NULL);
+}
+
+/* Return the innermost lexical block containing the specified pc value
+   in the specified section, or 0 if there is none.  */
+
+struct block *
+block_for_pc_sect (register CORE_ADDR pc, struct sec *section)
+{
+  register struct blockvector *bl;
+  int index;
+
+  bl = blockvector_for_pc_sect (pc, section, &index, NULL);
+  if (bl)
+    return BLOCKVECTOR_BLOCK (bl, index);
+  return 0;
+}
+
+/* Return the innermost lexical block containing the specified pc value,
+   or 0 if there is none.  Backward compatibility, no section.  */
+
+struct block *
+block_for_pc (register CORE_ADDR pc)
+{
+  return block_for_pc_sect (pc, find_pc_mapped_section (pc));
+}
diff --git a/gdb/block.h b/gdb/block.h
new file mode 100644 (file)
index 0000000..d7dbf31
--- /dev/null
@@ -0,0 +1,183 @@
+/* Code dealing with blocks for GDB.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef BLOCK_H
+#define BLOCK_H
+
+/* Opaque declarations.  */
+
+struct symbol;
+struct symtab;
+
+/* All of the name-scope contours of the program
+   are represented by `struct block' objects.
+   All of these objects are pointed to by the blockvector.
+
+   Each block represents one name scope.
+   Each lexical context has its own block.
+
+   The blockvector begins with some special blocks.
+   The GLOBAL_BLOCK contains all the symbols defined in this compilation
+   whose scope is the entire program linked together.
+   The STATIC_BLOCK contains all the symbols whose scope is the
+   entire compilation excluding other separate compilations.
+   Blocks starting with the FIRST_LOCAL_BLOCK are not special.
+
+   Each block records a range of core addresses for the code that
+   is in the scope of the block.  The STATIC_BLOCK and GLOBAL_BLOCK
+   give, for the range of code, the entire range of code produced
+   by the compilation that the symbol segment belongs to.
+
+   The blocks appear in the blockvector
+   in order of increasing starting-address,
+   and, within that, in order of decreasing ending-address.
+
+   This implies that within the body of one function
+   the blocks appear in the order of a depth-first tree walk.  */
+
+struct block
+{
+
+  /* Addresses in the executable code that are in this block.  */
+
+  CORE_ADDR startaddr;
+  CORE_ADDR endaddr;
+
+  /* The symbol that names this block, if the block is the body of a
+     function; otherwise, zero.  */
+
+  struct symbol *function;
+
+  /* The `struct block' for the containing block, or 0 if none.
+
+     The superblock of a top-level local block (i.e. a function in the
+     case of C) is the STATIC_BLOCK.  The superblock of the
+     STATIC_BLOCK is the GLOBAL_BLOCK.  */
+
+  struct block *superblock;
+
+  /* Version of GCC used to compile the function corresponding
+     to this block, or 0 if not compiled with GCC.  When possible,
+     GCC should be compatible with the native compiler, or if that
+     is not feasible, the differences should be fixed during symbol
+     reading.  As of 16 Apr 93, this flag is never used to distinguish
+     between gcc2 and the native compiler.
+
+     If there is no function corresponding to this block, this meaning
+     of this flag is undefined.  */
+
+  unsigned char gcc_compile_flag;
+
+  /* The symbols for this block are either in a simple linear list or
+     in a simple hashtable.  Blocks which correspond to a function
+     (which have a list of symbols corresponding to arguments) use
+     a linear list, as do some older symbol readers (currently only
+     mdebugread and dstread).  Other blocks are hashed.
+
+     The hashtable uses the same hash function as the minsym hashtables,
+     found in minsyms.c:minsym_hash_iw.  Symbols are hashed based on
+     their demangled name if appropriate, and on their name otherwise.
+     The hash function ignores space, and stops at the beginning of the
+     argument list if any.
+
+     The table is laid out in NSYMS/5 buckets and symbols are chained via
+     their hash_next field.  */
+
+  /* If this is really a hashtable of the symbols, this flag is 1.  */
+
+  unsigned char hashtable;
+
+  /* Number of local symbols.  */
+
+  int nsyms;
+
+  /* The symbols.  If some of them are arguments, then they must be
+     in the order in which we would like to print them.  */
+
+  struct symbol *sym[1];
+};
+
+#define BLOCK_START(bl)                (bl)->startaddr
+#define BLOCK_END(bl)          (bl)->endaddr
+#define BLOCK_FUNCTION(bl)     (bl)->function
+#define BLOCK_SUPERBLOCK(bl)   (bl)->superblock
+#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
+#define BLOCK_HASHTABLE(bl)    (bl)->hashtable
+
+/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only.  */
+#define BLOCK_NSYMS(bl)                (bl)->nsyms
+#define BLOCK_SYM(bl, n)       (bl)->sym[n]
+
+/* For blocks with a hashtable, but these are valid for non-hashed blocks as
+   well - each symbol will appear to be one bucket by itself.  */
+#define BLOCK_BUCKETS(bl)      (bl)->nsyms
+#define BLOCK_BUCKET(bl, n)    (bl)->sym[n]
+
+/* Macro used to set the size of a hashtable for N symbols.  */
+#define BLOCK_HASHTABLE_SIZE(n)        ((n)/5 + 1)
+
+/* Macro to loop through all symbols in a block BL, in no particular order.
+   i counts which bucket we are in, and sym points to the current symbol.  */
+
+#define ALL_BLOCK_SYMBOLS(bl, i, sym)                          \
+       for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++)        \
+         for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym);         \
+              (sym) = (sym)->hash_next)
+
+/* Nonzero if symbols of block BL should be sorted alphabetically.
+   Don't sort a block which corresponds to a function.  If we did the
+   sorting would have to preserve the order of the symbols for the
+   arguments.  Also don't sort any block that we chose to hash.  */
+
+#define BLOCK_SHOULD_SORT(bl) (! BLOCK_HASHTABLE (bl) \
+                              && BLOCK_FUNCTION (bl) == NULL)
+
+struct blockvector
+{
+  /* Number of blocks in the list.  */
+  int nblocks;
+  /* The blocks themselves.  */
+  struct block *block[1];
+};
+
+#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
+#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
+
+/* Special block numbers */
+
+#define GLOBAL_BLOCK           0
+#define        STATIC_BLOCK            1
+#define        FIRST_LOCAL_BLOCK       2
+
+extern struct symbol *block_function (struct block *);
+
+extern int contained_in (struct block *, struct block *);
+
+extern struct blockvector *blockvector_for_pc (CORE_ADDR, int *);
+
+extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR, asection *,
+                                                   int *, struct symtab *);
+
+extern struct block *block_for_pc (CORE_ADDR);
+
+extern struct block *block_for_pc_sect (CORE_ADDR, asection *);
+
+#endif /* BLOCK_H */
index d5ed002..4096ab5 100644 (file)
@@ -38,6 +38,7 @@
 #include "dummy-frame.h"
 #include "command.h"
 #include "gdbcmd.h"
+#include "block.h"
 
 /* Prototypes for exported functions. */
 
@@ -257,96 +258,6 @@ get_frame_function (struct frame_info *frame)
 }
 \f
 
-/* Return the blockvector immediately containing the innermost lexical block
-   containing the specified pc value and section, or 0 if there is none.
-   PINDEX is a pointer to the index value of the block.  If PINDEX
-   is NULL, we don't pass this information back to the caller.  */
-
-struct blockvector *
-blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section,
-                        int *pindex, struct symtab *symtab)
-{
-  register struct block *b;
-  register int bot, top, half;
-  struct blockvector *bl;
-
-  if (symtab == 0)             /* if no symtab specified by caller */
-    {
-      /* First search all symtabs for one whose file contains our pc */
-      if ((symtab = find_pc_sect_symtab (pc, section)) == 0)
-       return 0;
-    }
-
-  bl = BLOCKVECTOR (symtab);
-  b = BLOCKVECTOR_BLOCK (bl, 0);
-
-  /* Then search that symtab for the smallest block that wins.  */
-  /* Use binary search to find the last block that starts before PC.  */
-
-  bot = 0;
-  top = BLOCKVECTOR_NBLOCKS (bl);
-
-  while (top - bot > 1)
-    {
-      half = (top - bot + 1) >> 1;
-      b = BLOCKVECTOR_BLOCK (bl, bot + half);
-      if (BLOCK_START (b) <= pc)
-       bot += half;
-      else
-       top = bot + half;
-    }
-
-  /* Now search backward for a block that ends after PC.  */
-
-  while (bot >= 0)
-    {
-      b = BLOCKVECTOR_BLOCK (bl, bot);
-      if (BLOCK_END (b) > pc)
-       {
-         if (pindex)
-           *pindex = bot;
-         return bl;
-       }
-      bot--;
-    }
-  return 0;
-}
-
-/* Return the blockvector immediately containing the innermost lexical block
-   containing the specified pc value, or 0 if there is none.
-   Backward compatibility, no section.  */
-
-struct blockvector *
-blockvector_for_pc (register CORE_ADDR pc, int *pindex)
-{
-  return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
-                                 pindex, NULL);
-}
-
-/* Return the innermost lexical block containing the specified pc value
-   in the specified section, or 0 if there is none.  */
-
-struct block *
-block_for_pc_sect (register CORE_ADDR pc, struct sec *section)
-{
-  register struct blockvector *bl;
-  int index;
-
-  bl = blockvector_for_pc_sect (pc, section, &index, NULL);
-  if (bl)
-    return BLOCKVECTOR_BLOCK (bl, index);
-  return 0;
-}
-
-/* Return the innermost lexical block containing the specified pc value,
-   or 0 if there is none.  Backward compatibility, no section.  */
-
-struct block *
-block_for_pc (register CORE_ADDR pc)
-{
-  return block_for_pc_sect (pc, find_pc_mapped_section (pc));
-}
-
 /* Return the function containing pc value PC in section SECTION.
    Returns 0 if function is not known.  */
 
@@ -453,7 +364,7 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
            {
              cache_pc_function_low = BLOCK_START (SYMBOL_BLOCK_VALUE (f));
              cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f));
-             cache_pc_function_name = SYMBOL_NAME (f);
+             cache_pc_function_name = DEPRECATED_SYMBOL_NAME (f);
              cache_pc_function_section = section;
              goto return_cached_value;
            }
@@ -474,7 +385,7 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
              if (address)
                *address = SYMBOL_VALUE_ADDRESS (psb);
              if (name)
-               *name = SYMBOL_NAME (psb);
+               *name = DEPRECATED_SYMBOL_NAME (psb);
              /* endaddr non-NULL can't happen here.  */
              return 1;
            }
@@ -505,7 +416,7 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
     }
 
   cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol);
-  cache_pc_function_name = SYMBOL_NAME (msymbol);
+  cache_pc_function_name = DEPRECATED_SYMBOL_NAME (msymbol);
   cache_pc_function_section = section;
 
   /* Use the lesser of the next minimal symbol in the same section, or
@@ -515,14 +426,14 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
      other sections, to find the next symbol in this section with
      a different address.  */
 
-  for (i = 1; SYMBOL_NAME (msymbol + i) != NULL; i++)
+  for (i = 1; DEPRECATED_SYMBOL_NAME (msymbol + i) != NULL; i++)
     {
       if (SYMBOL_VALUE_ADDRESS (msymbol + i) != SYMBOL_VALUE_ADDRESS (msymbol)
          && SYMBOL_BFD_SECTION (msymbol + i) == SYMBOL_BFD_SECTION (msymbol))
        break;
     }
 
-  if (SYMBOL_NAME (msymbol + i) != NULL
+  if (DEPRECATED_SYMBOL_NAME (msymbol + i) != NULL
       && SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr)
     cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + i);
   else
index 4544ed5..f27f3fc 100644 (file)
@@ -48,6 +48,7 @@
 #include "ui-out.h"
 #include "cli/cli-script.h"
 #include "gdb_assert.h"
+#include "block.h"
 
 #include "gdb-events.h"
 
@@ -1238,8 +1239,8 @@ update_breakpoints_after_exec (void)
        automagically.  Certainly on HP-UX that's true.
 
        Jim Blandy <jimb@redhat.com>: Actually, zero is a perfectly
-       valid code address on some platforms (like the mn10200 and
-       mn10300 simulators).  We shouldn't assign any special
+       valid code address on some platforms (like the OBSOLETE mn10200
+       and mn10300 simulators).  We shouldn't assign any special
        interpretation to a breakpoint with a zero address.  And in
        fact, GDB doesn't --- I can't see what that comment above is
        talking about.  As far as I can tell, setting the address of a
@@ -2002,7 +2003,7 @@ top:
 static enum print_stop_action
 print_it_typical (bpstat bs)
 {
-  struct cleanup *old_chain;
+  struct cleanup *old_chain, *ui_out_chain;
   struct ui_stream *stb;
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -2163,14 +2164,14 @@ print_it_typical (bpstat bs)
          if (ui_out_is_mi_like_p (uiout))
            ui_out_field_string (uiout, "reason", "watchpoint-trigger");
          mention (bs->breakpoint_at);
-         ui_out_tuple_begin (uiout, "value");
+         ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
          ui_out_text (uiout, "\nOld value = ");
          value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
          ui_out_field_stream (uiout, "old", stb);
          ui_out_text (uiout, "\nNew value = ");
          value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
          ui_out_field_stream (uiout, "new", stb);
-         ui_out_tuple_end (uiout);
+         do_cleanups (ui_out_chain);
          ui_out_text (uiout, "\n");
          value_free (bs->old_val);
          bs->old_val = NULL;
@@ -2183,11 +2184,11 @@ print_it_typical (bpstat bs)
       if (ui_out_is_mi_like_p (uiout))
        ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
       mention (bs->breakpoint_at);
-      ui_out_tuple_begin (uiout, "value");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
       ui_out_text (uiout, "\nValue = ");
       value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
       ui_out_field_stream (uiout, "value", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       ui_out_text (uiout, "\n");
       return PRINT_UNKNOWN;
       break;
@@ -2199,7 +2200,7 @@ print_it_typical (bpstat bs)
          if (ui_out_is_mi_like_p (uiout))
            ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
          mention (bs->breakpoint_at);
-         ui_out_tuple_begin (uiout, "value");
+         ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
          ui_out_text (uiout, "\nOld value = ");
          value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
          ui_out_field_stream (uiout, "old", stb);
@@ -2212,12 +2213,12 @@ print_it_typical (bpstat bs)
          mention (bs->breakpoint_at);
          if (ui_out_is_mi_like_p (uiout))
            ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
-         ui_out_tuple_begin (uiout, "value");
+         ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
          ui_out_text (uiout, "\nValue = ");
        }
       value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default);
       ui_out_field_stream (uiout, "new", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       ui_out_text (uiout, "\n");
       return PRINT_UNKNOWN;
       break;
@@ -3229,9 +3230,10 @@ print_one_breakpoint (struct breakpoint *b,
   char wrap_indent[80];
   struct ui_stream *stb = ui_out_stream_new (uiout);
   struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb);
+  struct cleanup *bkpt_chain;
 
   annotate_record ();
-  ui_out_tuple_begin (uiout, "bkpt");
+  bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt");
 
   /* 1 */
   annotate_field (0);
@@ -3385,7 +3387,7 @@ print_one_breakpoint (struct breakpoint *b,
            {
              ui_out_text (uiout, "in ");
              ui_out_field_string (uiout, "func",
-                                  SYMBOL_SOURCE_NAME (sym));
+                                  SYMBOL_PRINT_NAME (sym));
              ui_out_wrap_hint (uiout, wrap_indent);
              ui_out_text (uiout, " at ");
            }
@@ -3469,12 +3471,14 @@ print_one_breakpoint (struct breakpoint *b,
   
   if ((l = b->commands))
     {
+      struct cleanup *script_chain;
+
       annotate_field (9);
-      ui_out_tuple_begin (uiout, "script");
+      script_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "script");
       print_command_lines (uiout, l, 4);
-      ui_out_tuple_end (uiout);
+      do_cleanups (script_chain);
     }
-  ui_out_tuple_end (uiout);
+  do_cleanups (bkpt_chain);
   do_cleanups (old_chain);
 }
 
@@ -3542,6 +3546,7 @@ breakpoint_1 (int bnum, int allflag)
   register struct breakpoint *b;
   CORE_ADDR last_addr = (CORE_ADDR) -1;
   int nr_printable_breakpoints;
+  struct cleanup *bkpttbl_chain;
   
   /* Compute the number of rows in the table. */
   nr_printable_breakpoints = 0;
@@ -3554,9 +3559,13 @@ breakpoint_1 (int bnum, int allflag)
       }
 
   if (addressprint)
-    ui_out_table_begin (uiout, 6, nr_printable_breakpoints, "BreakpointTable");
+    bkpttbl_chain 
+      = make_cleanup_ui_out_table_begin_end (uiout, 6, nr_printable_breakpoints,
+                                             "BreakpointTable");
   else
-    ui_out_table_begin (uiout, 5, nr_printable_breakpoints, "BreakpointTable");
+    bkpttbl_chain 
+      = make_cleanup_ui_out_table_begin_end (uiout, 5, nr_printable_breakpoints,
+                                             "BreakpointTable");
 
   if (nr_printable_breakpoints > 0)
     annotate_breakpoints_headers ();
@@ -3598,7 +3607,7 @@ breakpoint_1 (int bnum, int allflag)
          print_one_breakpoint (b, &last_addr);
       }
   
-  ui_out_table_end (uiout);
+  do_cleanups (bkpttbl_chain);
 
   if (nr_printable_breakpoints == 0)
     {
@@ -4390,7 +4399,7 @@ static void
 mention (struct breakpoint *b)
 {
   int say_where = 0;
-  struct cleanup *old_chain;
+  struct cleanup *old_chain, *ui_out_chain;
   struct ui_stream *stb;
 
   stb = ui_out_stream_new (uiout);
@@ -4412,39 +4421,39 @@ mention (struct breakpoint *b)
       break;
     case bp_watchpoint:
       ui_out_text (uiout, "Watchpoint ");
-      ui_out_tuple_begin (uiout, "wpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_hardware_watchpoint:
       ui_out_text (uiout, "Hardware watchpoint ");
-      ui_out_tuple_begin (uiout, "wpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_read_watchpoint:
       ui_out_text (uiout, "Hardware read watchpoint ");
-      ui_out_tuple_begin (uiout, "hw-rwpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_access_watchpoint:
       ui_out_text (uiout, "Hardware access (read/write) watchpoint ");
-      ui_out_tuple_begin (uiout, "hw-awpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_breakpoint:
       if (ui_out_is_mi_like_p (uiout))
@@ -5820,7 +5829,7 @@ get_catch_sals (int this_level_only)
 
              ALL_BLOCK_SYMBOLS (b, i, sym)
                {
-                 if (STREQ (SYMBOL_NAME (sym), "default"))
+                 if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
                    {
                      if (have_default)
                        continue;
index ba4d278..e8c8750 100644 (file)
@@ -28,6 +28,7 @@
 #include "gdb-events.h"
 
 struct value;
+struct block;
 
 /* This is the maximum number of bytes a breakpoint instruction can take.
    Feel free to increase it.  It's just used in a few places to size
@@ -203,10 +204,10 @@ struct breakpoint
     /* Number assigned to distinguish breakpoints.  */
     int number;
 
-    /* Address to break at.
-       Note that zero is a perfectly valid code address on some
-       platforms (for example, the mn10200 and mn10300 simulators).
-       NULL is not a special value for this field.  */
+    /* Address to break at.  Note that zero is a perfectly valid code
+       address on some platforms (for example, the OBSOLETE mn10200
+       and mn10300 simulators).  NULL is not a special value for this
+       field.  */
     CORE_ADDR address;
 
     /* Line number of this address.  */
index 5e9ac84..4c4ac90 100644 (file)
@@ -43,6 +43,7 @@
 #include "filenames.h"         /* For DOSish file names */
 #include "macrotab.h"
 #include "demangle.h"          /* Needed by SYMBOL_INIT_DEMANGLED_NAME.  */
+#include "block.h"
 /* Ask buildsym.h to define the vars it normally declares `extern'.  */
 #define        EXTERN
 /**/
@@ -136,7 +137,7 @@ find_symbol_in_list (struct pending *list, char *name, int length)
     {
       for (j = list->nsyms; --j >= 0;)
        {
-         pp = SYMBOL_NAME (list->symbol[j]);
+         pp = DEPRECATED_SYMBOL_NAME (list->symbol[j]);
          if (*pp == *name && strncmp (pp, name, length) == 0 &&
              pp[length] == '\0')
            {
@@ -265,7 +266,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
              unsigned int hash_index;
              const char *name = SYMBOL_DEMANGLED_NAME (next->symbol[j]);
              if (name == NULL)
-               name = SYMBOL_NAME (next->symbol[j]);
+               name = DEPRECATED_SYMBOL_NAME (next->symbol[j]);
              hash_index = msymbol_hash_iw (name);
              hash_index = hash_index % BLOCK_BUCKETS (block);
              sym = BLOCK_BUCKET (block, hash_index);
@@ -308,6 +309,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
                case LOC_REGPARM_ADDR:
                case LOC_BASEREG_ARG:
                case LOC_LOCAL_ARG:
+               case LOC_COMPUTED_ARG:
                  nparams++;
                  break;
                case LOC_UNDEF:
@@ -323,6 +325,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
                case LOC_BASEREG:
                case LOC_UNRESOLVED:
                case LOC_OPTIMIZED_OUT:
+               case LOC_COMPUTED:
                default:
                  break;
                }
@@ -344,6 +347,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
                    case LOC_REGPARM_ADDR:
                    case LOC_BASEREG_ARG:
                    case LOC_LOCAL_ARG:
+                   case LOC_COMPUTED_ARG:
                      TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym);
                      TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
                      iparams++;
@@ -361,6 +365,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
                    case LOC_BASEREG:
                    case LOC_UNRESOLVED:
                    case LOC_OPTIMIZED_OUT:
+                   case LOC_COMPUTED:
                    default:
                      break;
                    }
@@ -394,7 +399,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
        {
          complaint (&symfile_complaints,
                     "block end address less than block start address in %s (patched it)",
-                    SYMBOL_SOURCE_NAME (symbol));
+                    SYMBOL_PRINT_NAME (symbol));
        }
       else
        {
@@ -428,7 +433,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
                {
                  complaint (&symfile_complaints,
                             "inner block not inside outer block in %s",
-                            SYMBOL_SOURCE_NAME (symbol));
+                            SYMBOL_PRINT_NAME (symbol));
                }
              else
                {
index b2a249c..6987742 100644 (file)
@@ -34,6 +34,8 @@
    normally extern, but which get defined in a single module using
    this technique.  */
 
+struct block;
+
 #ifndef EXTERN
 #define        EXTERN extern
 #endif
index d47588e..cd4e8d0 100644 (file)
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "charset.h"
+#include "block.h"
 
 /* Flag indicating we're dealing with HP-compiled objects */ 
 extern int hp_som_som_object_present;
index 53b07c6..a07717a 100644 (file)
@@ -205,7 +205,7 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
                  (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
                {
                  fputs_filtered (" <", stream);
-                 fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
+                 fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
                  fputs_filtered (">", stream);
                }
              if (vt_address && vtblprint)
@@ -218,7 +218,7 @@ c_val_print (struct type *type, char *valaddr, int embedded_offset,
                  int is_this_fld;
 
                  if (msymbol != NULL)
-                   wsym = lookup_symbol (SYMBOL_NAME (msymbol), block,
+                   wsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), block,
                                          VAR_NAMESPACE, &is_this_fld, &s);
 
                  if (wsym)
index bd079f2..e3b45cd 100644 (file)
@@ -365,6 +365,15 @@ cli_out_new (struct ui_file *stream)
   return ui_out_new (&cli_ui_out_impl, data, flags);
 }
 
+struct ui_file *
+cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
+{
+  struct ui_out_data *data = ui_out_data (uiout);
+  struct ui_file *old = data->stream;
+  data->stream = stream;
+  return old;
+}
+
 /* standard gdb initialization hook */
 void
 _initialize_cli_out (void)
index 723b726..a984d05 100644 (file)
@@ -24,4 +24,7 @@
 
 extern struct ui_out *cli_out_new (struct ui_file *stream);
 
+extern struct ui_file *cli_out_set_stream (struct ui_out *uiout,
+                                          struct ui_file *stream);
+
 #endif
index 154ecf6..108329a 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB CLI commands.
 
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -605,7 +605,7 @@ edit_command (char *arg, int from_tty)
            {
              print_address_numeric (sal.pc, 1, gdb_stdout);
              printf_filtered (" is in ");
-             fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
+             fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
              printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
            }
           else
@@ -772,7 +772,7 @@ list_command (char *arg, int from_tty)
        {
          print_address_numeric (sal.pc, 1, gdb_stdout);
          printf_filtered (" is in ");
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
          printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
        }
       else
@@ -852,7 +852,9 @@ disassemble_command (char *arg, int from_tty)
       if (find_pc_partial_function (pc, &name, &low, &high) == 0)
        error ("No function contains program counter for selected frame.\n");
 #if defined(TUI)
-      else if (tui_version)
+      /* NOTE: cagney/2003-02-13 The `tui_active' was previously
+        `tui_version'.  */
+      else if (tui_active)
        low = tuiGetLowDisassemblyAddress (low, pc);
 #endif
       low += FUNCTION_START_OFFSET;
@@ -864,7 +866,9 @@ disassemble_command (char *arg, int from_tty)
       if (find_pc_partial_function (pc, &name, &low, &high) == 0)
        error ("No function contains specified address.\n");
 #if defined(TUI)
-      else if (tui_version)
+      /* NOTE: cagney/2003-02-13 The `tui_active' was previously
+        `tui_version'.  */
+      else if (tui_active)
        low = tuiGetLowDisassemblyAddress (low, pc);
 #endif
       low += FUNCTION_START_OFFSET;
index bce0c2d..2a6d196 100644 (file)
@@ -923,10 +923,14 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
   /* Treating underscores as part of command words is important
      so that "set args_foo()" doesn't get interpreted as
      "set args _foo()".  */
+  /* NOTE: cagney/2003-02-13 The `tui_active' was previously
+     `tui_version'.  */
   for (p = *text;
        *p && (isalnum (*p) || *p == '-' || *p == '_' ||
-             (tui_version &&
+#if defined(TUI)
+             (tui_active &&
               (*p == '+' || *p == '<' || *p == '>' || *p == '$')) ||
+#endif
              (xdb_commands && (*p == '!' || *p == '/' || *p == '?')));
        p++)
     ;
@@ -1293,10 +1297,14 @@ lookup_cmd_composition (char *text,
       /* Treating underscores as part of command words is important
        so that "set args_foo()" doesn't get interpreted as
        "set args _foo()".  */
+      /* NOTE: cagney/2003-02-13 The `tui_active' was previously
+        `tui_version'.  */
       for (p = text;
          *p && (isalnum (*p) || *p == '-' || *p == '_' ||
-                (tui_version &&
+#if defined(TUI)
+                (tui_active &&
                  (*p == '+' || *p == '<' || *p == '>' || *p == '$')) ||
+#endif
                 (xdb_commands && (*p == '!' || *p == '/' || *p == '?')));
          p++)
       ;
index 7a58fcb..6bd40e0 100644 (file)
@@ -132,7 +132,8 @@ bfd_openr_with_cleanup (const char *filename, const char *target)
 {
   bfd *ibfd;
 
-  if ((ibfd = bfd_openr (filename, target)) == NULL)
+  ibfd = bfd_openr (filename, target);
+  if (ibfd == NULL)
     error ("Failed to open %s: %s.", filename, 
           bfd_errmsg (bfd_get_error ()));
 
@@ -150,7 +151,8 @@ bfd_openw_with_cleanup (char *filename, const char *target, char *mode)
 
   if (*mode == 'w')    /* Write: create new file */
     {
-      if ((obfd = bfd_openw (filename, target)) == NULL)
+      obfd = bfd_openw (filename, target);
+      if (obfd == NULL)
        error ("Failed to open %s: %s.", filename, 
               bfd_errmsg (bfd_get_error ()));
       make_cleanup_bfd_close (obfd);
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
new file mode 100644 (file)
index 0000000..e2116e7
--- /dev/null
@@ -0,0 +1,138 @@
+/* CLI Definitions for GDB, the GNU debugger.
+
+   Copyright 2002, 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "interps.h"
+#include "wrapper.h"
+#include "event-top.h"
+#include "ui-out.h"
+#include "cli-out.h"
+#include "top.h"               /* for "execute_command" */
+#include "gdb_string.h"
+
+struct ui_out *cli_uiout;
+
+/* These are the ui_out and the interpreter for the console interpreter. */
+
+/* Longjmp-safe wrapper for "execute_command" */
+static int do_captured_execute_command (struct ui_out *uiout, void *data);
+static enum gdb_rc safe_execute_command (struct ui_out *uiout, char *command,
+                                        int from_tty);
+struct captured_execute_command_args
+{
+  char *command;
+  int from_tty;
+};
+
+/* These implement the cli out interpreter: */
+
+static void *
+cli_interpreter_init (void)
+{
+  return NULL;
+}
+
+static int
+cli_interpreter_resume (void *data)
+{
+  /*sync_execution = 1; */
+  gdb_setup_readline ();
+  return 1;
+}
+
+static int
+cli_interpreter_suspend (void *data)
+{
+  gdb_disable_readline ();
+  return 1;
+}
+
+/* Don't display the prompt if we are set quiet.  */
+static int
+cli_interpreter_display_prompt_p (void *data)
+{
+  if (interp_quiet_p (NULL))
+    return 0;
+  else
+    return 1;
+}
+
+static int
+cli_interpreter_exec (void *data, const char *command_str)
+{
+  int result;
+  struct ui_file *old_stream;
+
+  /* FIXME: cagney/2003-02-01: Need to const char *propogate
+     safe_execute_command.  */
+  char *str = strcpy (alloca (strlen (command_str) + 1), command_str);
+
+  /* gdb_stdout could change between the time cli_uiout was initialized
+     and now. Since we're probably using a different interpreter which has
+     a new ui_file for gdb_stdout, use that one instead of the default.
+
+     It is important that it gets reset everytime, since the user could
+     set gdb to use a different interpreter. */
+  old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
+  result = safe_execute_command (cli_uiout, str, 1);
+  cli_out_set_stream (cli_uiout, old_stream);
+  return result;
+}
+
+static int
+do_captured_execute_command (struct ui_out *uiout, void *data)
+{
+  struct captured_execute_command_args *args =
+    (struct captured_execute_command_args *) data;
+  execute_command (args->command, args->from_tty);
+  return GDB_RC_OK;
+}
+
+static enum gdb_rc
+safe_execute_command (struct ui_out *uiout, char *command, int from_tty)
+{
+  struct captured_execute_command_args args;
+  args.command = command;
+  args.from_tty = from_tty;
+  return catch_exceptions (uiout, do_captured_execute_command, &args,
+                          NULL, RETURN_MASK_ALL);
+}
+
+
+/* standard gdb initialization hook */
+void
+_initialize_cli_interp (void)
+{
+  static const struct interp_procs procs = {
+    cli_interpreter_init,      /* init_proc */
+    cli_interpreter_resume,    /* resume_proc */
+    cli_interpreter_suspend,   /* suspend_proc */
+    cli_interpreter_exec,      /* exec_proc */
+    cli_interpreter_display_prompt_p   /* prompt_proc_p */
+  };
+  struct interp *cli_interp;
+
+  /* Create a default uiout builder for the CLI. */
+  cli_uiout = cli_out_new (gdb_stdout);
+  cli_interp = interp_new (INTERP_CONSOLE, NULL, cli_uiout, &procs);
+
+  interp_add (cli_interp);
+}
index 6b7bec6..d68c365 100644 (file)
@@ -1093,7 +1093,7 @@ define_command (char *comname, int from_tty)
 
   /* Look it up, and verify that we got an exact match.  */
   c = lookup_cmd (&tem, cmdlist, "", -1, 1);
-  if (c && !STREQ (comname, c->name))
+  if (c && strcmp (comname, c->name) != 0)
     c = 0;
 
   if (c)
@@ -1126,7 +1126,7 @@ define_command (char *comname, int from_tty)
       /* Look up cmd it hooks, and verify that we got an exact match.  */
       tem = comname + hook_name_size;
       hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
-      if (hookc && !STREQ (comname + hook_name_size, hookc->name))
+      if (hookc && strcmp (comname + hook_name_size, hookc->name) != 0)
        hookc = 0;
       if (!hookc)
        {
index 6fe2ff0..1d68ae4 100644 (file)
@@ -1,6 +1,6 @@
 /* Handle set and show GDB commands.
 
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -353,28 +353,35 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
 void
 cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
 {
-  ui_out_tuple_begin (uiout, "showlist");
+  struct cleanup *showlist_chain;
+
+  showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist");
   for (; list != NULL; list = list->next)
     {
       /* If we find a prefix, run its list, prefixing our output by its
          prefix (with "show " skipped).  */
       if (list->prefixlist && !list->abbrev_flag)
        {
-         ui_out_tuple_begin (uiout, "optionlist");
+         struct cleanup *optionlist_chain
+           = make_cleanup_ui_out_tuple_begin_end (uiout, "optionlist");
          ui_out_field_string (uiout, "prefix", list->prefixname + 5);
          cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
-         ui_out_tuple_end (uiout);
+         /* Close the tuple.  */
+         do_cleanups (optionlist_chain);
        }
       if (list->type == show_cmd)
        {
-         ui_out_tuple_begin (uiout, "option");
+         struct cleanup *option_chain
+           = make_cleanup_ui_out_tuple_begin_end (uiout, "option");
          ui_out_text (uiout, prefix);
          ui_out_field_string (uiout, "name", list->name);
          ui_out_text (uiout, ":  ");
          do_setshow_command ((char *) NULL, from_tty, list);
-         ui_out_tuple_end (uiout);
+          /* Close the tuple.  */
+         do_cleanups (option_chain);
        }
     }
-  ui_out_tuple_end (uiout);
+  /* Close the tuple.  */
+  do_cleanups (showlist_chain);
 }
 
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
new file mode 100644 (file)
index 0000000..2d1e854
--- /dev/null
@@ -0,0 +1,346 @@
+/* Read the export table symbols from a portable executable and
+   convert to internal format, for GDB. Used as a last resort if no
+   debugging symbols recognized.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Contributed by Raoul M. Gough (RaoulGough@yahoo.co.uk). */
+
+#include "coff-pe-read.h"
+
+#include "bfd.h"
+
+#include "defs.h"
+#include "gdbtypes.h"
+
+#include "symtab.h"
+#include "symfile.h"
+#include "objfiles.h"
+
+/* Internal section information */
+
+struct read_pe_section_data
+{
+  CORE_ADDR vma_offset;                /* Offset to loaded address of section. */
+  unsigned long rva_start;     /* Start offset within the pe. */
+  unsigned long rva_end;       /* End offset within the pe. */
+  enum minimal_symbol_type ms_type;    /* Type to assign symbols in section. */
+};
+
+#define PE_SECTION_INDEX_TEXT     0
+#define PE_SECTION_INDEX_DATA     1
+#define PE_SECTION_INDEX_BSS      2
+#define PE_SECTION_TABLE_SIZE     3
+#define PE_SECTION_INDEX_INVALID -1
+\f
+/* Get the index of the named section in our own array, which contains
+   text, data and bss in that order. Return PE_SECTION_INDEX_INVALID
+   if passed an unrecognised section name. */
+
+static int
+read_pe_section_index (const char *section_name)
+{
+  if (strcmp (section_name, ".text") == 0)
+    {
+      return PE_SECTION_INDEX_TEXT;
+    }
+
+  else if (strcmp (section_name, ".data") == 0)
+    {
+      return PE_SECTION_INDEX_DATA;
+    }
+
+  else if (strcmp (section_name, ".bss") == 0)
+    {
+      return PE_SECTION_INDEX_BSS;
+    }
+
+  else
+    {
+      return PE_SECTION_INDEX_INVALID;
+    }
+}
+
+/* Record the virtual memory address of a section. */
+
+static void
+get_section_vmas (bfd *abfd, asection *sectp, void *context)
+{
+  struct read_pe_section_data *sections = context;
+  int sectix = read_pe_section_index (sectp->name);
+
+  if (sectix != PE_SECTION_INDEX_INVALID)
+    {
+      /* Data within the section start at rva_start in the pe and at
+         bfd_get_section_vma() within memory. Store the offset. */
+
+      sections[sectix].vma_offset
+       = bfd_get_section_vma (abfd, sectp) - sections[sectix].rva_start;
+    }
+}
+\f
+/* Create a minimal symbol entry for an exported symbol. */
+
+static void
+add_pe_exported_sym (char *sym_name,
+                    unsigned long func_rva,
+                    const struct read_pe_section_data *section_data,
+                    const char *dll_name, struct objfile *objfile)
+{
+  /* Add the stored offset to get the loaded address of the symbol. */
+
+  CORE_ADDR vma = func_rva + section_data->vma_offset;
+
+  char *qualified_name = 0;
+  int dll_name_len = strlen (dll_name);
+  int count;
+
+  /* Generate a (hopefully unique) qualified name using the first part
+     of the dll name, e.g. KERNEL32!AddAtomA. This matches the style
+     used by windbg from the "Microsoft Debugging Tools for Windows". */
+
+  qualified_name = xmalloc (dll_name_len + strlen (sym_name) + 2);
+
+  strncpy (qualified_name, dll_name, dll_name_len);
+  qualified_name[dll_name_len] = '!';
+  strcpy (qualified_name + dll_name_len + 1, sym_name);
+
+  prim_record_minimal_symbol (qualified_name,
+                             vma, section_data->ms_type, objfile);
+
+  xfree (qualified_name);
+
+  /* Enter the plain name as well, which might not be unique. */
+  prim_record_minimal_symbol (sym_name, vma, section_data->ms_type, objfile);
+}
+
+/* Truncate a dll_name at the first dot character. */
+
+static void
+read_pe_truncate_name (char *dll_name)
+{
+  while (*dll_name)
+    {
+      if ((*dll_name) == '.')
+       {
+         *dll_name = '\0';     /* truncates and causes loop exit. */
+       }
+
+      else
+       {
+         ++dll_name;
+       }
+    }
+}
+\f
+/* Low-level support functions, direct from the ld module pe-dll.c. */
+static unsigned int
+pe_get16 (bfd *abfd, int where)
+{
+  unsigned char b[2];
+
+  bfd_seek (abfd, (file_ptr) where, SEEK_SET);
+  bfd_bread (b, (bfd_size_type) 2, abfd);
+  return b[0] + (b[1] << 8);
+}
+
+static unsigned int
+pe_get32 (bfd *abfd, int where)
+{
+  unsigned char b[4];
+
+  bfd_seek (abfd, (file_ptr) where, SEEK_SET);
+  bfd_bread (b, (bfd_size_type) 4, abfd);
+  return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
+}
+
+static unsigned int
+pe_as32 (void *ptr)
+{
+  unsigned char *b = ptr;
+
+  return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
+}
+\f
+/* Read the (non-debug) export symbol table from a portable
+   executable. Code originally lifted from the ld function
+   pe_implied_import_dll in pe-dll.c. */
+
+void
+read_pe_exported_syms (struct objfile *objfile)
+{
+  bfd *dll = objfile->obfd;
+  unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+  unsigned long export_rva, export_size, nsections, secptr, expptr;
+  unsigned long exp_funcbase;
+  unsigned char *expdata, *erva;
+  unsigned long name_rvas, ordinals, nexp, ordbase;
+  char *dll_name;
+
+  /* Array elements are for text, data and bss in that order
+     Initialization with start_rva > end_rva guarantees that
+     unused sections won't be matched. */
+  struct read_pe_section_data section_data[PE_SECTION_TABLE_SIZE]
+    = { {0, 1, 0, mst_text},
+  {0, 1, 0, mst_data},
+  {0, 1, 0, mst_bss}
+  };
+
+  struct cleanup *back_to = 0;
+
+  char const *target = bfd_get_target (objfile->obfd);
+
+  if ((strcmp (target, "pe-i386") != 0) && (strcmp (target, "pei-i386") != 0))
+    {
+      /* This is not an i386 format file. Abort now, because the code
+         is untested on anything else. *FIXME* test on further
+         architectures and loosen or remove this test. */
+      return;
+    }
+
+  /* Get pe_header, optional header and numbers of export entries.  */
+  pe_header_offset = pe_get32 (dll, 0x3c);
+  opthdr_ofs = pe_header_offset + 4 + 20;
+  num_entries = pe_get32 (dll, opthdr_ofs + 92);
+
+  if (num_entries < 1)         /* No exports.  */
+    {
+      return;
+    }
+
+  export_rva = pe_get32 (dll, opthdr_ofs + 96);
+  export_size = pe_get32 (dll, opthdr_ofs + 100);
+  nsections = pe_get16 (dll, pe_header_offset + 4 + 2);
+  secptr = (pe_header_offset + 4 + 20 +
+           pe_get16 (dll, pe_header_offset + 4 + 16));
+  expptr = 0;
+
+  /* Get the rva and size of the export section.  */
+  for (i = 0; i < nsections; i++)
+    {
+      char sname[8];
+      unsigned long secptr1 = secptr + 40 * i;
+      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+      unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+      unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+
+      bfd_seek (dll, (file_ptr) secptr1, SEEK_SET);
+      bfd_bread (sname, (bfd_size_type) 8, dll);
+
+      if (vaddr <= export_rva && vaddr + vsize > export_rva)
+       {
+         expptr = fptr + (export_rva - vaddr);
+         if (export_rva + export_size > vaddr + vsize)
+           export_size = vsize - (export_rva - vaddr);
+         break;
+       }
+    }
+
+  if (export_size == 0)
+    {
+      /* Empty export table. */
+      return;
+    }
+
+  /* Scan sections and store the base and size of the relevant sections. */
+  for (i = 0; i < nsections; i++)
+    {
+      unsigned long secptr1 = secptr + 40 * i;
+      unsigned long vsize = pe_get32 (dll, secptr1 + 8);
+      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+      unsigned long flags = pe_get32 (dll, secptr1 + 36);
+      char sec_name[9];
+      int sectix;
+
+      sec_name[8] = '\0';
+      bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET);
+      bfd_bread (sec_name, (bfd_size_type) 8, dll);
+
+      sectix = read_pe_section_index (sec_name);
+
+      if (sectix != PE_SECTION_INDEX_INVALID)
+       {
+         section_data[sectix].rva_start = vaddr;
+         section_data[sectix].rva_end = vaddr + vsize;
+       }
+    }
+
+  expdata = (unsigned char *) xmalloc (export_size);
+  back_to = make_cleanup (xfree, expdata);
+
+  bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
+  bfd_bread (expdata, (bfd_size_type) export_size, dll);
+  erva = expdata - export_rva;
+
+  nexp = pe_as32 (expdata + 24);
+  name_rvas = pe_as32 (expdata + 32);
+  ordinals = pe_as32 (expdata + 36);
+  ordbase = pe_as32 (expdata + 16);
+  exp_funcbase = pe_as32 (expdata + 28);
+
+  /* Use internal dll name instead of full pathname. */
+  dll_name = pe_as32 (expdata + 12) + erva;
+
+  bfd_map_over_sections (dll, get_section_vmas, section_data);
+
+  /* Adjust the vma_offsets in case this PE got relocated. This
+     assumes that *all* sections share the same relocation offset
+     as the text section. */
+  for (i = 0; i < PE_SECTION_TABLE_SIZE; i++)
+    {
+      section_data[i].vma_offset
+       += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+    }
+
+  printf_filtered ("Minimal symbols from %s...", dll_name);
+  wrap_here ("");
+
+  /* Truncate name at first dot. Should maybe also convert to all
+     lower case for convenience on Windows. */
+  read_pe_truncate_name (dll_name);
+
+  /* Iterate through the list of symbols.  */
+  for (i = 0; i < nexp; i++)
+    {
+      /* Pointer to the names vector.  */
+      unsigned long name_rva = pe_as32 (erva + name_rvas + i * 4);
+
+      /* Pointer to the function address vector.  */
+      unsigned long func_rva = pe_as32 (erva + exp_funcbase + i * 4);
+
+      /* Find this symbol's section in our own array. */
+      int sectix = 0;
+
+      for (sectix = 0; sectix < PE_SECTION_TABLE_SIZE; ++sectix)
+       {
+         if ((func_rva >= section_data[sectix].rva_start)
+             && (func_rva < section_data[sectix].rva_end))
+           {
+             add_pe_exported_sym (erva + name_rva,
+                                  func_rva,
+                                  section_data + sectix, dll_name, objfile);
+             break;
+           }
+       }
+    }
+
+  /* discard expdata. */
+  do_cleanups (back_to);
+}
similarity index 60%
rename from gdb/config/m68k/tm-mac.h
rename to gdb/coff-pe-read.h
index 270f353..c5d4e68 100644 (file)
@@ -1,5 +1,6 @@
-/* Target-dependent definitions for Mac running MacOS.
-   Copyright 1994, 1995 Free Software Foundation, Inc.
+/* Interface to coff-pe-read.c (portable-executable-specific symbol reader).
+
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    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.  */
+   Boston, MA 02111-1307, USA.
+
+   Contributed by Raoul M. Gough (RaoulGough@yahoo.co.uk). */
+
+#if !defined (COFF_PE_READ_H)
+#define COFF_PE_READ_H
+
+struct objfile;
+
+/* Read the export table and convert it to minimal symbol table entries */
+extern void read_pe_exported_syms (struct objfile *objfile);
 
-#include "m68k/tm-m68k.h"
+#endif /* !defined (COFF_PE_READ_H) */
index 573306d..0f36b95 100644 (file)
@@ -1,6 +1,6 @@
 /* Read coff symbol tables and convert to internal format, for GDB.
    Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002
+   1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
 
@@ -44,6 +44,9 @@
 #include "complaints.h"
 #include "target.h"
 #include "gdb_assert.h"
+#include "block.h"
+
+#include "coff-pe-read.h"
 
 extern void _initialize_coffread (void);
 
@@ -515,7 +518,7 @@ coff_symfile_read (struct objfile *objfile, int mainline)
   unsigned int num_symbols;
   int symtab_offset;
   int stringtab_offset;
-  struct cleanup *back_to;
+  struct cleanup *back_to, *cleanup_minimal_symbols;
   int stabstrsize;
   int len;
   char * target;
@@ -595,7 +598,7 @@ coff_symfile_read (struct objfile *objfile, int mainline)
     error ("\"%s\": can't get string table", name);
 
   init_minimal_symbol_collection ();
-  make_cleanup_discard_minimal_symbols ();
+  cleanup_minimal_symbols = make_cleanup_discard_minimal_symbols ();
 
   /* Now that the executable file is positioned at symbol table,
      process it and define symbols accordingly.  */
@@ -616,6 +619,9 @@ coff_symfile_read (struct objfile *objfile, int mainline)
 
   install_minimal_symbols (objfile);
 
+  /* Free the installed minimal symbol data.  */
+  do_cleanups (cleanup_minimal_symbols);
+
   bfd_map_over_sections (abfd, coff_locate_sections, (void *) info);
 
   if (info->stabsects)
@@ -1086,6 +1092,13 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
        }
     }
 
+  if ((nsyms == 0) && (pe_file))
+    {
+      /* We've got no debugging symbols, but it's is a portable
+        executable, so try to read the export table */
+      read_pe_exported_syms (objfile);
+    }
+
   if (last_source_file)
     coff_end_symtab (objfile);
 
@@ -1416,15 +1429,15 @@ patch_opaque_types (struct symtab *s)
          TYPE_CODE (SYMBOL_TYPE (real_sym)) == TYPE_CODE_PTR &&
          TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0)
        {
-         register char *name = SYMBOL_NAME (real_sym);
+         register char *name = DEPRECATED_SYMBOL_NAME (real_sym);
          register int hash = hashname (name);
          register struct symbol *sym, *prev;
 
          prev = 0;
          for (sym = opaque_type_chain[hash]; sym;)
            {
-             if (name[0] == SYMBOL_NAME (sym)[0] &&
-                 STREQ (name + 1, SYMBOL_NAME (sym) + 1))
+             if (name[0] == DEPRECATED_SYMBOL_NAME (sym)[0] &&
+                 STREQ (name + 1, DEPRECATED_SYMBOL_NAME (sym) + 1))
                {
                  if (prev)
                    {
@@ -1469,10 +1482,8 @@ process_coff_symbol (register struct coff_symbol *cs,
   memset (sym, 0, sizeof (struct symbol));
   name = cs->c_name;
   name = EXTERNAL_NAME (name, objfile->obfd);
-  SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
-                                   &objfile->symbol_obstack);
   SYMBOL_LANGUAGE (sym) = language_auto;
-  SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
+  SYMBOL_SET_NAMES (sym, name, strlen (name), objfile);
 
   /* default assumptions */
   SYMBOL_VALUE (sym) = cs->c_value;
@@ -1628,7 +1639,7 @@ process_coff_symbol (register struct coff_symbol *cs,
                }
              else
                TYPE_NAME (SYMBOL_TYPE (sym)) =
-                 concat (SYMBOL_NAME (sym), NULL);
+                 concat (DEPRECATED_SYMBOL_NAME (sym), NULL);
            }
 #ifdef CXUX_TARGET
          /* Ignore vendor section for Harris CX/UX targets. */
@@ -1646,7 +1657,7 @@ process_coff_symbol (register struct coff_symbol *cs,
              TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) !=
              TYPE_CODE_UNDEF)
            {
-             register int i = hashname (SYMBOL_NAME (sym));
+             register int i = hashname (DEPRECATED_SYMBOL_NAME (sym));
 
              SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i];
              opaque_type_chain[i] = sym;
@@ -1664,11 +1675,11 @@ process_coff_symbol (register struct coff_symbol *cs,
             names for anonymous enums, structures, and unions, like
             "~0fake" or ".0fake".  Thanks, but no thanks... */
          if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
-           if (SYMBOL_NAME (sym) != NULL
-               && *SYMBOL_NAME (sym) != '~'
-               && *SYMBOL_NAME (sym) != '.')
+           if (DEPRECATED_SYMBOL_NAME (sym) != NULL
+               && *DEPRECATED_SYMBOL_NAME (sym) != '~'
+               && *DEPRECATED_SYMBOL_NAME (sym) != '.')
              TYPE_TAG_NAME (SYMBOL_TYPE (sym)) =
-               concat (SYMBOL_NAME (sym), NULL);
+               concat (DEPRECATED_SYMBOL_NAME (sym), NULL);
 
          add_symbol_to_list (sym, &file_symbols);
          break;
@@ -2064,7 +2075,7 @@ coff_read_enum_type (int index, int length, int lastsym)
             sizeof (struct symbol));
          memset (sym, 0, sizeof (struct symbol));
 
-         SYMBOL_NAME (sym) =
+         DEPRECATED_SYMBOL_NAME (sym) =
            obsavestring (name, strlen (name),
                          &current_objfile->symbol_obstack);
          SYMBOL_CLASS (sym) = LOC_CONST;
@@ -2112,7 +2123,7 @@ coff_read_enum_type (int index, int length, int lastsym)
        {
          struct symbol *xsym = syms->symbol[j];
          SYMBOL_TYPE (xsym) = type;
-         TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+         TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          if (SYMBOL_VALUE (xsym) < 0)
            unsigned_enum = 0;
index 06f4670..4500519 100644 (file)
 /* Define to BFD's default target vector.  */
 #undef DEFAULT_BFD_VEC
 
+/* Define to 1 if your system has the _etext variable.  */
+#undef HAVE__ETEXT
+
 /* Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
    Solaris 2.[78] when using GCC.  */
 #undef _MSE_INT_H
 /* Define to 1 if the regex included in libiberty should be used. */
 #undef USE_INCLUDED_REGEX
 
+/* Define if <stdint.h> provides the uintptr_t type. */
+#undef HAVE_UINTPTR_T
+
 /* Define if malloc is not declared in system header files. */
 #undef NEED_DECLARATION_MALLOC
 
index 5792b35..b426652 100644 (file)
 @V@/gdb/testsuite/gdb.c++/overload.exp @V@/gdb/testsuite/gdb.cxx/overload.exp
 @V@/gdb/testsuite/gdb.c++/ovldbreak.cc @V@/gdb/testsuite/gdb.cxx/ovldbreak.cc
 @V@/gdb/testsuite/gdb.c++/ovldbreak.exp @V@/gdb/testsuite/gdb.cxx/ovldbreak.exp
+@V@/gdb/testsuite/gdb.c++/pr-1023.cc @V@/gdb/testsuite/gdb.cxx/pr-1023.cc
+@V@/gdb/testsuite/gdb.c++/pr-1023.exp @V@/gdb/testsuite/gdb.cxx/pr-1023.exp
 @V@/gdb/testsuite/gdb.c++/pr-574.cc @V@/gdb/testsuite/gdb.cxx/pr-574.cc
 @V@/gdb/testsuite/gdb.c++/pr-574.exp @V@/gdb/testsuite/gdb.cxx/pr-574.exp
 @V@/gdb/testsuite/gdb.c++/printmethod.cc @V@/gdb/testsuite/gdb.cxx/printmethod.cc
index 35f6b4d..64608a0 100644 (file)
@@ -1,6 +1,6 @@
-# Target: H8500 with HMS monitor and H8 simulator
-TDEPFILES= h8500-tdep.o monitor.o remote-hms.o dsrec.o
-TM_FILE= tm-h8500.h
-
-SIM_OBS = remote-sim.o
-SIM = ../sim/h8500/libsim.a
+# OBSOLETE # Target: H8500 with HMS monitor and H8 simulator
+# OBSOLETE TDEPFILES= h8500-tdep.o monitor.o remote-hms.o dsrec.o
+# OBSOLETE TM_FILE= tm-h8500.h
+# OBSOLETE 
+# OBSOLETE SIM_OBS = remote-sim.o
+# OBSOLETE SIM = ../sim/h8500/libsim.a
index 5915565..4d0f640 100644 (file)
-/* Parameters for execution on a H8/500 series machine.
-
-   Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 Free
-   Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "regcache.h"
-
-/* NOTE: cagney/2002-11-24: This is a guess.  */
-#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0
-#define CALL_DUMMY_LOCATION ON_STACK
-#define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address)
-
-/* Contributed by Steve Chamberlain sac@cygnus.com */
-
-#define GDB_TARGET_IS_H8500
-
-/* Define the sizes of integers and pointers.  */
-
-#define TARGET_INT_BIT 16
-
-#define TARGET_LONG_BIT 32
-
-#define TARGET_PTR_BIT (minimum_mode ? 16 : 32)
-
-/* Offset from address of function to start of its code.
-   Zero on most machines.  */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
-   to reach some "real" code.  */
-
-#define SKIP_PROLOGUE(ip)   (h8500_skip_prologue (ip))
-extern CORE_ADDR h8500_skip_prologue (CORE_ADDR);
-
-/* Immediately after a function call, return the saved pc.
-   Can't always go through the frames for this because on some machines
-   the new frame is not set up until the new function executes
-   some instructions.  */
-
-#define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call()
-extern CORE_ADDR saved_pc_after_call (void);
-
-/* Stack grows downward.  */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* Illegal instruction - used by the simulator for breakpoint
-   detection */
-
-#define BREAKPOINT {0x0b}
-
-/* If your kernel resets the pc after the trap happens you may need to
-   define this before including this file.  */
-
-#define DECR_PC_AFTER_BREAK 0
-
-/* Say how long registers are.  */
-
-#define REGISTER_TYPE  unsigned long
-
-/* Say how much memory is needed to store a copy of the register set */
-
-#define REGISTER_BYTES    (NUM_REGS * 4)
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#define REGISTER_BYTE(N)  ((N)*4)
-
-/* Number of bytes of storage in the actual machine representation
-   for register N.  */
-
-#define REGISTER_RAW_SIZE(N) h8500_register_size(N)
-extern int h8500_register_size (int regno);
-
-#define REGISTER_SIZE 4
-
-#define REGISTER_VIRTUAL_SIZE(N) h8500_register_size(N)
-
-/* Largest value REGISTER_RAW_SIZE can have.  */
-
-#define MAX_REGISTER_RAW_SIZE 4
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 4
-
-/* Return the GDB type object for the "standard" data type
-   of data in register N.  */
-
-#define REGISTER_VIRTUAL_TYPE(N) h8500_register_virtual_type(N)
-extern struct type *h8500_register_virtual_type (int regno);
-
-/* Initializer for an array of names of registers.
-   Entries beyond the first NUM_REGS are ignored.  */
-
-#define REGISTER_NAMES \
-  { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
-   "pr0","pr1","pr2","pr3","pr4","pr5","pr6","pr7", \
-    "cp", "dp", "ep", "tp", "sr", "pc"}
-
-/* Register numbers of various important registers.  Note that some of
-   these values are "real" register numbers, and correspond to the
-   general registers of the machine, and some are "phony" register
-   numbers which are too large to be actual register numbers as far as
-   the user is concerned but do serve to get the desired values when
-   passed to read_register.  */
-
-#define R0_REGNUM      0
-#define R1_REGNUM      1
-#define R2_REGNUM      2
-#define R3_REGNUM      3
-#define R4_REGNUM      4
-#define R5_REGNUM      5
-#define R6_REGNUM      6
-#define R7_REGNUM      7
-
-#define PR0_REGNUM     8
-#define PR1_REGNUM     9
-#define PR2_REGNUM     10
-#define PR3_REGNUM     11
-#define PR4_REGNUM     12
-#define PR5_REGNUM     13
-#define PR6_REGNUM     14
-#define PR7_REGNUM     15
-
-#define SEG_C_REGNUM   16      /* Segment registers */
-#define SEG_D_REGNUM   17
-#define SEG_E_REGNUM   18
-#define SEG_T_REGNUM   19
-
-#define CCR_REGNUM      20     /* Contains processor status */
-#define PC_REGNUM       21     /* Contains program counter */
-
-#define NUM_REGS       22
-
-#define SP_REGNUM       PR7_REGNUM     /* Contains address of top of stack */
-#define FP_REGNUM       PR6_REGNUM     /* Contains address of executing stack frame */
-
-#define PTR_SIZE (minimum_mode ? 2 : 4)
-#define PTR_MASK (minimum_mode ? 0x0000ffff : 0x00ffffff)
-
-/* Store the address of the place in which to copy the structure the
-   subroutine will return.  This is called from call_function. */
-
-/*#define STORE_STRUCT_RETURN(ADDR, SP) \
-   { write_register (0, (ADDR)); internal_error (__FILE__, __LINE__, "failed internal consistency check"); } */
-
-/* Extract from an array REGBUF containing the (raw) register state
-   a function return value of type TYPE, and copy that, in virtual format,
-   into VALBUF.  */
-
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-  memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE))
-
-/* Write into appropriate registers a function return value
-   of type TYPE, given in virtual format.  */
-
-#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \
-  deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
-
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one).  */
-
-#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
-\f
-
-/* Define other aspects of the stack frame.  */
-
-/* A macro that tells us whether the function invocation represented
-   by FI does not have a frame on the stack associated with it.  If it
-   does not, FRAMELESS is set to 1, else 0.  */
-
-#define FRAMELESS_FUNCTION_INVOCATION(FI) \
-  (frameless_look_for_prologue (FI))
-
-/* Any function with a frame looks like this
-   SECOND ARG
-   FIRST ARG
-   RET PC
-   SAVED R2
-   SAVED R3
-   SAVED FP   <-FP POINTS HERE
-   LOCALS0
-   LOCALS1    <-SP POINTS HERE
-
- */
-
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fci)  ;
-/*       (fci)->frame |= read_register(SEG_T_REGNUM) << 16; */
-
-#define FRAME_CHAIN(FRAME) h8500_frame_chain(FRAME)
-struct frame_info;
-extern CORE_ADDR h8500_frame_chain (struct frame_info *);
-
-#define FRAME_SAVED_PC(FRAME) frame_saved_pc(FRAME)
-extern CORE_ADDR frame_saved_pc (struct frame_info *frame);
-
-#define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi))
-
-#define FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi))
-
-/* Set VAL to the number of args passed to frame described by FI.
-   Can set VAL to -1, meaning no way to tell.  */
-
-/* We can't tell how many args there are
-   now that the C compiler delays popping them.  */
-
-#define FRAME_NUM_ARGS(fi) (-1)
-
-/* Return number of bytes at start of arglist that are not really args.  */
-
-#define FRAME_ARGS_SKIP 0
-
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of the saved registers of frame described by FRAME_INFO.
-   This includes special registers such as pc and fp saved in special
-   ways in the stack frame.  sp is even more special:
-   the address we return for it IS the sp for the next frame.  */
-
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)        \
-   frame_find_saved_regs(frame_info, &(frame_saved_regs))
-struct frame_saved_regs;
-extern void frame_find_saved_regs (struct frame_info *frame_info,
-                                  struct frame_saved_regs *frame_saved_regs);
-\f
-
-/* Discard from the stack the innermost frame, restoring all registers.  */
-
-#define POP_FRAME { h8500_pop_frame (); }
-extern void h8500_pop_frame (void);
-
-#define SHORT_INT_MAX 32767
-#define SHORT_INT_MIN -32768
-
-typedef unsigned short INSN_WORD;
-
-extern CORE_ADDR h8500_addr_bits_remove (CORE_ADDR);
-#define ADDR_BITS_REMOVE(addr) h8500_addr_bits_remove (addr)
-
-#define read_memory_short(x)  (read_memory_integer(x,2) & 0xffff)
-
-extern void h8500_do_registers_info (int regnum, int all);
-#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \
-       h8500_do_registers_info (REGNUM, ALL)
-
-extern int minimum_mode;
-
-#define CALL_DUMMY_LENGTH 10
-
-/* Fake variables to make it easy to use 24 bit register pointers */
-
-#define IS_TRAPPED_INTERNALVAR h8500_is_trapped_internalvar
-extern int h8500_is_trapped_internalvar (char *name);
-
-#define VALUE_OF_TRAPPED_INTERNALVAR h8500_value_of_trapped_internalvar
-extern struct value *h8500_value_of_trapped_internalvar ( /* struct internalvar *var */ );
-
-#define SET_TRAPPED_INTERNALVAR h8500_set_trapped_internalvar
-extern void h8500_set_trapped_internalvar ( /* struct internalvar *var, value newval, int bitpos, int bitsize, int offset */ );
-
-extern CORE_ADDR h8500_read_sp (void);
-extern void h8500_write_sp (CORE_ADDR);
-
-extern CORE_ADDR h8500_read_fp (void);
-
-extern CORE_ADDR h8500_read_pc (ptid_t);
-extern void h8500_write_pc (CORE_ADDR, ptid_t);
-
-#define TARGET_READ_SP() h8500_read_sp()
-#define TARGET_WRITE_SP(x) h8500_write_sp(x)
-
-#define TARGET_READ_PC(pid) h8500_read_pc(pid)
-#define TARGET_WRITE_PC(x,pid) h8500_write_pc(x,pid)
-
-#define TARGET_READ_FP() h8500_read_fp()
+// OBSOLETE /* Parameters for execution on a H8/500 series machine.
+// OBSOLETE 
+// OBSOLETE    Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003 Free
+// OBSOLETE    Software Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE /* NOTE: cagney/2002-11-24: This is a guess.  */
+// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0
+// OBSOLETE #define CALL_DUMMY_LOCATION ON_STACK
+// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address)
+// OBSOLETE 
+// OBSOLETE /* Contributed by Steve Chamberlain sac@cygnus.com */
+// OBSOLETE 
+// OBSOLETE #define GDB_TARGET_IS_H8500
+// OBSOLETE 
+// OBSOLETE /* Define the sizes of integers and pointers.  */
+// OBSOLETE 
+// OBSOLETE #define TARGET_INT_BIT 16
+// OBSOLETE 
+// OBSOLETE #define TARGET_LONG_BIT 32
+// OBSOLETE 
+// OBSOLETE #define TARGET_PTR_BIT (minimum_mode ? 16 : 32)
+// OBSOLETE 
+// OBSOLETE /* Offset from address of function to start of its code.
+// OBSOLETE    Zero on most machines.  */
+// OBSOLETE 
+// OBSOLETE #define FUNCTION_START_OFFSET 0
+// OBSOLETE 
+// OBSOLETE /* Advance PC across any function entry prologue instructions
+// OBSOLETE    to reach some "real" code.  */
+// OBSOLETE 
+// OBSOLETE #define SKIP_PROLOGUE(ip)   (h8500_skip_prologue (ip))
+// OBSOLETE extern CORE_ADDR h8500_skip_prologue (CORE_ADDR);
+// OBSOLETE 
+// OBSOLETE /* Immediately after a function call, return the saved pc.
+// OBSOLETE    Can't always go through the frames for this because on some machines
+// OBSOLETE    the new frame is not set up until the new function executes
+// OBSOLETE    some instructions.  */
+// OBSOLETE 
+// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) saved_pc_after_call()
+// OBSOLETE extern CORE_ADDR saved_pc_after_call (void);
+// OBSOLETE 
+// OBSOLETE /* Stack grows downward.  */
+// OBSOLETE 
+// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+// OBSOLETE 
+// OBSOLETE /* Illegal instruction - used by the simulator for breakpoint
+// OBSOLETE    detection */
+// OBSOLETE 
+// OBSOLETE #define BREAKPOINT {0x0b}
+// OBSOLETE 
+// OBSOLETE /* If your kernel resets the pc after the trap happens you may need to
+// OBSOLETE    define this before including this file.  */
+// OBSOLETE 
+// OBSOLETE #define DECR_PC_AFTER_BREAK 0
+// OBSOLETE 
+// OBSOLETE /* Say how long registers are.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_TYPE  unsigned long
+// OBSOLETE 
+// OBSOLETE /* Say how much memory is needed to store a copy of the register set */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_BYTES    (NUM_REGS * 4)
+// OBSOLETE 
+// OBSOLETE /* Index within `registers' of the first byte of the space for
+// OBSOLETE    register N.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_BYTE(N)  ((N)*4)
+// OBSOLETE 
+// OBSOLETE /* Number of bytes of storage in the actual machine representation
+// OBSOLETE    for register N.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_RAW_SIZE(N) h8500_register_size(N)
+// OBSOLETE extern int h8500_register_size (int regno);
+// OBSOLETE 
+// OBSOLETE #define REGISTER_SIZE 4
+// OBSOLETE 
+// OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) h8500_register_size(N)
+// OBSOLETE 
+// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have.  */
+// OBSOLETE 
+// OBSOLETE #define MAX_REGISTER_RAW_SIZE 4
+// OBSOLETE 
+// OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
+// OBSOLETE 
+// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 4
+// OBSOLETE 
+// OBSOLETE /* Return the GDB type object for the "standard" data type
+// OBSOLETE    of data in register N.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) h8500_register_virtual_type(N)
+// OBSOLETE extern struct type *h8500_register_virtual_type (int regno);
+// OBSOLETE 
+// OBSOLETE /* Initializer for an array of names of registers.
+// OBSOLETE    Entries beyond the first NUM_REGS are ignored.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_NAMES \
+// OBSOLETE   { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
+// OBSOLETE    "pr0","pr1","pr2","pr3","pr4","pr5","pr6","pr7", \
+// OBSOLETE     "cp", "dp", "ep", "tp", "sr", "pc"}
+// OBSOLETE 
+// OBSOLETE /* Register numbers of various important registers.  Note that some of
+// OBSOLETE    these values are "real" register numbers, and correspond to the
+// OBSOLETE    general registers of the machine, and some are "phony" register
+// OBSOLETE    numbers which are too large to be actual register numbers as far as
+// OBSOLETE    the user is concerned but do serve to get the desired values when
+// OBSOLETE    passed to read_register.  */
+// OBSOLETE 
+// OBSOLETE #define R0_REGNUM  0
+// OBSOLETE #define R1_REGNUM  1
+// OBSOLETE #define R2_REGNUM  2
+// OBSOLETE #define R3_REGNUM  3
+// OBSOLETE #define R4_REGNUM  4
+// OBSOLETE #define R5_REGNUM  5
+// OBSOLETE #define R6_REGNUM  6
+// OBSOLETE #define R7_REGNUM  7
+// OBSOLETE 
+// OBSOLETE #define PR0_REGNUM 8
+// OBSOLETE #define PR1_REGNUM 9
+// OBSOLETE #define PR2_REGNUM 10
+// OBSOLETE #define PR3_REGNUM 11
+// OBSOLETE #define PR4_REGNUM 12
+// OBSOLETE #define PR5_REGNUM 13
+// OBSOLETE #define PR6_REGNUM 14
+// OBSOLETE #define PR7_REGNUM 15
+// OBSOLETE 
+// OBSOLETE #define SEG_C_REGNUM       16      /* Segment registers */
+// OBSOLETE #define SEG_D_REGNUM       17
+// OBSOLETE #define SEG_E_REGNUM       18
+// OBSOLETE #define SEG_T_REGNUM       19
+// OBSOLETE 
+// OBSOLETE #define CCR_REGNUM      20 /* Contains processor status */
+// OBSOLETE #define PC_REGNUM       21 /* Contains program counter */
+// OBSOLETE 
+// OBSOLETE #define NUM_REGS   22
+// OBSOLETE 
+// OBSOLETE #define SP_REGNUM       PR7_REGNUM /* Contains address of top of stack */
+// OBSOLETE #define FP_REGNUM       PR6_REGNUM /* Contains address of executing stack frame */
+// OBSOLETE 
+// OBSOLETE #define PTR_SIZE (minimum_mode ? 2 : 4)
+// OBSOLETE #define PTR_MASK (minimum_mode ? 0x0000ffff : 0x00ffffff)
+// OBSOLETE 
+// OBSOLETE /* Store the address of the place in which to copy the structure the
+// OBSOLETE    subroutine will return.  This is called from call_function. */
+// OBSOLETE 
+// OBSOLETE /*#define STORE_STRUCT_RETURN(ADDR, SP) \
+// OBSOLETE    { write_register (0, (ADDR)); internal_error (__FILE__, __LINE__, "failed internal consistency check"); } */
+// OBSOLETE 
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE    a function return value of type TYPE, and copy that, in virtual format,
+// OBSOLETE    into VALBUF.  */
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+// OBSOLETE   memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE))
+// OBSOLETE 
+// OBSOLETE /* Write into appropriate registers a function return value
+// OBSOLETE    of type TYPE, given in virtual format.  */
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \
+// OBSOLETE   deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
+// OBSOLETE 
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE    the address in which a function should return its structure value,
+// OBSOLETE    as a CORE_ADDR (or an expression that can be used as one).  */
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
+// OBSOLETE \f
+// OBSOLETE 
+// OBSOLETE /* Define other aspects of the stack frame.  */
+// OBSOLETE 
+// OBSOLETE /* A macro that tells us whether the function invocation represented
+// OBSOLETE    by FI does not have a frame on the stack associated with it.  If it
+// OBSOLETE    does not, FRAMELESS is set to 1, else 0.  */
+// OBSOLETE 
+// OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) \
+// OBSOLETE   (frameless_look_for_prologue (FI))
+// OBSOLETE 
+// OBSOLETE /* Any function with a frame looks like this
+// OBSOLETE    SECOND ARG
+// OBSOLETE    FIRST ARG
+// OBSOLETE    RET PC
+// OBSOLETE    SAVED R2
+// OBSOLETE    SAVED R3
+// OBSOLETE    SAVED FP   <-FP POINTS HERE
+// OBSOLETE    LOCALS0
+// OBSOLETE    LOCALS1    <-SP POINTS HERE
+// OBSOLETE 
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fci)  ;
+// OBSOLETE /*       (fci)->frame |= read_register(SEG_T_REGNUM) << 16; */
+// OBSOLETE 
+// OBSOLETE #define FRAME_CHAIN(FRAME) h8500_frame_chain(FRAME)
+// OBSOLETE struct frame_info;
+// OBSOLETE extern CORE_ADDR h8500_frame_chain (struct frame_info *);
+// OBSOLETE 
+// OBSOLETE #define FRAME_SAVED_PC(FRAME) frame_saved_pc(FRAME)
+// OBSOLETE extern CORE_ADDR frame_saved_pc (struct frame_info *frame);
+// OBSOLETE 
+// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi))
+// OBSOLETE 
+// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi))
+// OBSOLETE 
+// OBSOLETE /* Set VAL to the number of args passed to frame described by FI.
+// OBSOLETE    Can set VAL to -1, meaning no way to tell.  */
+// OBSOLETE 
+// OBSOLETE /* We can't tell how many args there are
+// OBSOLETE    now that the C compiler delays popping them.  */
+// OBSOLETE 
+// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1)
+// OBSOLETE 
+// OBSOLETE /* Return number of bytes at start of arglist that are not really args.  */
+// OBSOLETE 
+// OBSOLETE #define FRAME_ARGS_SKIP 0
+// OBSOLETE 
+// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
+// OBSOLETE    the addresses of the saved registers of frame described by FRAME_INFO.
+// OBSOLETE    This includes special registers such as pc and fp saved in special
+// OBSOLETE    ways in the stack frame.  sp is even more special:
+// OBSOLETE    the address we return for it IS the sp for the next frame.  */
+// OBSOLETE 
+// OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)            \
+// OBSOLETE    frame_find_saved_regs(frame_info, &(frame_saved_regs))
+// OBSOLETE struct frame_saved_regs;
+// OBSOLETE extern void frame_find_saved_regs (struct frame_info *frame_info,
+// OBSOLETE                               struct frame_saved_regs *frame_saved_regs);
+// OBSOLETE \f
+// OBSOLETE 
+// OBSOLETE /* Discard from the stack the innermost frame, restoring all registers.  */
+// OBSOLETE 
+// OBSOLETE #define POP_FRAME { h8500_pop_frame (); }
+// OBSOLETE extern void h8500_pop_frame (void);
+// OBSOLETE 
+// OBSOLETE #define SHORT_INT_MAX 32767
+// OBSOLETE #define SHORT_INT_MIN -32768
+// OBSOLETE 
+// OBSOLETE typedef unsigned short INSN_WORD;
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR h8500_addr_bits_remove (CORE_ADDR);
+// OBSOLETE #define ADDR_BITS_REMOVE(addr) h8500_addr_bits_remove (addr)
+// OBSOLETE 
+// OBSOLETE #define read_memory_short(x)  (read_memory_integer(x,2) & 0xffff)
+// OBSOLETE 
+// OBSOLETE extern void h8500_do_registers_info (int regnum, int all);
+// OBSOLETE #define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \
+// OBSOLETE    h8500_do_registers_info (REGNUM, ALL)
+// OBSOLETE 
+// OBSOLETE extern int minimum_mode;
+// OBSOLETE 
+// OBSOLETE #define CALL_DUMMY_LENGTH 10
+// OBSOLETE 
+// OBSOLETE /* Fake variables to make it easy to use 24 bit register pointers */
+// OBSOLETE 
+// OBSOLETE #define IS_TRAPPED_INTERNALVAR h8500_is_trapped_internalvar
+// OBSOLETE extern int h8500_is_trapped_internalvar (char *name);
+// OBSOLETE 
+// OBSOLETE #define VALUE_OF_TRAPPED_INTERNALVAR h8500_value_of_trapped_internalvar
+// OBSOLETE extern struct value *h8500_value_of_trapped_internalvar ( /* struct internalvar *var */ );
+// OBSOLETE 
+// OBSOLETE #define SET_TRAPPED_INTERNALVAR h8500_set_trapped_internalvar
+// OBSOLETE extern void h8500_set_trapped_internalvar ( /* struct internalvar *var, value newval, int bitpos, int bitsize, int offset */ );
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR h8500_read_sp (void);
+// OBSOLETE extern void h8500_write_sp (CORE_ADDR);
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR h8500_read_fp (void);
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR h8500_read_pc (ptid_t);
+// OBSOLETE extern void h8500_write_pc (CORE_ADDR, ptid_t);
+// OBSOLETE 
+// OBSOLETE #define TARGET_READ_SP() h8500_read_sp()
+// OBSOLETE #define TARGET_WRITE_SP(x) h8500_write_sp(x)
+// OBSOLETE 
+// OBSOLETE #define TARGET_READ_PC(pid) h8500_read_pc(pid)
+// OBSOLETE #define TARGET_WRITE_PC(x,pid) h8500_write_pc(x,pid)
+// OBSOLETE 
+// OBSOLETE #define TARGET_READ_FP() h8500_read_fp()
diff --git a/gdb/config/i386/gdbserve.mt b/gdb/config/i386/gdbserve.mt
deleted file mode 100644 (file)
index d8a7cba..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: GDBSERVE.NLM running on a i386
-TDEPFILES=     i386.o
-CPU_FILE=      i386
diff --git a/gdb/config/i386/i386sco5.mt b/gdb/config/i386/i386sco5.mt
deleted file mode 100644 (file)
index 11ab55f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Intel 386 running SCO Open Server 5
-TDEPFILES= i386-tdep.o i387-tdep.o
-TM_FILE= tm-i386.h
diff --git a/gdb/config/i386/i386v4.mt b/gdb/config/i386/i386v4.mt
deleted file mode 100644 (file)
index d1b8c26..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Intel 386 running SVR4
-TDEPFILES= i386-tdep.o i387-tdep.o
-TM_FILE= tm-i386.h
diff --git a/gdb/config/i386/i386v42mp.mt b/gdb/config/i386/i386v42mp.mt
deleted file mode 100644 (file)
index 1a0ac88..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: Intel 386 running SVR4.2MP
-TDEPFILES= i386-tdep.o i387-tdep.o
-TM_FILE= tm-i386.h
index eed05a4..97a7053 100644 (file)
@@ -93,7 +93,7 @@ extern int  i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow);
    one that caused the trap.  Therefore we don't need to step over it.
    But we do need to reset the status register to avoid another trap.  */
 
-#define HAVE_CONTINUABLE_WATCHPOINT
+#define HAVE_CONTINUABLE_WATCHPOINT 1
 
 #define STOPPED_BY_WATCHPOINT(W)       (i386_stopped_data_address () != 0)
 
index 37a4b16..65f3176 100644 (file)
@@ -63,7 +63,7 @@ extern int kernel_u_size (void);
 /* After a watchpoint trap, the PC points to the instruction which
    caused the trap.  But we can continue over it without disabling the
    trap.  */
-#define HAVE_CONTINUABLE_WATCHPOINT
+#define HAVE_CONTINUABLE_WATCHPOINT 1
 #define HAVE_STEPPABLE_WATCHPOINT
 
 #define STOPPED_BY_WATCHPOINT(W)  \
index 8a51942..aeb89a2 100644 (file)
@@ -32,7 +32,7 @@
 /* When a hardware watchpoint fires off the PC will be left at the
    instruction following the one which caused the watchpoint.  
    It will *NOT* be necessary for GDB to step over the watchpoint. */
-#define HAVE_CONTINUABLE_WATCHPOINT
+#define HAVE_CONTINUABLE_WATCHPOINT 1
 
 /* Solaris x86 2.6 and 2.7 targets have a kernel bug when stepping
    over an instruction that causes a page fault without triggering
index 6a75298..80026e3 100644 (file)
@@ -136,8 +136,8 @@ extern int ptx_register_u_addr (int, int);
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
-#undef  MAX_REGISTER_RAW_SIZE
-#define MAX_REGISTER_RAW_SIZE 10
+#undef  DEPRECATED_MAX_REGISTER_RAW_SIZE
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 10
 
 /* Nonzero if register N requires conversion
    from raw format to virtual format.  */
index d08e59b..9ebe9ae 100644 (file)
@@ -66,7 +66,7 @@
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
-#define MAX_REGISTER_RAW_SIZE 16
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 16
 
 
 #define GDBSERVER_RESUME_REGS { IA64_IP_REGNUM, IA64_PSR_REGNUM, SP_REGNUM, IA64_BSP_REGNUM, IA64_CFM_REGNUM }
index a200853..a281608 100644 (file)
@@ -1,5 +1,5 @@
-# Target: Mitsubishi m32r processor
-TDEPFILES= m32r-tdep.o monitor.o m32r-rom.o dsrec.o
-TM_FILE= tm-m32r.h
-SIM_OBS = remote-sim.o
-SIM = ../sim/m32r/libsim.a
+# OBSOLETE # Target: Mitsubishi m32r processor
+# OBSOLETE TDEPFILES= m32r-tdep.o monitor.o m32r-rom.o dsrec.o
+# OBSOLETE TM_FILE= tm-m32r.h
+# OBSOLETE SIM_OBS = remote-sim.o
+# OBSOLETE SIM = ../sim/m32r/libsim.a
index aa92499..89af4e3 100644 (file)
-/* Parameters for execution on a Mitsubishi m32r processor.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc. 
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "regcache.h"
-
-/* Used by mswin.  */
-#define TARGET_M32R 1
-
-/* mvs_check REGISTER_NAMES */
-#define REGISTER_NAMES \
-{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
-  "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
-  "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch", \
-    /*  "cond", "sm", "bsm", "ie", "bie", "bcarry",  */ \
-}
-/* mvs_check  NUM_REGS */
-#define NUM_REGS                       24
-
-/* mvs_check  REGISTER_SIZE */
-#define REGISTER_SIZE                  4
-/* mvs_check  MAX_REGISTER_RAW_SIZE */
-#define MAX_REGISTER_RAW_SIZE          4
-
-/* mvs_check  *_REGNUM */
-#define R0_REGNUM      0
-#define STRUCT_RETURN_REGNUM 0
-#define ARG0_REGNUM    0
-#define ARGLAST_REGNUM 3
-#define V0_REGNUM      0
-#define V1_REGNUM      1
-#define FP_REGNUM      13
-#define RP_REGNUM      14
-#define SP_REGNUM      15
-#define PSW_REGNUM     16
-#define CBR_REGNUM     17
-#define SPI_REGNUM     18
-#define SPU_REGNUM     19
-#define BPC_REGNUM     20
-#define PC_REGNUM      21
-#define ACCL_REGNUM    22
-#define ACCH_REGNUM    23
-
-/* mvs_check  REGISTER_BYTES */
-#define REGISTER_BYTES                 (NUM_REGS * 4)
-
-/* mvs_check  REGISTER_VIRTUAL_TYPE */
-#define REGISTER_VIRTUAL_TYPE(REG)     builtin_type_int
-
-/* mvs_check  REGISTER_BYTE */
-#define REGISTER_BYTE(REG)             ((REG) * 4)
-/* mvs_check  REGISTER_VIRTUAL_SIZE */
-#define REGISTER_VIRTUAL_SIZE(REG)     4
-/* mvs_check  REGISTER_RAW_SIZE */
-#define REGISTER_RAW_SIZE(REG)         4
-
-/* mvs_check  MAX_REGISTER_VIRTUAL_SIZE */
-#define MAX_REGISTER_VIRTUAL_SIZE      4
-
-/* mvs_check  BREAKPOINT */
-#define BREAKPOINT {0x10, 0xf1}
-
-/* mvs_no_check  FUNCTION_START_OFFSET */
-#define FUNCTION_START_OFFSET 0
-
-/* mvs_check  DECR_PC_AFTER_BREAK */
-#define DECR_PC_AFTER_BREAK 0
-
-/* mvs_check  INNER_THAN */
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* mvs_check  SAVED_PC_AFTER_CALL */
-#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
-
-struct frame_info;
-struct frame_saved_regs;
-struct type;
-struct value;
-
-/* Define other aspects of the stack frame. 
-   We keep the offsets of all saved registers, 'cause we need 'em a lot!
-   We also keep the current size of the stack frame, and whether 
-   the frame pointer is valid (for frameless functions, and when we're
-   still in the prologue of a function with a frame) */
-
-/* mvs_check  EXTRA_FRAME_INFO */
-#define EXTRA_FRAME_INFO       \
-  struct frame_saved_regs fsr; \
-  int framesize;               \
-  int using_frame_pointer;
-
-
-extern void m32r_init_extra_frame_info (struct frame_info *fi);
-/* mvs_check  INIT_EXTRA_FRAME_INFO */
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) m32r_init_extra_frame_info (fi)
-/* mvs_no_check  DEPRECATED_INIT_FRAME_PC */
-#define DEPRECATED_INIT_FRAME_PC               init_frame_pc_noop
-
-extern void
-m32r_frame_find_saved_regs (struct frame_info *fi,
-                           struct frame_saved_regs *regaddr);
-
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of the saved registers of frame described by FRAME_INFO.
-   This includes special registers such as pc and fp saved in special
-   ways in the stack frame.  sp is even more special:
-   the address we return for it IS the sp for the next frame.  */
-
-/* mvs_check  FRAME_FIND_SAVED_REGS */
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)        \
-   m32r_frame_find_saved_regs(frame_info, &(frame_saved_regs))
-
-extern CORE_ADDR m32r_frame_chain (struct frame_info *fi);
-/* mvs_check  FRAME_CHAIN */
-#define FRAME_CHAIN(fi)                m32r_frame_chain (fi)
-
-extern CORE_ADDR m32r_find_callers_reg (struct frame_info *fi, int regnum);
-extern CORE_ADDR m32r_frame_saved_pc (struct frame_info *);
-/* mvs_check  FRAME_SAVED_PC */
-#define FRAME_SAVED_PC(fi)             m32r_frame_saved_pc (fi)
-
-/* mvs_check  DEPRECATED_EXTRACT_RETURN_VALUE */
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
-  memcpy ((VALBUF), \
-         (char *)(REGBUF) + REGISTER_BYTE (V0_REGNUM) + \
-         ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
-         TYPE_LENGTH (TYPE))
-
-/* mvs_check  DEPRECATED_STORE_RETURN_VALUE */
-#define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
-  deprecated_write_register_bytes(REGISTER_BYTE (V0_REGNUM) + \
-                      ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
-                      (VALBUF), TYPE_LENGTH (TYPE));
-
-extern CORE_ADDR m32r_skip_prologue (CORE_ADDR pc);
-/* mvs_check  SKIP_PROLOGUE */
-#define SKIP_PROLOGUE(pc) (m32r_skip_prologue (pc))
-
-/* mvs_no_check  FRAME_ARGS_SKIP */
-#define FRAME_ARGS_SKIP 0
-
-/* mvs_no_check  FRAME_ARGS_ADDRESS */
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
-/* mvs_no_check  FRAME_LOCALS_ADDRESS */
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-/* mvs_no_check  FRAME_NUM_ARGS */
-#define FRAME_NUM_ARGS(fi) (-1)
-
-extern void m32r_write_sp (CORE_ADDR val);
-#define TARGET_WRITE_SP m32r_write_sp
-
-
-
-
-
-
-/* struct passing and returning stuff */
-#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)   \
-       write_register (0, STRUCT_ADDR)
-
-extern use_struct_convention_fn m32r_use_struct_convention;
-#define USE_STRUCT_CONVENTION(GCC_P, TYPE) m32r_use_struct_convention (GCC_P, TYPE)
-
-#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-  extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
-                  REGISTER_RAW_SIZE (V0_REGNUM))
-
-#define REG_STRUCT_HAS_ADDR(gcc_p,type)     (TYPE_LENGTH (type) > 8)
-
-
-/* generic dummy frame stuff */
-
-#define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
-#define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
-
-
-/* target-specific dummy_frame stuff */
-
-extern struct frame_info *m32r_pop_frame (struct frame_info *frame);
-/* mvs_check  POP_FRAME */
-#define POP_FRAME m32r_pop_frame (get_current_frame ())
-
-/* mvs_no_check  STACK_ALIGN */
-/* #define STACK_ALIGN(x) ((x + 3) & ~3) */
-
-extern CORE_ADDR m32r_push_return_address (CORE_ADDR, CORE_ADDR);
-extern CORE_ADDR m32r_push_arguments (int nargs,
-                                     struct value **args,
-                                     CORE_ADDR sp,
-                                     unsigned char struct_return,
-                                     CORE_ADDR struct_addr);
-
-
-
-/* mvs_no_check  PUSH_ARGUMENTS */
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
-  (m32r_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
-
-#define PUSH_RETURN_ADDRESS(PC, SP)      m32r_push_return_address (PC, SP)
-
-/* override the standard get_saved_register function with 
-   one that takes account of generic CALL_DUMMY frames */
-#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
-     deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
-
-
-#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 1
-#define CALL_DUMMY                   {0}
-#define CALL_DUMMY_LENGTH            (0)
-#define CALL_DUMMY_START_OFFSET      (0)
-#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
-#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
-#define CALL_DUMMY_ADDRESS()         entry_point_address ()
+// OBSOLETE /* Parameters for execution on a Mitsubishi m32r processor.
+// OBSOLETE    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// OBSOLETE    Free Software Foundation, Inc. 
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE /* Used by mswin.  */
+// OBSOLETE #define TARGET_M32R 1
+// OBSOLETE 
+// OBSOLETE /* mvs_check REGISTER_NAMES */
+// OBSOLETE #define REGISTER_NAMES \
+// OBSOLETE { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
+// OBSOLETE   "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp", \
+// OBSOLETE   "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch", \
+// OBSOLETE     /*  "cond", "sm", "bsm", "ie", "bie", "bcarry",  */ \
+// OBSOLETE }
+// OBSOLETE /* mvs_check  NUM_REGS */
+// OBSOLETE #define NUM_REGS                   24
+// OBSOLETE 
+// OBSOLETE /* mvs_check  REGISTER_SIZE */
+// OBSOLETE #define REGISTER_SIZE                      4
+// OBSOLETE /* mvs_check  MAX_REGISTER_RAW_SIZE */
+// OBSOLETE #define MAX_REGISTER_RAW_SIZE              4
+// OBSOLETE 
+// OBSOLETE /* mvs_check  *_REGNUM */
+// OBSOLETE #define R0_REGNUM  0
+// OBSOLETE #define STRUCT_RETURN_REGNUM 0
+// OBSOLETE #define ARG0_REGNUM        0
+// OBSOLETE #define ARGLAST_REGNUM     3
+// OBSOLETE #define V0_REGNUM  0
+// OBSOLETE #define V1_REGNUM  1
+// OBSOLETE #define FP_REGNUM  13
+// OBSOLETE #define RP_REGNUM  14
+// OBSOLETE #define SP_REGNUM  15
+// OBSOLETE #define PSW_REGNUM 16
+// OBSOLETE #define CBR_REGNUM 17
+// OBSOLETE #define SPI_REGNUM 18
+// OBSOLETE #define SPU_REGNUM 19
+// OBSOLETE #define BPC_REGNUM 20
+// OBSOLETE #define PC_REGNUM  21
+// OBSOLETE #define ACCL_REGNUM        22
+// OBSOLETE #define ACCH_REGNUM        23
+// OBSOLETE 
+// OBSOLETE /* mvs_check  REGISTER_BYTES */
+// OBSOLETE #define REGISTER_BYTES                     (NUM_REGS * 4)
+// OBSOLETE 
+// OBSOLETE /* mvs_check  REGISTER_VIRTUAL_TYPE */
+// OBSOLETE #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
+// OBSOLETE 
+// OBSOLETE /* mvs_check  REGISTER_BYTE */
+// OBSOLETE #define REGISTER_BYTE(REG)                 ((REG) * 4)
+// OBSOLETE /* mvs_check  REGISTER_VIRTUAL_SIZE */
+// OBSOLETE #define REGISTER_VIRTUAL_SIZE(REG)         4
+// OBSOLETE /* mvs_check  REGISTER_RAW_SIZE */
+// OBSOLETE #define REGISTER_RAW_SIZE(REG)             4
+// OBSOLETE 
+// OBSOLETE /* mvs_check  MAX_REGISTER_VIRTUAL_SIZE */
+// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE  4
+// OBSOLETE 
+// OBSOLETE /* mvs_check  BREAKPOINT */
+// OBSOLETE #define BREAKPOINT {0x10, 0xf1}
+// OBSOLETE 
+// OBSOLETE /* mvs_no_check  FUNCTION_START_OFFSET */
+// OBSOLETE #define FUNCTION_START_OFFSET 0
+// OBSOLETE 
+// OBSOLETE /* mvs_check  DECR_PC_AFTER_BREAK */
+// OBSOLETE #define DECR_PC_AFTER_BREAK 0
+// OBSOLETE 
+// OBSOLETE /* mvs_check  INNER_THAN */
+// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+// OBSOLETE 
+// OBSOLETE /* mvs_check  SAVED_PC_AFTER_CALL */
+// OBSOLETE #define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM)
+// OBSOLETE 
+// OBSOLETE struct frame_info;
+// OBSOLETE struct frame_saved_regs;
+// OBSOLETE struct type;
+// OBSOLETE struct value;
+// OBSOLETE 
+// OBSOLETE /* Define other aspects of the stack frame. 
+// OBSOLETE    We keep the offsets of all saved registers, 'cause we need 'em a lot!
+// OBSOLETE    We also keep the current size of the stack frame, and whether 
+// OBSOLETE    the frame pointer is valid (for frameless functions, and when we're
+// OBSOLETE    still in the prologue of a function with a frame) */
+// OBSOLETE 
+// OBSOLETE /* mvs_check  EXTRA_FRAME_INFO */
+// OBSOLETE #define EXTRA_FRAME_INFO   \
+// OBSOLETE   struct frame_saved_regs fsr;     \
+// OBSOLETE   int framesize;           \
+// OBSOLETE   int using_frame_pointer;
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE extern void m32r_init_extra_frame_info (struct frame_info *fi);
+// OBSOLETE /* mvs_check  INIT_EXTRA_FRAME_INFO */
+// OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) m32r_init_extra_frame_info (fi)
+// OBSOLETE /* mvs_no_check  DEPRECATED_INIT_FRAME_PC */
+// OBSOLETE #define DEPRECATED_INIT_FRAME_PC           init_frame_pc_noop
+// OBSOLETE 
+// OBSOLETE extern void
+// OBSOLETE m32r_frame_find_saved_regs (struct frame_info *fi,
+// OBSOLETE                        struct frame_saved_regs *regaddr);
+// OBSOLETE 
+// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
+// OBSOLETE    the addresses of the saved registers of frame described by FRAME_INFO.
+// OBSOLETE    This includes special registers such as pc and fp saved in special
+// OBSOLETE    ways in the stack frame.  sp is even more special:
+// OBSOLETE    the address we return for it IS the sp for the next frame.  */
+// OBSOLETE 
+// OBSOLETE /* mvs_check  FRAME_FIND_SAVED_REGS */
+// OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)            \
+// OBSOLETE    m32r_frame_find_saved_regs(frame_info, &(frame_saved_regs))
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR m32r_frame_chain (struct frame_info *fi);
+// OBSOLETE /* mvs_check  FRAME_CHAIN */
+// OBSOLETE #define FRAME_CHAIN(fi)            m32r_frame_chain (fi)
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR m32r_find_callers_reg (struct frame_info *fi, int regnum);
+// OBSOLETE extern CORE_ADDR m32r_frame_saved_pc (struct frame_info *);
+// OBSOLETE /* mvs_check  FRAME_SAVED_PC */
+// OBSOLETE #define FRAME_SAVED_PC(fi)         m32r_frame_saved_pc (fi)
+// OBSOLETE 
+// OBSOLETE /* mvs_check  DEPRECATED_EXTRACT_RETURN_VALUE */
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
+// OBSOLETE   memcpy ((VALBUF), \
+// OBSOLETE      (char *)(REGBUF) + REGISTER_BYTE (V0_REGNUM) + \
+// OBSOLETE      ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
+// OBSOLETE      TYPE_LENGTH (TYPE))
+// OBSOLETE 
+// OBSOLETE /* mvs_check  DEPRECATED_STORE_RETURN_VALUE */
+// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
+// OBSOLETE   deprecated_write_register_bytes(REGISTER_BYTE (V0_REGNUM) + \
+// OBSOLETE                   ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
+// OBSOLETE                   (VALBUF), TYPE_LENGTH (TYPE));
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR m32r_skip_prologue (CORE_ADDR pc);
+// OBSOLETE /* mvs_check  SKIP_PROLOGUE */
+// OBSOLETE #define SKIP_PROLOGUE(pc) (m32r_skip_prologue (pc))
+// OBSOLETE 
+// OBSOLETE /* mvs_no_check  FRAME_ARGS_SKIP */
+// OBSOLETE #define FRAME_ARGS_SKIP 0
+// OBSOLETE 
+// OBSOLETE /* mvs_no_check  FRAME_ARGS_ADDRESS */
+// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+// OBSOLETE /* mvs_no_check  FRAME_LOCALS_ADDRESS */
+// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+// OBSOLETE /* mvs_no_check  FRAME_NUM_ARGS */
+// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1)
+// OBSOLETE 
+// OBSOLETE extern void m32r_write_sp (CORE_ADDR val);
+// OBSOLETE #define TARGET_WRITE_SP m32r_write_sp
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* struct passing and returning stuff */
+// OBSOLETE #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP)       \
+// OBSOLETE    write_register (0, STRUCT_ADDR)
+// OBSOLETE 
+// OBSOLETE extern use_struct_convention_fn m32r_use_struct_convention;
+// OBSOLETE #define USE_STRUCT_CONVENTION(GCC_P, TYPE) m32r_use_struct_convention (GCC_P, TYPE)
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+// OBSOLETE   extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
+// OBSOLETE               REGISTER_RAW_SIZE (V0_REGNUM))
+// OBSOLETE 
+// OBSOLETE #define REG_STRUCT_HAS_ADDR(gcc_p,type)     (TYPE_LENGTH (type) > 8)
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* generic dummy frame stuff */
+// OBSOLETE 
+// OBSOLETE #define PUSH_DUMMY_FRAME             generic_push_dummy_frame ()
+// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* target-specific dummy_frame stuff */
+// OBSOLETE 
+// OBSOLETE extern struct frame_info *m32r_pop_frame (struct frame_info *frame);
+// OBSOLETE /* mvs_check  POP_FRAME */
+// OBSOLETE #define POP_FRAME m32r_pop_frame (get_current_frame ())
+// OBSOLETE 
+// OBSOLETE /* mvs_no_check  STACK_ALIGN */
+// OBSOLETE /* #define STACK_ALIGN(x) ((x + 3) & ~3) */
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR m32r_push_return_address (CORE_ADDR, CORE_ADDR);
+// OBSOLETE extern CORE_ADDR m32r_push_arguments (int nargs,
+// OBSOLETE                                  struct value **args,
+// OBSOLETE                                  CORE_ADDR sp,
+// OBSOLETE                                  unsigned char struct_return,
+// OBSOLETE                                  CORE_ADDR struct_addr);
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* mvs_no_check  PUSH_ARGUMENTS */
+// OBSOLETE #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
+// OBSOLETE   (m32r_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
+// OBSOLETE 
+// OBSOLETE #define PUSH_RETURN_ADDRESS(PC, SP)      m32r_push_return_address (PC, SP)
+// OBSOLETE 
+// OBSOLETE /* override the standard get_saved_register function with 
+// OBSOLETE    one that takes account of generic CALL_DUMMY frames */
+// OBSOLETE #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
+// OBSOLETE      deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 1
+// OBSOLETE #define CALL_DUMMY                   {0}
+// OBSOLETE #define CALL_DUMMY_LENGTH            (0)
+// OBSOLETE #define CALL_DUMMY_START_OFFSET      (0)
+// OBSOLETE #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
+// OBSOLETE #define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
+// OBSOLETE #define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
+// OBSOLETE #define CALL_DUMMY_ADDRESS()         entry_point_address ()
diff --git a/gdb/config/m68k/nm-hp300bsd.h b/gdb/config/m68k/nm-hp300bsd.h
deleted file mode 100644 (file)
index e0f7a11..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Parameters for Hewlett-Packard 9000/300 native support under bsd.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993
-   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.  */
-
-/* Detect whether this is 4.3 or 4.4.  */
-
-#include <errno.h>
-#include <sys/param.h>
-#ifdef BSD4_4
-
-/* BSD 4.4 alpha or better */
-
-/* We can attach to processes using ptrace.  */
-
-#define        ATTACH_DETACH
-#define        PTRACE_ATTACH   10
-#define        PTRACE_DETACH   11
-
-/* The third argument of ptrace is declared as this type.  */
-
-#define        PTRACE_ARG3_TYPE        caddr_t
-
-/* U_REGS_OFFSET is the offset of the registers within the u area for
-   ptrace purposes.  */
-#define U_REGS_OFFSET \
-  ptrace (PT_READ_U, PIDGET (inferior_ptid), \
-         (PTRACE_ARG3_TYPE) \
-          (offsetof (struct user, u_kproc.kp_proc.p_md.md_regs)), 0) \
-    - USRSTACK
-
-/* No user structure in 4.4, registers are relative to kernel stack
-   which is fixed.  */
-#define KERNEL_U_ADDR  0xFFF00000
-
-/* FIXME: Is ONE_PROCESS_WRITETEXT still true now that the kernel has
-   copy-on-write?  It not, move it to the 4.3-specific section below
-   (now it is in xm-hp300bsd.h).  */
-
-#else
-
-/* This is BSD 4.3 or something like it.  */
-
-/* Get kernel u area address at run-time using BSD style nlist ().  */
-#define KERNEL_U_ADDR_BSD
-
-#endif
-
-/* This was once broken for 4.4, but probably because we had the wrong
-   KERNEL_U_ADDR.  */
-
-/* This is a piece of magic that is given a register number REGNO
-   and as BLOCKEND the address in the system of the end of the user structure
-   and stores in ADDR the address in the kernel or core dump
-   of that register.  */
-
-#define REGISTER_U_ADDR(addr, blockend, regno)                         \
-{                                                                      \
-  if (regno < PS_REGNUM)                                               \
-    addr = (int) &((struct frame *)(blockend))->f_regs[regno];         \
-  else if (regno == PS_REGNUM)                                         \
-    addr = (int) &((struct frame *)(blockend))->f_stackadj;            \
-  else if (regno == PC_REGNUM)                                         \
-    addr = (int) &((struct frame *)(blockend))->f_pc;                  \
-  else if (regno < FPC_REGNUM)                                         \
-    addr = (int)                                                       \
-      &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\
-  else if (regno == FPC_REGNUM)                                                \
-    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr;       \
-  else if (regno == FPS_REGNUM)                                                \
-    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr;       \
-  else                                                                 \
-    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar;      \
-}
diff --git a/gdb/config/m68k/tm-apollo68b.h b/gdb/config/m68k/tm-apollo68b.h
deleted file mode 100644 (file)
index f0b7488..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Parameters for execution on Apollo 68k running BSD.
-   Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1998, 2003
-   Free Software Foundation, Inc.
-   Contributed by Cygnus Support.
-
-   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.  */
-
-/* Apollos use vector 0xb for the breakpoint vector */
-
-#define BPT_VECTOR 0xb
-
-#include "m68k/tm-m68k.h"
-
-/* These are the jmp_buf registers I could guess. There are 13 registers
- * in the buffer. There are 8 data registers, 6 general address registers,
- * the Frame Pointer, the Stack Pointer, the PC and the SR in the chip. I would
- * guess that 12 is the SR, but we don't need that anyway. 0 and 1 have
- * me stumped. 4 appears to be a5 for some unknown reason. If you care
- * about this, disassemble setjmp to find out. But don't do it with gdb :)
- */
-
-#undef JB_SP
-#undef JB_FP
-#undef JB_PC
-#undef JB_D0
-#undef JB_D1
-#undef JB_D2
-#undef JB_D3
-#undef JB_D4
-#undef JB_D5
-
-#define JB_SP 2
-#define JB_FP 3
-#define JB_PC 5
-#define JB_D0 6
-#define JB_D1 7
-#define JB_D2 8
-#define JB_D3 9
-#define JB_D4 10
-#define JB_D5 11
-
-/* How to decide if we're in a shared library function.  (Probably a wrong
-   definintion inherited from the VxWorks config file).  */
-#define        IN_SOLIB_CALL_TRAMPOLINE(pc, name) (name && strcmp(name, "<end_of_program>") == 0)
diff --git a/gdb/config/m68k/tm-es1800.h b/gdb/config/m68k/tm-es1800.h
deleted file mode 100644 (file)
index 46e4a64..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Parameters for execution on ES-1800 emulator for 68000.
-   The code was originally written by Johan Holmberg TT/SJ Ericsson Telecom
-   AB and later modified by Johan Henriksson TT/SJ. It was adapted to GDB 4.0
-   by Jan Norden TX/DK.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1996, 2000
-   Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   GDB is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 1, or (at your option)
-   any later version.
-
-   GDB is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#define        GDBINIT_FILENAME        ".esgdbinit"
-
-#define        DEFAULT_PROMPT          "(esgdb) "
-
-#include "m68k/tm-m68k.h"
-
-/* Longjmp stuff borrowed from sun3 configuration.  Don't know if correct. 
-   FIXME.  */
-/* Offsets (in target ints) into jmp_buf.  Not defined by Sun, but at least
-   documented in a comment in <machine/setjmp.h>! */
-
-#define JB_ELEMENT_SIZE 4
-
-#define JB_ONSSTACK 0
-#define JB_SIGMASK 1
-#define JB_SP 2
-#define JB_PC 3
-#define JB_PSL 4
-#define JB_D2 5
-#define JB_D3 6
-#define JB_D4 7
-#define JB_D5 8
-#define JB_D6 9
-#define JB_D7 10
-#define JB_A2 11
-#define JB_A3 12
-#define JB_A4 13
-#define JB_A5 14
-#define JB_A6 15
-
-/* Figure out where the longjmp will land.  Slurp the args out of the stack.
-   We expect the first arg to be a pointer to the jmp_buf structure from which
-   we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
-   This routine returns true on success */
-
-#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
diff --git a/gdb/config/m68k/tm-hp300bsd.h b/gdb/config/m68k/tm-hp300bsd.h
deleted file mode 100644 (file)
index 0a03387..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Parameters for target machine Hewlett-Packard 9000/300, running bsd.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1996
-   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.  */
-
-/* Configuration file for HP9000/300 series machine running BSD,
-   including Utah, Mt. Xinu or Berkeley variants.  This is NOT for HP-UX.
-   Problems to hpbsd-bugs@cs.utah.edu.  */
-
-/* GCC is the only compiler used on this OS.  So get this right even if
-   the code which detects gcc2_compiled. is still broken.  */
-
-#define BELIEVE_PCC_PROMOTION 1
-
-/* Define BPT_VECTOR if it is different than the default.
-   This is the vector number used by traps to indicate a breakpoint.
-
-   For hp300bsd the normal breakpoint vector is 0x2 (for debugging via
-   ptrace); for remote kernel debugging the breakpoint vector is 0xf.  */
-
-#define BPT_VECTOR 0x2
-#define REMOTE_BPT_VECTOR 0xf
-
-#define TARGET_NBPG 4096
-
-/* For 4.4 this would be 2, but it is OK for us to detect an area a
-   bit bigger than necessary.  This way the same gdb binary can target
-   either 4.3 or 4.4.  */
-
-#define TARGET_UPAGES 3
-
-/* On the HP300, sigtramp is in the u area.  Gak!  User struct is not
-   mapped to the same virtual address in user/kernel address space
-   (hence STACK_END_ADDR as opposed to KERNEL_U_ADDR).  This tests
-   for the whole u area, since we don't necessarily have hp300bsd
-   include files around.  */
-
-/* For 4.4, it is actually right 20 bytes *before* STACK_END_ADDR, so
-   include that in the area we test for.  */
-
-#define SIGTRAMP_START(pc) (STACK_END_ADDR - 20)
-#define SIGTRAMP_END(pc) (STACK_END_ADDR + TARGET_UPAGES * TARGET_NBPG)
-
-/* Address of end of stack space.  */
-
-#define STACK_END_ADDR 0xfff00000
-
-#include "m68k/tm-m68k.h"
index c85a2fb..be374ec 100644 (file)
@@ -1,6 +1,6 @@
-# Target: Matsushita mn10200
-TDEPFILES= mn10200-tdep.o
-TM_FILE= tm-mn10200.h
-
-SIM_OBS = remote-sim.o
-SIM = ../sim/mn10200/libsim.a
+# OBSOLETE # Target: Matsushita mn10200
+# OBSOLETE TDEPFILES= mn10200-tdep.o
+# OBSOLETE TM_FILE= tm-mn10200.h
+# OBSOLETE 
+# OBSOLETE SIM_OBS = remote-sim.o
+# OBSOLETE SIM = ../sim/mn10200/libsim.a
index beb063e..511c136 100644 (file)
-/* Parameters for execution on a Matsushita mn10200 processor.
-
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
-   Foundation, Inc.
-
-   Contributed by Geoffrey Noer <noer@cygnus.com>
-
-   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.  */
-
-/* FIXME: cagney/2001-03-01: The below macros refer to functions
-   declared in "regcache.h".  The ``correct fix'' is to convert those
-   macros into functions.  */
-#include "regcache.h"
-#include "symtab.h"            /* For namespace_enum.  */
-#include "symfile.h"           /* For entry_point_address().  */
-
-/* ints are only 16bits on the mn10200.  */
-#undef TARGET_INT_BIT
-#define TARGET_INT_BIT 16
-
-/* The mn10200 doesn't support long long types.  */
-#undef TARGET_LONG_LONG_BIT
-#define TARGET_LONG_LONG_BIT 32
-
-/* The mn10200 doesn't support double or long double either.  */
-#undef TARGET_DOUBLE_BIT
-#undef TARGET_LONG_DOUBLE_BIT
-#define TARGET_DOUBLE_BIT 32
-#define TARGET_LONG_DOUBLE_BIT 32
-
-/* Not strictly correct, but the machine independent code is not
-   ready to handle any of the basic sizes not being a power of two.  */
-#undef TARGET_PTR_BIT
-#define TARGET_PTR_BIT 32
-
-/* The mn10200 really has 24 bit registers but the simulator reads/writes
-   them as 32bit values, so we claim they're 32bits each.  This may have
-   to be tweaked if the Matsushita emulator/board really deals with them
-   as 24bits each.  */
-#define REGISTER_SIZE 4
-
-#define MAX_REGISTER_RAW_SIZE REGISTER_SIZE
-#define NUM_REGS 11
-
-#define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
-
-#define REGISTER_NAMES \
-{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "sp", \
-  "pc", "mdr", "psw"}
-
-#define FP_REGNUM 6
-#define SP_REGNUM 7
-#define PC_REGNUM 8
-#define MDR_REGNUM 9
-#define PSW_REGNUM 10
-
-/* Treat the registers as 32bit values.  */
-#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_long
-
-#define REGISTER_BYTE(REG) ((REG) * REGISTER_SIZE)
-#define REGISTER_VIRTUAL_SIZE(REG) REGISTER_SIZE
-#define REGISTER_RAW_SIZE(REG) REGISTER_SIZE
-
-#define MAX_REGISTER_VIRTUAL_SIZE REGISTER_SIZE
-
-/* The breakpoint instruction must be the same size as te smallest
-   instruction in the instruction set.
-
-   The Matsushita mn10x00 processors have single byte instructions
-   so we need a single byte breakpoint.  Matsushita hasn't defined
-   one, so we defined it ourselves.
-
-   0xff is the only available single byte insn left on the mn10200.  */
-#define BREAKPOINT {0xff}
-
-#define FUNCTION_START_OFFSET 0
-
-#define DECR_PC_AFTER_BREAK 0
-
-/* Stacks grow the normal way.  */
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-#define SAVED_PC_AFTER_CALL(frame) \
-  (read_memory_integer (read_register (SP_REGNUM), REGISTER_SIZE) & 0xffffff)
-
-struct frame_info;
-struct frame_saved_regs;
-struct type;
-struct value;
-
-#define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size;
-
-extern void mn10200_init_extra_frame_info (struct frame_info *);
-#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10200_init_extra_frame_info (fi)
-#define DEPRECATED_INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y))
-#define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y))
-
-extern void mn10200_frame_find_saved_regs (struct frame_info *,
-                                          struct frame_saved_regs *);
-#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
-
-extern CORE_ADDR mn10200_frame_chain (struct frame_info *);
-#define FRAME_CHAIN(fi) mn10200_frame_chain (fi)
-
-extern CORE_ADDR mn10200_find_callers_reg (struct frame_info *, int);
-extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *);
-#define FRAME_SAVED_PC(FI) (mn10200_frame_saved_pc (FI))
-
-/* Extract from an array REGBUF containing the (raw) register state
-   a function return value of type TYPE, and copy that, in virtual format,
-   into VALBUF.  */
-
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
-  { \
-    if (TYPE_LENGTH (TYPE) > 8) \
-      internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
-    else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
-      { \
-       memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), 2); \
-       memcpy (VALBUF + 2, REGBUF + REGISTER_BYTE (1), 2); \
-      } \
-    else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
-      { \
-        memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \
-      } \
-    else \
-      { \
-        memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE)); \
-      } \
-  }
-
-#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-  extract_address (REGBUF + REGISTER_BYTE (4), \
-                  REGISTER_RAW_SIZE (4))
-
-#define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
-  { \
-    if (TYPE_LENGTH (TYPE) > 8) \
-      internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
-    else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
-      { \
-       deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \
-       deprecated_write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \
-      } \
-    else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
-      { \
-        deprecated_write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \
-      } \
-    else \
-      { \
-        deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \
-      } \
-  }
-
-
-extern CORE_ADDR mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
-#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
-  (SP) = mn10200_store_struct_return (STRUCT_ADDR, SP)
-
-extern CORE_ADDR mn10200_skip_prologue (CORE_ADDR);
-#define SKIP_PROLOGUE(pc) (mn10200_skip_prologue (pc))
-
-#define FRAME_ARGS_SKIP 0
-
-#define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi))
-#define FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi))
-#define FRAME_NUM_ARGS(fi) (-1)
-
-extern void mn10200_pop_frame (struct frame_info *);
-#define POP_FRAME mn10200_pop_frame (get_current_frame ())
-
-#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 1
-#define CALL_DUMMY                   {0}
-#define CALL_DUMMY_START_OFFSET      (0)
-#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
-#define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
-#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
-#define CALL_DUMMY_ADDRESS()         entry_point_address ()
-
-extern CORE_ADDR mn10200_push_return_address (CORE_ADDR, CORE_ADDR);
-#define PUSH_RETURN_ADDRESS(PC, SP)  mn10200_push_return_address (PC, SP)
-
-#define PUSH_DUMMY_FRAME       generic_push_dummy_frame ()
-
-extern CORE_ADDR mn10200_push_arguments (int, struct value **, CORE_ADDR,
-                                        unsigned char, CORE_ADDR);
-#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
-  (mn10200_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
-
-#define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
-
-#define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \
-       (TYPE_LENGTH (TYPE) > 8)
-
-extern use_struct_convention_fn mn10200_use_struct_convention;
-#define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10200_use_struct_convention (GCC_P, TYPE)
-
-/* Define this for Wingdb */
-#define TARGET_MN10200
+// OBSOLETE /* Parameters for execution on a Matsushita mn10200 processor.
+// OBSOLETE 
+// OBSOLETE    Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+// OBSOLETE    Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    Contributed by Geoffrey Noer <noer@cygnus.com>
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE /* FIXME: cagney/2001-03-01: The below macros refer to functions
+// OBSOLETE    declared in "regcache.h".  The ``correct fix'' is to convert those
+// OBSOLETE    macros into functions.  */
+// OBSOLETE #include "regcache.h"
+// OBSOLETE #include "symtab.h"                /* For namespace_enum.  */
+// OBSOLETE #include "symfile.h"               /* For entry_point_address().  */
+// OBSOLETE 
+// OBSOLETE /* ints are only 16bits on the mn10200.  */
+// OBSOLETE #undef TARGET_INT_BIT
+// OBSOLETE #define TARGET_INT_BIT 16
+// OBSOLETE 
+// OBSOLETE /* The mn10200 doesn't support long long types.  */
+// OBSOLETE #undef TARGET_LONG_LONG_BIT
+// OBSOLETE #define TARGET_LONG_LONG_BIT 32
+// OBSOLETE 
+// OBSOLETE /* The mn10200 doesn't support double or long double either.  */
+// OBSOLETE #undef TARGET_DOUBLE_BIT
+// OBSOLETE #undef TARGET_LONG_DOUBLE_BIT
+// OBSOLETE #define TARGET_DOUBLE_BIT 32
+// OBSOLETE #define TARGET_LONG_DOUBLE_BIT 32
+// OBSOLETE 
+// OBSOLETE /* Not strictly correct, but the machine independent code is not
+// OBSOLETE    ready to handle any of the basic sizes not being a power of two.  */
+// OBSOLETE #undef TARGET_PTR_BIT
+// OBSOLETE #define TARGET_PTR_BIT 32
+// OBSOLETE 
+// OBSOLETE /* The mn10200 really has 24 bit registers but the simulator reads/writes
+// OBSOLETE    them as 32bit values, so we claim they're 32bits each.  This may have
+// OBSOLETE    to be tweaked if the Matsushita emulator/board really deals with them
+// OBSOLETE    as 24bits each.  */
+// OBSOLETE #define REGISTER_SIZE 4
+// OBSOLETE 
+// OBSOLETE #define MAX_REGISTER_RAW_SIZE REGISTER_SIZE
+// OBSOLETE #define NUM_REGS 11
+// OBSOLETE 
+// OBSOLETE #define REGISTER_BYTES (NUM_REGS * REGISTER_SIZE)
+// OBSOLETE 
+// OBSOLETE #define REGISTER_NAMES \
+// OBSOLETE { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "sp", \
+// OBSOLETE   "pc", "mdr", "psw"}
+// OBSOLETE 
+// OBSOLETE #define FP_REGNUM 6
+// OBSOLETE #define SP_REGNUM 7
+// OBSOLETE #define PC_REGNUM 8
+// OBSOLETE #define MDR_REGNUM 9
+// OBSOLETE #define PSW_REGNUM 10
+// OBSOLETE 
+// OBSOLETE /* Treat the registers as 32bit values.  */
+// OBSOLETE #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_long
+// OBSOLETE 
+// OBSOLETE #define REGISTER_BYTE(REG) ((REG) * REGISTER_SIZE)
+// OBSOLETE #define REGISTER_VIRTUAL_SIZE(REG) REGISTER_SIZE
+// OBSOLETE #define REGISTER_RAW_SIZE(REG) REGISTER_SIZE
+// OBSOLETE 
+// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE REGISTER_SIZE
+// OBSOLETE 
+// OBSOLETE /* The breakpoint instruction must be the same size as te smallest
+// OBSOLETE    instruction in the instruction set.
+// OBSOLETE 
+// OBSOLETE    The Matsushita mn10x00 processors have single byte instructions
+// OBSOLETE    so we need a single byte breakpoint.  Matsushita hasn't defined
+// OBSOLETE    one, so we defined it ourselves.
+// OBSOLETE 
+// OBSOLETE    0xff is the only available single byte insn left on the mn10200.  */
+// OBSOLETE #define BREAKPOINT {0xff}
+// OBSOLETE 
+// OBSOLETE #define FUNCTION_START_OFFSET 0
+// OBSOLETE 
+// OBSOLETE #define DECR_PC_AFTER_BREAK 0
+// OBSOLETE 
+// OBSOLETE /* Stacks grow the normal way.  */
+// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+// OBSOLETE 
+// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) \
+// OBSOLETE   (read_memory_integer (read_register (SP_REGNUM), REGISTER_SIZE) & 0xffffff)
+// OBSOLETE 
+// OBSOLETE struct frame_info;
+// OBSOLETE struct frame_saved_regs;
+// OBSOLETE struct type;
+// OBSOLETE struct value;
+// OBSOLETE 
+// OBSOLETE #define EXTRA_FRAME_INFO struct frame_saved_regs fsr; int status; int stack_size;
+// OBSOLETE 
+// OBSOLETE extern void mn10200_init_extra_frame_info (struct frame_info *);
+// OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) mn10200_init_extra_frame_info (fi)
+// OBSOLETE #define DEPRECATED_INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y))
+// OBSOLETE #define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y))
+// OBSOLETE 
+// OBSOLETE extern void mn10200_frame_find_saved_regs (struct frame_info *,
+// OBSOLETE                                       struct frame_saved_regs *);
+// OBSOLETE #define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR mn10200_frame_chain (struct frame_info *);
+// OBSOLETE #define FRAME_CHAIN(fi) mn10200_frame_chain (fi)
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR mn10200_find_callers_reg (struct frame_info *, int);
+// OBSOLETE extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *);
+// OBSOLETE #define FRAME_SAVED_PC(FI) (mn10200_frame_saved_pc (FI))
+// OBSOLETE 
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE    a function return value of type TYPE, and copy that, in virtual format,
+// OBSOLETE    into VALBUF.  */
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \
+// OBSOLETE   { \
+// OBSOLETE     if (TYPE_LENGTH (TYPE) > 8) \
+// OBSOLETE       internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
+// OBSOLETE     else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
+// OBSOLETE       { \
+// OBSOLETE    memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), 2); \
+// OBSOLETE    memcpy (VALBUF + 2, REGBUF + REGISTER_BYTE (1), 2); \
+// OBSOLETE       } \
+// OBSOLETE     else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
+// OBSOLETE       { \
+// OBSOLETE         memcpy (VALBUF, REGBUF + REGISTER_BYTE (4), TYPE_LENGTH (TYPE)); \
+// OBSOLETE       } \
+// OBSOLETE     else \
+// OBSOLETE       { \
+// OBSOLETE         memcpy (VALBUF, REGBUF + REGISTER_BYTE (0), TYPE_LENGTH (TYPE)); \
+// OBSOLETE       } \
+// OBSOLETE   }
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
+// OBSOLETE   extract_address (REGBUF + REGISTER_BYTE (4), \
+// OBSOLETE               REGISTER_RAW_SIZE (4))
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \
+// OBSOLETE   { \
+// OBSOLETE     if (TYPE_LENGTH (TYPE) > 8) \
+// OBSOLETE       internal_error (__FILE__, __LINE__, "failed internal consistency check"); \
+// OBSOLETE     else if (TYPE_LENGTH (TYPE) > 2 && TYPE_CODE (TYPE) != TYPE_CODE_PTR) \
+// OBSOLETE       { \
+// OBSOLETE    deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, 2); \
+// OBSOLETE    deprecated_write_register_bytes (REGISTER_BYTE (1), VALBUF + 2, 2); \
+// OBSOLETE       } \
+// OBSOLETE     else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)\
+// OBSOLETE       { \
+// OBSOLETE         deprecated_write_register_bytes (REGISTER_BYTE (4), VALBUF, TYPE_LENGTH (TYPE)); \
+// OBSOLETE       } \
+// OBSOLETE     else \
+// OBSOLETE       { \
+// OBSOLETE         deprecated_write_register_bytes (REGISTER_BYTE (0), VALBUF, TYPE_LENGTH (TYPE)); \
+// OBSOLETE       } \
+// OBSOLETE   }
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp);
+// OBSOLETE #define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
+// OBSOLETE   (SP) = mn10200_store_struct_return (STRUCT_ADDR, SP)
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR mn10200_skip_prologue (CORE_ADDR);
+// OBSOLETE #define SKIP_PROLOGUE(pc) (mn10200_skip_prologue (pc))
+// OBSOLETE 
+// OBSOLETE #define FRAME_ARGS_SKIP 0
+// OBSOLETE 
+// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) (get_frame_base (fi))
+// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) (get_frame_base (fi))
+// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1)
+// OBSOLETE 
+// OBSOLETE extern void mn10200_pop_frame (struct frame_info *);
+// OBSOLETE #define POP_FRAME mn10200_pop_frame (get_current_frame ())
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 1
+// OBSOLETE #define CALL_DUMMY                   {0}
+// OBSOLETE #define CALL_DUMMY_START_OFFSET      (0)
+// OBSOLETE #define CALL_DUMMY_BREAKPOINT_OFFSET (0)
+// OBSOLETE #define CALL_DUMMY_LOCATION          AT_ENTRY_POINT
+// OBSOLETE #define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP)
+// OBSOLETE #define CALL_DUMMY_ADDRESS()         entry_point_address ()
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR mn10200_push_return_address (CORE_ADDR, CORE_ADDR);
+// OBSOLETE #define PUSH_RETURN_ADDRESS(PC, SP)  mn10200_push_return_address (PC, SP)
+// OBSOLETE 
+// OBSOLETE #define PUSH_DUMMY_FRAME   generic_push_dummy_frame ()
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR mn10200_push_arguments (int, struct value **, CORE_ADDR,
+// OBSOLETE                                     unsigned char, CORE_ADDR);
+// OBSOLETE #define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
+// OBSOLETE   (mn10200_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR))
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
+// OBSOLETE 
+// OBSOLETE #define REG_STRUCT_HAS_ADDR(gcc_p,TYPE) \
+// OBSOLETE    (TYPE_LENGTH (TYPE) > 8)
+// OBSOLETE 
+// OBSOLETE extern use_struct_convention_fn mn10200_use_struct_convention;
+// OBSOLETE #define USE_STRUCT_CONVENTION(GCC_P, TYPE) mn10200_use_struct_convention (GCC_P, TYPE)
+// OBSOLETE 
+// OBSOLETE /* Define this for Wingdb */
+// OBSOLETE #define TARGET_MN10200
diff --git a/gdb/config/pa/hpux1020.mt b/gdb/config/pa/hpux1020.mt
deleted file mode 100644 (file)
index a856d8c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: HP PA-RISC running hpux
-TDEPFILES= hppa-tdep.o remote-pa.o somsolib.o corelow.o
-TM_FILE= tm-hppah.h
diff --git a/gdb/config/pa/hpux11.mt b/gdb/config/pa/hpux11.mt
deleted file mode 100644 (file)
index 405f73a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: HP PA-RISC running HPUX 11.00
-TDEPFILES= hppa-tdep.o remote-pa.o somsolib.o
-TM_FILE= tm-hppah.h
diff --git a/gdb/config/pa/hpux11w.mt b/gdb/config/pa/hpux11w.mt
deleted file mode 100644 (file)
index 4064d20..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: HP PA-RISC running HPUX 11.00
-TDEPFILES= hppa-tdep.o remote-pa.o
-TM_FILE= tm-hppah.h
index 1b9e770..dc23a63 100644 (file)
@@ -302,13 +302,13 @@ extern int hppa_register_byte (int reg_nr);
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
 #if !GDB_MULTI_ARCH
-#define MAX_REGISTER_RAW_SIZE 4
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 4
 #endif
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
 #if !GDB_MULTI_ARCH
-#define MAX_REGISTER_VIRTUAL_SIZE 8
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE 8
 #endif
 
 #if !GDB_MULTI_ARCH
@@ -383,7 +383,7 @@ extern int hppa_cannot_store_register (int regnum);
 #endif
 
 #if !GDB_MULTI_ARCH
-#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) hppa_init_extra_frame_info (fromleaf, frame)
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame) hppa_init_extra_frame_info (fromleaf, frame)
 extern void hppa_init_extra_frame_info (int, struct frame_info *);
 #endif
 
@@ -453,11 +453,11 @@ extern void hppa_frame_find_saved_regs (struct frame_info *,
 /* Push an empty stack frame, to record the current PC, etc. */
 
 /* FIXME: brobecker 2002-12-26.  This macro definition takes advantage
-   of the fact that PUSH_DUMMY_FRAME is called within a function where
-   a variable inf_status of type struct inferior_status * is defined.
-   Ugh!  Until this is fixed, we will not be able to move to multiarch
-   partial.  */
-#define PUSH_DUMMY_FRAME hppa_push_dummy_frame (inf_status)
+   of the fact that DEPRECATED_PUSH_DUMMY_FRAME is called within a
+   function where a variable inf_status of type struct inferior_status
+   * is defined.  Ugh!  Until this is fixed, we will not be able to
+   move to multiarch partial.  */
+#define DEPRECATED_PUSH_DUMMY_FRAME hppa_push_dummy_frame (inf_status)
 extern void hppa_push_dummy_frame (struct inferior_status *);
 
 /* Discard from the stack the innermost frame, 
index 775055f..e6177b0 100644 (file)
@@ -51,8 +51,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
-#undef MAX_REGISTER_RAW_SIZE
-#define MAX_REGISTER_RAW_SIZE 8
+#undef DEPRECATED_MAX_REGISTER_RAW_SIZE
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 8
 
 /* Total amount of space needed to store our copies of the machine's
    register state, the array `registers'.  */
diff --git a/gdb/config/powerpc/gdbserve.mt b/gdb/config/powerpc/gdbserve.mt
deleted file mode 100644 (file)
index 7728407..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: GDBSERVE.NLM running on a Power-PC
-TDEPFILES= ppc.o 
-CPU_FILE= ppc
diff --git a/gdb/config/powerpc/ppcle-eabi.mt b/gdb/config/powerpc/ppcle-eabi.mt
deleted file mode 100644 (file)
index ee05f16..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Target: PowerPC running eabi in little endian mode
-TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-sysv-tdep.o solib.o solib-svr4.o
-TM_FILE= tm-ppcle-eabi.h
diff --git a/gdb/config/powerpc/ppcle-sim.mt b/gdb/config/powerpc/ppcle-sim.mt
deleted file mode 100644 (file)
index 31cb900..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Target: PowerPC running eabi in little endian mode under the simulator
-TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-sysv-tdep.o solib.o solib-svr4.o
-TM_FILE= tm-ppcle-eabi.h
-
-SIM_OBS = remote-sim.o
-SIM = ../sim/ppc/libsim.a
index 3846579..727a66e 100644 (file)
@@ -51,7 +51,7 @@ extern int kernel_u_size (void);
 /* WATCHPOINT SPECIFIC STUFF */
 
 #define TARGET_HAS_HARDWARE_WATCHPOINTS
-#define HAVE_CONTINUABLE_WATCHPOINT
+#define HAVE_CONTINUABLE_WATCHPOINT 1
 #define target_insert_watchpoint(addr, len, type)  \
   s390_insert_watchpoint (PIDGET (inferior_ptid), addr, len, type)
 
index 3cad417..8ad58a1 100644 (file)
@@ -51,7 +51,7 @@
 /* When a hardware watchpoint fires off the PC will be left at the
    instruction following the one which caused the watchpoint.  
    It will *NOT* be necessary for GDB to step over the watchpoint. */
-#define HAVE_CONTINUABLE_WATCHPOINT
+#define HAVE_CONTINUABLE_WATCHPOINT 1
 
 extern int procfs_stopped_by_watchpoint (ptid_t);
 #define STOPPED_BY_WATCHPOINT(W) \
diff --git a/gdb/config/sparc/sp64sim.mt b/gdb/config/sparc/sp64sim.mt
deleted file mode 100644 (file)
index a9c5ac9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Target: SPARC64 (with simulator)
-# solib.o and procfs.o taken out for now.  We don't have shared libraries yet,
-# and the elf version requires procfs.o but the a.out version doesn't.
-# Then again, having procfs.o in a target makefile fragment seems wrong.
-TDEPFILES = sparc-tdep.o
-TM_FILE= tm-sp64.h
-
-# Need gcc for long long support.
-CC = gcc
-
-MH_CFLAGS = -I${srcdir}/../sim/sp64
-SIM_OBS = remote-sim.o
-SIM = ../sim/sp64/libsim.a
index e8f5656..691e38f 100644 (file)
@@ -400,14 +400,14 @@ extern void sp64_extract_return_value (struct type *, char[], char *, int);
 /* Largest value REGISTER_RAW_SIZE can have.  */
 /* tm-sparc.h defines this as 8, but play it safe.  */
 
-#undef  MAX_REGISTER_RAW_SIZE
-#define MAX_REGISTER_RAW_SIZE 8
+#undef  DEPRECATED_MAX_REGISTER_RAW_SIZE
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 8
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 /* tm-sparc.h defines this as 8, but play it safe.  */
 
-#undef  MAX_REGISTER_VIRTUAL_SIZE
-#define MAX_REGISTER_VIRTUAL_SIZE 8
+#undef  DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE 8
 
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
diff --git a/gdb/config/sparc/tm-sp64sim.h b/gdb/config/sparc/tm-sp64sim.h
deleted file mode 100644 (file)
index bb1263b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Macro definitions for GDB with the SPARC64 Simulator.
-   Copyright 1993, 2000 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* ??? This file is based on tm-spc-em.h.  Our contents are probably bogus
-   but it's a good start.  */
-
-#include "sparc/tm-sp64.h"
-#include "config/tm-sunos.h"
-
-/* Offsets into jmp_buf.  Not defined by Sun, but at least documented in a
-   comment in <machine/setjmp.h>! */
-
-#define JB_ELEMENT_SIZE 8      /* Size of each element in jmp_buf */
-
-#define JB_ONSSTACK 0
-#define JB_SIGMASK 1
-#define JB_SP 2
-#define JB_PC 3
-#define JB_NPC 4
-#define JB_PSR 5
-#define JB_G1 6
-#define JB_O0 7
-#define JB_WBCNT 8
-
-/* Figure out where the longjmp will land.  We expect that we have just entered
-   longjmp and haven't yet setup the stack frame, so the args are still in the
-   output regs.  %o0 (O0_REGNUM) points at the jmp_buf structure from which we
-   extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
-   This routine returns true on success */
-
-extern int get_longjmp_target (CORE_ADDR *);
-
-#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
index 05495ed..20d5b37 100644 (file)
@@ -227,11 +227,11 @@ extern int sparc_intreg_size (void);
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
-#define MAX_REGISTER_RAW_SIZE 8
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE 8
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
-#define MAX_REGISTER_VIRTUAL_SIZE 8
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE 8
 
 /* Return the GDB type object for the "standard" data type
    of data in register N.  */
@@ -466,9 +466,9 @@ void sparc_get_saved_register (char *raw_buffer,
      sparc_get_saved_register (RAW_BUFFER, OPTIMIZED, ADDRP, \
                               FRAME, REGNUM, LVAL)
 
-#define FRAME_INIT_SAVED_REGS(FP)      /*no-op */
+#define DEPRECATED_FRAME_INIT_SAVED_REGS(FP)   /*no-op */
 
-#define INIT_EXTRA_FRAME_INFO(FROMLEAF, FCI) \
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO(FROMLEAF, FCI) \
      sparc_init_extra_frame_info (FROMLEAF, FCI)
 extern void sparc_init_extra_frame_info (int, struct frame_info *);
 
@@ -509,8 +509,13 @@ extern CORE_ADDR sparc_frame_saved_pc (struct frame_info *);
      sparc_print_extra_frame_info (FI)
 extern void sparc_print_extra_frame_info (struct frame_info *);
 
-/* INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames.  */
+/* DEPRECATED_INIT_EXTRA_FRAME_INFO needs the PC to detect flat
+   frames.  */
 
+/* NOTE: cagney/2002-12-08: Add local declaration of
+   init_frame_pc_noop() because it isn't possible to include
+   "arch-utils.h" here.  */
+extern CORE_ADDR init_frame_pc_noop (int fromleaf, struct frame_info *prev);
 #define        DEPRECATED_INIT_FRAME_PC(FROMLEAF, PREV)        (init_frame_pc_noop (FROMLEAF, PREV))
 #define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \
   ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \
@@ -578,18 +583,18 @@ extern void sparc_print_extra_frame_info (struct frame_info *);
  *   I understand everything in this picture except what the space
  * between fp - 0xe0 and fp - 0x140 is used for.  Oh, and I don't
  * understand why there's a large chunk of CALL_DUMMY that never gets
- * executed (its function is superceeded by PUSH_DUMMY_FRAME; they
- * are designed to do the same thing).
+ * executed (its function is superceeded by
+ * DEPRECATED_PUSH_DUMMY_FRAME; they are designed to do the same
+ * thing).
  *
- *   PUSH_DUMMY_FRAME saves the registers above sp' and pushes the
- * register file stack down one.
+ *   DEPRECATED_PUSH_DUMMY_FRAME saves the registers above sp' and
+ * pushes the * register file stack down one.
  *
  *   call_function then writes CALL_DUMMY, pushes the args onto the
  * stack, and adjusts the stack pointer.
  *
  *   run_stack_dummy then starts execution (in the middle of
- * CALL_DUMMY, as directed by call_function).
- */
+ * CALL_DUMMY, as directed by call_function).  */
 
 #ifndef CALL_DUMMY
 /* This sequence of words is the instructions
@@ -677,7 +682,7 @@ void sparc_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
 
 /* Push an empty stack frame, to record the current PC, etc.  */
 
-#define PUSH_DUMMY_FRAME       sparc_push_dummy_frame ()
+#define DEPRECATED_PUSH_DUMMY_FRAME    sparc_push_dummy_frame ()
 #define POP_FRAME              sparc_pop_frame ()
 
 void sparc_push_dummy_frame (void);
index 86cc4a4..59b6ecb 100644 (file)
-/* Parameters for execution on a z8000 series machine.
-
-   Copyright 1992, 1993, 1994, 1998, 1999, 2000, 2001, 2002 Free
-   Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* NOTE: cagney/2002-11-24: This is a guess.  */
-#define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0
-#define CALL_DUMMY_LOCATION ON_STACK
-#define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address)
-
-#undef TARGET_INT_BIT
-#undef TARGET_LONG_BIT
-#undef TARGET_SHORT_BIT
-#undef TARGET_PTR_BIT
-
-#define TARGET_SHORT_BIT 16
-#define TARGET_INT_BIT 16
-#define TARGET_LONG_BIT 32
-#define TARGET_PTR_BIT (BIG ? 32: 16)
-
-/* Offset from address of function to start of its code.
-   Zero on most machines.  */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions
-   to reach some "real" code.  */
-
-#define SKIP_PROLOGUE(ip)   (z8k_skip_prologue (ip))
-extern CORE_ADDR z8k_skip_prologue (CORE_ADDR ip);
-
-
-/* Immediately after a function call, return the saved pc.
-   Can't always go through the frames for this because on some machines
-   the new frame is not set up until the new function executes
-   some instructions.  */
-
-
-extern int z8k_saved_pc_after_call (struct frame_info *frame);
-#define SAVED_PC_AFTER_CALL(frame) z8k_saved_pc_after_call(frame)
-
-/* Stack grows downward.  */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* Sequence of bytes for breakpoint instruction. */
-
-#define BREAKPOINT {0x36,0x00}
-
-/* If your kernel resets the pc after the trap happens you may need to
-   define this before including this file.  */
-
-#define DECR_PC_AFTER_BREAK 0
-
-/* Say how long registers are.  */
-
-#define REGISTER_TYPE unsigned int
-
-#define NUM_REGS       23      /* 16 registers + 1 ccr + 1 pc + 3 debug
-                                  regs + fake fp + fake sp */
-#define REGISTER_BYTES  (NUM_REGS *4)
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#define REGISTER_BYTE(N)  ((N)*4)
-
-/* Number of bytes of storage in the actual machine representation
-   for register N.  On the z8k, all but the pc are 2 bytes, but we
-   keep them all as 4 bytes and trim them on I/O */
-
-
-#define REGISTER_RAW_SIZE(N) (((N) < 16)? 2:4)
-
-/* Number of bytes of storage in the program's representation
-   for register N.  */
-
-#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
-
-/* Largest value REGISTER_RAW_SIZE can have.  */
-
-#define MAX_REGISTER_RAW_SIZE 4
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
-
-#define MAX_REGISTER_VIRTUAL_SIZE 4
-
-/* Return the GDB type object for the "standard" data type
-   of data in register N.  */
-
-#define REGISTER_VIRTUAL_TYPE(N) \
- (REGISTER_VIRTUAL_SIZE(N) == 2? builtin_type_unsigned_int : builtin_type_long)
-
-#define DEPRECATED_INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y))
-#define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y))
-
-#define REGISTER_NAMES  \
- {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
-  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
-  "ccr", "pc", "cycles","insts","time","fp","sp"}
-
-/* Register numbers of various important registers.
-   Note that some of these values are "real" register numbers,
-   and correspond to the general registers of the machine,
-   and some are "phony" register numbers which are too large
-   to be actual register numbers as far as the user is concerned
-   but do serve to get the desired values when passed to read_register.  */
-
-#define CCR_REGNUM     16      /* Contains processor status */
-#define PC_REGNUM      17      /* Contains program counter */
-#define CYCLES_REGNUM  18
-#define INSTS_REGNUM   19
-#define TIME_REGNUM    20
-#define FP_REGNUM      21      /* Contains fp, whatever memory model */
-#define SP_REGNUM      22      /* Conatins sp, whatever memory model */
-
-
-
-#define PTR_SIZE (BIG ? 4: 2)
-#define PTR_MASK (BIG ? 0xff00ffff : 0x0000ffff)
-
-/* Store the address of the place in which to copy the structure the
-   subroutine will return.  This is called from call_function. */
-
-#define STORE_STRUCT_RETURN(ADDR, SP) internal_error (__FILE__, __LINE__, "failed internal consistency check");
-
-/* Extract from an array REGBUF containing the (raw) register state
-   a function return value of type TYPE, and copy that, in virtual format,
-   into VALBUF.  This is assuming that floating point values are returned
-   as doubles in d0/d1.  */
-
-
-#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
-  memcpy(VALBUF, REGBUF + REGISTER_BYTE(2), TYPE_LENGTH(TYPE));
-
-/* Write into appropriate registers a function return value
-   of type TYPE, given in virtual format. */
-
-#define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) internal_error (__FILE__, __LINE__, "failed internal consistency check");
-
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one).  */
-
-#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
-\f
-/* Describe the pointer in each stack frame to the previous stack frame
-   (its caller).  */
-
-/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
-   chain-pointer.
-   In the case of the Z8000, the frame's nominal address
-   is the address of a ptr sized byte word containing the calling
-   frame's address.  */
-
-extern CORE_ADDR z8k_frame_chain (struct frame_info *thisframe);
-#define FRAME_CHAIN(thisframe) z8k_frame_chain(thisframe);
-
-
-
-/* Define other aspects of the stack frame.  */
-
-/* A macro that tells us whether the function invocation represented
-   by FI does not have a frame on the stack associated with it.  If it
-   does not, FRAMELESS is set to 1, else 0.  */
-#define FRAMELESS_FUNCTION_INVOCATION(FI) \
-  (frameless_look_for_prologue (FI))
-
-extern CORE_ADDR z8k_frame_saved_pc (struct frame_info *frame);
-#define FRAME_SAVED_PC(FRAME) z8k_frame_saved_pc(FRAME)
-
-#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
-
-#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
-
-/* Set VAL to the number of args passed to frame described by FI.
-   Can set VAL to -1, meaning no way to tell.  */
-
-/* We can't tell how many args there are
-   now that the C compiler delays popping them.  */
-#if !defined (FRAME_NUM_ARGS)
-#define FRAME_NUM_ARGS(fi) (-1)
-#endif
-
-/* Return number of bytes at start of arglist that are not really args.  */
-
-#define FRAME_ARGS_SKIP 8
-
-struct frame_info;
-extern void z8k_frame_init_saved_regs (struct frame_info *);
-#define FRAME_INIT_SAVED_REGS(fi) z8k_frame_init_saved_regs (fi)
-\f
-
-/* Things needed for making the inferior call functions.
-   It seems like every m68k based machine has almost identical definitions
-   in the individual machine's configuration files.  Most other cpu types
-   (mips, i386, etc) have routines in their *-tdep.c files to handle this
-   for most configurations.  The m68k family should be able to do this as
-   well.  These macros can still be overridden when necessary.  */
-
-/* The CALL_DUMMY macro is the sequence of instructions, as disassembled
-   by gdb itself:
-
-   fmovemx fp0-fp7,sp@-                 0xf227 0xe0ff
-   moveml d0-a5,sp@-                    0x48e7 0xfffc
-   clrw sp@-                            0x4267
-   movew ccr,sp@-                               0x42e7
-
-   /..* The arguments are pushed at this point by GDB;
-   no code is needed in the dummy for this.
-   The CALL_DUMMY_START_OFFSET gives the position of 
-   the following jsr instruction.  *../
-
-   jsr @#0x32323232                     0x4eb9 0x3232 0x3232
-   addal #0x69696969,sp                 0xdffc 0x6969 0x6969
-   trap #<your BPT_VECTOR number here>  0x4e4?
-   nop                                  0x4e71
-
-   Note this is CALL_DUMMY_LENGTH bytes (28 for the above example).
-   We actually start executing at the jsr, since the pushing of the
-   registers is done by PUSH_DUMMY_FRAME.  If this were real code,
-   the arguments for the function called by the jsr would be pushed
-   between the moveml and the jsr, and we could allow it to execute through.
-   But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is
-   done, and we cannot allow the moveml to push the registers again lest
-   they be taken for the arguments.  */
-
-
-#define CALL_DUMMY { 0 }
-#define CALL_DUMMY_LENGTH 24   /* Size of CALL_DUMMY */
-#define CALL_DUMMY_START_OFFSET 8      /* Offset to jsr instruction */
-
-
-/* Insert the specified number of args and function address
-   into a call sequence of the above form stored at DUMMYNAME.
-   We use the BFD routines to store a big-endian value of known size.  */
-
-#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)     \
-{ bfd_putb32 (fun,     (char *) dummyname + CALL_DUMMY_START_OFFSET + 2);  \
-  bfd_putb32 (nargs*4, (char *) dummyname + CALL_DUMMY_START_OFFSET + 8); }
-
-/* Push an empty stack frame, to record the current PC, etc.  */
-
-#define PUSH_DUMMY_FRAME       { z8k_push_dummy_frame (); }
-
-extern void z8k_push_dummy_frame (void);
-
-extern void z8k_pop_frame (void);
-
-/* Discard from the stack the innermost frame, restoring all registers.  */
-
-#define POP_FRAME              { z8k_pop_frame (); }
-
-/* Offset from SP to first arg on stack at first instruction of a function */
-
-#define SP_ARG0 (1 * 4)
-
-extern CORE_ADDR z8k_addr_bits_remove (CORE_ADDR);
-#define ADDR_BITS_REMOVE(addr) z8k_addr_bits_remove (addr)
-int sim_z8001_mode;
-#define BIG (sim_z8001_mode)
-
-#define read_memory_short(x)  (read_memory_integer(x,2) & 0xffff)
-
-#define NO_STD_REGS
-
-extern void z8k_do_registers_info (int regnum, int all);
-#define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \
-       z8k_do_registers_info (REGNUM, ALL)
-
-extern void z8k_set_pointer_size (int newsize);
-#define INIT_EXTRA_SYMTAB_INFO \
-  z8k_set_pointer_size(objfile->obfd->arch_info->bits_per_address);
-
-#define REGISTER_SIZE 4
+// OBSOLETE /* Parameters for execution on a z8000 series machine.
+// OBSOLETE 
+// OBSOLETE    Copyright 1992, 1993, 1994, 1998, 1999, 2000, 2001, 2002 Free
+// OBSOLETE    Software Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE /* NOTE: cagney/2002-11-24: This is a guess.  */
+// OBSOLETE #define DEPRECATED_USE_GENERIC_DUMMY_FRAMES 0
+// OBSOLETE #define CALL_DUMMY_LOCATION ON_STACK
+// OBSOLETE #define DEPRECATED_PC_IN_CALL_DUMMY(pc, sp, frame_address) deprecated_pc_in_call_dummy_on_stack (pc, sp, frame_address)
+// OBSOLETE 
+// OBSOLETE #undef TARGET_INT_BIT
+// OBSOLETE #undef TARGET_LONG_BIT
+// OBSOLETE #undef TARGET_SHORT_BIT
+// OBSOLETE #undef TARGET_PTR_BIT
+// OBSOLETE 
+// OBSOLETE #define TARGET_SHORT_BIT 16
+// OBSOLETE #define TARGET_INT_BIT 16
+// OBSOLETE #define TARGET_LONG_BIT 32
+// OBSOLETE #define TARGET_PTR_BIT (BIG ? 32: 16)
+// OBSOLETE 
+// OBSOLETE /* Offset from address of function to start of its code.
+// OBSOLETE    Zero on most machines.  */
+// OBSOLETE 
+// OBSOLETE #define FUNCTION_START_OFFSET 0
+// OBSOLETE 
+// OBSOLETE /* Advance PC across any function entry prologue instructions
+// OBSOLETE    to reach some "real" code.  */
+// OBSOLETE 
+// OBSOLETE #define SKIP_PROLOGUE(ip)   (z8k_skip_prologue (ip))
+// OBSOLETE extern CORE_ADDR z8k_skip_prologue (CORE_ADDR ip);
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* Immediately after a function call, return the saved pc.
+// OBSOLETE    Can't always go through the frames for this because on some machines
+// OBSOLETE    the new frame is not set up until the new function executes
+// OBSOLETE    some instructions.  */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE extern int z8k_saved_pc_after_call (struct frame_info *frame);
+// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) z8k_saved_pc_after_call(frame)
+// OBSOLETE 
+// OBSOLETE /* Stack grows downward.  */
+// OBSOLETE 
+// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+// OBSOLETE 
+// OBSOLETE /* Sequence of bytes for breakpoint instruction. */
+// OBSOLETE 
+// OBSOLETE #define BREAKPOINT {0x36,0x00}
+// OBSOLETE 
+// OBSOLETE /* If your kernel resets the pc after the trap happens you may need to
+// OBSOLETE    define this before including this file.  */
+// OBSOLETE 
+// OBSOLETE #define DECR_PC_AFTER_BREAK 0
+// OBSOLETE 
+// OBSOLETE /* Say how long registers are.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_TYPE unsigned int
+// OBSOLETE 
+// OBSOLETE #define NUM_REGS   23      /* 16 registers + 1 ccr + 1 pc + 3 debug
+// OBSOLETE                               regs + fake fp + fake sp */
+// OBSOLETE #define REGISTER_BYTES  (NUM_REGS *4)
+// OBSOLETE 
+// OBSOLETE /* Index within `registers' of the first byte of the space for
+// OBSOLETE    register N.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_BYTE(N)  ((N)*4)
+// OBSOLETE 
+// OBSOLETE /* Number of bytes of storage in the actual machine representation
+// OBSOLETE    for register N.  On the z8k, all but the pc are 2 bytes, but we
+// OBSOLETE    keep them all as 4 bytes and trim them on I/O */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE #define REGISTER_RAW_SIZE(N) (((N) < 16)? 2:4)
+// OBSOLETE 
+// OBSOLETE /* Number of bytes of storage in the program's representation
+// OBSOLETE    for register N.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
+// OBSOLETE 
+// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have.  */
+// OBSOLETE 
+// OBSOLETE #define MAX_REGISTER_RAW_SIZE 4
+// OBSOLETE 
+// OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
+// OBSOLETE 
+// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 4
+// OBSOLETE 
+// OBSOLETE /* Return the GDB type object for the "standard" data type
+// OBSOLETE    of data in register N.  */
+// OBSOLETE 
+// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \
+// OBSOLETE  (REGISTER_VIRTUAL_SIZE(N) == 2? builtin_type_unsigned_int : builtin_type_long)
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_INIT_FRAME_PC(x,y) (init_frame_pc_noop (x, y))
+// OBSOLETE #define INIT_FRAME_PC_FIRST(x,y) (init_frame_pc_noop (x, y))
+// OBSOLETE 
+// OBSOLETE #define REGISTER_NAMES  \
+// OBSOLETE  {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
+// OBSOLETE   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
+// OBSOLETE   "ccr", "pc", "cycles","insts","time","fp","sp"}
+// OBSOLETE 
+// OBSOLETE /* Register numbers of various important registers.
+// OBSOLETE    Note that some of these values are "real" register numbers,
+// OBSOLETE    and correspond to the general registers of the machine,
+// OBSOLETE    and some are "phony" register numbers which are too large
+// OBSOLETE    to be actual register numbers as far as the user is concerned
+// OBSOLETE    but do serve to get the desired values when passed to read_register.  */
+// OBSOLETE 
+// OBSOLETE #define CCR_REGNUM         16      /* Contains processor status */
+// OBSOLETE #define PC_REGNUM  17      /* Contains program counter */
+// OBSOLETE #define CYCLES_REGNUM      18
+// OBSOLETE #define INSTS_REGNUM       19
+// OBSOLETE #define TIME_REGNUM        20
+// OBSOLETE #define FP_REGNUM  21      /* Contains fp, whatever memory model */
+// OBSOLETE #define SP_REGNUM  22      /* Conatins sp, whatever memory model */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE #define PTR_SIZE (BIG ? 4: 2)
+// OBSOLETE #define PTR_MASK (BIG ? 0xff00ffff : 0x0000ffff)
+// OBSOLETE 
+// OBSOLETE /* Store the address of the place in which to copy the structure the
+// OBSOLETE    subroutine will return.  This is called from call_function. */
+// OBSOLETE 
+// OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE 
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE    a function return value of type TYPE, and copy that, in virtual format,
+// OBSOLETE    into VALBUF.  This is assuming that floating point values are returned
+// OBSOLETE    as doubles in d0/d1.  */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+// OBSOLETE   memcpy(VALBUF, REGBUF + REGISTER_BYTE(2), TYPE_LENGTH(TYPE));
+// OBSOLETE 
+// OBSOLETE /* Write into appropriate registers a function return value
+// OBSOLETE    of type TYPE, given in virtual format. */
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE 
+// OBSOLETE /* Extract from an array REGBUF containing the (raw) register state
+// OBSOLETE    the address in which a function should return its structure value,
+// OBSOLETE    as a CORE_ADDR (or an expression that can be used as one).  */
+// OBSOLETE 
+// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
+// OBSOLETE \f
+// OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame
+// OBSOLETE    (its caller).  */
+// OBSOLETE 
+// OBSOLETE /* FRAME_CHAIN takes a frame's nominal address and produces the frame's
+// OBSOLETE    chain-pointer.
+// OBSOLETE    In the case of the Z8000, the frame's nominal address
+// OBSOLETE    is the address of a ptr sized byte word containing the calling
+// OBSOLETE    frame's address.  */
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR z8k_frame_chain (struct frame_info *thisframe);
+// OBSOLETE #define FRAME_CHAIN(thisframe) z8k_frame_chain(thisframe);
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* Define other aspects of the stack frame.  */
+// OBSOLETE 
+// OBSOLETE /* A macro that tells us whether the function invocation represented
+// OBSOLETE    by FI does not have a frame on the stack associated with it.  If it
+// OBSOLETE    does not, FRAMELESS is set to 1, else 0.  */
+// OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) \
+// OBSOLETE   (frameless_look_for_prologue (FI))
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR z8k_frame_saved_pc (struct frame_info *frame);
+// OBSOLETE #define FRAME_SAVED_PC(FRAME) z8k_frame_saved_pc(FRAME)
+// OBSOLETE 
+// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+// OBSOLETE 
+// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+// OBSOLETE 
+// OBSOLETE /* Set VAL to the number of args passed to frame described by FI.
+// OBSOLETE    Can set VAL to -1, meaning no way to tell.  */
+// OBSOLETE 
+// OBSOLETE /* We can't tell how many args there are
+// OBSOLETE    now that the C compiler delays popping them.  */
+// OBSOLETE #if !defined (FRAME_NUM_ARGS)
+// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1)
+// OBSOLETE #endif
+// OBSOLETE 
+// OBSOLETE /* Return number of bytes at start of arglist that are not really args.  */
+// OBSOLETE 
+// OBSOLETE #define FRAME_ARGS_SKIP 8
+// OBSOLETE 
+// OBSOLETE struct frame_info;
+// OBSOLETE extern void z8k_frame_init_saved_regs (struct frame_info *);
+// OBSOLETE #define FRAME_INIT_SAVED_REGS(fi) z8k_frame_init_saved_regs (fi)
+// OBSOLETE \f
+// OBSOLETE 
+// OBSOLETE /* Things needed for making the inferior call functions.
+// OBSOLETE    It seems like every m68k based machine has almost identical definitions
+// OBSOLETE    in the individual machine's configuration files.  Most other cpu types
+// OBSOLETE    (mips, i386, etc) have routines in their *-tdep.c files to handle this
+// OBSOLETE    for most configurations.  The m68k family should be able to do this as
+// OBSOLETE    well.  These macros can still be overridden when necessary.  */
+// OBSOLETE 
+// OBSOLETE /* The CALL_DUMMY macro is the sequence of instructions, as disassembled
+// OBSOLETE    by gdb itself:
+// OBSOLETE 
+// OBSOLETE    fmovemx fp0-fp7,sp@-                 0xf227 0xe0ff
+// OBSOLETE    moveml d0-a5,sp@-                    0x48e7 0xfffc
+// OBSOLETE    clrw sp@-                            0x4267
+// OBSOLETE    movew ccr,sp@-                               0x42e7
+// OBSOLETE 
+// OBSOLETE    /..* The arguments are pushed at this point by GDB;
+// OBSOLETE    no code is needed in the dummy for this.
+// OBSOLETE    The CALL_DUMMY_START_OFFSET gives the position of 
+// OBSOLETE    the following jsr instruction.  *../
+// OBSOLETE 
+// OBSOLETE    jsr @#0x32323232                     0x4eb9 0x3232 0x3232
+// OBSOLETE    addal #0x69696969,sp                 0xdffc 0x6969 0x6969
+// OBSOLETE    trap #<your BPT_VECTOR number here>  0x4e4?
+// OBSOLETE    nop                                  0x4e71
+// OBSOLETE 
+// OBSOLETE    Note this is CALL_DUMMY_LENGTH bytes (28 for the above example).
+// OBSOLETE    We actually start executing at the jsr, since the pushing of the
+// OBSOLETE    registers is done by PUSH_DUMMY_FRAME.  If this were real code,
+// OBSOLETE    the arguments for the function called by the jsr would be pushed
+// OBSOLETE    between the moveml and the jsr, and we could allow it to execute through.
+// OBSOLETE    But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is
+// OBSOLETE    done, and we cannot allow the moveml to push the registers again lest
+// OBSOLETE    they be taken for the arguments.  */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE #define CALL_DUMMY { 0 }
+// OBSOLETE #define CALL_DUMMY_LENGTH 24       /* Size of CALL_DUMMY */
+// OBSOLETE #define CALL_DUMMY_START_OFFSET 8  /* Offset to jsr instruction */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* Insert the specified number of args and function address
+// OBSOLETE    into a call sequence of the above form stored at DUMMYNAME.
+// OBSOLETE    We use the BFD routines to store a big-endian value of known size.  */
+// OBSOLETE 
+// OBSOLETE #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)     \
+// OBSOLETE { bfd_putb32 (fun,     (char *) dummyname + CALL_DUMMY_START_OFFSET + 2);  \
+// OBSOLETE   bfd_putb32 (nargs*4, (char *) dummyname + CALL_DUMMY_START_OFFSET + 8); }
+// OBSOLETE 
+// OBSOLETE /* Push an empty stack frame, to record the current PC, etc.  */
+// OBSOLETE 
+// OBSOLETE #define PUSH_DUMMY_FRAME   { z8k_push_dummy_frame (); }
+// OBSOLETE 
+// OBSOLETE extern void z8k_push_dummy_frame (void);
+// OBSOLETE 
+// OBSOLETE extern void z8k_pop_frame (void);
+// OBSOLETE 
+// OBSOLETE /* Discard from the stack the innermost frame, restoring all registers.  */
+// OBSOLETE 
+// OBSOLETE #define POP_FRAME          { z8k_pop_frame (); }
+// OBSOLETE 
+// OBSOLETE /* Offset from SP to first arg on stack at first instruction of a function */
+// OBSOLETE 
+// OBSOLETE #define SP_ARG0 (1 * 4)
+// OBSOLETE 
+// OBSOLETE extern CORE_ADDR z8k_addr_bits_remove (CORE_ADDR);
+// OBSOLETE #define ADDR_BITS_REMOVE(addr) z8k_addr_bits_remove (addr)
+// OBSOLETE int sim_z8001_mode;
+// OBSOLETE #define BIG (sim_z8001_mode)
+// OBSOLETE 
+// OBSOLETE #define read_memory_short(x)  (read_memory_integer(x,2) & 0xffff)
+// OBSOLETE 
+// OBSOLETE #define NO_STD_REGS
+// OBSOLETE 
+// OBSOLETE extern void z8k_do_registers_info (int regnum, int all);
+// OBSOLETE #define DEPRECATED_DO_REGISTERS_INFO(REGNUM,ALL) \
+// OBSOLETE    z8k_do_registers_info (REGNUM, ALL)
+// OBSOLETE 
+// OBSOLETE extern void z8k_set_pointer_size (int newsize);
+// OBSOLETE #define INIT_EXTRA_SYMTAB_INFO \
+// OBSOLETE   z8k_set_pointer_size(objfile->obfd->arch_info->bits_per_address);
+// OBSOLETE 
+// OBSOLETE #define REGISTER_SIZE 4
index cb8d043..3eb6c7b 100644 (file)
@@ -1,7 +1,6 @@
-# Target: Z8000 with simulator
-TDEPFILES= z8k-tdep.o
-TM_FILE= tm-z8k.h
-
-SIM_OBS = remote-sim.o
-SIM = ../sim/z8k/libsim.a
-
+# OBSOLETE # Target: Z8000 with simulator
+# OBSOLETE TDEPFILES= z8k-tdep.o
+# OBSOLETE TM_FILE= tm-z8k.h
+# OBSOLETE 
+# OBSOLETE SIM_OBS = remote-sim.o
+# OBSOLETE SIM = ../sim/z8k/libsim.a
index b16718a..207381a 100755 (executable)
@@ -3165,6 +3165,40 @@ else
 fi
 done
 
+echo $ac_n "checking for _etext""... $ac_c" 1>&6
+echo "configure:3170: checking for _etext" >&5
+if eval "test \"`echo '$''{'ac_cv_var__etext'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3175 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+extern char _etext;
+
+int main() {
+free (&_etext);
+; return 0; }
+EOF
+if { (eval echo configure:3184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_var__etext=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_var__etext=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_var__etext" 1>&6
+if test $ac_cv_var__etext = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE__ETEXT 1
+EOF
+
+fi
 if test "$enable_profiling" = yes ; then
   if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
     { echo "configure: error: --enable-profiling requires monstartup and _mcleanup" 1>&2; exit 1; }
@@ -3174,19 +3208,19 @@ if test "$enable_profiling" = yes ; then
   CFLAGS="$CFLAGS $PROFILE_CFLAGS"
 
   echo $ac_n "checking whether $CC supports -pg""... $ac_c" 1>&6
-echo "configure:3178: checking whether $CC supports -pg" >&5
+echo "configure:3212: checking whether $CC supports -pg" >&5
 if eval "test \"`echo '$''{'ac_cv_cc_supports_pg'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3183 "configure"
+#line 3217 "configure"
 #include "confdefs.h"
 
 int main() {
 int x;
 ; return 0; }
 EOF
-if { (eval echo configure:3190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cc_supports_pg=yes
 else
@@ -3216,7 +3250,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3220: checking for $ac_word" >&5
+echo "configure:3254: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3257,7 +3291,7 @@ done
 # 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:3261: checking for a BSD compatible install" >&5
+echo "configure:3295: 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
@@ -3310,7 +3344,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:3314: checking whether ln -s works" >&5
+echo "configure:3348: 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
@@ -3333,7 +3367,7 @@ 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:3337: checking for $ac_word" >&5
+echo "configure:3371: 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
@@ -3365,7 +3399,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3369: checking for $ac_word" >&5
+echo "configure:3403: 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
@@ -3399,7 +3433,7 @@ test -n "$YACC" || YACC="yacc"
 # 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:3403: checking for $ac_word" >&5
+echo "configure:3437: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3431,7 +3465,7 @@ fi
 # 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:3435: checking for $ac_word" >&5
+echo "configure:3469: 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
@@ -3463,7 +3497,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ac_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3467: checking for $ac_word" >&5
+echo "configure:3501: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3497,7 +3531,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
 set dummy ${ac_tool_prefix}mig; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3501: checking for $ac_word" >&5
+echo "configure:3535: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3533,7 +3567,7 @@ fi
 
 # We might need to link with -lm; most simulators need it.
 echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:3537: checking for main in -lm" >&5
+echo "configure:3571: checking for main in -lm" >&5
 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3541,14 +3575,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3545 "configure"
+#line 3579 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3586: \"$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,12 +3615,12 @@ fi
 # libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
 # is known to have this problem).  Therefore we avoid libw if we can.
 echo $ac_n "checking for wctype""... $ac_c" 1>&6
-echo "configure:3585: checking for wctype" >&5
+echo "configure:3619: checking for wctype" >&5
 if eval "test \"`echo '$''{'ac_cv_func_wctype'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3590 "configure"
+#line 3624 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char wctype(); below.  */
@@ -3609,7 +3643,7 @@ wctype();
 
 ; 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:3647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_wctype=yes"
 else
@@ -3627,7 +3661,7 @@ if eval "test \"`echo '$ac_cv_func_'wctype`\" = yes"; then
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6
-echo "configure:3631: checking for wctype in -lw" >&5
+echo "configure:3665: checking for wctype in -lw" >&5
 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3635,7 +3669,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lw  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3639 "configure"
+#line 3673 "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
@@ -3646,7 +3680,7 @@ int main() {
 wctype()
 ; return 0; }
 EOF
-if { (eval echo configure:3650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3684: \"$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
@@ -3679,14 +3713,14 @@ fi
 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
 
 echo $ac_n "checking for library containing socketpair""... $ac_c" 1>&6
-echo "configure:3683: checking for library containing socketpair" >&5
+echo "configure:3717: checking for library containing socketpair" >&5
 if eval "test \"`echo '$''{'ac_cv_search_socketpair'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_socketpair="no"
 cat > conftest.$ac_ext <<EOF
-#line 3690 "configure"
+#line 3724 "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
@@ -3697,7 +3731,7 @@ int main() {
 socketpair()
 ; return 0; }
 EOF
-if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_socketpair="none required"
 else
@@ -3708,7 +3742,7 @@ rm -f conftest*
 test "$ac_cv_search_socketpair" = "no" && for i in socket; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3712 "configure"
+#line 3746 "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
@@ -3719,7 +3753,7 @@ int main() {
 socketpair()
 ; return 0; }
 EOF
-if { (eval echo configure:3723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_socketpair="-l$i"
 break
@@ -3755,14 +3789,14 @@ fi
 if test "$need_curses" = yes; then
   
 echo $ac_n "checking for library containing initscr""... $ac_c" 1>&6
-echo "configure:3759: checking for library containing initscr" >&5
+echo "configure:3793: checking for library containing initscr" >&5
 if eval "test \"`echo '$''{'ac_cv_search_initscr'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_initscr="no"
 cat > conftest.$ac_ext <<EOF
-#line 3766 "configure"
+#line 3800 "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
@@ -3773,7 +3807,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_initscr="none required"
 else
@@ -3784,7 +3818,7 @@ rm -f conftest*
 test "$ac_cv_search_initscr" = "no" && for i in ncurses Hcurses curses; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3788 "configure"
+#line 3822 "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
@@ -3795,7 +3829,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_initscr="-l$i"
 break
@@ -3832,14 +3866,14 @@ case $host_os in
     # ??? Why?
     
 echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6
-echo "configure:3836: checking for library containing tgetent" >&5
+echo "configure:3870: checking for library containing tgetent" >&5
 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_tgetent="no"
 cat > conftest.$ac_ext <<EOF
-#line 3843 "configure"
+#line 3877 "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
@@ -3850,7 +3884,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:3854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_tgetent="none required"
 else
@@ -3861,7 +3895,7 @@ rm -f conftest*
 test "$ac_cv_search_tgetent" = "no" && for i in tinfo ncurses curses termcap; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3865 "configure"
+#line 3899 "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
@@ -3872,7 +3906,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:3876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_tgetent="-l$i"
 break
@@ -3899,14 +3933,14 @@ esac
 # Readline doesn't, so I think we're safe with leaving them out.
 
 echo $ac_n "checking for library containing tgetent""... $ac_c" 1>&6
-echo "configure:3903: checking for library containing tgetent" >&5
+echo "configure:3937: checking for library containing tgetent" >&5
 if eval "test \"`echo '$''{'ac_cv_search_tgetent'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_func_search_save_LIBS="$LIBS"
 ac_cv_search_tgetent="no"
 cat > conftest.$ac_ext <<EOF
-#line 3910 "configure"
+#line 3944 "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
@@ -3917,7 +3951,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:3921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_tgetent="none required"
 else
@@ -3928,7 +3962,7 @@ rm -f conftest*
 test "$ac_cv_search_tgetent" = "no" && for i in termcap tinfo ncurses Hcurses curses; do
 LIBS="-l$i  $ac_func_search_save_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3932 "configure"
+#line 3966 "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
@@ -3939,7 +3973,7 @@ int main() {
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:3943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_search_tgetent="-l$i"
 break
@@ -3973,12 +4007,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 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:3977: checking for $ac_hdr that defines DIR" >&5
+echo "configure:4011: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3982 "configure"
+#line 4016 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -3986,7 +4020,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:3990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -4011,7 +4045,7 @@ done
 # 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:4015: checking for opendir in -ldir" >&5
+echo "configure:4049: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4019,7 +4053,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4023 "configure"
+#line 4057 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4030,7 +4064,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4068: \"$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
@@ -4052,7 +4086,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4056: checking for opendir in -lx" >&5
+echo "configure:4090: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4060,7 +4094,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4064 "configure"
+#line 4098 "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
@@ -4071,7 +4105,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:4075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4109: \"$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
@@ -4094,12 +4128,12 @@ fi
 fi
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:4098: checking whether stat file-mode macros are broken" >&5
+echo "configure:4132: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4103 "configure"
+#line 4137 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -4150,12 +4184,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4154: checking for ANSI C header files" >&5
+echo "configure:4188: 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 4159 "configure"
+#line 4193 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -4163,7 +4197,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4167: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4201: \"$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*
@@ -4180,7 +4214,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 4184 "configure"
+#line 4218 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -4198,7 +4232,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 4202 "configure"
+#line 4236 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -4219,7 +4253,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 4223 "configure"
+#line 4257 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4230,7 +4264,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:4234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -4257,17 +4291,17 @@ for ac_hdr in link.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4261: checking for $ac_hdr" >&5
+echo "configure:4295: 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 4266 "configure"
+#line 4300 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4271: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4305: \"$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*
@@ -4297,17 +4331,17 @@ for ac_hdr in nlist.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4301: checking for $ac_hdr" >&5
+echo "configure:4335: 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 4306 "configure"
+#line 4340 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4311: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4345: \"$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*
@@ -4337,17 +4371,17 @@ for ac_hdr in poll.h sys/poll.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4341: checking for $ac_hdr" >&5
+echo "configure:4375: 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 4346 "configure"
+#line 4380 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4385: \"$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*
@@ -4377,17 +4411,17 @@ for ac_hdr in proc_service.h thread_db.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4381: checking for $ac_hdr" >&5
+echo "configure:4415: 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 4386 "configure"
+#line 4420 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4425: \"$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*
@@ -4417,17 +4451,17 @@ for ac_hdr in stddef.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4421: checking for $ac_hdr" >&5
+echo "configure:4455: 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 4426 "configure"
+#line 4460 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4431: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4465: \"$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*
@@ -4457,17 +4491,17 @@ for ac_hdr in stdlib.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4461: checking for $ac_hdr" >&5
+echo "configure:4495: 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 4466 "configure"
+#line 4500 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4505: \"$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*
@@ -4497,17 +4531,17 @@ for ac_hdr in stdint.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4501: checking for $ac_hdr" >&5
+echo "configure:4535: 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 4506 "configure"
+#line 4540 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4545: \"$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*
@@ -4537,17 +4571,17 @@ for ac_hdr in string.h memory.h strings.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4541: checking for $ac_hdr" >&5
+echo "configure:4575: 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 4546 "configure"
+#line 4580 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4585: \"$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*
@@ -4577,17 +4611,17 @@ for ac_hdr in sys/fault.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4581: checking for $ac_hdr" >&5
+echo "configure:4615: 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 4586 "configure"
+#line 4620 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4625: \"$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*
@@ -4617,17 +4651,17 @@ for ac_hdr in 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:4621: checking for $ac_hdr" >&5
+echo "configure:4655: 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 4626 "configure"
+#line 4660 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4665: \"$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*
@@ -4657,17 +4691,17 @@ for ac_hdr in sys/filio.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4661: checking for $ac_hdr" >&5
+echo "configure:4695: 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 4666 "configure"
+#line 4700 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4705: \"$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*
@@ -4697,17 +4731,17 @@ for ac_hdr in sys/ioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4701: checking for $ac_hdr" >&5
+echo "configure:4735: 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 4706 "configure"
+#line 4740 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4745: \"$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*
@@ -4737,17 +4771,17 @@ for ac_hdr in sys/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4741: checking for $ac_hdr" >&5
+echo "configure:4775: 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 4746 "configure"
+#line 4780 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4785: \"$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*
@@ -4777,17 +4811,17 @@ for ac_hdr in sys/proc.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4781: checking for $ac_hdr" >&5
+echo "configure:4815: 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 4786 "configure"
+#line 4820 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4825: \"$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*
@@ -4817,17 +4851,17 @@ for ac_hdr in sys/procfs.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4821: checking for $ac_hdr" >&5
+echo "configure:4855: 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 4826 "configure"
+#line 4860 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4865: \"$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*
@@ -4857,17 +4891,17 @@ for ac_hdr in sys/ptrace.h ptrace.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4861: checking for $ac_hdr" >&5
+echo "configure:4895: 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 4866 "configure"
+#line 4900 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4905: \"$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*
@@ -4897,17 +4931,17 @@ for ac_hdr in sys/reg.h sys/debugreg.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4901: checking for $ac_hdr" >&5
+echo "configure:4935: 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 4906 "configure"
+#line 4940 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4911: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4945: \"$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*
@@ -4937,17 +4971,17 @@ for ac_hdr in sys/select.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4941: checking for $ac_hdr" >&5
+echo "configure:4975: 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 4946 "configure"
+#line 4980 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4985: \"$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*
@@ -4977,17 +5011,17 @@ for ac_hdr in sys/syscall.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4981: checking for $ac_hdr" >&5
+echo "configure:5015: 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 4986 "configure"
+#line 5020 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5025: \"$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*
@@ -5017,17 +5051,17 @@ for ac_hdr in sys/user.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5021: checking for $ac_hdr" >&5
+echo "configure:5055: 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 5026 "configure"
+#line 5060 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5065: \"$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*
@@ -5057,17 +5091,17 @@ for ac_hdr in sys/wait.h wait.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5061: checking for $ac_hdr" >&5
+echo "configure:5095: 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 5066 "configure"
+#line 5100 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5105: \"$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*
@@ -5097,17 +5131,17 @@ for ac_hdr in termios.h termio.h sgtty.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5101: checking for $ac_hdr" >&5
+echo "configure:5135: 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 5106 "configure"
+#line 5140 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5145: \"$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*
@@ -5137,17 +5171,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5141: checking for $ac_hdr" >&5
+echo "configure:5175: 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 5146 "configure"
+#line 5180 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5151: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5185: \"$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*
@@ -5190,17 +5224,17 @@ for ac_hdr in curses.h ncurses.h term.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5194: checking for $ac_hdr" >&5
+echo "configure:5228: 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 5199 "configure"
+#line 5233 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5238: \"$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*
@@ -5233,17 +5267,17 @@ for ac_hdr in ctype.h time.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5237: checking for $ac_hdr" >&5
+echo "configure:5271: 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 5242 "configure"
+#line 5276 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5281: \"$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*
@@ -5275,12 +5309,12 @@ done
 # ------------------ #
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:5279: checking return type of signal handlers" >&5
+echo "configure:5313: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5284 "configure"
+#line 5318 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -5297,7 +5331,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:5301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5335: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -5321,12 +5355,12 @@ EOF
 # ------------------------------------- #
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5325: checking for working const" >&5
+echo "configure:5359: 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 5330 "configure"
+#line 5364 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -5375,7 +5409,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:5379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -5396,21 +5430,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:5400: checking for inline" >&5
+echo "configure:5434: 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 5407 "configure"
+#line 5441 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:5414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -5443,19 +5477,19 @@ esac
 # 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:5447: checking for working alloca.h" >&5
+echo "configure:5481: 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 5452 "configure"
+#line 5486 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5493: \"$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
@@ -5476,12 +5510,12 @@ EOF
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5480: checking for alloca" >&5
+echo "configure:5514: 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 5485 "configure"
+#line 5519 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5509,7 +5543,7 @@ int main() {
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5547: \"$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
@@ -5541,12 +5575,12 @@ EOF
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5545: checking whether alloca needs Cray hooks" >&5
+echo "configure:5579: 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 5550 "configure"
+#line 5584 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5571,12 +5605,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5575: checking for $ac_func" >&5
+echo "configure:5609: 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 5580 "configure"
+#line 5614 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5599,7 +5633,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5637: \"$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
@@ -5626,7 +5660,7 @@ done
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5630: checking stack direction for C alloca" >&5
+echo "configure:5664: 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
@@ -5634,7 +5668,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5638 "configure"
+#line 5672 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -5653,7 +5687,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:5657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5691: \"$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
@@ -5678,17 +5712,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5682: checking for $ac_hdr" >&5
+echo "configure:5716: 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 5687 "configure"
+#line 5721 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5726: \"$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*
@@ -5717,12 +5751,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5721: checking for $ac_func" >&5
+echo "configure:5755: 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 5726 "configure"
+#line 5760 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5745,7 +5779,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5783: \"$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
@@ -5770,7 +5804,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:5774: checking for working mmap" >&5
+echo "configure:5808: 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
@@ -5778,7 +5812,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 5782 "configure"
+#line 5816 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -5918,7 +5952,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:5922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5956: \"$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
@@ -5941,12 +5975,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:5945: checking for pid_t" >&5
+echo "configure:5979: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5950 "configure"
+#line 5984 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5975,17 +6009,17 @@ fi
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:5979: checking for vfork.h" >&5
+echo "configure:6013: checking for vfork.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5984 "configure"
+#line 6018 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6023: \"$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*
@@ -6010,18 +6044,18 @@ else
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:6014: checking for working vfork" >&5
+echo "configure:6048: checking for working vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
   echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:6020: checking for vfork" >&5
+echo "configure:6054: checking for vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6025 "configure"
+#line 6059 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -6044,7 +6078,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -6066,7 +6100,7 @@ fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 else
   cat > conftest.$ac_ext <<EOF
-#line 6070 "configure"
+#line 6104 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -6161,7 +6195,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:6165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -6186,12 +6220,12 @@ fi
 for ac_func in canonicalize_file_name realpath
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6190: checking for $ac_func" >&5
+echo "configure:6224: 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 6195 "configure"
+#line 6229 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6214,7 +6248,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6241,12 +6275,12 @@ done
 for ac_func in poll
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6245: checking for $ac_func" >&5
+echo "configure:6279: 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 6250 "configure"
+#line 6284 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6269,7 +6303,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6307: \"$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
@@ -6296,12 +6330,12 @@ done
 for ac_func in pread64
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6300: checking for $ac_func" >&5
+echo "configure:6334: 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 6305 "configure"
+#line 6339 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6324,7 +6358,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6362: \"$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
@@ -6351,12 +6385,12 @@ done
 for ac_func in sbrk
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6355: checking for $ac_func" >&5
+echo "configure:6389: 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 6360 "configure"
+#line 6394 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6379,7 +6413,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6417: \"$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
@@ -6406,12 +6440,12 @@ done
 for ac_func in setpgid setpgrp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6410: checking for $ac_func" >&5
+echo "configure:6444: 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 6415 "configure"
+#line 6449 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6434,7 +6468,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6472: \"$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
@@ -6461,12 +6495,12 @@ done
 for ac_func in sigaction sigprocmask sigsetmask
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6465: checking for $ac_func" >&5
+echo "configure:6499: 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 6470 "configure"
+#line 6504 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6489,7 +6523,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6527: \"$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
@@ -6516,12 +6550,12 @@ done
 for ac_func in socketpair
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6520: checking for $ac_func" >&5
+echo "configure:6554: 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 6525 "configure"
+#line 6559 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6544,7 +6578,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6582: \"$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
@@ -6571,7 +6605,7 @@ done
 
 if test "$cross_compiling" = no; then
   echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:6575: checking whether setpgrp takes no argument" >&5
+echo "configure:6609: checking whether setpgrp takes no argument" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6579,7 +6613,7 @@ else
   { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 6583 "configure"
+#line 6617 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_UNISTD_H
@@ -6599,7 +6633,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:6603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_setpgrp_void=no
 else
@@ -6624,12 +6658,12 @@ fi
 
 else
   echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:6628: checking whether setpgrp takes no argument" >&5
+echo "configure:6662: checking whether setpgrp takes no argument" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6633 "configure"
+#line 6667 "configure"
 #include "confdefs.h"
 
 #include <unistd.h>
@@ -6643,7 +6677,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:6647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_func_setpgrp_void=no
 else
@@ -6667,12 +6701,12 @@ fi
 # Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
 # since sigsetjmp might only be defined as a macro.
 echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
-echo "configure:6671: checking for sigsetjmp" >&5
+echo "configure:6705: checking for sigsetjmp" >&5
 if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6676 "configure"
+#line 6710 "configure"
 #include "confdefs.h"
 
 #include <setjmp.h>
@@ -6681,7 +6715,7 @@ int main() {
 sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);
 ; return 0; }
 EOF
-if { (eval echo configure:6685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_func_sigsetjmp=yes
 else
@@ -6707,12 +6741,12 @@ gdb_use_included_regex=yes
 # However, if the system regex is GNU regex, then default to *not*
 # using the included regex.
 echo $ac_n "checking for GNU regex""... $ac_c" 1>&6
-echo "configure:6711: checking for GNU regex" >&5
+echo "configure:6745: checking for GNU regex" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6716 "configure"
+#line 6750 "configure"
 #include "confdefs.h"
 #include <gnu-versions.h>
 int main() {
@@ -6722,7 +6756,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:6726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_gnu_regex=yes
 else
@@ -6757,19 +6791,19 @@ fi
 # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
 # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
 echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6
-echo "configure:6761: checking for r_fs in struct reg" >&5
+echo "configure:6795: checking for r_fs in struct reg" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6766 "configure"
+#line 6800 "configure"
 #include "confdefs.h"
 #include <machine/reg.h>
 int main() {
 struct reg r; r.r_fs;
 ; return 0; }
 EOF
-if { (eval echo configure:6773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg_r_fs=yes
 else
@@ -6789,19 +6823,19 @@ EOF
 
 fi
 echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6
-echo "configure:6793: checking for r_gs in struct reg" >&5
+echo "configure:6827: checking for r_gs in struct reg" >&5
 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6798 "configure"
+#line 6832 "configure"
 #include "confdefs.h"
 #include <machine/reg.h>
 int main() {
 struct reg r; r.r_gs;
 ; return 0; }
 EOF
-if { (eval echo configure:6805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_struct_reg_r_gs=yes
 else
@@ -6823,19 +6857,19 @@ fi
 
 # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
 echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6
-echo "configure:6827: checking for PTRACE_GETREGS" >&5
+echo "configure:6861: checking for PTRACE_GETREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6832 "configure"
+#line 6866 "configure"
 #include "confdefs.h"
 #include <sys/ptrace.h>
 int main() {
 PTRACE_GETREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:6839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_ptrace_getregs=yes
 else
@@ -6857,19 +6891,19 @@ fi
 
 # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
 echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6
-echo "configure:6861: checking for PTRACE_GETFPXREGS" >&5
+echo "configure:6895: checking for PTRACE_GETFPXREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6866 "configure"
+#line 6900 "configure"
 #include "confdefs.h"
 #include <sys/ptrace.h>
 int main() {
 PTRACE_GETFPXREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:6873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_ptrace_getfpxregs=yes
 else
@@ -6891,12 +6925,12 @@ fi
 
 # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
 echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6
-echo "configure:6895: checking for PT_GETDBREGS" >&5
+echo "configure:6929: checking for PT_GETDBREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6900 "configure"
+#line 6934 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ptrace.h>
@@ -6904,7 +6938,7 @@ int main() {
 PT_GETDBREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:6908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_pt_getdbregs=yes
 else
@@ -6926,12 +6960,12 @@ fi
 
 # See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
 echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6
-echo "configure:6930: checking for PT_GETXMMREGS" >&5
+echo "configure:6964: checking for PT_GETXMMREGS" >&5
 if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6935 "configure"
+#line 6969 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/ptrace.h>
@@ -6939,7 +6973,7 @@ int main() {
 PT_GETXMMREGS;
 ; return 0; }
 EOF
-if { (eval echo configure:6943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_pt_getxmmregs=yes
 else
@@ -6959,14 +6993,49 @@ EOF
 
 fi
 
+# See if stdint.h provides the uintptr_t type.
+# Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this.
+echo $ac_n "checking for uintptr_t in stdint.h""... $ac_c" 1>&6
+echo "configure:7000: checking for uintptr_t in stdint.h" >&5
+if eval "test \"`echo '$''{'gdb_cv_have_uintptr_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7005 "configure"
+#include "confdefs.h"
+#include <stdint.h>
+int main() {
+uintptr_t foo = 0;
+; return 0; }
+EOF
+if { (eval echo configure:7012: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  gdb_cv_have_uintptr_t=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  gdb_cv_have_uintptr_t=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gdb_cv_have_uintptr_t" 1>&6
+echo "$ac_t""$gdb_cv_have_uintptr_t" 1>&6
+if test $gdb_cv_have_uintptr_t = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_UINTPTR_T 1
+EOF
+
+fi
 
 echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6
-echo "configure:6965: checking whether malloc must be declared" >&5
+echo "configure:7034: checking whether malloc must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6970 "configure"
+#line 7039 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -6987,7 +7056,7 @@ int main() {
 char *(*pfn) = (char *(*)) malloc
 ; return 0; }
 EOF
-if { (eval echo configure:6991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_malloc=no
 else
@@ -7008,12 +7077,12 @@ EOF
 fi
 
 echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6
-echo "configure:7012: checking whether realloc must be declared" >&5
+echo "configure:7081: checking whether realloc must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7017 "configure"
+#line 7086 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7034,7 +7103,7 @@ int main() {
 char *(*pfn) = (char *(*)) realloc
 ; return 0; }
 EOF
-if { (eval echo configure:7038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_realloc=no
 else
@@ -7055,12 +7124,12 @@ EOF
 fi
 
 echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
-echo "configure:7059: checking whether free must be declared" >&5
+echo "configure:7128: checking whether free must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7064 "configure"
+#line 7133 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7081,7 +7150,7 @@ int main() {
 char *(*pfn) = (char *(*)) free
 ; return 0; }
 EOF
-if { (eval echo configure:7085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_free=no
 else
@@ -7102,12 +7171,12 @@ EOF
 fi
 
 echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6
-echo "configure:7106: checking whether strerror must be declared" >&5
+echo "configure:7175: checking whether strerror must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7111 "configure"
+#line 7180 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7128,7 +7197,7 @@ int main() {
 char *(*pfn) = (char *(*)) strerror
 ; return 0; }
 EOF
-if { (eval echo configure:7132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strerror=no
 else
@@ -7149,12 +7218,12 @@ EOF
 fi
 
 echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6
-echo "configure:7153: checking whether strdup must be declared" >&5
+echo "configure:7222: checking whether strdup must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7158 "configure"
+#line 7227 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7175,7 +7244,7 @@ int main() {
 char *(*pfn) = (char *(*)) strdup
 ; return 0; }
 EOF
-if { (eval echo configure:7179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strdup=no
 else
@@ -7196,12 +7265,12 @@ EOF
 fi
 
 echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
-echo "configure:7200: checking whether strstr must be declared" >&5
+echo "configure:7269: 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 7205 "configure"
+#line 7274 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7222,7 +7291,7 @@ int main() {
 char *(*pfn) = (char *(*)) strstr
 ; return 0; }
 EOF
-if { (eval echo configure:7226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_strstr=no
 else
@@ -7243,12 +7312,12 @@ EOF
 fi
 
 echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6
-echo "configure:7247: checking whether canonicalize_file_name must be declared" >&5
+echo "configure:7316: checking whether canonicalize_file_name must be declared" >&5
 if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7252 "configure"
+#line 7321 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -7269,7 +7338,7 @@ int main() {
 char *(*pfn) = (char *(*)) canonicalize_file_name
 ; return 0; }
 EOF
-if { (eval echo configure:7273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_decl_needed_canonicalize_file_name=no
 else
@@ -7295,9 +7364,9 @@ fi
 # could be expunged. --jsm 1999-03-22
 
 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6
-echo "configure:7299: checking for HPUX save_state structure" >&5
+echo "configure:7368: checking for HPUX save_state structure" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7301 "configure"
+#line 7370 "configure"
 #include "confdefs.h"
 #include <machine/save_state.h>
 EOF
@@ -7312,7 +7381,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 7316 "configure"
+#line 7385 "configure"
 #include "confdefs.h"
 #include <machine/save_state.h>
 EOF
@@ -7382,12 +7451,12 @@ fi
 
 if test "$ac_cv_header_sys_procfs_h" = yes; then
   echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7386: checking for pstatus_t in sys/procfs.h" >&5
+echo "configure:7455: checking for pstatus_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7391 "configure"
+#line 7460 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7396,7 +7465,7 @@ int main() {
 pstatus_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pstatus_t=yes
 else
@@ -7418,12 +7487,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6
 
   echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7422: checking for prrun_t in sys/procfs.h" >&5
+echo "configure:7491: checking for prrun_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7427 "configure"
+#line 7496 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7432,7 +7501,7 @@ int main() {
 prrun_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prrun_t=yes
 else
@@ -7454,12 +7523,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6
 
   echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7458: checking for gregset_t in sys/procfs.h" >&5
+echo "configure:7527: checking for gregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7463 "configure"
+#line 7532 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7468,7 +7537,7 @@ int main() {
 gregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_gregset_t=yes
 else
@@ -7490,12 +7559,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6
 
   echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7494: checking for fpregset_t in sys/procfs.h" >&5
+echo "configure:7563: checking for fpregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7499 "configure"
+#line 7568 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7504,7 +7573,7 @@ int main() {
 fpregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_fpregset_t=yes
 else
@@ -7526,12 +7595,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_fpregset_t" 1>&6
 
   echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7530: checking for prgregset_t in sys/procfs.h" >&5
+echo "configure:7599: checking for prgregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7535 "configure"
+#line 7604 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7540,7 +7609,7 @@ int main() {
 prgregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7544: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prgregset_t=yes
 else
@@ -7562,12 +7631,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6
 
   echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7566: checking for prfpregset_t in sys/procfs.h" >&5
+echo "configure:7635: checking for prfpregset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7571 "configure"
+#line 7640 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7576,7 +7645,7 @@ int main() {
 prfpregset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prfpregset_t=yes
 else
@@ -7598,12 +7667,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6
 
   echo $ac_n "checking for prgregset32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7602: checking for prgregset32_t in sys/procfs.h" >&5
+echo "configure:7671: checking for prgregset32_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7607 "configure"
+#line 7676 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7612,7 +7681,7 @@ int main() {
 prgregset32_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prgregset32_t=yes
 else
@@ -7634,12 +7703,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset32_t" 1>&6
 
   echo $ac_n "checking for prfpregset32_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7638: checking for prfpregset32_t in sys/procfs.h" >&5
+echo "configure:7707: checking for prfpregset32_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7643 "configure"
+#line 7712 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7648,7 +7717,7 @@ int main() {
 prfpregset32_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prfpregset32_t=yes
 else
@@ -7670,12 +7739,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset32_t" 1>&6
 
   echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7674: checking for lwpid_t in sys/procfs.h" >&5
+echo "configure:7743: checking for lwpid_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7679 "configure"
+#line 7748 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7684,7 +7753,7 @@ int main() {
 lwpid_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7688: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_lwpid_t=yes
 else
@@ -7706,12 +7775,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6
 
   echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7710: checking for psaddr_t in sys/procfs.h" >&5
+echo "configure:7779: checking for psaddr_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7715 "configure"
+#line 7784 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7720,7 +7789,7 @@ int main() {
 psaddr_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_psaddr_t=yes
 else
@@ -7742,12 +7811,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6
 
   echo $ac_n "checking for prsysent_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7746: checking for prsysent_t in sys/procfs.h" >&5
+echo "configure:7815: checking for prsysent_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7751 "configure"
+#line 7820 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7756,7 +7825,7 @@ int main() {
 prsysent_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_prsysent_t=yes
 else
@@ -7778,12 +7847,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_prsysent_t" 1>&6
 
   echo $ac_n "checking for pr_sigset_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7782: checking for pr_sigset_t in sys/procfs.h" >&5
+echo "configure:7851: checking for pr_sigset_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7787 "configure"
+#line 7856 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7792,7 +7861,7 @@ int main() {
 pr_sigset_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pr_sigset_t=yes
 else
@@ -7814,12 +7883,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigset_t" 1>&6
 
   echo $ac_n "checking for pr_sigaction64_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7818: checking for pr_sigaction64_t in sys/procfs.h" >&5
+echo "configure:7887: checking for pr_sigaction64_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7823 "configure"
+#line 7892 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7828,7 +7897,7 @@ int main() {
 pr_sigaction64_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes
 else
@@ -7850,12 +7919,12 @@ EOF
  echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigaction64_t" 1>&6
 
   echo $ac_n "checking for pr_siginfo64_t in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7854: checking for pr_siginfo64_t in sys/procfs.h" >&5
+echo "configure:7923: checking for pr_siginfo64_t in sys/procfs.h" >&5
  if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7859 "configure"
+#line 7928 "configure"
 #include "confdefs.h"
 
 #define _SYSCALL32
@@ -7864,7 +7933,7 @@ int main() {
 pr_siginfo64_t avar
 ; return 0; }
 EOF
-if { (eval echo configure:7868: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes
 else
@@ -7891,7 +7960,7 @@ EOF
         
   if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
     echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6
-echo "configure:7895: checking whether prfpregset_t type is broken" >&5
+echo "configure:7964: checking whether prfpregset_t type is broken" >&5
     if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7899,7 +7968,7 @@ else
   gdb_cv_prfpregset_t_broken=yes
 else
   cat > conftest.$ac_ext <<EOF
-#line 7903 "configure"
+#line 7972 "configure"
 #include "confdefs.h"
 #include <sys/procfs.h>
        int main ()
@@ -7909,7 +7978,7 @@ else
          return 0;
        }
 EOF
-if { (eval echo configure:7913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:7982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_prfpregset_t_broken=no
 else
@@ -7934,12 +8003,12 @@ EOF
 
   
   echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6
-echo "configure:7938: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
+echo "configure:8007: checking for PIOCSET ioctl entry in sys/procfs.h" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7943 "configure"
+#line 8012 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 #include <sys/types.h>
@@ -7952,7 +8021,7 @@ int main() {
   
 ; return 0; }
 EOF
-if { (eval echo configure:7956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_procfs_piocset=yes
 else
@@ -7976,19 +8045,19 @@ fi
 if test ${host} = ${target} ; then
     
   echo $ac_n "checking for member l_addr in struct link_map""... $ac_c" 1>&6
-echo "configure:7980: checking for member l_addr in struct link_map" >&5
+echo "configure:8049: checking for member l_addr in struct link_map" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7985 "configure"
+#line 8054 "configure"
 #include "confdefs.h"
 #include <link.h>
 int main() {
 struct link_map lm; (void) lm.l_addr;
 ; return 0; }
 EOF
-if { (eval echo configure:7992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_link_map_with_l_members=yes
 else
@@ -8010,12 +8079,12 @@ EOF
 
     
   echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6
-echo "configure:8014: checking for member lm_addr in struct link_map" >&5
+echo "configure:8083: checking for member lm_addr in struct link_map" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8019 "configure"
+#line 8088 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <link.h>
@@ -8023,7 +8092,7 @@ int main() {
 struct link_map lm; (void) lm.lm_addr;
 ; return 0; }
 EOF
-if { (eval echo configure:8027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_link_map_with_lm_members=yes
 else
@@ -8045,12 +8114,12 @@ EOF
 
     
   echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6
-echo "configure:8049: checking for member som_addr in struct so_map" >&5
+echo "configure:8118: checking for member som_addr in struct so_map" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8054 "configure"
+#line 8123 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_NLIST_H
@@ -8061,7 +8130,7 @@ int main() {
 struct so_map lm; (void) lm.som_addr;
 ; return 0; }
 EOF
-if { (eval echo configure:8065: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_so_map_with_som_members=yes
 else
@@ -8083,12 +8152,12 @@ EOF
 
     
   echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6
-echo "configure:8087: checking for struct link_map32 in sys/link.h" >&5
+echo "configure:8156: checking for struct link_map32 in sys/link.h" >&5
   if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8092 "configure"
+#line 8161 "configure"
 #include "confdefs.h"
 #define _SYSCALL32
 #include <sys/link.h>
@@ -8096,7 +8165,7 @@ int main() {
 struct link_map32 l;
 ; return 0; }
 EOF
-if { (eval echo configure:8100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_struct_link_map32=yes
 else
@@ -8123,12 +8192,12 @@ fi
 
 
 echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6
-echo "configure:8127: checking for long long support in compiler" >&5
+echo "configure:8196: checking for long long support in compiler" >&5
 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8132 "configure"
+#line 8201 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -8138,7 +8207,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:8142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_c_long_long=yes
 else
@@ -8160,7 +8229,7 @@ fi
 
 
 echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6
-echo "configure:8164: checking for long long support in printf" >&5
+echo "configure:8233: checking for long long support in printf" >&5
 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8168,7 +8237,7 @@ else
   gdb_cv_printf_has_long_long=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 8172 "configure"
+#line 8241 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -8182,7 +8251,7 @@ int main () {
   return (strcmp ("0x0123456789abcdef", buf));
 }
 EOF
-if { (eval echo configure:8186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_printf_has_long_long=yes
 else
@@ -8206,19 +8275,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6
 
 
 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6
-echo "configure:8210: checking for long double support in compiler" >&5
+echo "configure:8279: checking for long double support in compiler" >&5
 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8215 "configure"
+#line 8284 "configure"
 #include "confdefs.h"
 
 int main() {
 long double foo;
 ; return 0; }
 EOF
-if { (eval echo configure:8222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_long_double=yes
 else
@@ -8240,7 +8309,7 @@ fi
 
 
 echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6
-echo "configure:8244: checking for long double support in printf" >&5
+echo "configure:8313: checking for long double support in printf" >&5
 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8248,7 +8317,7 @@ else
   gdb_cv_printf_has_long_double=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 8252 "configure"
+#line 8321 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -8258,7 +8327,7 @@ int main () {
   return (strncmp ("3.14159", buf, 7));
 }
 EOF
-if { (eval echo configure:8262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_printf_has_long_double=yes
 else
@@ -8282,7 +8351,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6
 
 
 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6
-echo "configure:8286: checking for long double support in scanf" >&5
+echo "configure:8355: checking for long double support in scanf" >&5
 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8290,7 +8359,7 @@ else
   gdb_cv_scanf_has_long_double=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 8294 "configure"
+#line 8363 "configure"
 #include "confdefs.h"
 
 int main () {
@@ -8300,7 +8369,7 @@ int main () {
   return !(f > 3.14159 && f < 3.14160);
 }
 EOF
-if { (eval echo configure:8304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   gdb_cv_scanf_has_long_double=yes
 else
@@ -8325,7 +8394,7 @@ echo "$ac_t""$gdb_cv_scanf_has_long_double" 1>&6
 case ${host_os} in
 aix*)
   echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6
-echo "configure:8329: checking for -bbigtoc option" >&5
+echo "configure:8398: checking for -bbigtoc option" >&5
 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8339,14 +8408,14 @@ else
 
     LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
     cat > conftest.$ac_ext <<EOF
-#line 8343 "configure"
+#line 8412 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:8350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   :
 else
   echo "configure: failed program was:" >&5
@@ -8369,7 +8438,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then
    case ${host_os} in
    hpux*)
       echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6
-echo "configure:8373: checking for HPUX/OSF thread support" >&5
+echo "configure:8442: checking for HPUX/OSF thread support" >&5
       if test -f /usr/include/dce/cma_config.h ; then
          if test "$GCC" = "yes" ; then
             echo "$ac_t""yes" 1>&6
@@ -8392,7 +8461,7 @@ EOF
       # because version 0 (present on Solaris 2.4 or earlier) doesn't have
       # the same API.
       echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6
-echo "configure:8396: checking for Solaris thread debugging library" >&5
+echo "configure:8465: checking for Solaris thread debugging library" >&5
       if test -f /usr/lib/libthread_db.so.1 ; then
          echo "$ac_t""yes" 1>&6
          cat >> confdefs.h <<\EOF
@@ -8402,7 +8471,7 @@ EOF
          CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o"
          CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
          echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:8406: checking for dlopen in -ldl" >&5
+echo "configure:8475: 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
@@ -8410,7 +8479,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 8414 "configure"
+#line 8483 "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
@@ -8421,7 +8490,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:8425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8494: \"$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
@@ -8453,17 +8522,17 @@ fi
             # all symbols visible in the dynamic symbol table.
             hold_ldflags=$LDFLAGS
             echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6
-echo "configure:8457: checking for the ld -export-dynamic flag" >&5
+echo "configure:8526: checking for the ld -export-dynamic flag" >&5
             LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
             cat > conftest.$ac_ext <<EOF
-#line 8460 "configure"
+#line 8529 "configure"
 #include "confdefs.h"
 
 int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:8467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   found=yes
 else
@@ -8482,13 +8551,13 @@ rm -f conftest*
         # Sun randomly tweaked the prototypes in <proc_service.h>
         # at one point.
         echo $ac_n "checking if <proc_service.h> is old""... $ac_c" 1>&6
-echo "configure:8486: checking if <proc_service.h> is old" >&5
+echo "configure:8555: checking if <proc_service.h> is old" >&5
         if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
            cat > conftest.$ac_ext <<EOF
-#line 8492 "configure"
+#line 8561 "configure"
 #include "confdefs.h"
 
                #include <proc_service.h>
@@ -8499,7 +8568,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:8503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_proc_service_is_old=no
 else
@@ -8525,12 +8594,12 @@ EOF
       ;;
    aix*)
       echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6
-echo "configure:8529: checking for AiX thread debugging library" >&5
+echo "configure:8598: checking for AiX thread debugging library" >&5
       if eval "test \"`echo '$''{'gdb_cv_have_aix_thread_debug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8534 "configure"
+#line 8603 "configure"
 #include "confdefs.h"
 #include <sys/pthdebug.h>
 int main() {
@@ -8539,7 +8608,7 @@ int main() {
                                     #endif
 ; return 0; }
 EOF
-if { (eval echo configure:8543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_have_aix_thread_debug=yes
 else
@@ -8564,19 +8633,19 @@ fi
 
 if test "x$ac_cv_header_thread_db_h" = "xyes"; then
    echo $ac_n "checking whether <thread_db.h> has TD_NOTALLOC""... $ac_c" 1>&6
-echo "configure:8568: checking whether <thread_db.h> has TD_NOTALLOC" >&5
+echo "configure:8637: checking whether <thread_db.h> has TD_NOTALLOC" >&5
 if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8573 "configure"
+#line 8642 "configure"
 #include "confdefs.h"
 #include <thread_db.h>
 int main() {
 int i = TD_NOTALLOC;
 ; return 0; }
 EOF
-if { (eval echo configure:8580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   gdb_cv_thread_db_h_has_td_notalloc=yes
 else
@@ -8605,7 +8674,7 @@ if test "${with_sysroot+set}" = set; then
   withval="$with_sysroot"
   
  case ${with_sysroot} in
- yes) { echo "configure: error: with-sysroot must specify path" 1>&2; exit 1; } ;;
+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
  esac
 
@@ -8621,7 +8690,8 @@ if test "${with_sysroot+set}" = set; then
   test_prefix=$exec_prefix
  fi
  case ${TARGET_SYSTEM_ROOT} in
- ${test_prefix}*)
+ "${test_prefix}"|"${test_prefix}/"*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
    TARGET_SYSTEM_ROOT_DEFINE="$t"
    ;;
@@ -8686,7 +8756,7 @@ WERROR_CFLAGS=""
 if test "x${build_warnings}" != x -a "x$GCC" = xyes
 then
     echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6
-echo "configure:8690: checking compiler warning flags" >&5
+echo "configure:8760: checking compiler warning flags" >&5
     # Separate out the -Werror flag as some files just cannot be
     # compiled with it enabled.
     for w in ${build_warnings}; do
@@ -8696,14 +8766,14 @@ echo "configure:8690: checking compiler warning flags" >&5
            saved_CFLAGS="$CFLAGS"
            CFLAGS="$CFLAGS $w"
            cat > conftest.$ac_ext <<EOF
-#line 8700 "configure"
+#line 8770 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:8707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   WARN_CFLAGS="${WARN_CFLAGS} $w"
 else
@@ -8751,12 +8821,12 @@ fi
 
 # In the Cygwin environment, we need some additional flags.
 echo $ac_n "checking for cygwin""... $ac_c" 1>&6
-echo "configure:8755: checking for cygwin" >&5
+echo "configure:8825: checking for cygwin" >&5
 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 8760 "configure"
+#line 8830 "configure"
 #include "confdefs.h"
 
 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
@@ -8834,7 +8904,7 @@ if test "${with_tclconfig+set}" = set; then
 fi
 
   echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6
-echo "configure:8838: checking for Tcl configuration" >&5
+echo "configure:8908: checking for Tcl configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -8922,6 +8992,7 @@ fi
     
     
     
+    
 
 
 
@@ -8942,7 +9013,7 @@ if test "${with_tkconfig+set}" = set; then
 fi
 
   echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6
-echo "configure:8946: checking for Tk configuration" >&5
+echo "configure:9017: checking for Tk configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9051,7 +9122,7 @@ fi
 
 no_tcl=true
 echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6
-echo "configure:9055: checking for Tcl private headers. dir=${configdir}" >&5
+echo "configure:9126: checking for Tcl private headers. dir=${configdir}" >&5
 # Check whether --with-tclinclude or --without-tclinclude was given.
 if test "${with_tclinclude+set}" = set; then
   withval="$with_tclinclude"
@@ -9117,17 +9188,17 @@ fi
 if test x"${ac_cv_c_tclh}" = x ; then
    ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6
-echo "configure:9121: checking for tclInt.h" >&5
+echo "configure:9192: checking for tclInt.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9126 "configure"
+#line 9197 "configure"
 #include "confdefs.h"
 #include <tclInt.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9202: \"$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*
@@ -9187,7 +9258,7 @@ fi
 #
 no_tk=true
 echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6
-echo "configure:9191: checking for Tk private headers" >&5
+echo "configure:9262: checking for Tk private headers" >&5
 # Check whether --with-tkinclude or --without-tkinclude was given.
 if test "${with_tkinclude+set}" = set; then
   withval="$with_tkinclude"
@@ -9253,17 +9324,17 @@ fi
 if test x"${ac_cv_c_tkh}" = x ; then
    ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for tk.h""... $ac_c" 1>&6
-echo "configure:9257: checking for tk.h" >&5
+echo "configure:9328: checking for tk.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 9262 "configure"
+#line 9333 "configure"
 #include "confdefs.h"
 #include <tk.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9338: \"$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*
@@ -9309,7 +9380,7 @@ fi
 
           
 echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:9313: checking for Itcl private headers. srcdir=${srcdir}" >&5
+echo "configure:9384: checking for Itcl private headers. srcdir=${srcdir}" >&5
 if test x"${ac_cv_c_itclh}" = x ; then
   for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
     if test -f $i/generic/itcl.h ; then
@@ -9332,7 +9403,7 @@ fi
 
           
 echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6
-echo "configure:9336: checking for Itk private headers. srcdir=${srcdir}" >&5
+echo "configure:9407: checking for Itk private headers. srcdir=${srcdir}" >&5
 if test x"${ac_cv_c_itkh}" = x ; then
   for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
     if test -f $i/generic/itk.h ; then
@@ -9387,7 +9458,7 @@ if test "${with_itclconfig+set}" = set; then
 fi
 
   echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6
-echo "configure:9391: checking for Itcl configuration" >&5
+echo "configure:9462: checking for Itcl configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9490,7 +9561,7 @@ if test "${with_itkconfig+set}" = set; then
 fi
 
   echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6
-echo "configure:9494: checking for Itk configuration" >&5
+echo "configure:9565: checking for Itk configuration" >&5
   if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -9633,7 +9704,7 @@ fi
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:9637: checking for X" >&5
+echo "configure:9708: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -9695,12 +9766,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 9699 "configure"
+#line 9770 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9775: \"$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*
@@ -9769,14 +9840,14 @@ if test "$ac_x_libraries" = NO; then
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 9773 "configure"
+#line 9844 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:9780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -10024,7 +10095,7 @@ fi
 # We only build gdbserver automatically if host and target are the same.
 if test "x$target" = "x$host"; then
   echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6
-echo "configure:10028: checking whether gdbserver is supported on this host" >&5
+echo "configure:10099: checking whether gdbserver is supported on this host" >&5
   if test "x$build_gdbserver" = xyes; then
     configdirs="$configdirs gdbserver"
     echo "$ac_t""yes" 1>&6
 
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:10092: checking for Cygwin environment" >&5
+echo "configure:10163: 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 10097 "configure"
+#line 10168 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -10104,7 +10175,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:10108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -10121,19 +10192,19 @@ 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:10125: checking for mingw32 environment" >&5
+echo "configure:10196: 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 10130 "configure"
+#line 10201 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:10137: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -10152,7 +10223,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:10156: checking for executable suffix" >&5
+echo "configure:10227: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10162,10 +10233,10 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:10166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:10237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.C | *.o | *.obj | *.ilk | *.pdb) ;;
+      *.c | *.o | *.obj | *.ilk | *.pdb) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -10204,7 +10275,7 @@ fi
 
 
   echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:10208: checking for iconv" >&5
+echo "configure:10279: checking for iconv" >&5
 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -10212,7 +10283,7 @@ else
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
     cat > conftest.$ac_ext <<EOF
-#line 10216 "configure"
+#line 10287 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <iconv.h>
@@ -10222,7 +10293,7 @@ iconv_t cd = iconv_open("","");
        iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:10226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_func_iconv=yes
 else
@@ -10234,7 +10305,7 @@ rm -f conftest*
       am_save_LIBS="$LIBS"
       LIBS="$LIBS -liconv"
       cat > conftest.$ac_ext <<EOF
-#line 10238 "configure"
+#line 10309 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <iconv.h>
@@ -10244,7 +10315,7 @@ iconv_t cd = iconv_open("","");
          iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:10248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   am_cv_lib_iconv=yes
         am_cv_func_iconv=yes
@@ -10265,13 +10336,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6
 EOF
 
     echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:10269: checking for iconv declaration" >&5
+echo "configure:10340: checking for iconv declaration" >&5
     if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
       cat > conftest.$ac_ext <<EOF
-#line 10275 "configure"
+#line 10346 "configure"
 #include "confdefs.h"
 
 #include <stdlib.h>
@@ -10290,7 +10361,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:10294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_proto_iconv_arg1=""
 else
@@ -10529,6 +10600,7 @@ s%@TCL_SHLIB_SUFFIX@%$TCL_SHLIB_SUFFIX%g
 s%@TCL_DL_LIBS@%$TCL_DL_LIBS%g
 s%@TCL_LD_FLAGS@%$TCL_LD_FLAGS%g
 s%@TCL_LD_SEARCH_FLAGS@%$TCL_LD_SEARCH_FLAGS%g
+s%@TCL_CC_SEARCH_FLAGS@%$TCL_CC_SEARCH_FLAGS%g
 s%@TCL_COMPAT_OBJS@%$TCL_COMPAT_OBJS%g
 s%@TCL_RANLIB@%$TCL_RANLIB%g
 s%@TCL_BUILD_LIB_SPEC@%$TCL_BUILD_LIB_SPEC%g
index 3f2d749..b309a33 100644 (file)
@@ -39,7 +39,6 @@ alpha*-*-netbsd*)     gdb_host=nbsd ;;
 arm*-*-linux*)         gdb_host=linux ;;
 arm*-*-netbsdelf*)     gdb_host=nbsdelf ;;
 arm*-*-netbsd*)                gdb_host=nbsdaout ;;
-arm*-*-*)              gdb_host=arm ;;
 
 hppa*-*-bsd*)          gdb_host=hppabsd ;;
 hppa*-*-hiux*)         gdb_host=hppahpux ;;
@@ -144,9 +143,6 @@ sparc64-*-linux*)   gdb_host=linux ;;
 sparc64-*-netbsd*)     gdb_host=nbsd64 ;;
 sparcv9-*-* | sparc64-*-*) gdb_host=sun4sol2 ;;
 
-strongarm-*-*)         gdb_host=arm ;;
-xscale-*-*)            gdb_host=arm ;;
-
 vax-*-bsd*)            gdb_host=vaxbsd ;;
 vax-*-ultrix2*)                gdb_host=vaxult2 ;;
 vax-*-ultrix*)         gdb_host=vaxult ;;
index 65b62f0..07aab35 100644 (file)
@@ -204,6 +204,16 @@ AC_ARG_ENABLE(profiling,
  [enable_profiling=no])
 
 AC_CHECK_FUNCS(monstartup _mcleanup)
+AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
+[AC_TRY_LINK(
+[#include <stdlib.h>
+extern char _etext;
+],
+[free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
+if test $ac_cv_var__etext = yes; then
+  AC_DEFINE(HAVE__ETEXT, 1,
+            [Define to 1 if your system has the _etext variable. ])
+fi
 if test "$enable_profiling" = yes ; then
   if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
     AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
@@ -501,6 +511,18 @@ if test $gdb_cv_have_pt_getxmmregs = yes; then
   AC_DEFINE(HAVE_PT_GETXMMREGS)
 fi
 
+# See if stdint.h provides the uintptr_t type.
+# Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this.
+AC_CACHE_CHECK([for uintptr_t in stdint.h], gdb_cv_have_uintptr_t,
+  [AC_TRY_COMPILE(
+    [#include <stdint.h>],
+    [uintptr_t foo = 0;],
+    gdb_cv_have_uintptr_t=yes,
+    gdb_cv_have_uintptr_t=no)])
+AC_MSG_RESULT($gdb_cv_have_uintptr_t)
+if test $gdb_cv_have_uintptr_t = yes; then
+  AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if <stdint.h> provides the uintptr_t type.])
+fi
 
 BFD_NEED_DECLARATION(malloc)
 BFD_NEED_DECLARATION(realloc)
@@ -895,7 +917,7 @@ AC_ARG_WITH(sysroot,
 [  --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
 [
  case ${with_sysroot} in
- yes) AC_ERROR(with-sysroot must specify path) ;;
+ yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
  *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
  esac
 
@@ -911,7 +933,8 @@ AC_ARG_WITH(sysroot,
   test_prefix=$exec_prefix
  fi
  case ${TARGET_SYSTEM_ROOT} in
- ${test_prefix}*)
+ "${test_prefix}"|"${test_prefix}/"*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
    TARGET_SYSTEM_ROOT_DEFINE="$t"
    ;;
index 488b41f..17ac70f 100644 (file)
@@ -68,7 +68,7 @@ cris*)                  gdb_target=cris ;;
 d10v-*-*)              gdb_target=d10v ;;
 
 h8300-*-*)             gdb_target=h8300 ;;
-h8500-*-*)             gdb_target=h8500 ;;
+# OBSOLETE h8500-*-*)          gdb_target=h8500 ;;
 
 
 frv-*-*)               gdb_target=frv ;;
@@ -92,11 +92,6 @@ i[3456]86-*-go32*)   gdb_target=i386aout ;;
 i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;;
 i[3456]86-*-lynxos*)   gdb_target=i386lynx ;;
 i[3456]86-*-solaris*)  gdb_target=i386sol2 ;;
-i[3456]86-*-sysv4.2*)  gdb_target=i386v42mp ;;
-i[3456]86-*-sysv4*)    gdb_target=i386v4 ;;
-i[3456]86-*-sysv5*)    gdb_target=i386v42mp ;;
-i[3456]86-*-sco3.2v4*) gdb_target=i386sco4 ;;
-i[3456]86-*-sco3.2v5*) gdb_target=i386sco5 ;;
 i[3456]86-*-sco*)      gdb_target=i386v ;;
 i[3456]86-*-sysv*)     gdb_target=i386v ;;
 i[3456]86-*-linux*)    gdb_target=linux
@@ -116,7 +111,7 @@ ia64-*-linux*)              gdb_target=linux
                        ;;
 ia64*-*-*)             gdb_target=ia64 ;;
 
-m32r-*-elf*)           gdb_target=m32r ;;
+# OBSOLETE m32r-*-elf*)                gdb_target=m32r ;;
 
 m68hc11*-*-*|m6811*-*-*)       gdb_target=m68hc11 ;;
 
@@ -146,7 +141,6 @@ m68*-*-vxworks*)    gdb_target=vxworks68 ;;
 mcore*-*-*)            gdb_target=mcore ;;
 mips64*-big-*)         gdb_target=bigmips64 ;;
 mips*-big-*)           gdb_target=bigmips ;;
-mips*-dec-mach3*)      gdb_target=mach3 ;;
 mips*-dec-*)           gdb_target=decstation ;;
 mips*-*-pe)            gdb_target=wince ;;
 mips64*el-*-ecoff*)    gdb_target=embedl64 ;;
@@ -185,7 +179,7 @@ mips*-*-riscos*)    gdb_target=bigmips ;;
 mips*-*-vxworks*)       gdb_target=vxmips ;;
 mips*-*-*)             gdb_target=embed ;;
 
-mn10200-*-*)           gdb_target=mn10200 ;;
+# OBSOLETE mn10200-*-*)                gdb_target=mn10200 ;;
 mn10300-*-*)           gdb_target=mn10300 ;;
 
 none-*-*)              gdb_target=none ;;
@@ -264,7 +258,7 @@ x86_64-*-linux*)    gdb_target=x86-64linux
                        build_gdbserver=yes
                        ;;
 
-z8k-*-coff*)           gdb_target=z8k ;;
+# OBSOLETE z8k-*-coff*)                gdb_target=z8k ;;
 
 esac
 
@@ -286,4 +280,5 @@ esac
 case "${target}" in
 *-*-linux*)    gdb_osabi=GDB_OSABI_LINUX ;;
 *-*-gnu*)      gdb_osabi=GDB_OSABI_HURD ;;
+*-*-solaris*)  gdb_osabi=GDB_OSABI_SOLARIS ;;
 esac
index a2ccbdb..69f1b15 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for printing C++ values for GDB, the GNU debugger.
    Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   2000, 2001, 2002
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -130,7 +130,7 @@ cp_print_class_method (char *valaddr,
          check_stub_method_group (domain, i);
          for (j = 0; j < len2; j++)
            {
-             if (strcmp (SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j))
+             if (strcmp (DEPRECATED_SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j))
                  == 0)
                goto common;
            }
@@ -260,8 +260,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr,
   if ((len == n_baseclasses)
       || ((len - n_baseclasses == 1)
          && TYPE_HAS_VTABLE (type)
-         && STREQN (TYPE_FIELD_NAME (type, n_baseclasses),
-                    hpacc_vtbl_ptr_name, 5))
+         && strncmp (TYPE_FIELD_NAME (type, n_baseclasses),
+                     hpacc_vtbl_ptr_name, 5) == 0)
       || !len)
     fprintf_filtered (stream, "<No data fields>");
   else
@@ -285,7 +285,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr,
 
          /* If a vtable pointer appears, we'll print it out later */
          if (TYPE_HAS_VTABLE (type)
-             && STREQN (TYPE_FIELD_NAME (type, i), hpacc_vtbl_ptr_name, 5))
+             && strncmp (TYPE_FIELD_NAME (type, i), hpacc_vtbl_ptr_name,
+                         5) == 0)
            continue;
 
          if (fields_seen)
@@ -408,9 +409,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, char *valaddr,
     }                          /* if there are data fields */
   /* Now print out the virtual table pointer if there is one */
   if (TYPE_HAS_VTABLE (type)
-      && STREQN (TYPE_FIELD_NAME (type, n_baseclasses),
-                hpacc_vtbl_ptr_name, 
-                5))
+      && strncmp (TYPE_FIELD_NAME (type, n_baseclasses),
+                 hpacc_vtbl_ptr_name, 5) == 0)
     {
       struct value *v;
       /* First get the virtual table pointer and print it out */
index 5911318..a51f98c 100644 (file)
@@ -1146,9 +1146,10 @@ cris_frameless_function_invocation (struct frame_info *fi)
     return frameless_look_for_prologue (fi);
 }
 
-/* See frame.h.  Determines the address of all registers in the current stack
-   frame storing each in frame->saved_regs.  Space for frame->saved_regs shall
-   be allocated by FRAME_INIT_SAVED_REGS using frame_saved_regs_zalloc.  */
+/* See frame.h.  Determines the address of all registers in the
+   current stack frame storing each in frame->saved_regs.  Space for
+   frame->saved_regs shall be allocated by
+   DEPRECATED_FRAME_INIT_SAVED_REGS using frame_saved_regs_zalloc.  */
 
 void
 cris_frame_init_saved_regs (struct frame_info *fi)
@@ -4242,13 +4243,13 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_raw_size (gdbarch, cris_register_size);
   
   /* The largest value REGISTER_RAW_SIZE can have.  */
-  set_gdbarch_max_register_raw_size (gdbarch, 32);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 32);
   
   /* The length of the registers in the program's representation.  */
   set_gdbarch_register_virtual_size (gdbarch, cris_register_size);
   
   /* The largest value REGISTER_VIRTUAL_SIZE can have.  */
-  set_gdbarch_max_register_virtual_size (gdbarch, 32);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 32);
 
   set_gdbarch_register_virtual_type (gdbarch, cris_register_virtual_type);
   
@@ -4283,7 +4284,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* No register requires conversion from raw format to virtual format.  */
   set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
 
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, cris_push_return_address);
   set_gdbarch_pop_frame (gdbarch, cris_pop_frame);
 
@@ -4292,8 +4292,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     (gdbarch, cris_extract_struct_value_address);
   set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs);
-  set_gdbarch_init_extra_frame_info (gdbarch, cris_init_extra_frame_info);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, cris_init_extra_frame_info);
   set_gdbarch_skip_prologue (gdbarch, cris_skip_prologue);
   set_gdbarch_prologue_frameless_p (gdbarch, generic_prologue_frameless_p);
   
index c6b94bd..addf9ca 100644 (file)
@@ -348,7 +348,7 @@ d10v_register_raw_size (int reg_nr)
    of data in register N.  */
 
 static struct type *
-d10v_register_virtual_type (int reg_nr)
+d10v_register_type (struct gdbarch *gdbarch, int reg_nr)
 {
   if (reg_nr == PC_REGNUM)
     return builtin_type_void_func_ptr;
@@ -789,7 +789,7 @@ d10v_frame_unwind_cache (struct frame_info *fi,
     {
       CORE_ADDR return_pc 
        = read_memory_unsigned_integer (info->saved_regs[LR_REGNUM], 
-                                       REGISTER_RAW_SIZE (LR_REGNUM));
+                                       register_size (current_gdbarch, LR_REGNUM));
       info->return_pc = d10v_make_iaddr (return_pc);
     }
   else
@@ -889,7 +889,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
        int i;
        fprintf_filtered (file, "  ");
        frame_register_read (frame, a, num);
-       for (i = 0; i < MAX_REGISTER_RAW_SIZE; i++)
+       for (i = 0; i < max_register_size (current_gdbarch); i++)
          {
            fprintf_filtered (file, "%02x", (num[i] & 0xff));
          }
@@ -1078,7 +1078,7 @@ d10v_extract_return_value (struct type *type, struct regcache *regcache,
   printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), 
         TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, 
         (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), 
-                                        REGISTER_RAW_SIZE (RET1_REGNUM)));
+                                        register_size (current_gdbarch, RET1_REGNUM)));
 #endif
   if (TYPE_LENGTH (type) == 1)
     {
@@ -1464,7 +1464,7 @@ d10v_frame_id_unwind (struct frame_info *frame,
     }
 
   addr = read_memory_unsigned_integer (info->saved_regs[FP_REGNUM],
-                                      REGISTER_RAW_SIZE (FP_REGNUM));
+                                      register_size (current_gdbarch, FP_REGNUM));
   if (addr == 0)
     return;
 
@@ -1495,7 +1495,7 @@ saved_regs_unwinder (struct frame_info *frame,
          *addrp = 0;
          *realnump = -1;
          if (bufferp != NULL)
-           store_address (bufferp, REGISTER_RAW_SIZE (regnum),
+           store_address (bufferp, register_size (current_gdbarch, regnum),
                           saved_regs[regnum]);
        }
       else
@@ -1510,7 +1510,7 @@ saved_regs_unwinder (struct frame_info *frame,
            {
              /* Read the value in from memory.  */
              read_memory (saved_regs[regnum], bufferp,
-                          REGISTER_RAW_SIZE (regnum));
+                          register_size (current_gdbarch, regnum));
            }
        }
       return;
@@ -1566,7 +1566,8 @@ d10v_frame_pop (struct frame_info *fi, void **unwind_cache,
   frame_unwind_register (fi, LR_REGNUM, raw_buffer);
   regcache_cooked_write (regcache, PC_REGNUM, raw_buffer);
 
-  store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (SP_REGNUM),
+  store_unsigned_integer (raw_buffer,
+                         register_size (current_gdbarch, SP_REGNUM),
                          fp + info->size);
   regcache_cooked_write (regcache, SP_REGNUM, raw_buffer);
 
@@ -1648,10 +1649,8 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, (d10v_num_regs - 2) * 2 + 16);
   set_gdbarch_register_byte (gdbarch, d10v_register_byte);
   set_gdbarch_register_raw_size (gdbarch, d10v_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 8);
   set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 8);
-  set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type);
+  set_gdbarch_register_type (gdbarch, d10v_register_type);
 
   set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
   set_gdbarch_addr_bit (gdbarch, 32);
@@ -1697,7 +1696,6 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, d10v_push_arguments);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
 
   set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return);
index 2a1d4e2..d813553 100644 (file)
@@ -2784,9 +2784,10 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
      peculiarities of function_start_offset.  */
   static CORE_ADDR last_function_start;
 
-  /* If this is nonzero, we've seen an N_SLINE since the start of the current
-     function.  Initialized to nonzero to assure that last_function_start
-     is never used uninitialized.  */
+  /* If this is nonzero, we've seen an N_SLINE since the start of the
+     current function.  We use this to tell us to move the first sline
+     to the beginning of the function regardless of what its given
+     value is. */
   static int sline_found_in_function = 1;
 
   /* If this is nonzero, we've seen a non-gcc N_OPT symbol for this source
@@ -2830,7 +2831,13 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
              break;
            }
 
-         record_line (current_subfile, 0, function_start_offset + valu);
+         /* The following check is added before recording line 0 at
+            end of function so as to handle hand-generated stabs
+            which may have an N_FUN stabs at the end of the function, but
+            no N_SLINE stabs.  */
+         if (sline_found_in_function)
+           record_line (current_subfile, 0, last_function_start + valu);
+
          within_function = 0;
          new = pop_context ();
 
@@ -3260,13 +3267,13 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
                  int l = colon_pos - name;
 
                  m = lookup_minimal_symbol_by_pc (last_pc_address);
-                 if (m && STREQN (SYMBOL_NAME (m), name, l)
-                     && SYMBOL_NAME (m)[l] == '\0')
+                 if (m && STREQN (DEPRECATED_SYMBOL_NAME (m), name, l)
+                     && DEPRECATED_SYMBOL_NAME (m)[l] == '\0')
                    /* last_pc_address was in this function */
                    valu = SYMBOL_VALUE (m);
-                 else if (m && SYMBOL_NAME (m + 1)
-                          && STREQN (SYMBOL_NAME (m + 1), name, l)
-                          && SYMBOL_NAME (m + 1)[l] == '\0')
+                 else if (m && DEPRECATED_SYMBOL_NAME (m + 1)
+                          && STREQN (DEPRECATED_SYMBOL_NAME (m + 1), name, l)
+                          && DEPRECATED_SYMBOL_NAME (m + 1)[l] == '\0')
                    /* last_pc_address was in last function */
                    valu = SYMBOL_VALUE (m + 1);
                  else
@@ -3555,7 +3562,6 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
   buildsym_new_init ();
   free_header_files ();
   init_header_files ();
-  install_minimal_symbols (objfile);
 
   processing_acc_compilation = 1;
 
@@ -3567,7 +3573,10 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
 
   /* In an elf file, we've already installed the minimal symbols that came
      from the elf (non-stab) symbol table, so always act like an
-     incremental load here. */
+     incremental load here.  dbx_symfile_read should not generate any new
+     minimal symbols, since we will have already read the ELF dynamic symbol
+     table and normal symbol entries won't be in the ".stab" section; but in
+     case it does, it will install them itself.  */
   dbx_symfile_read (objfile, 0);
 
   if (back_to)
@@ -3649,7 +3658,6 @@ stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
   buildsym_new_init ();
   free_header_files ();
   init_header_files ();
-  install_minimal_symbols (objfile);
 
   /* Now, do an incremental load */
 
index d2a1615..1cd32c0 100644 (file)
@@ -160,9 +160,6 @@ typedef bfd_vma CORE_ADDR;
 /* Check if a character is one of the commonly used C++ marker characters.  */
 extern int is_cplus_marker (int);
 
-/* use tui interface if non-zero */
-extern int tui_version;
-
 /* enable xdb commands if set */
 extern int xdb_commands;
 
@@ -308,6 +305,10 @@ extern void notice_quit (void);
 
 extern int strcmp_iw (const char *, const char *);
 
+extern int strcmp_iw_ordered (const char *, const char *);
+
+extern int streq (const char *, const char *);
+
 extern int subset_compare (char *, char *);
 
 extern char *safe_strerror (int);
@@ -1009,6 +1010,7 @@ enum gdb_osabi
   GDB_OSABI_ARM_EABI_V1,
   GDB_OSABI_ARM_EABI_V2,
   GDB_OSABI_ARM_APCS,
+  GDB_OSABI_QNXNTO,
 
   GDB_OSABI_INVALID            /* keep this last */
 };
@@ -1081,6 +1083,29 @@ extern void *alloca ();
 #include "arch-utils.h"
 #endif
 
+/* FIXME: cagney/2003-03-01: Hack to prop up old targets while they
+   migrate to the overhauled register cache.
+
+   The problem is that some architectures specify different sized raw
+   and cooked (nee virtual) register sizes.  They shouldn't.  Instead,
+   all architectures should just implement a gdbarch_register_type().
+   That can be used to compute all needed register attributes.  While
+   waiting for the conversion, provide compatibility macros that keep
+   old code working.  */
+
+#ifdef MAX_REGISTER_RAW_SIZE
+#error MAX_REGISTER_RAW_SIZE defined
+#endif
+extern int legacy_max_register_raw_size (void);
+#define MAX_REGISTER_RAW_SIZE legacy_max_register_raw_size ()
+
+#ifdef MAX_REGISTER_VIRTUAL_SIZE
+#error MAX_REGISTER_VIRTUAL_SIZE defined
+#endif
+extern int legacy_max_register_virtual_size (void);
+#define MAX_REGISTER_VIRTUAL_SIZE legacy_max_register_virtual_size ()
+
+
 /* Static target-system-dependent parameters for GDB. */
 
 /* Number of bits in a char or unsigned char for the target machine.
index 4ac22a2..75d1783 100644 (file)
@@ -97,6 +97,7 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
   char *name = NULL;
   int offset;
   int line;
+  struct cleanup *ui_out_chain;
 
   for (pc = low; pc < high;)
     {
@@ -108,7 +109,7 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
          else
            num_displayed++;
        }
-      ui_out_tuple_begin (uiout, NULL);
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       ui_out_field_core_addr (uiout, "address", pc);
 
       if (!build_address_symbolic (pc, 0, &name, &offset, &filename,
@@ -131,7 +132,7 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
       pc += TARGET_PRINT_INSN (pc, di);
       ui_out_field_stream (uiout, "inst", stb);
       ui_file_rewind (stb->stream);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       ui_out_text (uiout, "\n");
     }
   return num_displayed;
@@ -157,6 +158,7 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
   int next_line = 0;
   CORE_ADDR pc;
   int num_displayed = 0;
+  struct cleanup *ui_out_chain;
 
   mle = (struct dis_line_entry *) alloca (nlines
                                          * sizeof (struct dis_line_entry));
@@ -210,11 +212,14 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
      they have been emitted before), followed by the assembly code
      for that line.  */
 
-  ui_out_list_begin (uiout, "asm_insns");
+  ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
 
   for (i = 0; i < newlines; i++)
     {
+      struct cleanup *ui_out_tuple_chain = NULL;
+      struct cleanup *ui_out_list_chain = NULL;
       int close_list = 1;
+      
       /* Print out everything from next_line to the current line.  */
       if (mle[i].line >= next_line)
        {
@@ -223,7 +228,9 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
              /* Just one line to print. */
              if (next_line == mle[i].line)
                {
-                 ui_out_tuple_begin (uiout, "src_and_asm_line");
+                 ui_out_tuple_chain
+                   = make_cleanup_ui_out_tuple_begin_end (uiout,
+                                                          "src_and_asm_line");
                  print_source_lines (symtab, next_line, mle[i].line + 1, 0);
                }
              else
@@ -231,27 +238,38 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
                  /* Several source lines w/o asm instructions associated. */
                  for (; next_line < mle[i].line; next_line++)
                    {
-                     ui_out_tuple_begin (uiout, "src_and_asm_line");
+                     struct cleanup *ui_out_list_chain_line;
+                     struct cleanup *ui_out_tuple_chain_line;
+                     
+                     ui_out_tuple_chain_line
+                       = make_cleanup_ui_out_tuple_begin_end (uiout,
+                                                              "src_and_asm_line");
                      print_source_lines (symtab, next_line, next_line + 1,
                                          0);
-                     ui_out_list_begin (uiout, "line_asm_insn");
-                     ui_out_list_end (uiout);
-                     ui_out_tuple_end (uiout);
+                     ui_out_list_chain_line
+                       = make_cleanup_ui_out_list_begin_end (uiout,
+                                                             "line_asm_insn");
+                     do_cleanups (ui_out_list_chain_line);
+                     do_cleanups (ui_out_tuple_chain_line);
                    }
                  /* Print the last line and leave list open for
                     asm instructions to be added. */
-                 ui_out_tuple_begin (uiout, "src_and_asm_line");
+                 ui_out_tuple_chain
+                   = make_cleanup_ui_out_tuple_begin_end (uiout,
+                                                          "src_and_asm_line");
                  print_source_lines (symtab, next_line, mle[i].line + 1, 0);
                }
            }
          else
            {
-             ui_out_tuple_begin (uiout, "src_and_asm_line");
+             ui_out_tuple_chain
+               = make_cleanup_ui_out_tuple_begin_end (uiout, "src_and_asm_line");
              print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0);
            }
 
          next_line = mle[i].line + 1;
-         ui_out_list_begin (uiout, "line_asm_insn");
+         ui_out_list_chain
+           = make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn");
          /* Don't close the list if the lines are not in order. */
          if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line)
            close_list = 0;
@@ -261,8 +279,8 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
                                   how_many, stb);
       if (close_list)
        {
-         ui_out_list_end (uiout);
-         ui_out_tuple_end (uiout);
+         do_cleanups (ui_out_list_chain);
+         do_cleanups (ui_out_tuple_chain);
          ui_out_text (uiout, "\n");
          close_list = 0;
        }
@@ -270,7 +288,7 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
        if (num_displayed >= how_many)
          break;
     }
-  ui_out_list_end (uiout);
+  do_cleanups (ui_out_chain);
 }
 
 
@@ -280,12 +298,13 @@ do_assembly_only (struct ui_out *uiout, disassemble_info * di,
                  int how_many, struct ui_stream *stb)
 {
   int num_displayed = 0;
+  struct cleanup *ui_out_chain;
 
-  ui_out_list_begin (uiout, "asm_insns");
+  ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
 
   num_displayed = dump_insns (uiout, di, low, high, how_many, stb);
 
-  ui_out_list_end (uiout);
+  do_cleanups (ui_out_chain);
 }
 
 void
index 832ac37..013e8ca 100644 (file)
@@ -1,3 +1,50 @@
+2003-03-02  Daniel Jacobowitz  <drow@mvista.com>
+
+       * Makefile.in (distclean): Remove config.log.
+
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * gdbint.texinfo (Target Architecture Definition): Rename
+       FRAME_INIT_SAVED_REGS to DEPRECATED_FRAME_INIT_SAVED_REGS.
+
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * gdbint.texinfo: Rename INIT_EXTRA_FRAME_INFO to
+       DEPRECATED_INIT_EXTRA_FRAME_INFO.
+
+2003-02-23  Raoul Gough  <RaoulGough@yahoo.co.uk>
+
+       * gdb.texinfo (Cygwin Native): Links to Non-debug DLL symbols.
+       (Non-debug DLL symbols): New node, describing the minimal symbols
+       loaded from DLLs without real debugging symbols.
+
+2003-02-20  Andrew Cagney  <ac131313@redhat.com>
+
+       * gdb.texinfo (Set Breaks): Add cross reference to "set remote
+       hardware-breakpoint-limit".
+       (Set Watchpoints): Add cross reference to "set remote
+       hardware-watchpoint-limit".
+       (Remote configuration options): New section.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * gdbint.texinfo (Target Architecture Definition): Delete
+       descrption of IS_TRAPPED_INTERNALVAR.
+
+       From Keith Seitz <keiths@redhat.com>:
+       * gdb.texinfo (Interpreters): New chapter.  Refer the command-line
+       option "-i"/"--interpreter" to this chapter.  Include index
+       entries.
+
+2003-02-04  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.texinfo (C@t{++}): Recommend DWARF 2, then stabs+.
+       (Variables): Recommend stabs+ and DWARF 2.
+       (C plus plus expressions): Correct info about
+       compiler versions, debug formats.
+       (Contributors): Change 'DWARF2' to 'DWARF 2'.
+       PR symtab/874.
+
 2003-02-01  Andrew Cagney  <ac131313@redhat.com>
 
        * gdbint.texinfo (Target Architecture Definition): Delete
index b17cce8..1d5ad3e 100644 (file)
@@ -440,7 +440,7 @@ clean: mostlyclean
        rm -f gdb-cfg.texi
 
 distclean: clean
-       rm -f Makefile config.status
+       rm -f Makefile config.status config.log
 
 # GDBvn.texi, the dvi files, the info files, and the postscript files, 
 # are all part of the distribution, so it should not be removed by
index b3dd7a7..0bad40b 100644 (file)
@@ -146,6 +146,7 @@ Copyright (C) 1988-2003 Free Software Foundation, Inc.
 * Controlling GDB::             Controlling @value{GDBN}
 * Sequences::                   Canned sequences of commands
 * TUI::                         @value{GDBN} Text User Interface
+* Interpreters::               Command Interpreters
 * Emacs::                       Using @value{GDBN} under @sc{gnu} Emacs
 * Annotations::                 @value{GDBN}'s annotation interface.
 * GDB/MI::                      @value{GDBN}'s Machine Interface.
@@ -371,7 +372,7 @@ Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore.
 David Johnson wrote the original COFF support; Pace Willison did
 the original support for encapsulated COFF.
 
-Brent Benson of Harris Computer Systems contributed DWARF2 support.
+Brent Benson of Harris Computer Systems contributed DWARF 2 support.
 
 Adam de Boor and Bradley Davis contributed the ISI Optimum V support.
 Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS
@@ -1124,6 +1125,7 @@ Do not use this option if you run @value{GDBN} from Emacs
 Use the interpreter @var{interp} for interface with the controlling
 program or device.  This option is meant to be set by programs which
 communicate with @value{GDBN} using it as a back end.
+@xref{Interpreters, , Command Interpreters}.
 
 @samp{--interpreter=mi} (or @samp{--interpreter=mi2}) causes
 @value{GDBN} to use the current @dfn{@sc{gdb/mi} interface}
@@ -2512,6 +2514,8 @@ example, on the DSU, only two data breakpoints can be set at a time, and
 @value{GDBN} will reject this command if more than two are used.  Delete
 or disable unused hardware breakpoints before setting new ones
 (@pxref{Disabling, ,Disabling}).  @xref{Conditions, ,Break conditions}.
+@xref{set remote hardware-breakpoint-limit}.
+
 
 @kindex thbreak
 @item thbreak @var{args}
@@ -2748,6 +2752,8 @@ when a non-current thread's activity changes the expression.  (Hardware
 watchpoints, in contrast, watch an expression in all threads.)
 @end quotation
 
+@xref{set remote hardware-watchpoint-limit}.
+
 @node Set Catchpoints
 @subsection Setting catchpoints
 @cindex catchpoints, setting
@@ -4711,13 +4717,12 @@ No symbol "foo" in current context.
 
 To solve such problems, either recompile without optimizations, or use a
 different debug info format, if the compiler supports several such
-formats.  For example, @value{NGCC}, the @sc{gnu} C/C@t{++} compiler usually
-supports the @samp{-gstabs} option.  @samp{-gstabs} produces debug info
-in a format that is superior to formats such as COFF.  You may be able
-to use DWARF2 (@samp{-gdwarf-2}), which is also an effective form for
-debug info.  See @ref{Debugging Options,,Options for Debugging Your
-Program or @sc{gnu} CC, gcc.info, Using @sc{gnu} CC}, for more
-information.
+formats.  For example, @value{NGCC}, the @sc{gnu} C/C@t{++} compiler
+usually supports the @option{-gstabs+} option.  @option{-gstabs+}
+produces debug info in a format that is superior to formats such as
+COFF.  You may be able to use DWARF 2 (@option{-gdwarf-2}), which is also
+an effective form for debug info.  @xref{Debugging Options,,Options
+for Debugging Your Program or @sc{gnu} CC, gcc.info, Using @sc{gnu} CC}.
 
 
 @node Arrays
@@ -7812,11 +7817,12 @@ effectively, you must compile your C@t{++} programs with a supported
 C@t{++} compiler, such as @sc{gnu} @code{g++}, or the HP ANSI C@t{++}
 compiler (@code{aCC}).
 
-For best results when using @sc{gnu} C@t{++}, use the stabs debugging
-format.  You can select that format explicitly with the @code{g++}
-command-line options @samp{-gstabs} or @samp{-gstabs+}.  See
-@ref{Debugging Options,,Options for Debugging Your Program or @sc{gnu}
-CC, gcc.info, Using @sc{gnu} CC}, for more information.
+For best results when using @sc{gnu} C@t{++}, use the DWARF 2 debugging
+format; if it doesn't work on your system, try the stabs+ debugging
+format.  You can select those formats explicitly with the @code{g++}
+command-line options @option{-gdwarf-2} and @option{-gstabs+}.
+@xref{Debugging Options,,Options for Debugging Your Program or @sc{gnu}
+CC, gcc.info, Using @sc{gnu} CC}.
 
 @menu
 * C Operators::                 C and C@t{++} operators
@@ -8062,28 +8068,21 @@ and @samp{@{&"hi", &"there", &"fred"@}} is a three-element array of pointers.
 @cindex expressions in C@t{++}
 @value{GDBN} expression handling can interpret most C@t{++} expressions.
 
-@cindex C@t{++} support, not in @sc{coff}
-@cindex @sc{coff} versus C@t{++}
-@cindex C@t{++} and object formats
-@cindex object formats and C@t{++}
-@cindex a.out and C@t{++}
-@cindex @sc{ecoff} and C@t{++}
-@cindex @sc{xcoff} and C@t{++}
-@cindex @sc{elf}/stabs and C@t{++}
-@cindex @sc{elf}/@sc{dwarf} and C@t{++}
-@c FIXME!! GDB may eventually be able to debug C++ using DWARF; check
-@c periodically whether this has happened...
+@cindex debugging C@t{++} programs
+@cindex C@t{++} compilers
+@cindex debug formats and C@t{++}
+@cindex @value{NGCC} and C@t{++}
 @quotation
 @emph{Warning:} @value{GDBN} can only debug C@t{++} code if you use the
-proper compiler.  Typically, C@t{++} debugging depends on the use of
-additional debugging information in the symbol table, and thus requires
-special support.  In particular, if your compiler generates a.out, MIPS
-@sc{ecoff}, RS/6000 @sc{xcoff}, or @sc{elf} with stabs extensions to the
-symbol table, these facilities are all available.  (With @sc{gnu} CC,
-you can use the @samp{-gstabs} option to request stabs debugging
-extensions explicitly.)  Where the object code format is standard
-@sc{coff} or @sc{dwarf} in @sc{elf}, on the other hand, most of the C@t{++}
-support in @value{GDBN} does @emph{not} work.
+proper compiler and the proper debug format.  Currently, @value{GDBN}
+works best when debugging C@t{++} code that is compiled with
+@value{NGCC} 2.95.3 or with @value{NGCC} 3.1 or newer, using the options
+@option{-gdwarf-2} or @option{-gstabs+}.  DWARF 2 is preferred over
+stabs+.  Most configurations of @value{NGCC} emit either DWARF 2 or
+stabs+ as their default debug format, so you usually don't need to
+specify a debug format explicitly.  Other compilers and/or debug formats
+are likely to work badly or not at all when using @value{GDBN} to debug
+C@t{++} code.
 @end quotation
 
 @enumerate
@@ -10357,6 +10356,7 @@ is supported other than to try it.
 @menu
 * Server::                     Using the gdbserver program
 * NetWare::                     Using the gdbserve.nlm program
+* Remote configuration::        Remote configuration
 * remote stub::                 Implementing a remote stub
 @end menu
 
@@ -10529,6 +10529,23 @@ argument is a device name (usually a serial device, like
 communications with the server via serial line @file{/dev/ttyb}.
 @end table
 
+@node Remote configuration
+@section Remote configuration
+
+The following configuration options are available when debugging remote
+programs:
+
+@table @code
+@kindex set remote hardware-watchpoint-limit
+@kindex set remote hardware-breakpoint-limit
+@anchor{set remote hardware-watchpoint-limit}
+@anchor{set remote hardware-breakpoint-limit}
+@item set remote hardware-watchpoint-limit @var{limit}
+@itemx set remote hardware-breakpoint-limit @var{limit}
+Restrict @value{GDBN} to using @var{limit} remote hardware breakpoint or
+watchpoints.  A limit of -1, the default, is treated as unlimited.
+@end table
+
 @node remote stub
 @section Implementing a remote stub
 
@@ -11147,9 +11164,12 @@ This command is supported only with some DPMI servers.
 @cindex native Cygwin debugging
 @cindex Cygwin-specific commands
 
-@value{GDBN} supports native debugging of MS Windows programs, and
-defines a few commands specific to the Cygwin port.  This
-subsection describes those commands.
+@value{GDBN} supports native debugging of MS Windows programs, including
+DLLs with and without symbolic debugging information. There are various
+additional Cygwin-specific commands, described in this subsection.  The
+subsubsection @pxref{Non-debug DLL symbols} describes working with DLLs
+that have no debugging symbols.
+
 
 @table @code
 @kindex info w32
@@ -11227,6 +11247,130 @@ Displays if the debuggee will be started with a shell.
 
 @end table
 
+@menu
+* Non-debug DLL symbols::  Support for DLLs without debugging symbols
+@end menu
+
+@node Non-debug DLL symbols
+@subsubsection Support for DLLs without debugging symbols
+@cindex DLLs with no debugging symbols
+@cindex Minimal symbols and DLLs
+
+Very often on windows, some of the DLLs that your program relies on do
+not include symbolic debugging information (for example,
+@file{kernel32.dll}). When @value{GDBN} doesn't recognize any debugging
+symbols in a DLL, it relies on the minimal amount of symbolic
+information contained in the DLL's export table. This subsubsection
+describes working with such symbols, known internally to @value{GDBN} as
+``minimal symbols''.
+
+Note that before the debugged program has started execution, no DLLs
+will have been loaded. The easiest way around this problem is simply to
+start the program --- either by setting a breakpoint or letting the
+program run once to completion. It is also possible to force
+@value{GDBN} to load a particular DLL before starting the executable ---
+see the shared library information in @pxref{Files} or the
+@code{dll-symbols} command in @pxref{Cygwin Native}. Currently,
+explicitly loading symbols from a DLL with no debugging information will
+cause the symbol names to be duplicated in @value{GDBN}'s lookup table,
+which may adversely affect symbol lookup performance.
+
+@subsubsection DLL name prefixes
+
+In keeping with the naming conventions used by the Microsoft debugging
+tools, DLL export symbols are made available with a prefix based on the
+DLL name, for instance @code{KERNEL32!CreateFileA}.  The plain name is
+also entered into the symbol table, so @code{CreateFileA} is often
+sufficient. In some cases there will be name clashes within a program
+(particularly if the executable itself includes full debugging symbols)
+necessitating the use of the fully qualified name when referring to the
+contents of the DLL. Use single-quotes around the name to avoid the
+exclamation mark (``!'')  being interpreted as a language operator.
+
+Note that the internal name of the DLL may be all upper-case, even
+though the file name of the DLL is lower-case, or vice-versa. Since
+symbols within @value{GDBN} are @emph{case-sensitive} this may cause
+some confusion. If in doubt, try the @code{info functions} and
+@code{info variables} commands or even @code{maint print msymbols} (see
+@pxref{Symbols}). Here's an example:
+
+@smallexample
+(gdb) info function CreateFileA
+All functions matching regular expression "CreateFileA":
+
+Non-debugging symbols:
+0x77e885f4  CreateFileA
+0x77e885f4  KERNEL32!CreateFileA
+@end smallexample
+
+@smallexample
+(gdb) info function !
+All functions matching regular expression "!":
+
+Non-debugging symbols:
+0x6100114c  cygwin1!__assert
+0x61004034  cygwin1!_dll_crt0@@0
+0x61004240  cygwin1!dll_crt0(per_process *)
+[etc...]
+@end smallexample
+
+@subsubsection Working with minimal symbols
+
+Symbols extracted from a DLL's export table do not contain very much
+type information. All that @value{GDBN} can do is guess whether a symbol
+refers to a function or variable depending on the linker section that
+contains the symbol. Also note that the actual contents of the memory
+contained in a DLL are not available unless the program is running. This
+means that you cannot examine the contents of a variable or disassemble
+a function within a DLL without a running program.
+
+Variables are generally treated as pointers and dereferenced
+automatically. For this reason, it is often necessary to prefix a
+variable name with the address-of operator (``&'') and provide explicit
+type information in the command. Here's an example of the type of
+problem:
+
+@smallexample
+(gdb) print 'cygwin1!__argv'
+$1 = 268572168
+@end smallexample
+
+@smallexample
+(gdb) x 'cygwin1!__argv'
+0x10021610:      "\230y\""
+@end smallexample
+
+And two possible solutions:
+
+@smallexample
+(gdb) print ((char **)'cygwin1!__argv')[0]
+$2 = 0x22fd98 "/cygdrive/c/mydirectory/myprogram"
+@end smallexample
+
+@smallexample
+(gdb) x/2x &'cygwin1!__argv'
+0x610c0aa8 <cygwin1!__argv>:    0x10021608      0x00000000
+(gdb) x/x 0x10021608
+0x10021608:     0x0022fd98
+(gdb) x/s 0x0022fd98
+0x22fd98:        "/cygdrive/c/mydirectory/myprogram"
+@end smallexample
+
+Setting a break point within a DLL is possible even before the program
+starts execution. However, under these circumstances, @value{GDBN} can't
+examine the initial instructions of the function in order to skip the
+function's frame set-up code. You can work around this by using ``*&''
+to set the breakpoint at a raw memory address:
+
+@smallexample
+(gdb) break *&'python22!PyOS_Readline'
+Breakpoint 1 at 0x1e04eff0
+@end smallexample
+
+The author of these extensions is not entirely convinced that setting a
+break point within a shared DLL like @file{kernel32.dll} is completely
+safe.
+
 @node Embedded OS
 @section Embedded Operating Systems
 
@@ -13220,6 +13364,69 @@ string are the simple ones that consist of backslash followed by a
 letter.
 @end table
 
+@node Interpreters
+@chapter Command Interpreters
+@cindex command interpreters
+
+@value{GDBN} supports multiple command interpreters, and some command
+infrastructure to allow users or user interface writers to switch
+between interpreters or run commands in other interpreters.
+
+@value{GDBN} currently supports two command interpreters, the console
+interpreter (sometimes called the command-line interpreter or @sc{cli})
+and the machine interface interpreter (or @sc{gdb/mi}).  This manual
+describes both of these interfaces in great detail.
+
+By default, @value{GDBN} will start with the console interpreter.
+However, the user may choose to start @value{GDBN} with another
+interpreter by specifying the @option{-i} or @option{--interpreter}
+startup options.  Defined interpreters include:
+
+@table @code
+@item console
+@cindex console interpreter
+The traditional console or command-line interpreter.  This is the most often
+used interpreter with @value{GDBN}. With no interpreter specified at runtime,
+@value{GDBN} will use this interpreter.
+
+@item mi
+@cindex mi interpreter
+The newest @sc{gdb/mi} interface (currently @code{mi2}).  Used primarily
+by programs wishing to use @value{GDBN} as a backend for a debugger GUI
+or an IDE.  For more information, see @ref{GDB/MI, ,The @sc{gdb/mi}
+Interface}.
+
+@item mi2
+@cindex mi2 interpreter
+The current @sc{gdb/mi} interface.
+
+@item mi1
+@cindex mi1 interpreter
+The @sc{gdb/mi} interface included in @value{GDBN} 5.1, 5.2, and 5.3.
+
+@end table
+
+@cindex invoke another interpreter
+The interpreter being used by @value{GDBN} may not be dynamically
+switched at runtime.  Although possible, this could lead to a very
+precarious situation.  Consider an IDE using @sc{gdb/mi}.  If a user
+enters the command "interpreter-set console" in a console view,
+@value{GDBN} would switch to using the console interpreter, rendering
+the IDE inoperable!
+
+@kindex interpreter-exec
+Although you may only choose a single interpreter at startup, you may execute
+commands in any interpreter from the current interpreter using the appropriate
+command.  If you are running the console interpreter, simply use the
+@code{interpreter-exec} command:
+
+@smallexample
+interpreter-exec mi "-data-list-register-names"
+@end smallexample
+
+@sc{gdb/mi} has a similar command, although it is only available in versions of
+@value{GDBN} which support @sc{gdb/mi} version 2 (or greater).
+
 @node TUI
 @chapter @value{GDBN} Text User Interface
 @cindex TUI
index cf35a28..35acd14 100644 (file)
@@ -247,14 +247,15 @@ create_new_frame (read_register (FP_REGNUM), read_pc ()));
 Other than that, all the meaning imparted to @code{FP_REGNUM} is
 imparted by the machine-dependent code.  So, @code{FP_REGNUM} can have
 any value that is convenient for the code that creates new frames.
-(@code{create_new_frame} calls @code{INIT_EXTRA_FRAME_INFO} if it is
-defined; that is where you should use the @code{FP_REGNUM} value, if
-your frames are nonstandard.)
+(@code{create_new_frame} calls @code{DEPRECATED_INIT_EXTRA_FRAME_INFO}
+if it is defined; that is where you should use the @code{FP_REGNUM}
+value, if your frames are nonstandard.)
 
 @cindex frame chain
 Given a @value{GDBN} frame, define @code{FRAME_CHAIN} to determine the
 address of the calling function's frame.  This will be used to create a
-new @value{GDBN} frame struct, and then @code{INIT_EXTRA_FRAME_INFO} and
+new @value{GDBN} frame struct, and then
+@code{DEPRECATED_INIT_EXTRA_FRAME_INFO} and
 @code{DEPRECATED_INIT_FRAME_PC} will be called for the new frame.
 
 @section Breakpoint Handling
@@ -3251,12 +3252,13 @@ chain pointers, dummy frames, and frames whose PC values are inside the
 startup file (e.g.@: @file{crt0.o}), inside @code{main}, or inside
 @code{_start}.
 
-@item FRAME_INIT_SAVED_REGS(@var{frame})
-@findex FRAME_INIT_SAVED_REGS
+@item DEPRECATED_FRAME_INIT_SAVED_REGS(@var{frame})
+@findex DEPRECATED_FRAME_INIT_SAVED_REGS
 See @file{frame.h}.  Determines the address of all registers in the
 current stack frame storing each in @code{frame->saved_regs}.  Space for
 @code{frame->saved_regs} shall be allocated by
-@code{FRAME_INIT_SAVED_REGS} using @code{frame_saved_regs_zalloc}.
+@code{DEPRECATED_FRAME_INIT_SAVED_REGS} using
+@code{frame_saved_regs_zalloc}.
 
 @code{FRAME_FIND_SAVED_REGS} and @code{EXTRA_FRAME_INFO} are deprecated.
 
@@ -3357,8 +3359,8 @@ On HP-UX, certain system routines (millicode) have names beginning with
 @samp{$} or @samp{$$}.  For example, @code{$$dyncall} is a millicode
 routine that handles inter-space procedure calls on PA-RISC.
 
-@item INIT_EXTRA_FRAME_INFO (@var{fromleaf}, @var{frame})
-@findex INIT_EXTRA_FRAME_INFO
+@item DEPRECATED_INIT_EXTRA_FRAME_INFO (@var{fromleaf}, @var{frame})
+@findex DEPRECATED_INIT_EXTRA_FRAME_INFO
 If additional information about the frame is required this should be
 stored in @code{frame->extra_info}.  Space for @code{frame->extra_info}
 is allocated using @code{frame_extra_info_zalloc}.
@@ -3437,13 +3439,6 @@ method like @code{INTEGER_TO_ADDRESS} certainly makes it possible for
 @xref{Target Architecture Definition, , Pointers Are Not Always
 Addresses}.
 
-@item IS_TRAPPED_INTERNALVAR (@var{name})
-@findex IS_TRAPPED_INTERNALVAR
-This is an ugly hook to allow the specification of special actions that
-should occur as a side-effect of setting the value of a variable
-internal to @value{GDBN}.  Currently only used by the h8500.  Note that this
-could be either a host or target conditional.
-
 @item NEED_TEXT_START_END
 @findex NEED_TEXT_START_END
 Define this if @value{GDBN} should determine the start and end addresses of the
@@ -4102,7 +4097,7 @@ Some mechanisms do not work with multi-arch.  They include:
 @item EXTRA_FRAME_INFO
 Delete.
 @item FRAME_FIND_SAVED_REGS
-Replaced with @code{FRAME_INIT_SAVED_REGS}
+Replaced with @code{DEPRECATED_FRAME_INIT_SAVED_REGS}
 @end table
 
 @noindent
index 49e3689..e601a4d 100644 (file)
@@ -663,7 +663,7 @@ extract_floating (const void *addr, int len)
 
   if (fmt == NULL)
     {
-      warning ("Can't store a floating-point number of %d bytes.", len);
+      warning ("Can't extract a floating-point number of %d bytes.", len);
       return NAN;
     }
 
index c928855..6bedddb 100644 (file)
@@ -172,11 +172,11 @@ extern file_ptr dwarf_eh_frame_offset;
 extern unsigned int dwarf_eh_frame_size;
 extern asection *dwarf_frame_section;
 extern asection *dwarf_eh_frame_section;
-
 \f
 
+
 extern char *dwarf2_read_section (struct objfile *objfile, file_ptr offset,
-                                 unsigned int size, asectionsectp);
+                                 unsigned int size, asection *sectp);
 
 static struct fde_unit *fde_unit_alloc (void);
 static struct cie_unit *cie_unit_alloc (void);
@@ -199,7 +199,8 @@ static LONGEST read_sleb128 (bfd *abfd, char **p);
 static CORE_ADDR read_pointer (bfd *abfd, char **p);
 static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p,
                                       unsigned char encoding);
-static enum ptr_encoding pointer_encoding (unsigned char encoding);
+static enum ptr_encoding pointer_encoding (unsigned char encoding,
+                                          struct objfile *objfile);
 
 static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read);
 static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read,
@@ -462,7 +463,9 @@ read_pointer (bfd *abfd, char **p)
     case 8:
       return read_8u (abfd, p);
     default:
-      error ("dwarf cfi error: unsupported target address length.");
+      error
+       ("dwarf cfi error: unsupported target address length [in module %s]",
+        bfd_get_filename (abfd));
     }
 }
 
@@ -509,7 +512,8 @@ read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding)
 
     default:
       internal_error (__FILE__, __LINE__,
-                     "read_encoded_pointer: unknown pointer encoding");
+                     "read_encoded_pointer: unknown pointer encoding [in module %s]",
+                     bfd_get_filename (abfd));
     }
 
   return ret;
@@ -520,12 +524,14 @@ read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding)
    - encoding & 0x70 : type (absolute, relative, ...)
    - encoding & 0x80 : indirect flag (DW_EH_PE_indirect == 0x80).  */
 enum ptr_encoding
-pointer_encoding (unsigned char encoding)
+pointer_encoding (unsigned char encoding, struct objfile *objfile)
 {
   int ret;
 
   if (encoding & DW_EH_PE_indirect)
-    warning ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect");
+    warning
+      ("CFI: Unsupported pointer encoding: DW_EH_PE_indirect [in module %s]",
+       objfile->name);
 
   switch (encoding & 0x70)
     {
@@ -537,7 +543,9 @@ pointer_encoding (unsigned char encoding)
       ret = encoding & 0x70;
       break;
     default:
-      internal_error (__FILE__, __LINE__, "CFI: unknown pointer encoding");
+      internal_error (__FILE__, __LINE__,
+                     "CFI: unknown pointer encoding [in module %s]",
+                     objfile->name);
     }
   return ret;
 }
@@ -614,8 +622,10 @@ execute_cfa_program (struct objfile *objfile, char *insn_ptr, char *insn_end,
            fs->pc = read_encoded_pointer (objfile->obfd, &insn_ptr,
                                           fs->addr_encoding);
 
-           if (pointer_encoding (fs->addr_encoding) != PE_absptr)
-             warning ("CFI: DW_CFA_set_loc uses relative addressing");
+           if (pointer_encoding (fs->addr_encoding, objfile) != PE_absptr)
+             warning
+               ("CFI: DW_CFA_set_loc uses relative addressing [in module %s]",
+                objfile->name);
 
            break;
 
@@ -764,7 +774,9 @@ execute_cfa_program (struct objfile *objfile, char *insn_ptr, char *insn_end,
            break;
 
          default:
-           error ("dwarf cfi error: unknown cfa instruction %d.", insn);
+           error
+             ("dwarf cfi error: unknown cfa instruction %d [in module %s]",
+              insn, objfile->name);
          }
     }
 }
@@ -1027,25 +1039,33 @@ execute_stack_op (struct objfile *objfile,
 
        case DW_OP_dup:
          if (stack_elt < 1)
-           internal_error (__FILE__, __LINE__, "execute_stack_op error");
+           internal_error (__FILE__, __LINE__,
+                           "execute_stack_op error [in module %s]",
+                           objfile->name);
          result = stack[stack_elt - 1];
          break;
 
        case DW_OP_drop:
          if (--stack_elt < 0)
-           internal_error (__FILE__, __LINE__, "execute_stack_op error");
+           internal_error (__FILE__, __LINE__,
+                           "execute_stack_op error [in module %s]",
+                           objfile->name);
          goto no_push;
 
        case DW_OP_pick:
          offset = *op_ptr++;
          if (offset >= stack_elt - 1)
-           internal_error (__FILE__, __LINE__, "execute_stack_op error");
+           internal_error (__FILE__, __LINE__,
+                           "execute_stack_op error [in module %s]",
+                           objfile->name);
          result = stack[stack_elt - 1 - offset];
          break;
 
        case DW_OP_over:
          if (stack_elt < 2)
-           internal_error (__FILE__, __LINE__, "execute_stack_op error");
+           internal_error (__FILE__, __LINE__,
+                           "execute_stack_op error [in module %s]",
+                           objfile->name);
          result = stack[stack_elt - 2];
          break;
 
@@ -1054,7 +1074,9 @@ execute_stack_op (struct objfile *objfile,
            CORE_ADDR t1, t2, t3;
 
            if (stack_elt < 3)
-             internal_error (__FILE__, __LINE__, "execute_stack_op error");
+             internal_error (__FILE__, __LINE__,
+                             "execute_stack_op error [in module %s]",
+                             objfile->name);
            t1 = stack[stack_elt - 1];
            t2 = stack[stack_elt - 2];
            t3 = stack[stack_elt - 3];
@@ -1072,7 +1094,9 @@ execute_stack_op (struct objfile *objfile,
        case DW_OP_plus_uconst:
          /* Unary operations.  */
          if (--stack_elt < 0)
-           internal_error (__FILE__, __LINE__, "execute_stack_op error");
+           internal_error (__FILE__, __LINE__,
+                           "execute_stack_op error [in module %s]",
+                           objfile->name);
          result = stack[stack_elt];
 
          switch (op)
@@ -1082,7 +1106,8 @@ execute_stack_op (struct objfile *objfile,
                int len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
                if (len != 4 && len != 8)
                  internal_error (__FILE__, __LINE__,
-                                 "execute_stack_op error");
+                                 "execute_stack_op error [in module %s]",
+                                 objfile->name);
                result = read_memory_unsigned_integer (result, len);
              }
              break;
@@ -1092,7 +1117,8 @@ execute_stack_op (struct objfile *objfile,
                int len = *op_ptr++;
                if (len != 1 && len != 2 && len != 4 && len != 8)
                  internal_error (__FILE__, __LINE__,
-                                 "execute_stack_op error");
+                                 "execute_stack_op error [in module %s]",
+                                 objfile->name);
                result = read_memory_unsigned_integer (result, len);
              }
              break;
@@ -1132,7 +1158,9 @@ execute_stack_op (struct objfile *objfile,
            /* Binary operations.  */
            CORE_ADDR first, second;
            if ((stack_elt -= 2) < 0)
-             internal_error (__FILE__, __LINE__, "execute_stack_op error");
+             internal_error (__FILE__, __LINE__,
+                             "execute_stack_op error [in module %s]",
+                             objfile->name);
            second = stack[stack_elt];
            first = stack[stack_elt + 1];
 
@@ -1190,7 +1218,9 @@ execute_stack_op (struct objfile *objfile,
                result = (LONGEST) first != (LONGEST) second;
                break;
              default:
-               error ("execute_stack_op: Unknown DW_OP_ value");
+               error
+                 ("execute_stack_op: Unknown DW_OP_ value [in module %s]",
+                  objfile->name);
                break;
              }
          }
@@ -1203,7 +1233,9 @@ execute_stack_op (struct objfile *objfile,
 
        case DW_OP_bra:
          if (--stack_elt < 0)
-           internal_error (__FILE__, __LINE__, "execute_stack_op error");
+           internal_error (__FILE__, __LINE__,
+                           "execute_stack_op error [in module %s]",
+                           objfile->name);
          offset = read_2s (objfile->obfd, &op_ptr);
          if (stack[stack_elt] != 0)
            op_ptr += offset;
@@ -1213,12 +1245,16 @@ execute_stack_op (struct objfile *objfile,
          goto no_push;
 
        default:
-         internal_error (__FILE__, __LINE__, "execute_stack_op error");
+         internal_error (__FILE__, __LINE__,
+                         "execute_stack_op error [in module %s]",
+                         objfile->name);
        }
 
       /* Most things push a result value.  */
       if ((size_t) stack_elt >= sizeof (stack) / sizeof (*stack))
-       internal_error (__FILE__, __LINE__, "execute_stack_op error");
+       internal_error (__FILE__, __LINE__,
+                       "execute_stack_op error [in module %s]",
+                       objfile->name);
       stack[++stack_elt] = result;
     no_push:;
     }
@@ -1226,7 +1262,8 @@ execute_stack_op (struct objfile *objfile,
   /* We were executing this program to get a value.  It should be
      at top of stack.  */
   if (--stack_elt < 0)
-    internal_error (__FILE__, __LINE__, "execute_stack_op error");
+    internal_error (__FILE__, __LINE__,
+                   "execute_stack_op error [in module %s]", objfile->name);
   return stack[stack_elt];
 }
 
@@ -1311,7 +1348,8 @@ update_context (struct context *context, struct frame_state *fs, int chain)
              orig_context->reg[fs->regs.reg[i].loc.reg].loc.addr;
            break;
          default:
-           internal_error (__FILE__, __LINE__, "bad switch");
+           internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
+                           orig_context->reg[fs->regs.reg[i].loc.reg].how);
          }
        break;
       case REG_SAVED_EXP:
@@ -1328,7 +1366,8 @@ update_context (struct context *context, struct frame_state *fs, int chain)
        }
        break;
       default:
-       internal_error (__FILE__, __LINE__, "bad switch");
+       internal_error (__FILE__, __LINE__, "bad switch 0x%02X",
+                       fs->regs.reg[i].how);
       }
   get_reg ((char *) &context->ra, context, fs->retaddr_column);
   unwind_tmp_obstack_free ();
@@ -1540,13 +1579,14 @@ parse_frame_info (struct objfile *objfile, file_ptr frame_offset,
                      cie = cie->next;
                    }
                  if (!cie)
-                   error ("CFI: can't find CIE pointer");
+                   error ("CFI: can't find CIE pointer [in module %s]",
+                          bfd_get_filename (abfd));
                }
 
              init_loc = read_encoded_pointer (abfd, &start,
                                               cie->addr_encoding);
 
-             switch (pointer_encoding (cie->addr_encoding))
+             switch (pointer_encoding (cie->addr_encoding, objfile))
                {
                case PE_absptr:
                  break;
@@ -1556,7 +1596,8 @@ parse_frame_info (struct objfile *objfile, file_ptr frame_offset,
                  init_loc += curr_section_vma + start - frame_buffer;
                  break;
                default:
-                 warning ("CFI: Unsupported pointer encoding\n");
+                 warning ("CFI: Unsupported pointer encoding [in module %s]",
+                          bfd_get_filename (abfd));
                }
 
              /* For relocatable objects we must add an offset telling
@@ -1763,7 +1804,7 @@ cfi_init_frame_pc (int fromleaf, struct frame_info *fi)
       CORE_ADDR pc;
       /* FIXME: cagney/2002-12-04: This is straight wrong.  It's
          assuming that the PC is CORE_ADDR (a host quantity) in size.  */
-      get_reg ((void *)&pc, UNWIND_CONTEXT (get_next_frame (fi)), PC_REGNUM);
+      get_reg ((void *) &pc, UNWIND_CONTEXT (get_next_frame (fi)), PC_REGNUM);
       return pc;
     }
   else
@@ -1779,7 +1820,9 @@ cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi)
   unwind_tmp_obstack_init ();
 
   fs = frame_state_alloc ();
-  deprecated_set_frame_context (fi, frame_obstack_zalloc (sizeof (struct context)));
+  deprecated_set_frame_context (fi,
+                               frame_obstack_zalloc (sizeof
+                                                     (struct context)));
   UNWIND_CONTEXT (fi)->reg =
     frame_obstack_zalloc (sizeof (struct context_reg) * NUM_REGS);
   memset (UNWIND_CONTEXT (fi)->reg, 0,
@@ -1864,8 +1907,8 @@ cfi_get_saved_register (char *raw_buffer,
              UNWIND_CONTEXT (frame)->reg[regnum].loc.offset;
          break;
        case REG_CTX_SAVED_REG:
-         deprecated_read_register_gen (UNWIND_CONTEXT (frame)->reg[regnum].loc.reg,
-                                       raw_buffer);
+         deprecated_read_register_gen (UNWIND_CONTEXT (frame)->reg[regnum].
+                                       loc.reg, raw_buffer);
          if (lval != NULL)
            *lval = lval_register;
          if (addrp != NULL)
@@ -1890,7 +1933,8 @@ cfi_get_saved_register (char *raw_buffer,
          break;
        default:
          internal_error (__FILE__, __LINE__,
-                         "cfi_get_saved_register: unknown register rule");
+                         "cfi_get_saved_register: unknown register rule 0x%02X",
+                         UNWIND_CONTEXT (frame)->reg[regnum].how);
        }
     }
 }
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
new file mode 100644 (file)
index 0000000..df6fc73
--- /dev/null
@@ -0,0 +1,687 @@
+/* Dwarf2 Expression Evaluator
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+   Contributed by Daniel Berlin (dan@dberlin.org)
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "symtab.h"
+#include "gdbtypes.h"
+#include "value.h"
+#include "gdbcore.h"
+#include "elf/dwarf2.h"
+#include "dwarf2expr.h"
+
+/* Local prototypes.  */
+
+static void execute_stack_op (struct dwarf_expr_context *,
+                             unsigned char *, unsigned char *);
+
+/* Create a new context for the expression evaluator.  */
+
+struct dwarf_expr_context *
+new_dwarf_expr_context ()
+{
+  struct dwarf_expr_context *retval;
+  retval = xcalloc (1, sizeof (struct dwarf_expr_context));
+  retval->stack_len = 10;
+  retval->stack = xmalloc (10 * sizeof (CORE_ADDR));
+  return retval;
+}
+
+/* Release the memory allocated to CTX.  */
+
+void
+free_dwarf_expr_context (struct dwarf_expr_context *ctx)
+{
+  xfree (ctx->stack);
+  xfree (ctx);
+}
+
+/* Expand the memory allocated to CTX's stack to contain at least
+   NEED more elements than are currently used.  */
+
+static void
+dwarf_expr_grow_stack (struct dwarf_expr_context *ctx, size_t need)
+{
+  if (ctx->stack_len + need > ctx->stack_allocated)
+    {
+      size_t templen = ctx->stack_len * 2;
+      while (templen < (ctx->stack_len + need))
+          templen *= 2;
+      ctx->stack = xrealloc (ctx->stack,
+                            templen * sizeof (CORE_ADDR));
+      ctx->stack_allocated = templen;
+    }
+}
+
+/* Push VALUE onto CTX's stack.  */
+
+void
+dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value)
+{
+  dwarf_expr_grow_stack (ctx, 1);
+  ctx->stack[ctx->stack_len++] = value;
+}
+
+/* Pop the top item off of CTX's stack.  */
+
+void
+dwarf_expr_pop (struct dwarf_expr_context *ctx)
+{
+  if (ctx->stack_len <= 0)
+    error ("dwarf expression stack underflow");
+  ctx->stack_len--;
+}
+
+/* Retrieve the N'th item on CTX's stack.  */
+
+CORE_ADDR
+dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n)
+{
+  if (ctx->stack_len < n)
+     error ("Asked for position %d of stack, stack only has %d elements on it\n",
+           n, ctx->stack_len);
+  return ctx->stack[ctx->stack_len - (1 + n)];
+
+}
+
+/* Evaluate the expression at ADDR (LEN bytes long) using the context
+   CTX.  */
+
+void
+dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr,
+                size_t len)
+{
+  execute_stack_op (ctx, addr, addr + len);
+}
+
+/* Decode the unsigned LEB128 constant at BUF into the variable pointed to
+   by R, and return the new value of BUF.  Verify that it doesn't extend
+   past BUF_END.  */
+
+unsigned char *
+read_uleb128 (unsigned char *buf, unsigned char *buf_end, ULONGEST * r)
+{
+  unsigned shift = 0;
+  ULONGEST result = 0;
+  unsigned char byte;
+
+  while (1)
+    {
+      if (buf >= buf_end)
+       error ("read_uleb128: Corrupted DWARF expression.");
+
+      byte = *buf++;
+      result |= (byte & 0x7f) << shift;
+      if ((byte & 0x80) == 0)
+       break;
+      shift += 7;
+    }
+  *r = result;
+  return buf;
+}
+
+/* Decode the signed LEB128 constant at BUF into the variable pointed to
+   by R, and return the new value of BUF.  Verify that it doesn't extend
+   past BUF_END.  */
+
+unsigned char *
+read_sleb128 (unsigned char *buf, unsigned char *buf_end, LONGEST * r)
+{
+  unsigned shift = 0;
+  LONGEST result = 0;
+  unsigned char byte;
+
+  while (1)
+    {
+      if (buf >= buf_end)
+       error ("read_sleb128: Corrupted DWARF expression.");
+
+      byte = *buf++;
+      result |= (byte & 0x7f) << shift;
+      shift += 7;
+      if ((byte & 0x80) == 0)
+       break;
+    }
+  if (shift < (sizeof (*r) * 8) && (byte & 0x40) != 0)
+    result |= -(1 << shift);
+
+  *r = result;
+  return buf;
+}
+
+/* Read an address from BUF, and verify that it doesn't extend past
+   BUF_END.  The address is returned, and *BYTES_READ is set to the
+   number of bytes read from BUF.  */
+
+static CORE_ADDR
+read_address (unsigned char *buf, unsigned char *buf_end, int *bytes_read)
+{
+  CORE_ADDR result;
+
+  if (buf_end - buf < TARGET_ADDR_BIT / TARGET_CHAR_BIT)
+    error ("read_address: Corrupted DWARF expression.");
+
+  *bytes_read = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
+  result = extract_address (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+  return result;
+}
+
+/* Return the type of an address, for unsigned arithmetic.  */
+
+static struct type *
+unsigned_address_type (void)
+{
+  switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT)
+    {
+    case 2:
+      return builtin_type_uint16;
+    case 4:
+      return builtin_type_uint32;
+    case 8:
+      return builtin_type_uint64;
+    default:
+      internal_error (__FILE__, __LINE__,
+                     "Unsupported address size.\n");
+    }
+}
+
+/* Return the type of an address, for signed arithmetic.  */
+
+static struct type *
+signed_address_type (void)
+{
+  switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT)
+    {
+    case 2:
+      return builtin_type_int16;
+    case 4:
+      return builtin_type_int32;
+    case 8:
+      return builtin_type_int64;
+    default:
+      internal_error (__FILE__, __LINE__,
+                     "Unsupported address size.\n");
+    }
+}
+\f
+/* The engine for the expression evaluator.  Using the context in CTX,
+   evaluate the expression between OP_PTR and OP_END.  */
+
+static void
+execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
+                 unsigned char *op_end)
+{
+  while (op_ptr < op_end)
+    {
+      enum dwarf_location_atom op = *op_ptr++;
+      CORE_ADDR result, memaddr;
+      ULONGEST uoffset, reg;
+      LONGEST offset;
+      int bytes_read;
+      enum lval_type expr_lval;
+
+      ctx->in_reg = 0;
+
+      switch (op)
+       {
+       case DW_OP_lit0:
+       case DW_OP_lit1:
+       case DW_OP_lit2:
+       case DW_OP_lit3:
+       case DW_OP_lit4:
+       case DW_OP_lit5:
+       case DW_OP_lit6:
+       case DW_OP_lit7:
+       case DW_OP_lit8:
+       case DW_OP_lit9:
+       case DW_OP_lit10:
+       case DW_OP_lit11:
+       case DW_OP_lit12:
+       case DW_OP_lit13:
+       case DW_OP_lit14:
+       case DW_OP_lit15:
+       case DW_OP_lit16:
+       case DW_OP_lit17:
+       case DW_OP_lit18:
+       case DW_OP_lit19:
+       case DW_OP_lit20:
+       case DW_OP_lit21:
+       case DW_OP_lit22:
+       case DW_OP_lit23:
+       case DW_OP_lit24:
+       case DW_OP_lit25:
+       case DW_OP_lit26:
+       case DW_OP_lit27:
+       case DW_OP_lit28:
+       case DW_OP_lit29:
+       case DW_OP_lit30:
+       case DW_OP_lit31:
+         result = op - DW_OP_lit0;
+         break;
+
+       case DW_OP_addr:
+         result = read_address (op_ptr, op_end, &bytes_read);
+         op_ptr += bytes_read;
+         break;
+
+       case DW_OP_const1u:
+         result = extract_unsigned_integer (op_ptr, 1);
+         op_ptr += 1;
+         break;
+       case DW_OP_const1s:
+         result = extract_signed_integer (op_ptr, 1);
+         op_ptr += 1;
+         break;
+       case DW_OP_const2u:
+         result = extract_unsigned_integer (op_ptr, 2);
+         op_ptr += 2;
+         break;
+       case DW_OP_const2s:
+         result = extract_signed_integer (op_ptr, 2);
+         op_ptr += 2;
+         break;
+       case DW_OP_const4u:
+         result = extract_unsigned_integer (op_ptr, 4);
+         op_ptr += 4;
+         break;
+       case DW_OP_const4s:
+         result = extract_signed_integer (op_ptr, 4);
+         op_ptr += 4;
+         break;
+       case DW_OP_const8u:
+         result = extract_unsigned_integer (op_ptr, 8);
+         op_ptr += 8;
+         break;
+       case DW_OP_const8s:
+         result = extract_signed_integer (op_ptr, 8);
+         op_ptr += 8;
+         break;
+       case DW_OP_constu:
+         op_ptr = read_uleb128 (op_ptr, op_end, &uoffset);
+         result = uoffset;
+         break;
+       case DW_OP_consts:
+         op_ptr = read_sleb128 (op_ptr, op_end, &offset);
+         result = offset;
+         break;
+
+       /* The DW_OP_reg operations are required to occur alone in
+          location expressions.  */
+       case DW_OP_reg0:
+       case DW_OP_reg1:
+       case DW_OP_reg2:
+       case DW_OP_reg3:
+       case DW_OP_reg4:
+       case DW_OP_reg5:
+       case DW_OP_reg6:
+       case DW_OP_reg7:
+       case DW_OP_reg8:
+       case DW_OP_reg9:
+       case DW_OP_reg10:
+       case DW_OP_reg11:
+       case DW_OP_reg12:
+       case DW_OP_reg13:
+       case DW_OP_reg14:
+       case DW_OP_reg15:
+       case DW_OP_reg16:
+       case DW_OP_reg17:
+       case DW_OP_reg18:
+       case DW_OP_reg19:
+       case DW_OP_reg20:
+       case DW_OP_reg21:
+       case DW_OP_reg22:
+       case DW_OP_reg23:
+       case DW_OP_reg24:
+       case DW_OP_reg25:
+       case DW_OP_reg26:
+       case DW_OP_reg27:
+       case DW_OP_reg28:
+       case DW_OP_reg29:
+       case DW_OP_reg30:
+       case DW_OP_reg31:
+         /* NOTE: in the presence of DW_OP_piece this check is incorrect.  */
+         if (op_ptr != op_end)
+           error ("DWARF-2 expression error: DW_OP_reg operations must be "
+                  "used alone.");
+
+         /* FIXME drow/2003-02-21: This call to read_reg could be pushed
+            into the evaluator's caller by changing the semantics for in_reg.
+            Then we wouldn't need to return an lval_type and a memaddr.  */
+         result = (ctx->read_reg) (ctx->baton, op - DW_OP_reg0, &expr_lval,
+                                   &memaddr);
+
+         if (expr_lval == lval_register)
+           {
+             ctx->regnum = op - DW_OP_reg0;
+             ctx->in_reg = 1;
+           }
+         else
+           result = memaddr;
+
+         break;
+
+       case DW_OP_regx:
+         op_ptr = read_uleb128 (op_ptr, op_end, &reg);
+         if (op_ptr != op_end)
+           error ("DWARF-2 expression error: DW_OP_reg operations must be "
+                  "used alone.");
+
+         result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr);
+
+         if (expr_lval == lval_register)
+           {
+             ctx->regnum = reg;
+             ctx->in_reg = 1;
+           }
+         else
+           result = memaddr;
+
+         break;
+
+       case DW_OP_breg0:
+       case DW_OP_breg1:
+       case DW_OP_breg2:
+       case DW_OP_breg3:
+       case DW_OP_breg4:
+       case DW_OP_breg5:
+       case DW_OP_breg6:
+       case DW_OP_breg7:
+       case DW_OP_breg8:
+       case DW_OP_breg9:
+       case DW_OP_breg10:
+       case DW_OP_breg11:
+       case DW_OP_breg12:
+       case DW_OP_breg13:
+       case DW_OP_breg14:
+       case DW_OP_breg15:
+       case DW_OP_breg16:
+       case DW_OP_breg17:
+       case DW_OP_breg18:
+       case DW_OP_breg19:
+       case DW_OP_breg20:
+       case DW_OP_breg21:
+       case DW_OP_breg22:
+       case DW_OP_breg23:
+       case DW_OP_breg24:
+       case DW_OP_breg25:
+       case DW_OP_breg26:
+       case DW_OP_breg27:
+       case DW_OP_breg28:
+       case DW_OP_breg29:
+       case DW_OP_breg30:
+       case DW_OP_breg31:
+         {
+           op_ptr = read_sleb128 (op_ptr, op_end, &offset);
+           result = (ctx->read_reg) (ctx->baton, op - DW_OP_breg0,
+                                     &expr_lval, &memaddr);
+           result += offset;
+         }
+         break;
+       case DW_OP_bregx:
+         {
+           op_ptr = read_uleb128 (op_ptr, op_end, &reg);
+           op_ptr = read_sleb128 (op_ptr, op_end, &offset);
+           result = (ctx->read_reg) (ctx->baton, reg, &expr_lval, &memaddr);
+           result += offset;
+         }
+         break;
+       case DW_OP_fbreg:
+         {
+           unsigned char *datastart;
+           size_t datalen;
+           unsigned int before_stack_len;
+
+           op_ptr = read_sleb128 (op_ptr, op_end, &offset);
+           /* Rather than create a whole new context, we simply
+              record the stack length before execution, then reset it
+              afterwards, effectively erasing whatever the recursive
+              call put there.  */
+           before_stack_len = ctx->stack_len;
+           (ctx->get_frame_base) (ctx->baton, &datastart, &datalen);
+           dwarf_expr_eval (ctx, datastart, datalen);
+           result = dwarf_expr_fetch (ctx, 0);
+           if (! ctx->in_reg)
+             {
+               char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+               int bytes_read;
+
+               (ctx->read_mem) (ctx->baton, buf, result,
+                                TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+               result = read_address (buf,
+                                      buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT,
+                                      &bytes_read);
+             }
+           result = result + offset;
+           ctx->stack_len = before_stack_len;
+           ctx->in_reg = 0;
+         }
+         break;
+       case DW_OP_dup:
+         result = dwarf_expr_fetch (ctx, 0);
+         break;
+
+       case DW_OP_drop:
+         dwarf_expr_pop (ctx);
+         goto no_push;
+
+       case DW_OP_pick:
+         offset = *op_ptr++;
+         result = dwarf_expr_fetch (ctx, offset);
+         break;
+
+       case DW_OP_over:
+         result = dwarf_expr_fetch (ctx, 1);
+         break;
+
+       case DW_OP_rot:
+         {
+           CORE_ADDR t1, t2, t3;
+
+           if (ctx->stack_len < 3)
+              error ("Not enough elements for DW_OP_rot. Need 3, have %d\n",
+                     ctx->stack_len);
+           t1 = ctx->stack[ctx->stack_len - 1];
+           t2 = ctx->stack[ctx->stack_len - 2];
+           t3 = ctx->stack[ctx->stack_len - 3];
+           ctx->stack[ctx->stack_len - 1] = t2;
+           ctx->stack[ctx->stack_len - 2] = t3;
+           ctx->stack[ctx->stack_len - 3] = t1;
+           goto no_push;
+         }
+
+       case DW_OP_deref:
+       case DW_OP_deref_size:
+       case DW_OP_abs:
+       case DW_OP_neg:
+       case DW_OP_not:
+       case DW_OP_plus_uconst:
+         /* Unary operations.  */
+         result = dwarf_expr_fetch (ctx, 0);
+         dwarf_expr_pop (ctx);
+
+         switch (op)
+           {
+           case DW_OP_deref:
+             {
+               char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+               int bytes_read;
+
+               (ctx->read_mem) (ctx->baton, buf, result,
+                                TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+               result = read_address (buf,
+                                      buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT,
+                                      &bytes_read);
+             }
+             break;
+
+           case DW_OP_deref_size:
+             {
+               char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+               int bytes_read;
+
+               (ctx->read_mem) (ctx->baton, buf, result, *op_ptr++);
+               result = read_address (buf,
+                                      buf + TARGET_ADDR_BIT / TARGET_CHAR_BIT,
+                                      &bytes_read);
+             }
+             break;
+
+           case DW_OP_abs:
+             if ((signed int) result < 0)
+               result = -result;
+             break;
+           case DW_OP_neg:
+             result = -result;
+             break;
+           case DW_OP_not:
+             result = ~result;
+             break;
+           case DW_OP_plus_uconst:
+             op_ptr = read_uleb128 (op_ptr, op_end, &reg);
+             result += reg;
+             break;
+           }
+         break;
+
+       case DW_OP_and:
+       case DW_OP_div:
+       case DW_OP_minus:
+       case DW_OP_mod:
+       case DW_OP_mul:
+       case DW_OP_or:
+       case DW_OP_plus:
+       case DW_OP_shl:
+       case DW_OP_shr:
+       case DW_OP_shra:
+       case DW_OP_xor:
+       case DW_OP_le:
+       case DW_OP_ge:
+       case DW_OP_eq:
+       case DW_OP_lt:
+       case DW_OP_gt:
+       case DW_OP_ne:
+         {
+           /* Binary operations.  Use the value engine to do computations in
+              the right width.  */
+           CORE_ADDR first, second;
+           enum exp_opcode binop;
+           struct value *val1, *val2;
+
+           second = dwarf_expr_fetch (ctx, 0);
+           dwarf_expr_pop (ctx);
+
+           first = dwarf_expr_fetch (ctx, 1);
+           dwarf_expr_pop (ctx);
+
+           val1 = value_from_longest (unsigned_address_type (), first);
+           val2 = value_from_longest (unsigned_address_type (), second);
+
+           switch (op)
+             {
+             case DW_OP_and:
+               binop = BINOP_BITWISE_AND;
+               break;
+             case DW_OP_div:
+               binop = BINOP_DIV;
+             case DW_OP_minus:
+               binop = BINOP_SUB;
+               break;
+             case DW_OP_mod:
+               binop = BINOP_MOD;
+               break;
+             case DW_OP_mul:
+               binop = BINOP_MUL;
+               break;
+             case DW_OP_or:
+               binop = BINOP_BITWISE_IOR;
+               break;
+             case DW_OP_plus:
+               binop = BINOP_ADD;
+               break;
+             case DW_OP_shl:
+               binop = BINOP_LSH;
+               break;
+             case DW_OP_shr:
+               binop = BINOP_RSH;
+             case DW_OP_shra:
+               binop = BINOP_RSH;
+               val1 = value_from_longest (signed_address_type (), first);
+               break;
+             case DW_OP_xor:
+               binop = BINOP_BITWISE_XOR;
+               break;
+             case DW_OP_le:
+               binop = BINOP_LEQ;
+               break;
+             case DW_OP_ge:
+               binop = BINOP_GEQ;
+               break;
+             case DW_OP_eq:
+               binop = BINOP_EQUAL;
+               break;
+             case DW_OP_lt:
+               binop = BINOP_LESS;
+               break;
+             case DW_OP_gt:
+               binop = BINOP_GTR;
+               break;
+             case DW_OP_ne:
+               binop = BINOP_NOTEQUAL;
+               break;
+             default:
+               internal_error (__FILE__, __LINE__,
+                               "Can't be reached.");
+             }
+           result = value_as_long (value_binop (val1, val2, binop));
+         }
+         break;
+
+       case DW_OP_GNU_push_tls_address:
+         result = dwarf_expr_fetch (ctx, 0);
+         dwarf_expr_pop (ctx);
+         result = (ctx->get_tls_address) (ctx->baton, result);
+         break;
+
+       case DW_OP_skip:
+         offset = extract_signed_integer (op_ptr, 2);
+         op_ptr += 2;
+         op_ptr += offset;
+         goto no_push;
+
+       case DW_OP_bra:
+         offset = extract_signed_integer (op_ptr, 2);
+         op_ptr += 2;
+         if (dwarf_expr_fetch (ctx, 0) != 0)
+           op_ptr += offset;
+         dwarf_expr_pop (ctx);
+         goto no_push;
+
+       case DW_OP_nop:
+         goto no_push;
+
+       default:
+         error ("Unhandled dwarf expression opcode");
+       }
+
+      /* Most things push a result value.  */
+      dwarf_expr_push (ctx, result);
+    no_push:;
+    }
+}
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
new file mode 100644 (file)
index 0000000..3d0fcb3
--- /dev/null
@@ -0,0 +1,103 @@
+/* Dwarf2 Expression Evaluator
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+   Contributed by Daniel Berlin (dan@dberlin.org)
+   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 (DWARF2EXPR_H)
+#define DWARF2EXPR_H
+
+/* The expression evaluator works with a dwarf_expr_context, describing
+   its current state and its callbacks.  */
+struct dwarf_expr_context
+{
+  /* The stack of values, allocated with xmalloc.  */
+  CORE_ADDR *stack;
+
+  /* The number of values currently pushed on the stack, and the
+     number of elements allocated to the stack.  */
+  int stack_len, stack_allocated;
+
+  /* An opaque argument provided by the caller, which will be passed
+     to all of the callback functions.  */
+  void *baton;
+
+  /* Return the value of register number REGNUM.  LVALP will be set
+     to the kind of lval this register is (generally lval_register
+     for the current frame's registers or lval_memory for a register
+     saved to the stack).  For lval_memory ADDRP will be set to the
+     saved location of the register.  */
+  CORE_ADDR (*read_reg) (void *baton, int regnum, enum lval_type *lvalp,
+                        CORE_ADDR *addrp);
+
+  /* Read LENGTH bytes at ADDR into BUF.  */
+  void (*read_mem) (void *baton, char *buf, CORE_ADDR addr,
+                   size_t length);
+
+  /* Return the location expression for the frame base attribute, in
+     START and LENGTH.  The result must be live until the current
+     expression evaluation is complete.  */
+  void (*get_frame_base) (void *baton, unsigned char **start,
+                        size_t *length);
+
+  /* Return the thread-local storage address for
+     DW_OP_GNU_push_tls_address.  */
+  CORE_ADDR (*get_tls_address) (void *baton, CORE_ADDR offset);
+
+#if 0
+  /* Not yet implemented.  */
+
+  /* Return the location expression for the dwarf expression
+     subroutine in the die at OFFSET in the current compilation unit.
+     The result must be live until the current expression evaluation
+     is complete.  */
+  unsigned char *(*get_subr) (void *baton, off_t offset, size_t *length);
+
+  /* Return the `object address' for DW_OP_push_object_address.  */
+  CORE_ADDR (*get_object_address) (void *baton);
+#endif
+
+  /* The current depth of dwarf expression recursion, via DW_OP_call*,
+     DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
+     depth we'll tolerate before raising an error.  */
+  int recursion_depth, max_recursion_depth;
+
+  /* Non-zero if the result is in a register.  The register number
+     will be in REGNUM, and the result will be the contents of the
+     register.  */
+  int in_reg;
+
+  /* If the result is in a register, the register number.  */
+  int regnum;
+};
+
+struct dwarf_expr_context *new_dwarf_expr_context ();
+void free_dwarf_expr_context (struct dwarf_expr_context *ctx);
+
+void dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value);
+void dwarf_expr_pop (struct dwarf_expr_context *ctx);
+void dwarf_expr_eval (struct dwarf_expr_context *ctx, unsigned char *addr,
+                     size_t len);
+CORE_ADDR dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n);
+
+
+unsigned char *read_uleb128 (unsigned char *buf, unsigned char *buf_end,
+                            ULONGEST * r);
+unsigned char *read_sleb128 (unsigned char *buf, unsigned char *buf_end,
+                            LONGEST * r);
+
+#endif
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
new file mode 100644 (file)
index 0000000..55de8da
--- /dev/null
@@ -0,0 +1,351 @@
+/* DWARF 2 location expression support for GDB.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "ui-out.h"
+#include "value.h"
+#include "frame.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "inferior.h"
+#include "ax.h"
+#include "ax-gdb.h"
+
+#include "elf/dwarf2.h"
+#include "dwarf2expr.h"
+#include "dwarf2loc.h"
+
+#include "gdb_string.h"
+
+#ifndef DWARF2_REG_TO_REGNUM
+#define DWARF2_REG_TO_REGNUM(REG) (REG)
+#endif
+
+/* This is the baton used when performing dwarf2 expression
+   evaluation.  */
+struct dwarf_expr_baton
+{
+  struct frame_info *frame;
+  struct objfile *objfile;
+};
+
+/* Helper functions for dwarf2_evaluate_loc_desc.  */
+
+/* Using the frame specified in BATON, read register REGNUM.  The lval
+   type will be returned in LVALP, and for lval_memory the register
+   save address will be returned in ADDRP.  */
+static CORE_ADDR
+dwarf_expr_read_reg (void *baton, int regnum, enum lval_type *lvalp,
+                    CORE_ADDR *addrp)
+{
+  CORE_ADDR result;
+  struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+  char *buf = (char *) alloca (MAX_REGISTER_RAW_SIZE);
+  int optimized, realnum;
+
+  frame_register (debaton->frame, DWARF2_REG_TO_REGNUM (regnum),
+                 &optimized, lvalp, addrp, &realnum, buf);
+  result = extract_address (buf, REGISTER_RAW_SIZE (regnum));
+
+  return result;
+}
+
+/* Read memory at ADDR (length LEN) into BUF.  */
+
+static void
+dwarf_expr_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len)
+{
+  read_memory (addr, buf, len);
+}
+
+/* Using the frame specified in BATON, find the location expression
+   describing the frame base.  Return a pointer to it in START and
+   its length in LENGTH.  */
+static void
+dwarf_expr_frame_base (void *baton, unsigned char **start, size_t * length)
+{
+  struct symbol *framefunc;
+  struct dwarf2_locexpr_baton *symbaton;
+  struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+  framefunc = get_frame_function (debaton->frame);
+  symbaton = SYMBOL_LOCATION_BATON (framefunc);
+  *start = symbaton->data;
+  *length = symbaton->size;
+}
+
+/* Using the objfile specified in BATON, find the address for the
+   current thread's thread-local storage with offset OFFSET.  */
+static CORE_ADDR
+dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
+{
+  struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+  CORE_ADDR addr;
+
+  if (target_get_thread_local_address_p ())
+    addr = target_get_thread_local_address (inferior_ptid,
+                                           debaton->objfile,
+                                           offset);
+  else
+    error ("Cannot find thread-local variables on this target");
+
+  return addr;
+}
+
+/* Evaluate a location description, starting at DATA and with length
+   SIZE, to find the current location of variable VAR in the context
+   of FRAME.  */
+static struct value *
+dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+                         unsigned char *data, unsigned short size,
+                         struct objfile *objfile)
+{
+  CORE_ADDR result;
+  struct value *retval;
+  struct dwarf_expr_baton baton;
+  struct dwarf_expr_context *ctx;
+
+  baton.frame = frame;
+  baton.objfile = objfile;
+
+  ctx = new_dwarf_expr_context ();
+  ctx->baton = &baton;
+  ctx->read_reg = dwarf_expr_read_reg;
+  ctx->read_mem = dwarf_expr_read_mem;
+  ctx->get_frame_base = dwarf_expr_frame_base;
+  ctx->get_tls_address = dwarf_expr_tls_address;
+
+  dwarf_expr_eval (ctx, data, size);
+
+  retval = allocate_value (SYMBOL_TYPE (var));
+  VALUE_BFD_SECTION (retval) = SYMBOL_BFD_SECTION (var);
+
+  if (ctx->in_reg)
+    {
+      store_unsigned_integer (VALUE_CONTENTS_RAW (retval),
+                             TYPE_LENGTH (SYMBOL_TYPE (var)),
+                             dwarf_expr_fetch (ctx, 0));
+      VALUE_LVAL (retval) = lval_register;
+      VALUE_REGNO (retval) = ctx->regnum;
+    }
+  else
+    {
+      result = dwarf_expr_fetch (ctx, 0);
+      VALUE_LVAL (retval) = lval_memory;
+      VALUE_LAZY (retval) = 1;
+      VALUE_ADDRESS (retval) = result;
+    }
+
+  free_dwarf_expr_context (ctx);
+
+  return retval;
+}
+
+
+
+
+\f
+/* Helper functions and baton for dwarf2_loc_desc_needs_frame.  */
+
+struct needs_frame_baton
+{
+  int needs_frame;
+};
+
+/* Reads from registers do require a frame.  */
+static CORE_ADDR
+needs_frame_read_reg (void *baton, int regnum, enum lval_type *lvalp,
+                           CORE_ADDR *addrp)
+{
+  struct needs_frame_baton *nf_baton = baton;
+  nf_baton->needs_frame = 1;
+  return 1;
+}
+
+/* Reads from memory do not require a frame.  */
+static void
+needs_frame_read_mem (void *baton, char *buf, CORE_ADDR addr, size_t len)
+{
+  memset (buf, 0, len);
+}
+
+/* Frame-relative accesses do require a frame.  */
+static void
+needs_frame_frame_base (void *baton, unsigned char **start, size_t * length)
+{
+  static char lit0 = DW_OP_lit0;
+  struct needs_frame_baton *nf_baton = baton;
+
+  *start = &lit0;
+  *length = 1;
+
+  nf_baton->needs_frame = 1;
+}
+
+/* Thread-local accesses do require a frame.  */
+static CORE_ADDR
+needs_frame_tls_address (void *baton, CORE_ADDR offset)
+{
+  struct needs_frame_baton *nf_baton = baton;
+  nf_baton->needs_frame = 1;
+  return 1;
+}
+
+/* Return non-zero iff the location expression at DATA (length SIZE)
+   requires a frame to evaluate.  */
+
+static int
+dwarf2_loc_desc_needs_frame (unsigned char *data, unsigned short size)
+{
+  struct needs_frame_baton baton;
+  struct dwarf_expr_context *ctx;
+
+  baton.needs_frame = 0;
+
+  ctx = new_dwarf_expr_context ();
+  ctx->baton = &baton;
+  ctx->read_reg = needs_frame_read_reg;
+  ctx->read_mem = needs_frame_read_mem;
+  ctx->get_frame_base = needs_frame_frame_base;
+  ctx->get_tls_address = needs_frame_tls_address;
+
+  dwarf_expr_eval (ctx, data, size);
+
+  free_dwarf_expr_context (ctx);
+
+  return baton.needs_frame;
+}
+
+
+
+\f
+/* Return the value of SYMBOL in FRAME using the DWARF-2 expression
+   evaluator to calculate the location.  */
+static struct value *
+locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
+{
+  struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+  struct value *val;
+  val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size,
+                                 dlbaton->objfile);
+
+  return val;
+}
+
+/* Return non-zero iff we need a frame to evaluate SYMBOL.  */
+static int
+locexpr_read_needs_frame (struct symbol *symbol)
+{
+  struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+  return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size);
+}
+
+/* Print a natural-language description of SYMBOL to STREAM.  */
+static int
+locexpr_describe_location (struct symbol *symbol, struct ui_file *stream)
+{
+  /* FIXME: be more extensive.  */
+  struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+
+  if (dlbaton->size == 1
+      && dlbaton->data[0] >= DW_OP_reg0
+      && dlbaton->data[0] <= DW_OP_reg31)
+    {
+      int regno = DWARF2_REG_TO_REGNUM (dlbaton->data[0] - DW_OP_reg0);
+      fprintf_filtered (stream,
+                       "a variable in register %s", REGISTER_NAME (regno));
+      return 1;
+    }
+
+  fprintf_filtered (stream,
+                   "a variable with complex or multiple locations (DWARF2)");
+  return 1;
+}
+
+
+/* Describe the location of SYMBOL as an agent value in VALUE, generating
+   any necessary bytecode in AX.
+
+   NOTE drow/2003-02-26: This function is extremely minimal, because
+   doing it correctly is extremely complicated and there is no
+   publicly available stub with tracepoint support for me to test
+   against.  When there is one this function should be revisited.  */
+
+void
+locexpr_tracepoint_var_ref (struct symbol * symbol, struct agent_expr * ax,
+                           struct axs_value * value)
+{
+  struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+
+  if (dlbaton->size == 0)
+    error ("Symbol \"%s\" has been optimized out.",
+          SYMBOL_PRINT_NAME (symbol));
+
+  if (dlbaton->size == 1
+      && dlbaton->data[0] >= DW_OP_reg0
+      && dlbaton->data[0] <= DW_OP_reg31)
+    {
+      value->kind = axs_lvalue_register;
+      value->u.reg = dlbaton->data[0] - DW_OP_reg0;
+    }
+  else if (dlbaton->data[0] == DW_OP_regx)
+    {
+      ULONGEST reg;
+      read_uleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size,
+                   &reg);
+      value->kind = axs_lvalue_register;
+      value->u.reg = reg;
+    }
+  else if (dlbaton->data[0] == DW_OP_fbreg)
+    {
+      /* And this is worse than just minimal; we should honor the frame base
+        as above.  */
+      int frame_reg;
+      LONGEST frame_offset;
+      unsigned char *buf_end;
+
+      buf_end = read_sleb128 (dlbaton->data + 1, dlbaton->data + dlbaton->size,
+                             &frame_offset);
+      if (buf_end != dlbaton->data + dlbaton->size)
+       error ("Unexpected opcode after DW_OP_fbreg for symbol \"%s\".",
+              SYMBOL_PRINT_NAME (symbol));
+
+      TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
+      ax_reg (ax, frame_reg);
+      ax_const_l (ax, frame_offset);
+      ax_simple (ax, aop_add);
+
+      ax_const_l (ax, frame_offset);
+      ax_simple (ax, aop_add);
+      value->kind = axs_lvalue_memory;
+    }
+  else
+    error ("Unsupported DWARF opcode in the location of \"%s\".",
+          SYMBOL_PRINT_NAME (symbol));
+}
+
+/* The set of location functions used with the DWARF-2 expression
+   evaluator.  */
+struct location_funcs dwarf2_locexpr_funcs = {
+  locexpr_read_variable,
+  locexpr_read_needs_frame,
+  locexpr_describe_location,
+  locexpr_tracepoint_var_ref
+};
similarity index 52%
rename from gdb/config/m68k/nm-apollo68b.h
rename to gdb/dwarf2loc.h
index 75731a7..fde1329 100644 (file)
@@ -1,5 +1,5 @@
-/* Macro defintions for an Apollo m68k in BSD mode
-   Copyright 1992, 1993, 1995, 1998 Free Software Foundation, Inc.
+/* Dwarf2 location expression support for GDB.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define        FETCH_INFERIOR_REGISTERS
+#if !defined (DWARF2LOC_H)
+#define DWARF2LOC_H
 
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
+/* This header is private to the DWARF-2 reader.  It is shared between
+   dwarf2read.c and dwarf2loc.c.  */
 
-#define U_REGS_OFFSET 6
+/* The symbol location baton type used by the DWARF-2 reader (i.e.
+   SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol).  */
 
-/* This is the amount to subtract from u.u_ar0
-   to get the offset in the core file of the register values.  */
+struct dwarf2_locexpr_baton
+{
+  unsigned char *data;
+  unsigned short size;
+  struct objfile *objfile;
+};
 
-#define KERNEL_U_ADDR 0
+extern struct location_funcs dwarf2_locexpr_funcs;
 
-#define REGISTER_U_ADDR(addr, blockend, regno) \
-       (addr) = (6 + 4 * (regno))
-
-/* Apollos don't really have a USER area,so trying to read it from the
- * process address space will fail. It does support a read from a faked
- * USER area using the "PEEKUSER" ptrace call.
- */
-#define PT_READ_U 3
+#endif
index 62f0fee..c77642d 100644 (file)
 #include "expression.h"
 #include "filenames.h" /* for DOSish file names */
 #include "macrotab.h"
-
 #include "language.h"
 #include "complaints.h"
 #include "bcache.h"
+#include "dwarf2expr.h"
+#include "dwarf2loc.h"
+
 #include <fcntl.h>
 #include "gdb_string.h"
 #include "gdb_assert.h"
@@ -905,6 +907,11 @@ static void dwarf_decode_macros (struct line_header *, unsigned int,
 
 static int attr_form_is_block (struct attribute *);
 
+static void
+dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+                            const struct comp_unit_head *,
+                            struct objfile *objfile);
+
 /* Try to locate the sections we need for DWARF 2 debugging
    information and return true if we have enough to do something.  */
 
@@ -978,7 +985,7 @@ dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr)
     {
       dwarf_macinfo_offset = sectp->filepos;
       dwarf_macinfo_size = bfd_get_section_size_before_reloc (sectp);
-      dwarf_loc_section = sectp;
+      dwarf_macinfo_section = sectp;
     }
   else if (STREQ (sectp->name, STR_SECTION))
     {
@@ -1218,22 +1225,24 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
 
       if (cu_header.version != 2)
        {
-         error ("Dwarf Error: wrong version in compilation unit header.");
+         error ("Dwarf Error: wrong version in compilation unit header (is %d, should be %d) [in module %s]", cu_header.version, 2, bfd_get_filename (abfd));
          return;
        }
       if (cu_header.abbrev_offset >= dwarf_abbrev_size)
        {
-         error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6).",
+         error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6) [in module %s]",
                 (long) cu_header.abbrev_offset,
-                (long) (beg_of_comp_unit - dwarf_info_buffer));
+                (long) (beg_of_comp_unit - dwarf_info_buffer),
+                bfd_get_filename (abfd));
          return;
        }
       if (beg_of_comp_unit + cu_header.length + cu_header.initial_length_size
          > dwarf_info_buffer + dwarf_info_size)
        {
-         error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0).",
+         error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0) [in module %s]",
                 (long) cu_header.length,
-                (long) (beg_of_comp_unit - dwarf_info_buffer));
+                (long) (beg_of_comp_unit - dwarf_info_buffer),
+                bfd_get_filename (abfd));
          return;
        }
       /* Complete the cu_header */
@@ -1996,6 +2005,13 @@ read_func_scope (struct die_info *die, struct objfile *objfile,
 
   new = push_context (0, lowpc);
   new->name = new_symbol (die, die->type, objfile, cu_header);
+
+  /* If there was a location expression for DW_AT_frame_base above,
+     record it.  We still need to decode it above because not all
+     symbols use location expressions exclusively.  */
+  if (attr)
+    dwarf2_symbol_mark_computed (attr, new->name, cu_header, objfile);
+
   list_in_scope = &local_symbols;
 
   if (die->has_children)
@@ -2193,6 +2209,9 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
                  return 0;
                }
 
+             range_beginning += base;
+             range_end += base;
+
              /* FIXME: This is recording everything as a low-high
                 segment of consecutive addresses.  We should have a
                 data structure for discontiguous block ranges
@@ -2908,7 +2927,7 @@ read_enumeration (struct die_info *die, struct objfile *objfile,
                                  * sizeof (struct field));
                    }
 
-                 FIELD_NAME (fields[num_fields]) = SYMBOL_NAME (sym);
+                 FIELD_NAME (fields[num_fields]) = DEPRECATED_SYMBOL_NAME (sym);
                  FIELD_TYPE (fields[num_fields]) = NULL;
                  FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym);
                  FIELD_BITSIZE (fields[num_fields]) = 0;
@@ -3787,7 +3806,8 @@ read_partial_die (struct partial_die_info *part_die, bfd *abfd,
   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
   if (!abbrev)
     {
-      error ("Dwarf Error: Could not find abbrev number %d.", abbrev_number);
+      error ("Dwarf Error: Could not find abbrev number %d [in module %s]", abbrev_number,
+                     bfd_get_filename (abfd));
     }
   part_die->offset = info_ptr - dwarf_info_buffer;
   part_die->tag = abbrev->tag;
@@ -3931,7 +3951,8 @@ read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr,
   abbrev = dwarf2_lookup_abbrev (abbrev_number, cu_header);
   if (!abbrev)
     {
-      error ("Dwarf Error: could not find abbrev number %d.", abbrev_number);
+      error ("Dwarf Error: could not find abbrev number %d [in module %s]", abbrev_number, 
+                     bfd_get_filename (abfd));
     }
   die = dwarf_alloc_die ();
   die->offset = offset;
@@ -4067,8 +4088,9 @@ read_attribute_value (struct attribute *attr, unsigned form,
       info_ptr = read_attribute_value (attr, form, abfd, info_ptr, cu_header);
       break;
     default:
-      error ("Dwarf Error: Cannot handle %s in DWARF reader.",
-            dwarf_form_name (form));
+      error ("Dwarf Error: Cannot handle %s in DWARF reader [in module %s]",
+            dwarf_form_name (form),
+            bfd_get_filename (abfd));
     }
   return info_ptr;
 }
@@ -4149,7 +4171,8 @@ read_address (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
          break;
        default:
          internal_error (__FILE__, __LINE__,
-                         "read_address: bad switch, signed");
+                         "read_address: bad switch, signed [in module %s]",
+                         bfd_get_filename (abfd));
        }
     }
   else
@@ -4167,7 +4190,8 @@ read_address (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
          break;
        default:
          internal_error (__FILE__, __LINE__,
-                         "read_address: bad switch, unsigned");
+                         "read_address: bad switch, unsigned [in module %s]",
+                         bfd_get_filename (abfd));
        }
     }
 
@@ -4282,7 +4306,8 @@ read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
       break;
     default:
       internal_error (__FILE__, __LINE__,
-                     "read_offset: bad switch");
+                     "read_offset: bad switch [in module %s]",
+                     bfd_get_filename (abfd));
     }
 
  return retval;
@@ -4324,12 +4349,14 @@ read_indirect_string (bfd *abfd, char *buf,
 
   if (dwarf_str_buffer == NULL)
     {
-      error ("DW_FORM_strp used without .debug_str section");
+      error ("DW_FORM_strp used without .debug_str section [in module %s]",
+                     bfd_get_filename (abfd));
       return NULL;
     }
   if (str_offset >= dwarf_str_size)
     {
-      error ("DW_FORM_strp pointing outside of .debug_str section");
+      error ("DW_FORM_strp pointing outside of .debug_str section [in module %s]",
+                     bfd_get_filename (abfd));
       return NULL;
     }
   gdb_assert (HOST_CHAR_BIT == 8);
@@ -4917,6 +4944,61 @@ dwarf2_start_subfile (char *filename, char *dirname)
   start_subfile (filename, dirname);
 }
 
+static void
+var_decode_location (struct attribute *attr, struct symbol *sym,
+                    struct objfile *objfile,
+                    const struct comp_unit_head *cu_header)
+{
+  /* NOTE drow/2003-01-30: There used to be a comment and some special
+     code here to turn a symbol with DW_AT_external and a
+     SYMBOL_VALUE_ADDRESS of 0 into a LOC_UNRESOLVED symbol.  This was
+     necessary for platforms (maybe Alpha, certainly PowerPC GNU/Linux
+     with some versions of binutils) where shared libraries could have
+     relocations against symbols in their debug information - the
+     minimal symbol would have the right address, but the debug info
+     would not.  It's no longer necessary, because we will explicitly
+     apply relocations when we read in the debug information now.  */
+
+  /* A DW_AT_location attribute with no contents indicates that a
+     variable has been optimized away.  */
+  if (attr_form_is_block (attr) && DW_BLOCK (attr)->size == 0)
+    {
+      SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
+      return;
+    }
+
+  /* Handle one degenerate form of location expression specially, to
+     preserve GDB's previous behavior when section offsets are
+     specified.  If this is just a DW_OP_addr then mark this symbol
+     as LOC_STATIC.  */
+
+  if (attr_form_is_block (attr)
+      && DW_BLOCK (attr)->size == 1 + cu_header->addr_size
+      && DW_BLOCK (attr)->data[0] == DW_OP_addr)
+    {
+      int dummy;
+
+      SYMBOL_VALUE_ADDRESS (sym) =
+       read_address (objfile->obfd, DW_BLOCK (attr)->data + 1, cu_header,
+                     &dummy);
+      fixup_symbol_section (sym, objfile);
+      SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets,
+                                             SYMBOL_SECTION (sym));
+      SYMBOL_CLASS (sym) = LOC_STATIC;
+      return;
+    }
+
+  /* NOTE drow/2002-01-30: It might be worthwhile to have a static
+     expression evaluator, and use LOC_COMPUTED only when necessary
+     (i.e. when the value of a register or memory location is
+     referenced, or a thread-local block, etc.).  Then again, it might
+     not be worthwhile.  I'm assuming that it isn't unless performance
+     or memory numbers show me otherwise.  */
+
+  dwarf2_symbol_mark_computed (attr, sym, cu_header, objfile);
+  SYMBOL_CLASS (sym) = LOC_COMPUTED;
+}
+
 /* Given a pointer to a DWARF information entry, figure out if we need
    to make a symbol table entry for it, and if so, create a new entry
    and return a pointer to it.
@@ -4940,8 +5022,10 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
                                             sizeof (struct symbol));
       OBJSTAT (objfile, n_syms++);
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
-                                       &objfile->symbol_obstack);
+
+      /* Cache this symbol's name and the name's demangled form (if any).  */
+      SYMBOL_LANGUAGE (sym) = cu_language;
+      SYMBOL_SET_NAMES (sym, name, strlen (name), objfile);
 
       /* Default assumptions.
          Use the passed type or decode it from the die.  */
@@ -4956,15 +5040,6 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
        {
          SYMBOL_LINE (sym) = DW_UNSND (attr);
        }
-
-      /* If this symbol is from a C++ compilation, then attempt to
-         cache the demangled form for future reference.  This is a
-         typical time versus space tradeoff, that was decided in favor
-         of time because it sped up C++ symbol lookups by a factor of
-         about 20. */
-
-      SYMBOL_LANGUAGE (sym) = cu_language;
-      SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
       switch (die->tag)
        {
        case DW_TAG_label:
@@ -5012,106 +5087,12 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
          attr = dwarf_attr (die, DW_AT_location);
          if (attr)
            {
+             var_decode_location (attr, sym, objfile, cu_header);
              attr2 = dwarf_attr (die, DW_AT_external);
              if (attr2 && (DW_UNSND (attr2) != 0))
-               {
-                  /* Support the .debug_loc offsets */
-                  if (attr_form_is_block (attr))
-                    {
-                     SYMBOL_VALUE_ADDRESS (sym) =
-                       decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
-                    }
-                  else if (attr->form == DW_FORM_data4
-                           || attr->form == DW_FORM_data8)
-                    {
-                     dwarf2_complex_location_expr_complaint ();
-                    }
-                  else
-                    {
-                     dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
-                                                            "external variable");
-                    }
-                 add_symbol_to_list (sym, &global_symbols);
-                  if (is_thread_local)
-                    {
-                      /* SYMBOL_VALUE_ADDRESS contains at this point the
-                        offset of the variable within the thread local
-                        storage.  */
-                      SYMBOL_CLASS (sym) = LOC_THREAD_LOCAL_STATIC;
-                      SYMBOL_OBJFILE (sym) = objfile;
-                    }
-
-                 /* In shared libraries the address of the variable
-                    in the location descriptor might still be relocatable,
-                    so its value could be zero.
-                    Enter the symbol as a LOC_UNRESOLVED symbol, if its
-                    value is zero, the address of the variable will then
-                    be determined from the minimal symbol table whenever
-                    the variable is referenced.  */
-                 else if (SYMBOL_VALUE_ADDRESS (sym))
-                   {
-                     fixup_symbol_section (sym, objfile);
-                     SYMBOL_VALUE_ADDRESS (sym) +=
-                       ANOFFSET (objfile->section_offsets,
-                                 SYMBOL_SECTION (sym));
-                     SYMBOL_CLASS (sym) = LOC_STATIC;
-                   }
-                 else
-                   SYMBOL_CLASS (sym) = LOC_UNRESOLVED;
-               }
+               add_symbol_to_list (sym, &global_symbols);
              else
-               {
-                  /* Support the .debug_loc offsets */
-                  if (attr_form_is_block (attr))
-                    {
-                     SYMBOL_VALUE (sym) = addr =
-                       decode_locdesc (DW_BLOCK (attr), objfile, cu_header);
-                    }
-                  else if (attr->form == DW_FORM_data4
-                           || attr->form == DW_FORM_data8)
-                    {
-                     dwarf2_complex_location_expr_complaint ();
-                    }
-                  else
-                    {
-                     dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
-                                                            "external variable");
-                      addr = 0;
-                    }
-                 add_symbol_to_list (sym, list_in_scope);
-                 if (optimized_out)
-                   {
-                     SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
-                   }
-                 else if (isreg)
-                   {
-                     SYMBOL_CLASS (sym) = LOC_REGISTER;
-                     SYMBOL_VALUE (sym) = 
-                       DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
-                   }
-                 else if (offreg)
-                   {
-                     SYMBOL_CLASS (sym) = LOC_BASEREG;
-                     SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
-                   }
-                 else if (islocal)
-                   {
-                     SYMBOL_CLASS (sym) = LOC_LOCAL;
-                   }
-                  else if (is_thread_local)
-                    {
-                      SYMBOL_CLASS (sym) = LOC_THREAD_LOCAL_STATIC;
-                      SYMBOL_OBJFILE (sym) = objfile;
-                    }
-                 else
-                   {
-                     fixup_symbol_section (sym, objfile);
-                     SYMBOL_VALUE_ADDRESS (sym) =
-                       addr + ANOFFSET (objfile->section_offsets,
-                                        SYMBOL_SECTION (sym));
-                     SYMBOL_CLASS (sym) = LOC_STATIC;
-                   }
-               }
+               add_symbol_to_list (sym, list_in_scope);
            }
          else
            {
@@ -5193,8 +5174,8 @@ new_symbol (struct die_info *die, struct type *type, struct objfile *objfile,
              SYMBOL_NAMESPACE (typedef_sym) = VAR_NAMESPACE;
              if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
                TYPE_NAME (SYMBOL_TYPE (sym)) =
-                 obsavestring (SYMBOL_NAME (sym),
-                               strlen (SYMBOL_NAME (sym)),
+                 obsavestring (DEPRECATED_SYMBOL_NAME (sym),
+                               strlen (DEPRECATED_SYMBOL_NAME (sym)),
                                &objfile->type_obstack);
              add_symbol_to_list (typedef_sym, list_in_scope);
            }
@@ -5239,7 +5220,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
     {
     case DW_FORM_addr:
       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != cu_header->addr_size)
-       dwarf2_const_value_length_mismatch_complaint (SYMBOL_NAME (sym),
+       dwarf2_const_value_length_mismatch_complaint (DEPRECATED_SYMBOL_NAME (sym),
                                                      cu_header->addr_size,
                                                      TYPE_LENGTH (SYMBOL_TYPE
                                                                   (sym)));
@@ -5255,7 +5236,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
     case DW_FORM_block:
       blk = DW_BLOCK (attr);
       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size)
-       dwarf2_const_value_length_mismatch_complaint (SYMBOL_NAME (sym),
+       dwarf2_const_value_length_mismatch_complaint (DEPRECATED_SYMBOL_NAME (sym),
                                                      blk->size,
                                                      TYPE_LENGTH (SYMBOL_TYPE
                                                                   (sym)));
@@ -5349,7 +5330,8 @@ die_type (struct die_info *die, struct objfile *objfile,
       type_die = follow_die_ref (ref);
       if (!type_die)
        {
-         error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+         error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", 
+                         ref, objfile->name);
          return NULL;
        }
     }
@@ -5357,7 +5339,8 @@ die_type (struct die_info *die, struct objfile *objfile,
   if (!type)
     {
       dump_die (type_die);
-      error ("Dwarf Error: Problem turning type die at offset into gdb type.");
+      error ("Dwarf Error: Problem turning type die at offset into gdb type [in module %s]",
+                     objfile->name);
     }
   return type;
 }
@@ -5381,7 +5364,8 @@ die_containing_type (struct die_info *die, struct objfile *objfile,
       type_die = follow_die_ref (ref);
       if (!type_die)
        {
-         error ("Dwarf Error: Cannot find referent at offset %d.", ref);
+         error ("Dwarf Error: Cannot find referent at offset %d [in module %s]", ref, 
+                         objfile->name);
          return NULL;
        }
       type = tag_type_to_type (type_die, objfile, cu_header);
@@ -5390,7 +5374,8 @@ die_containing_type (struct die_info *die, struct objfile *objfile,
     {
       if (type_die)
        dump_die (type_die);
-      error ("Dwarf Error: Problem turning containing type into gdb type.");
+      error ("Dwarf Error: Problem turning containing type into gdb type [in module %s]", 
+                     objfile->name);
     }
   return type;
 }
@@ -5427,7 +5412,8 @@ tag_type_to_type (struct die_info *die, struct objfile *objfile,
       if (!die->type)
        {
          dump_die (die);
-         error ("Dwarf Error: Cannot find type of die.");
+         error ("Dwarf Error: Cannot find type of die [in module %s]", 
+                         objfile->name);
        }
       return die->type;
     }
@@ -6602,8 +6588,8 @@ dwarf2_fundamental_type (struct objfile *objfile, int typeid)
 {
   if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
     {
-      error ("Dwarf Error: internal error - invalid fundamental type id %d.",
-            typeid);
+      error ("Dwarf Error: internal error - invalid fundamental type id %d [in module %s]",
+            typeid, objfile->name);
     }
 
   /* Look for this particular type in the fundamental type vector.  If
@@ -7336,3 +7322,32 @@ attr_form_is_block (struct attribute *attr)
       || attr->form == DW_FORM_block4
       || attr->form == DW_FORM_block);
 }
+
+static void
+dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+                            const struct comp_unit_head *cu_header,
+                            struct objfile *objfile)
+{
+  struct dwarf2_locexpr_baton *baton;
+
+  /* When support for location lists is added, this will go away.  */
+  if (!attr_form_is_block (attr))
+    {
+      dwarf2_complex_location_expr_complaint ();
+      return;
+    }
+
+  baton = obstack_alloc (&objfile->symbol_obstack,
+                        sizeof (struct dwarf2_locexpr_baton));
+  baton->objfile = objfile;
+
+  /* Note that we're just copying the block's data pointer here, not
+     the actual data.  We're still pointing into the dwarf_info_buffer
+     for SYM's objfile; right now we never release that buffer, but
+     when we do clean up properly this may need to change.  */
+  baton->size = DW_BLOCK (attr)->size;
+  baton->data = DW_BLOCK (attr)->data;
+
+  SYMBOL_LOCATION_FUNCS (sym) = &dwarf2_locexpr_funcs;
+  SYMBOL_LOCATION_BATON (sym) = baton;
+}
index 5c50b99..40c89e3 100644 (file)
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /*
+   If you are looking for DWARF-2 support, you are in the wrong file.
+   Go look in dwarf2read.c.  This file is for the original DWARF.
+
+   DWARF (also known as DWARF-1) is headed for obsoletion.
+
+   In gcc 3.2.1, these targets prefer dwarf-1:
+
+     i[34567]86-sequent-ptx4*   # TD-R2
+     i[34567]86-sequent-sysv4*  # TD-R2
+     i[34567]86-dg-dgux*        # obsolete in gcc 3.2.1, to be removed in 3.3
+     m88k-dg-dgux*              # TD-R2
+     mips-sni-sysv4             # TD-R2
+     sparc-hal-solaris2*        # TD-R2
+
+    Configurations marked with "# TD-R2" are on Zach Weinberg's list
+    of "Target Deprecation, Round 2".  This is a candidate list of
+    targets to be deprecated in gcc 3.3 and removed in gcc 3.4.
+
+      http://gcc.gnu.org/ml/gcc/2002-12/msg00702.html
+
+    gcc 2.95.3 had many configurations which prefer dwarf-1.
+    We may have to support dwarf-1 as long as we support gcc 2.95.3.
+    This could use more analysis.
+
+    DG/UX (Data General Unix) used dwarf-1 for its native format.
+    DG/UX uses gcc for its system C compiler, but they have their
+    own linker and their own debuggers.
+
+    Takis Psarogiannakopoulos has a complete gnu toolchain for DG/UX
+    with gcc 2.95.3, gdb 5.1, and debug formats of dwarf-2 and stabs.
+    For more info, see PR gdb/979 and PR gdb/1013; also:
+
+      http://sources.redhat.com/ml/gdb/2003-02/msg00074.html
+
+    There may be non-gcc compilers that still emit dwarf-1.
+
+    -- chastain 2003-02-04
+*/
+
+/*
 
    FIXME: Do we need to generate dependencies in partial symtabs?
    (Perhaps we don't need to).
@@ -1636,7 +1676,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
          sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                                 sizeof (struct symbol));
          memset (sym, 0, sizeof (struct symbol));
-         SYMBOL_NAME (sym) = create_name (list->field.name,
+         DEPRECATED_SYMBOL_NAME (sym) = create_name (list->field.name,
                                           &objfile->symbol_obstack);
          SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
          SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -2780,8 +2820,6 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile)
                                             sizeof (struct symbol));
       OBJSTAT (objfile, n_syms++);
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = create_name (dip->at_name,
-                                      &objfile->symbol_obstack);
       /* default assumptions */
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       SYMBOL_CLASS (sym) = LOC_STATIC;
@@ -2793,7 +2831,7 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile)
          C++ symbol lookups by a factor of about 20. */
 
       SYMBOL_LANGUAGE (sym) = cu_language;
-      SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
+      SYMBOL_SET_NAMES (sym, dip->at_name, strlen (dip->at_name), objfile);
       switch (dip->die_tag)
        {
        case TAG_label:
@@ -2941,7 +2979,7 @@ synthesize_typedef (struct dieinfo *dip, struct objfile *objfile,
        obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
       OBJSTAT (objfile, n_syms++);
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = create_name (dip->at_name,
+      DEPRECATED_SYMBOL_NAME (sym) = create_name (dip->at_name,
                                       &objfile->symbol_obstack);
       SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
       SYMBOL_TYPE (sym) = type;
index b96d6e7..7aee37c 100644 (file)
@@ -542,6 +542,15 @@ elf_symfile_read (struct objfile *objfile, int mainline)
 
   elf_symtab_read (objfile, 1);
 
+  /* Install any minimal symbols that have been collected as the current
+     minimal symbols for this objfile.  The debug readers below this point
+     should not generate new minimal symbols; if they do it's their
+     responsibility to install them.  "mdebug" appears to be the only one
+     which will do this.  */
+
+  install_minimal_symbols (objfile);
+  do_cleanups (back_to);
+
   /* Now process debugging information, which is contained in
      special ELF sections. */
 
@@ -611,13 +620,6 @@ elf_symfile_read (struct objfile *objfile, int mainline)
 
   if (DWARF2_BUILD_FRAME_INFO_P ())
     DWARF2_BUILD_FRAME_INFO(objfile);
-
-  /* Install any minimal symbols that have been collected as the current
-     minimal symbols for this objfile. */
-
-  install_minimal_symbols (objfile);
-
-  do_cleanups (back_to);
 }
 
 /* This cleans up the objfile's sym_stab_info pointer, and the chain of
index 8f39998..ceef7b9 100644 (file)
@@ -26,6 +26,7 @@
 #include "terminal.h"          /* for job_control */
 #include "event-loop.h"
 #include "event-top.h"
+#include "interps.h"
 #include <signal.h>
 
 /* For dont_repeat() */
 /* readline defines this.  */
 #undef savestring
 
-extern void _initialize_event_loop (void);
-
 static void rl_callback_read_char_wrapper (gdb_client_data client_data);
 static void command_line_handler (char *rl);
 static void command_line_handler_continuation (struct continuation_arg *arg);
 static void change_line_handler (void);
 static void change_annotation_level (void);
 static void command_handler (char *command);
-void cli_command_loop (void);
 static void async_do_nothing (gdb_client_data arg);
 static void async_disconnect (gdb_client_data arg);
 static void async_stop_sig (gdb_client_data arg);
@@ -250,9 +248,9 @@ display_gdb_prompt (char *new_prompt)
   int prompt_length = 0;
   char *gdb_prompt = get_prompt ();
 
-  /* When an alternative interpreter has been installed, do not
-     display the comand prompt. */
-  if (interpreter_p)
+  /* Each interpreter has its own rules on displaying the command
+     prompt.  */
+  if (!current_interp_display_prompt_p ())
     return;
 
   if (target_executing && sync_execution)
@@ -1125,6 +1123,11 @@ gdb_setup_readline (void)
 
   if (event_loop_p)
     {
+      gdb_stdout = stdio_fileopen (stdout);
+      gdb_stderr = stdio_fileopen (stderr);
+      gdb_stdlog = gdb_stderr;  /* for moment */
+      gdb_stdtarg = gdb_stderr; /* for moment */
+
       /* If the input stream is connected to a terminal, turn on
          editing.  */
       if (ISATTY (instream))
@@ -1193,14 +1196,3 @@ gdb_disable_readline (void)
       delete_file_handler (input_fd);
     }
 }
-
-void
-_initialize_event_loop (void)
-{
-  gdb_setup_readline ();
-
-  /* Tell gdb to use the cli_command_loop as the main loop. */
-  if (event_loop_p && command_loop_hook == NULL)
-    command_loop_hook = cli_command_loop;
-}
-
index 24044a5..4c06083 100644 (file)
@@ -1,5 +1,7 @@
-/* Definitions used by GDB event-top.c.
-   Copyright 1999, 2001 Free Software Foundation, Inc.
+/* Definitions used by event-top.c, for GDB, the GNU debugger.
+
+   Copyright 1999, 2001, 2003 Free Software Foundation, Inc.
+
    Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
 
    This file is part of GDB.
@@ -19,6 +21,9 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef EVENT_TOP_H
+#define EVENT_TOP_H
+
 /* Stack for prompts.  Each prompt is composed as a prefix, a prompt
    and a suffix.  The prompt to be displayed at any given time is the
    one on top of the stack.  A stack is necessary because of cases in
@@ -71,6 +76,8 @@ struct prompts
    FIXME: these should really go into top.h.  */
 
 extern void display_gdb_prompt (char *new_prompt);
+void gdb_setup_readline (void);
+void gdb_disable_readline (void);
 extern void async_init_signals (void);
 extern void set_async_editing_command (char *args, int from_tty,
                                       struct cmd_list_element *c);
@@ -109,3 +116,7 @@ extern void (*call_readline) (void *);
 extern void (*input_handler) (char *);
 extern int input_fd;
 extern void (*after_char_processing_hook) (void);
+
+extern void cli_command_loop (void);
+
+#endif
index 69d4559..d0e940b 100644 (file)
@@ -30,6 +30,7 @@
 #include "frame.h"             /* For frame_map_regnum_to_name.  */
 #include "target.h"
 #include "gdb_string.h"
+#include "block.h"
 
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
@@ -107,12 +108,12 @@ print_subexp (register struct expression *exp, register int *pos,
        b = exp->elts[pc + 1].block;
        if (b != NULL
            && BLOCK_FUNCTION (b) != NULL
-           && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)) != NULL)
+           && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)) != NULL)
          {
-           fputs_filtered (SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)), stream);
+           fputs_filtered (SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)), stream);
            fputs_filtered ("::", stream);
          }
-       fputs_filtered (SYMBOL_SOURCE_NAME (exp->elts[pc + 2].symbol), stream);
+       fputs_filtered (SYMBOL_PRINT_NAME (exp->elts[pc + 2].symbol), stream);
       }
       return;
 
@@ -889,7 +890,7 @@ dump_subexp (struct expression *exp, struct ui_file *stream, int elt)
       fprintf_filtered (stream, ", symbol @");
       gdb_print_host_address (exp->elts[elt + 1].symbol, stream);
       fprintf_filtered (stream, " (%s)",
-                       SYMBOL_NAME (exp->elts[elt + 1].symbol));
+                       DEPRECATED_SYMBOL_NAME (exp->elts[elt + 1].symbol));
       elt += 3;
       break;
     case OP_LAST:
index 6966231..a9504c1 100644 (file)
@@ -53,6 +53,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "bfd.h" /* Required by objfiles.h.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
 #include <ctype.h>
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
index 85866b3..84e3d81 100644 (file)
@@ -483,8 +483,8 @@ const struct language_defn f_language_defn =
   LANG_MAGIC
 };
 
-void
-_initialize_f_language (void)
+static void
+build_fortran_types (void)
 {
   builtin_type_f_void =
     init_type (TYPE_CODE_VOID, 1,
@@ -556,6 +556,42 @@ _initialize_f_language (void)
               0,
               "complex*32", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_f_complex_s32) = builtin_type_f_real_s16;
+}
+
+void
+_initialize_f_language (void)
+{
+  build_fortran_types ();
+  register_gdbarch_swap (&builtin_type_f_character, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_logical, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_logical_s1, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_logical_s2, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_integer, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_integer_s2, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_real, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_real_s8, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_real_s16, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_complex_s8, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_complex_s16, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_complex_s32, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_f_void, 
+                        sizeof (struct type *), NULL);
+  register_gdbarch_swap (&builtin_type_string, 
+                        sizeof (struct type *), NULL);
+
+  register_gdbarch_swap (NULL, 0, build_fortran_types);
 
   builtin_type_string =
     init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
index 6b4b36d..f67a260 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing Fortran values for GDB, the GNU debugger.
-   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000
+   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003
    Free Software Foundation, Inc.
    Contributed by Motorola.  Adapted from the C definitions by Farooq Butt
    (fmbutt@engage.sps.mot.com), additionally worked over by Stan Shebs.
@@ -33,6 +33,7 @@
 #include "frame.h"
 #include "gdbcore.h"
 #include "command.h"
+#include "block.h"
 
 #if 0
 static int there_is_a_visible_common_named (char *);
@@ -617,9 +618,9 @@ info_common_command (char *comname, int from_tty)
       if (msymbol != NULL
          && (SYMBOL_VALUE_ADDRESS (msymbol)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
       else
-       funname = SYMBOL_NAME (func);
+       funname = DEPRECATED_SYMBOL_NAME (func);
     }
   else
     {
@@ -627,7 +628,7 @@ info_common_command (char *comname, int from_tty)
       lookup_minimal_symbol_by_pc (get_frame_pc (fi));
 
       if (msymbol != NULL)
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
     }
 
   /* If comname is NULL, we assume the user wishes to see the 
@@ -653,7 +654,7 @@ info_common_command (char *comname, int from_tty)
 
       while (entry != NULL)
        {
-         printf_filtered ("%s = ", SYMBOL_NAME (entry->symbol));
+         printf_filtered ("%s = ", DEPRECATED_SYMBOL_NAME (entry->symbol));
          print_variable_value (entry->symbol, fi, gdb_stdout);
          printf_filtered ("\n");
          entry = entry->next;
@@ -709,9 +710,9 @@ there_is_a_visible_common_named (char *comname)
       if (msymbol != NULL
          && (SYMBOL_VALUE_ADDRESS (msymbol)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
       else
-       funname = SYMBOL_NAME (func);
+       funname = DEPRECATED_SYMBOL_NAME (func);
     }
   else
     {
@@ -719,7 +720,7 @@ there_is_a_visible_common_named (char *comname)
       lookup_minimal_symbol_by_pc (fi->pc);
 
       if (msymbol != NULL)
-       funname = SYMBOL_NAME (msymbol);
+       funname = DEPRECATED_SYMBOL_NAME (msymbol);
     }
 
   the_common = find_common_for_function (comname, funname);
index ccdb18d..3147126 100644 (file)
@@ -35,6 +35,7 @@
 #include "symfile.h"           /* for overlay functions */
 #include "regcache.h"
 #include "builtin-regs.h"
+#include "block.h"
 
 /* Basic byte-swapping routines.  GDB has needed these for a long time...
    All extract a target-format integer at ADDR which is LEN bytes long.  */
@@ -287,7 +288,7 @@ store_typed_address (void *buf, struct type *type, CORE_ADDR addr)
 
 /* Return a `value' with the contents of (virtual or cooked) register
    REGNUM as found in the specified FRAME.  The register's type is
-   determined by REGISTER_VIRTUAL_TYPE.
+   determined by register_type().
 
    NOTE: returns NULL if register value is not available.  Caller will
    check return value or die!  */
@@ -319,13 +320,13 @@ value_of_register (int regnum, struct frame_info *frame)
   if (register_cached (regnum) < 0)
     return NULL;               /* register value not available */
 
-  reg_val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
+  reg_val = allocate_value (register_type (current_gdbarch, regnum));
 
   /* Convert raw data to virtual format if necessary.  */
 
   if (REGISTER_CONVERTIBLE (regnum))
     {
-      REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
+      REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum),
                                   raw_buffer, VALUE_CONTENTS_RAW (reg_val));
     }
   else if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum))
@@ -383,6 +384,14 @@ symbol_read_needs_frame (struct symbol *sym)
     {
       /* All cases listed explicitly so that gcc -Wall will detect it if
          we failed to consider one.  */
+    case LOC_COMPUTED:
+    case LOC_COMPUTED_ARG:
+      {
+       struct location_funcs *symfuncs = SYMBOL_LOCATION_FUNCS (sym);
+       return (symfuncs->read_needs_frame) (sym);
+      }
+      break;
+
     case LOC_REGISTER:
     case LOC_ARG:
     case LOC_REF_ARG:
@@ -604,11 +613,23 @@ addresses have not been bound by the dynamic loader. Try again when executable i
       }
       break;
 
+    case LOC_COMPUTED:
+    case LOC_COMPUTED_ARG:
+      {
+       struct location_funcs *funcs = SYMBOL_LOCATION_FUNCS (var);
+
+       if (frame == 0 && (funcs->read_needs_frame) (var))
+         return 0;
+       return (funcs->read_variable) (var, frame);
+
+      }
+      break;
+
     case LOC_UNRESOLVED:
       {
        struct minimal_symbol *msym;
 
-       msym = lookup_minimal_symbol (SYMBOL_NAME (var), NULL, NULL);
+       msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (var), NULL, NULL);
        if (msym == NULL)
          return 0;
        if (overlay_debugging)
@@ -663,8 +684,10 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
                      1);
 
   if (num_storage_locs > 1
-#ifdef GDB_TARGET_IS_H8500
-      || TYPE_CODE (type) == TYPE_CODE_PTR
+#if 0
+      // OBSOLETE #ifdef GDB_TARGET_IS_H8500
+      // OBSOLETE       || TYPE_CODE (type) == TYPE_CODE_PTR
+      // OBSOLETE #endif
 #endif
     )
     {
@@ -680,76 +703,78 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
 
       /* Copy all of the data out, whereever it may be.  */
 
-#ifdef GDB_TARGET_IS_H8500
-/* This piece of hideosity is required because the H8500 treats registers
-   differently depending upon whether they are used as pointers or not.  As a
-   pointer, a register needs to have a page register tacked onto the front.
-   An alternate way to do this would be to have gcc output different register
-   numbers for the pointer & non-pointer form of the register.  But, it
-   doesn't, so we're stuck with this.  */
-
-      if (TYPE_CODE (type) == TYPE_CODE_PTR
-         && len > 2)
-       {
-         int page_regnum;
-
-         switch (regnum)
-           {
-           case R0_REGNUM:
-           case R1_REGNUM:
-           case R2_REGNUM:
-           case R3_REGNUM:
-             page_regnum = SEG_D_REGNUM;
-             break;
-           case R4_REGNUM:
-           case R5_REGNUM:
-             page_regnum = SEG_E_REGNUM;
-             break;
-           case R6_REGNUM:
-           case R7_REGNUM:
-             page_regnum = SEG_T_REGNUM;
-             break;
-           }
-
-         value_bytes[0] = 0;
-         get_saved_register (value_bytes + 1,
-                             &optim,
-                             &addr,
-                             frame,
-                             page_regnum,
-                             &lval);
-
-         if (register_cached (page_regnum) == -1)
-           return NULL;        /* register value not available */
-
-         if (lval == lval_register)
-           reg_stor++;
-         else
-           mem_stor++;
-         first_addr = addr;
-         last_addr = addr;
-
-         get_saved_register (value_bytes + 2,
-                             &optim,
-                             &addr,
-                             frame,
-                             regnum,
-                             &lval);
-
-         if (register_cached (regnum) == -1)
-           return NULL;        /* register value not available */
-
-         if (lval == lval_register)
-           reg_stor++;
-         else
-           {
-             mem_stor++;
-             mem_tracking = mem_tracking && (addr == last_addr);
-           }
-         last_addr = addr;
-       }
-      else
-#endif /* GDB_TARGET_IS_H8500 */
+#if 0
+      // OBSOLETE #ifdef GDB_TARGET_IS_H8500
+      // OBSOLETE /* This piece of hideosity is required because the H8500 treats registers
+      // OBSOLETE    differently depending upon whether they are used as pointers or not.  As a
+      // OBSOLETE    pointer, a register needs to have a page register tacked onto the front.
+      // OBSOLETE    An alternate way to do this would be to have gcc output different register
+      // OBSOLETE    numbers for the pointer & non-pointer form of the register.  But, it
+      // OBSOLETE    doesn't, so we're stuck with this.  */
+      // OBSOLETE 
+      // OBSOLETE       if (TYPE_CODE (type) == TYPE_CODE_PTR
+      // OBSOLETE        && len > 2)
+      // OBSOLETE      {
+      // OBSOLETE        int page_regnum;
+      // OBSOLETE 
+      // OBSOLETE        switch (regnum)
+      // OBSOLETE          {
+      // OBSOLETE          case R0_REGNUM:
+      // OBSOLETE          case R1_REGNUM:
+      // OBSOLETE          case R2_REGNUM:
+      // OBSOLETE          case R3_REGNUM:
+      // OBSOLETE            page_regnum = SEG_D_REGNUM;
+      // OBSOLETE            break;
+      // OBSOLETE          case R4_REGNUM:
+      // OBSOLETE          case R5_REGNUM:
+      // OBSOLETE            page_regnum = SEG_E_REGNUM;
+      // OBSOLETE            break;
+      // OBSOLETE          case R6_REGNUM:
+      // OBSOLETE          case R7_REGNUM:
+      // OBSOLETE            page_regnum = SEG_T_REGNUM;
+      // OBSOLETE            break;
+      // OBSOLETE          }
+      // OBSOLETE 
+      // OBSOLETE        value_bytes[0] = 0;
+      // OBSOLETE        get_saved_register (value_bytes + 1,
+      // OBSOLETE                            &optim,
+      // OBSOLETE                            &addr,
+      // OBSOLETE                            frame,
+      // OBSOLETE                            page_regnum,
+      // OBSOLETE                            &lval);
+      // OBSOLETE 
+      // OBSOLETE        if (register_cached (page_regnum) == -1)
+      // OBSOLETE          return NULL;        /* register value not available */
+      // OBSOLETE 
+      // OBSOLETE        if (lval == lval_register)
+      // OBSOLETE          reg_stor++;
+      // OBSOLETE        else
+      // OBSOLETE          mem_stor++;
+      // OBSOLETE        first_addr = addr;
+      // OBSOLETE        last_addr = addr;
+      // OBSOLETE 
+      // OBSOLETE        get_saved_register (value_bytes + 2,
+      // OBSOLETE                            &optim,
+      // OBSOLETE                            &addr,
+      // OBSOLETE                            frame,
+      // OBSOLETE                            regnum,
+      // OBSOLETE                            &lval);
+      // OBSOLETE 
+      // OBSOLETE        if (register_cached (regnum) == -1)
+      // OBSOLETE          return NULL;        /* register value not available */
+      // OBSOLETE 
+      // OBSOLETE        if (lval == lval_register)
+      // OBSOLETE          reg_stor++;
+      // OBSOLETE        else
+      // OBSOLETE          {
+      // OBSOLETE            mem_stor++;
+      // OBSOLETE            mem_tracking = mem_tracking && (addr == last_addr);
+      // OBSOLETE          }
+      // OBSOLETE        last_addr = addr;
+      // OBSOLETE      }
+      // OBSOLETE       else
+      // OBSOLETE #endif /* GDB_TARGET_IS_H8500 */
+#endif
        for (local_regnum = regnum;
             value_bytes_copied < len;
             (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
@@ -875,7 +900,7 @@ locate_var_value (register struct symbol *var, struct frame_info *frame)
 
   lazy_value = read_var_value (var, frame);
   if (lazy_value == 0)
-    error ("Address of \"%s\" is unknown.", SYMBOL_SOURCE_NAME (var));
+    error ("Address of \"%s\" is unknown.", SYMBOL_PRINT_NAME (var));
 
   if (VALUE_LAZY (lazy_value)
       || TYPE_CODE (type) == TYPE_CODE_FUNC)
@@ -896,7 +921,7 @@ locate_var_value (register struct symbol *var, struct frame_info *frame)
                    && *REGISTER_NAME (VALUE_REGNO (lazy_value)) != '\0');
       error("Address requested for identifier "
            "\"%s\" which is in register $%s",
-            SYMBOL_SOURCE_NAME (var), 
+            SYMBOL_PRINT_NAME (var), 
            REGISTER_NAME (VALUE_REGNO (lazy_value)));
       break;
 
@@ -905,13 +930,13 @@ locate_var_value (register struct symbol *var, struct frame_info *frame)
                    && *REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)) != '\0');
       error("Address requested for identifier "
            "\"%s\" which is in frame register $%s",
-            SYMBOL_SOURCE_NAME (var), 
+            SYMBOL_PRINT_NAME (var), 
            REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)));
       break;
 
     default:
       error ("Can't take address of \"%s\" which isn't an lvalue.",
-            SYMBOL_SOURCE_NAME (var));
+            SYMBOL_PRINT_NAME (var));
       break;
     }
   return 0;                    /* For lint -- never reached */
index 0c3009c..f4e0a14 100644 (file)
 #include "command.h"
 #include "gdbcmd.h"
 
+/* Flag to control debugging.  */
+
+static int frame_debug;
+
 /* Flag to indicate whether backtraces should stop at main.  */
 
 static int backtrace_below_main;
@@ -307,7 +311,7 @@ frame_read_signed_register (struct frame_info *frame, int regnum,
   frame_unwind_signed_register (frame->next, regnum, val);
 }
 
-static void
+void
 generic_unwind_get_saved_register (char *raw_buffer,
                                   int *optimizedp,
                                   CORE_ADDR *addrp,
@@ -605,12 +609,13 @@ frame_saved_regs_register_unwind (struct frame_info *frame, void **cache,
                && (get_frame_type (frame) == DUMMY_FRAME)));
 
   /* Only (older) architectures that implement the
-     FRAME_INIT_SAVED_REGS method should be using this function.  */
-  gdb_assert (FRAME_INIT_SAVED_REGS_P ());
+     DEPRECATED_FRAME_INIT_SAVED_REGS method should be using this
+     function.  */
+  gdb_assert (DEPRECATED_FRAME_INIT_SAVED_REGS_P ());
 
   /* Load the saved_regs register cache.  */
   if (get_frame_saved_regs (frame) == NULL)
-    FRAME_INIT_SAVED_REGS (frame);
+    DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
   if (get_frame_saved_regs (frame) != NULL
       && get_frame_saved_regs (frame)[regnum] != 0)
@@ -791,7 +796,7 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized,
   if (!target_has_registers)
     error ("No registers.");
 
-  gdb_assert (FRAME_INIT_SAVED_REGS_P ());
+  gdb_assert (DEPRECATED_FRAME_INIT_SAVED_REGS_P ());
 
   /* Normal systems don't optimize out things with register numbers.  */
   if (optimized != NULL)
@@ -827,7 +832,7 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized,
              return;
            }
 
-         FRAME_INIT_SAVED_REGS (frame);
+         DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
          if (get_frame_saved_regs (frame) != NULL
              && get_frame_saved_regs (frame)[regnum] != 0)
            {
@@ -901,8 +906,8 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
   fi->next = create_sentinel_frame (current_regcache);
   fi->type = frame_type_from_pc (pc);
 
-  if (INIT_EXTRA_FRAME_INFO_P ())
-    INIT_EXTRA_FRAME_INFO (0, fi);
+  if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
+    DEPRECATED_INIT_EXTRA_FRAME_INFO (0, fi);
 
   /* Select/initialize an unwind function.  */
   fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc);
@@ -1033,25 +1038,25 @@ legacy_get_prev_frame (struct frame_info *next_frame)
 
   /* This change should not be needed, FIXME!  We should determine
      whether any targets *need* DEPRECATED_INIT_FRAME_PC to happen
-     after INIT_EXTRA_FRAME_INFO and come up with a simple way to
-     express what goes on here.
+     after DEPRECATED_INIT_EXTRA_FRAME_INFO and come up with a simple
+     way to express what goes on here.
 
-     INIT_EXTRA_FRAME_INFO is called from two places: create_new_frame
-     (where the PC is already set up) and here (where it isn't).
-     DEPRECATED_INIT_FRAME_PC is only called from here, always after
-     INIT_EXTRA_FRAME_INFO.
+     DEPRECATED_INIT_EXTRA_FRAME_INFO is called from two places:
+     create_new_frame (where the PC is already set up) and here (where
+     it isn't).  DEPRECATED_INIT_FRAME_PC is only called from here,
+     always after DEPRECATED_INIT_EXTRA_FRAME_INFO.
 
-     The catch is the MIPS, where INIT_EXTRA_FRAME_INFO requires the
-     PC value (which hasn't been set yet).  Some other machines appear
-     to require INIT_EXTRA_FRAME_INFO before they can do
-     DEPRECATED_INIT_FRAME_PC.  Phoo.
+     The catch is the MIPS, where DEPRECATED_INIT_EXTRA_FRAME_INFO
+     requires the PC value (which hasn't been set yet).  Some other
+     machines appear to require DEPRECATED_INIT_EXTRA_FRAME_INFO
+     before they can do DEPRECATED_INIT_FRAME_PC.  Phoo.
 
      We shouldn't need DEPRECATED_INIT_FRAME_PC_FIRST to add more
      complication to an already overcomplicated part of GDB.
      gnu@cygnus.com, 15Sep92.
 
      Assuming that some machines need DEPRECATED_INIT_FRAME_PC after
-     INIT_EXTRA_FRAME_INFO, one possible scheme:
+     DEPRECATED_INIT_EXTRA_FRAME_INFO, one possible scheme:
 
      SETUP_INNERMOST_FRAME(): Default version is just create_new_frame
      (read_fp ()), read_pc ()).  Machines with extra frame info would
@@ -1061,13 +1066,14 @@ legacy_get_prev_frame (struct frame_info *next_frame)
      create_new_frame would no longer init extra frame info;
      SETUP_ARBITRARY_FRAME would have to do that.
 
-     INIT_PREV_FRAME(fromleaf, prev) Replace INIT_EXTRA_FRAME_INFO and
-     DEPRECATED_INIT_FRAME_PC.  This should also return a flag saying
-     whether to keep the new frame, or whether to discard it, because
-     on some machines (e.g.  mips) it is really awkward to have
-     FRAME_CHAIN_VALID called *before* INIT_EXTRA_FRAME_INFO (there is
-     no good way to get information deduced in FRAME_CHAIN_VALID into
-     the extra fields of the new frame).  std_frame_pc(fromleaf, prev)
+     INIT_PREV_FRAME(fromleaf, prev) Replace
+     DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC.
+     This should also return a flag saying whether to keep the new
+     frame, or whether to discard it, because on some machines (e.g.
+     mips) it is really awkward to have FRAME_CHAIN_VALID called
+     BEFORE DEPRECATED_INIT_EXTRA_FRAME_INFO (there is no good way to
+     get information deduced in FRAME_CHAIN_VALID into the extra
+     fields of the new frame).  std_frame_pc(fromleaf, prev)
 
      This is the default setting for INIT_PREV_FRAME.  It just does
      what the default DEPRECATED_INIT_FRAME_PC does.  Some machines
@@ -1104,8 +1110,8 @@ legacy_get_prev_frame (struct frame_info *next_frame)
   if (DEPRECATED_INIT_FRAME_PC_FIRST_P ())
     prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev));
 
-  if (INIT_EXTRA_FRAME_INFO_P ())
-    INIT_EXTRA_FRAME_INFO (fromleaf, prev);
+  if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
+    DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, prev);
 
   /* This entry is in the frame queue now, which is good since
      FRAME_SAVED_PC may use that queue to figure out its value (see
@@ -1223,14 +1229,22 @@ get_prev_frame (struct frame_info *next_frame)
        Note, this is done _before_ the frame has been marked as
        previously unwound.  That way if the user later decides to
        allow unwinds past main(), that just happens.  */
-    return NULL;
+    {
+      if (frame_debug)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Outermost frame - inside main func.\n");
+      return NULL;
+    }
 
   /* Only try to do the unwind once.  */
   if (next_frame->prev_p)
     return next_frame->prev;
   next_frame->prev_p = 1;
 
-  /* If we're inside the entry file, it isn't valid.  */
+  /* If we're inside the entry file, it isn't valid.  Don't apply this
+     test to a dummy frame - dummy frame PC's typically land in the
+     entry file.  Don't apply this test to the sentinel frame.
+     Sentinel frames should always be allowed to unwind.  */
   /* NOTE: drow/2002-12-25: should there be a way to disable this
      check?  It assumes a single small entry file, and the way some
      debug readers (e.g.  dbxread) figure out which object is the
@@ -1238,8 +1252,31 @@ get_prev_frame (struct frame_info *next_frame)
   /* NOTE: cagney/2003-01-10: If there is a way of disabling this test
      then it should probably be moved to before the ->prev_p test,
      above.  */
-  if (inside_entry_file (get_frame_pc (next_frame)))
+  if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0
+      && inside_entry_file (get_frame_pc (next_frame)))
+    {
+      if (frame_debug)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Outermost frame - inside entry file\n");
+      return NULL;
+    }
+
+  /* If we're already inside the entry function for the main objfile,
+     then it isn't valid.  Don't apply this test to a dummy frame -
+     dummy frame PC's typically land in the entry func.  Don't apply
+     this test to the sentinel frame.  Sentinel frames should always
+     be allowed to unwind.  */
+  /* NOTE: cagney/2003-02-25: Don't enable until someone has found
+     hard evidence that this is needed.  */
+  if (0
+      && next_frame->type != DUMMY_FRAME && next_frame->level >= 0
+      && inside_entry_func (get_frame_pc (next_frame)))
+    {
+      if (frame_debug)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Outermost frame - inside entry func\n");
       return NULL;
+    }
 
   /* If any of the old frame initialization methods are around, use
      the legacy get_prev_frame method.  Just don't try to unwind a
@@ -1247,10 +1284,16 @@ get_prev_frame (struct frame_info *next_frame)
      frames use the new unwind code.  */
   if ((DEPRECATED_INIT_FRAME_PC_P ()
        || DEPRECATED_INIT_FRAME_PC_FIRST_P ()
-       || INIT_EXTRA_FRAME_INFO_P ()
+       || DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()
        || FRAME_CHAIN_P ())
       && next_frame->level >= 0)
-    return legacy_get_prev_frame (next_frame);
+    {
+      prev_frame = legacy_get_prev_frame (next_frame);
+      if (frame_debug && prev_frame == NULL)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Outermost frame - legacy_get_prev_frame NULL.\n");
+      return prev_frame;
+    }
 
   /* Allocate the new frame but do not wire it in to the frame chain.
      Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along
@@ -1274,7 +1317,8 @@ get_prev_frame (struct frame_info *next_frame)
      frame chain.  This is ok since, for old targets, both
      frame_pc_unwind (nee, FRAME_SAVED_PC) and FRAME_CHAIN()) assume
      NEXT_FRAME's data structures have already been initialized (using
-     INIT_EXTRA_FRAME_INFO) and hence the call order doesn't matter.
+     DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order
+     doesn't matter.
 
      By unwinding the PC first, it becomes possible to, in the case of
      a dummy frame, avoid also unwinding the frame ID.  This is
@@ -1283,9 +1327,14 @@ get_prev_frame (struct frame_info *next_frame)
 
   prev_frame->pc = frame_pc_unwind (next_frame);
   if (prev_frame->pc == 0)
-    /* The allocated PREV_FRAME will be reclaimed when the frame
-       obstack is next purged.  */
-    return NULL;
+    {
+      /* The allocated PREV_FRAME will be reclaimed when the frame
+        obstack is next purged.  */
+      if (frame_debug)
+       fprintf_unfiltered (gdb_stdlog,
+                           "Outermost frame - unwound PC zero\n");
+      return NULL;
+    }
   prev_frame->type = frame_type_from_pc (prev_frame->pc);
 
   /* Set the unwind functions based on that identified PC.  */
@@ -1299,8 +1348,30 @@ get_prev_frame (struct frame_info *next_frame)
     /* FIXME: cagney/2002-12-18: Instead of this hack, should just
        save the frame ID directly.  */
     struct frame_id id = frame_id_unwind (next_frame);
+    /* Check that the unwound ID is valid.  As of 2003-02-24 the
+       x86-64 was returning an invalid frame ID when trying to do an
+       unwind a sentinel frame that belonged to a frame dummy.  */
     if (!frame_id_p (id))
-      return NULL;
+      {
+       if (frame_debug)
+         fprintf_unfiltered (gdb_stdlog,
+                             "Outermost frame - unwound frame ID invalid\n");
+       return NULL;
+      }
+    /* Check that the new frame isn't inner to (younger, below, next)
+       the old frame.  If that happens the frame unwind is going
+       backwards.  */
+    /* FIXME: cagney/2003-02-25: Ignore the sentinel frame since that
+       doesn't have a valid frame ID.  Should instead set the sentinel
+       frame's frame ID to a `sentinel'.  Leave it until after the
+       switch to storing the frame ID, instead of the frame base, in
+       the frame object.  */
+    if (next_frame->level >= 0
+       && frame_id_inner (id, get_frame_id (next_frame)))
+      error ("Unwound frame inner-to selected frame (corrupt stack?)");
+    /* Note that, due to frameless functions, the stronger test of the
+       new frame being outer to the old frame can't be used -
+       frameless functions differ by only their PC value.  */
     prev_frame->frame = id.base;
   }
 
@@ -1313,12 +1384,13 @@ get_prev_frame (struct frame_info *next_frame)
      (passed to the unwind functions) to store additional frame info.
      Unfortunatly legacy targets can't use legacy_get_prev_frame() to
      unwind the sentinel frame and, consequently, are forced to take
-     this code path and rely on the below call to INIT_EXTR_FRAME_INFO
-     to initialize the inner-most frame.  */
-  if (INIT_EXTRA_FRAME_INFO_P ())
+     this code path and rely on the below call to
+     DEPRECATED_INIT_EXTRA_FRAME_INFO to initialize the inner-most
+     frame.  */
+  if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
     {
       gdb_assert (prev_frame->level == 0);
-      INIT_EXTRA_FRAME_INFO (0, prev_frame);
+      DEPRECATED_INIT_EXTRA_FRAME_INFO (0, prev_frame);
     }
 
   return prev_frame;
@@ -1393,7 +1465,7 @@ deprecated_set_frame_type (struct frame_info *frame, enum frame_type type)
 
 #ifdef FRAME_FIND_SAVED_REGS
 /* XXX - deprecated.  This is a compatibility function for targets
-   that do not yet implement FRAME_INIT_SAVED_REGS.  */
+   that do not yet implement DEPRECATED_FRAME_INIT_SAVED_REGS.  */
 /* Find the addresses in which registers are saved in FRAME.  */
 
 void
@@ -1536,4 +1608,11 @@ Normally the caller of \"main\" is not of interest, so GDB will terminate\n\
 the backtrace at \"main\".  Set this variable if you need to see the rest\n\
 of the stack trace.",
                           NULL, NULL, &setlist, &showlist);
+
+
+  /* Debug this files internals. */
+  add_show_from_set (add_set_cmd ("frame", class_maintenance, var_zinteger,
+                                 &frame_debug, "Set frame debugging.\n\
+When non-zero, frame specific internal debugging is enabled.", &setdebuglist),
+                    &showdebuglist);
 }
index 8169173..bd20ba7 100644 (file)
@@ -25,6 +25,7 @@
 
 struct symtab_and_line;
 struct frame_unwind;
+struct block;
 
 /* The traditional frame unwinder.  */
 extern const struct frame_unwind *trad_frame_unwind;
@@ -242,7 +243,7 @@ extern enum frame_type get_frame_type (struct frame_info *);
    PC_IN_SIGTRAMP() indicates a SIGTRAMP_FRAME and
    DEPRECATED_PC_IN_CALL_DUMMY() indicates a DUMMY_FRAME.  I suspect
    the real problem here is that get_prev_frame() only sets
-   initialized after INIT_EXTRA_FRAME_INFO as been called.
+   initialized after DEPRECATED_INIT_EXTRA_FRAME_INFO as been called.
    Consequently, some targets found that the frame's type was wrong
    and tried to fix it.  The correct fix is to modify get_prev_frame()
    so that it initializes the frame's type before calling any other
@@ -380,7 +381,7 @@ struct frame_info
        special, the address here is the sp for the previous frame, not
        the address where the sp was saved.  */
     /* Allocated by frame_saved_regs_zalloc () which is called /
-       initialized by FRAME_INIT_SAVED_REGS(). */
+       initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */
     CORE_ADDR *saved_regs;     /*NUM_REGS + NUM_PSEUDO_REGS*/
 
 #ifdef EXTRA_FRAME_INFO
@@ -393,7 +394,7 @@ struct frame_info
     /* Anything extra for this structure that may have been defined
        in the machine dependent files. */
     /* Allocated by frame_extra_info_zalloc () which is called /
-       initialized by INIT_EXTRA_FRAME_INFO */
+       initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */
     struct frame_extra_info *extra_info;
 
     /* If dwarf2 unwind frame informations is used, this structure holds all
@@ -464,7 +465,7 @@ extern void generic_save_dummy_frame_tos (CORE_ADDR sp);
 
 #ifdef FRAME_FIND_SAVED_REGS
 /* XXX - deprecated */
-#define FRAME_INIT_SAVED_REGS(FI) deprecated_get_frame_saved_regs (FI, NULL)
+#define DEPRECATED_FRAME_INIT_SAVED_REGS(FI) deprecated_get_frame_saved_regs (FI, NULL)
 extern void deprecated_get_frame_saved_regs (struct frame_info *,
                                             struct frame_saved_regs *);
 #endif
@@ -506,10 +507,6 @@ extern CORE_ADDR frame_address_in_block (struct frame_info *);
 
 extern CORE_ADDR get_pc_function_start (CORE_ADDR);
 
-extern struct block *block_for_pc (CORE_ADDR);
-
-extern struct block *block_for_pc_sect (CORE_ADDR, asection *);
-
 extern int frameless_look_for_prologue (struct frame_info *);
 
 extern void print_frame_args (struct symbol *, struct frame_info *,
@@ -553,6 +550,13 @@ extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun,
                                    int nargs, struct value **args,
                                    struct type *type, int gcc_p);
 
+void generic_unwind_get_saved_register (char *raw_buffer,
+                                       int *optimizedp,
+                                       CORE_ADDR *addrp,
+                                       struct frame_info *frame,
+                                       int regnum,
+                                       enum lval_type *lvalp);
+
 /* The function generic_get_saved_register() has been made obsolete.
    GET_SAVED_REGISTER now defaults to the recursive equivalent -
    generic_unwind_get_saved_register() - so there is no need to even
index b89e54e..d279707 100644 (file)
@@ -38,7 +38,6 @@ static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc;
 static gdbarch_frame_chain_ftype frv_frame_chain;
 static gdbarch_frame_saved_pc_ftype frv_frame_saved_pc;
 static gdbarch_skip_prologue_ftype frv_skip_prologue;
-static gdbarch_frame_init_saved_regs_ftype frv_frame_init_saved_regs;
 static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value;
 static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address;
 static gdbarch_use_struct_convention_ftype frv_use_struct_convention;
@@ -1067,9 +1066,9 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, frv_num_regs * 4);
   set_gdbarch_register_byte (gdbarch, frv_register_byte);
   set_gdbarch_register_raw_size (gdbarch, frv_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
   set_gdbarch_register_virtual_size (gdbarch, frv_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_register_virtual_type (gdbarch, frv_register_virtual_type);
 
   set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue);
@@ -1084,7 +1083,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_chain (gdbarch, frv_frame_chain);
   set_gdbarch_frame_saved_pc (gdbarch, frv_frame_saved_pc);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, frv_frame_init_saved_regs);
 
   set_gdbarch_use_struct_convention (gdbarch, frv_use_struct_convention);
   set_gdbarch_deprecated_extract_return_value (gdbarch, frv_extract_return_value);
@@ -1103,7 +1102,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_words (gdbarch, frv_call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (frv_call_dummy_words));
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-  set_gdbarch_init_extra_frame_info (gdbarch, frv_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, frv_init_extra_frame_info);
 
   /* Settings that should be unnecessary.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -1119,7 +1118,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
index c0bc487..b6eae2b 100644 (file)
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -21,6 +21,7 @@
 #include "defs.h"
 #include "main.h"
 #include "gdb_string.h"
+#include "interps.h"
 
 int
 main (int argc, char **argv)
@@ -30,5 +31,6 @@ main (int argc, char **argv)
   args.argc = argc;
   args.argv = argv;
   args.use_windows = 0;
+  args.interpreter_p = INTERP_CONSOLE;
   return gdb_main (&args);
 }
index a23ea5e..fc17219 100755 (executable)
@@ -85,7 +85,8 @@ do
        ;;
     -f )
        # Force a rebuild
-       force=true ; shift ;;
+       force=true ;
+       ;;
     -v )
        # Be more, and more, and more, verbose
        verbose=`expr ${verbose} + 1`
index c47c424..81dd0a0 100644 (file)
@@ -199,6 +199,16 @@ typedef struct td_notify
   } u;
 } td_notify_t;
 
+/* Some people still have libc5 or old glibc with no uintptr_t.
+   They lose.  glibc 2.1.3 was released on 2000-02-25, and it has
+   uintptr_t, so it's reasonable to force these people to upgrade.  */
+
+#ifndef HAVE_UINTPTR_T
+#error No uintptr_t available; your C library is too old.
+/* Inhibit further compilation errors after this error.  */
+#define uintptr_t void *
+#endif
+
 /* Structure used to report event.  */
 typedef struct td_event_msg
 {
index 10f6397..68247d6 100644 (file)
@@ -170,10 +170,11 @@ struct gdbarch
   int register_bytes;
   gdbarch_register_byte_ftype *register_byte;
   gdbarch_register_raw_size_ftype *register_raw_size;
-  int max_register_raw_size;
+  int deprecated_max_register_raw_size;
   gdbarch_register_virtual_size_ftype *register_virtual_size;
-  int max_register_virtual_size;
+  int deprecated_max_register_virtual_size;
   gdbarch_register_virtual_type_ftype *register_virtual_type;
+  gdbarch_register_type_ftype *register_type;
   gdbarch_deprecated_do_registers_info_ftype *deprecated_do_registers_info;
   gdbarch_print_registers_info_ftype *print_registers_info;
   gdbarch_print_float_info_ftype *print_float_info;
@@ -213,7 +214,7 @@ struct gdbarch
   gdbarch_integer_to_address_ftype *integer_to_address;
   gdbarch_return_value_on_stack_ftype *return_value_on_stack;
   gdbarch_push_arguments_ftype *push_arguments;
-  gdbarch_push_dummy_frame_ftype *push_dummy_frame;
+  gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame;
   gdbarch_push_return_address_ftype *push_return_address;
   gdbarch_pop_frame_ftype *pop_frame;
   gdbarch_store_struct_return_ftype *store_struct_return;
@@ -224,8 +225,8 @@ struct gdbarch
   gdbarch_extract_struct_value_address_ftype *extract_struct_value_address;
   gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address;
   gdbarch_use_struct_convention_ftype *use_struct_convention;
-  gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs;
-  gdbarch_init_extra_frame_info_ftype *init_extra_frame_info;
+  gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs;
+  gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info;
   gdbarch_skip_prologue_ftype *skip_prologue;
   gdbarch_prologue_frameless_p_ftype *prologue_frameless_p;
   gdbarch_inner_than_ftype *inner_than;
@@ -339,6 +340,7 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
+  0,
   default_print_registers_info,
   0,
   0,
@@ -517,9 +519,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   current_gdbarch->register_bytes = -1;
   current_gdbarch->register_byte = generic_register_byte;
   current_gdbarch->register_raw_size = generic_register_size;
-  current_gdbarch->max_register_raw_size = -1;
   current_gdbarch->register_virtual_size = generic_register_size;
-  current_gdbarch->max_register_virtual_size = -1;
   current_gdbarch->print_registers_info = default_print_registers_info;
   current_gdbarch->register_sim_regno = legacy_register_sim_regno;
   current_gdbarch->cannot_fetch_register = cannot_register_not;
@@ -659,16 +659,11 @@ verify_gdbarch (struct gdbarch *gdbarch)
     fprintf_unfiltered (log, "\n\tregister_bytes");
   /* Skip verify of register_byte, invalid_p == 0 */
   /* Skip verify of register_raw_size, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->max_register_raw_size == -1))
-    fprintf_unfiltered (log, "\n\tmax_register_raw_size");
+  /* Skip verify of deprecated_max_register_raw_size, has predicate */
   /* Skip verify of register_virtual_size, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->max_register_virtual_size == -1))
-    fprintf_unfiltered (log, "\n\tmax_register_virtual_size");
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->register_virtual_type == 0))
-    fprintf_unfiltered (log, "\n\tregister_virtual_type");
+  /* Skip verify of deprecated_max_register_virtual_size, has predicate */
+  /* Skip verify of register_virtual_type, has predicate */
+  /* Skip verify of register_type, has predicate */
   /* Skip verify of deprecated_do_registers_info, has predicate */
   /* Skip verify of print_registers_info, invalid_p == 0 */
   /* Skip verify of print_float_info, has predicate */
@@ -724,9 +719,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of integer_to_address, has predicate */
   /* Skip verify of return_value_on_stack, invalid_p == 0 */
   /* Skip verify of push_arguments, invalid_p == 0 */
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->push_dummy_frame == 0))
-    fprintf_unfiltered (log, "\n\tpush_dummy_frame");
+  /* Skip verify of deprecated_push_dummy_frame, has predicate */
   /* Skip verify of push_return_address, has predicate */
   /* Skip verify of pop_frame, has predicate */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
@@ -737,8 +730,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of extract_struct_value_address, has predicate */
   /* Skip verify of deprecated_extract_struct_value_address, has predicate */
   /* Skip verify of use_struct_convention, invalid_p == 0 */
-  /* Skip verify of frame_init_saved_regs, has predicate */
-  /* Skip verify of init_extra_frame_info, has predicate */
+  /* Skip verify of deprecated_frame_init_saved_regs, has predicate */
+  /* Skip verify of deprecated_init_extra_frame_info, has predicate */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->skip_prologue == 0))
     fprintf_unfiltered (log, "\n\tskip_prologue");
@@ -1171,6 +1164,52 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->deprecated_extract_struct_value_address
                         /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
 #endif
+#ifdef DEPRECATED_FRAME_INIT_SAVED_REGS_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_FRAME_INIT_SAVED_REGS_P()",
+                      XSTRING (DEPRECATED_FRAME_INIT_SAVED_REGS_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_FRAME_INIT_SAVED_REGS_P() = %d\n",
+                      DEPRECATED_FRAME_INIT_SAVED_REGS_P ());
+#endif
+#ifdef DEPRECATED_FRAME_INIT_SAVED_REGS
+#if GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_FRAME_INIT_SAVED_REGS(frame)",
+                      XSTRING (DEPRECATED_FRAME_INIT_SAVED_REGS (frame)));
+#endif
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DEPRECATED_FRAME_INIT_SAVED_REGS = <0x%08lx>\n",
+                        (long) current_gdbarch->deprecated_frame_init_saved_regs
+                        /*DEPRECATED_FRAME_INIT_SAVED_REGS ()*/);
+#endif
+#ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_INIT_EXTRA_FRAME_INFO_P()",
+                      XSTRING (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_INIT_EXTRA_FRAME_INFO_P() = %d\n",
+                      DEPRECATED_INIT_EXTRA_FRAME_INFO_P ());
+#endif
+#ifdef DEPRECATED_INIT_EXTRA_FRAME_INFO
+#if GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame)",
+                      XSTRING (DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, frame)));
+#endif
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DEPRECATED_INIT_EXTRA_FRAME_INFO = <0x%08lx>\n",
+                        (long) current_gdbarch->deprecated_init_extra_frame_info
+                        /*DEPRECATED_INIT_EXTRA_FRAME_INFO ()*/);
+#endif
 #ifdef DEPRECATED_INIT_FRAME_PC_P
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -1211,6 +1250,40 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->deprecated_init_frame_pc_first
                         /*DEPRECATED_INIT_FRAME_PC_FIRST ()*/);
 #endif
+#ifdef DEPRECATED_MAX_REGISTER_RAW_SIZE_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_MAX_REGISTER_RAW_SIZE_P()",
+                      XSTRING (DEPRECATED_MAX_REGISTER_RAW_SIZE_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_MAX_REGISTER_RAW_SIZE_P() = %d\n",
+                      DEPRECATED_MAX_REGISTER_RAW_SIZE_P ());
+#endif
+#ifdef DEPRECATED_MAX_REGISTER_RAW_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_MAX_REGISTER_RAW_SIZE # %s\n",
+                      XSTRING (DEPRECATED_MAX_REGISTER_RAW_SIZE));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_MAX_REGISTER_RAW_SIZE = %d\n",
+                      DEPRECATED_MAX_REGISTER_RAW_SIZE);
+#endif
+#ifdef DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P()",
+                      XSTRING (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P() = %d\n",
+                      DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P ());
+#endif
+#ifdef DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE # %s\n",
+                      XSTRING (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE = %d\n",
+                      DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE);
+#endif
 #ifdef DEPRECATED_PC_IN_CALL_DUMMY_P
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -1231,6 +1304,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->deprecated_pc_in_call_dummy
                         /*DEPRECATED_PC_IN_CALL_DUMMY ()*/);
 #endif
+#ifdef DEPRECATED_PUSH_DUMMY_FRAME_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_PUSH_DUMMY_FRAME_P()",
+                      XSTRING (DEPRECATED_PUSH_DUMMY_FRAME_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_PUSH_DUMMY_FRAME_P() = %d\n",
+                      DEPRECATED_PUSH_DUMMY_FRAME_P ());
+#endif
+#ifdef DEPRECATED_PUSH_DUMMY_FRAME
+#if GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_PUSH_DUMMY_FRAME(-)",
+                      XSTRING (DEPRECATED_PUSH_DUMMY_FRAME (-)));
+#endif
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DEPRECATED_PUSH_DUMMY_FRAME = <0x%08lx>\n",
+                        (long) current_gdbarch->deprecated_push_dummy_frame
+                        /*DEPRECATED_PUSH_DUMMY_FRAME ()*/);
+#endif
 #ifdef DEPRECATED_STORE_RETURN_VALUE
 #if GDB_MULTI_ARCH
   /* Macro might contain `[{}]' when not multi-arch */
@@ -1465,29 +1561,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->frame_chain_valid
                         /*FRAME_CHAIN_VALID ()*/);
 #endif
-#ifdef FRAME_INIT_SAVED_REGS_P
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "FRAME_INIT_SAVED_REGS_P()",
-                      XSTRING (FRAME_INIT_SAVED_REGS_P ()));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: FRAME_INIT_SAVED_REGS_P() = %d\n",
-                      FRAME_INIT_SAVED_REGS_P ());
-#endif
-#ifdef FRAME_INIT_SAVED_REGS
-#if GDB_MULTI_ARCH
-  /* Macro might contain `[{}]' when not multi-arch */
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "FRAME_INIT_SAVED_REGS(frame)",
-                      XSTRING (FRAME_INIT_SAVED_REGS (frame)));
-#endif
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: FRAME_INIT_SAVED_REGS = <0x%08lx>\n",
-                        (long) current_gdbarch->frame_init_saved_regs
-                        /*FRAME_INIT_SAVED_REGS ()*/);
-#endif
 #ifdef FRAME_LOCALS_ADDRESS
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -1589,29 +1662,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                       "gdbarch_dump: HAVE_NONSTEPPABLE_WATCHPOINT = %d\n",
                       HAVE_NONSTEPPABLE_WATCHPOINT);
 #endif
-#ifdef INIT_EXTRA_FRAME_INFO_P
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "INIT_EXTRA_FRAME_INFO_P()",
-                      XSTRING (INIT_EXTRA_FRAME_INFO_P ()));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: INIT_EXTRA_FRAME_INFO_P() = %d\n",
-                      INIT_EXTRA_FRAME_INFO_P ());
-#endif
-#ifdef INIT_EXTRA_FRAME_INFO
-#if GDB_MULTI_ARCH
-  /* Macro might contain `[{}]' when not multi-arch */
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "INIT_EXTRA_FRAME_INFO(fromleaf, frame)",
-                      XSTRING (INIT_EXTRA_FRAME_INFO (fromleaf, frame)));
-#endif
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: INIT_EXTRA_FRAME_INFO = <0x%08lx>\n",
-                        (long) current_gdbarch->init_extra_frame_info
-                        /*INIT_EXTRA_FRAME_INFO ()*/);
-#endif
 #ifdef INNER_THAN
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -1665,22 +1715,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->in_solib_return_trampoline
                         /*IN_SOLIB_RETURN_TRAMPOLINE ()*/);
 #endif
-#ifdef MAX_REGISTER_RAW_SIZE
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: MAX_REGISTER_RAW_SIZE # %s\n",
-                      XSTRING (MAX_REGISTER_RAW_SIZE));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: MAX_REGISTER_RAW_SIZE = %d\n",
-                      MAX_REGISTER_RAW_SIZE);
-#endif
-#ifdef MAX_REGISTER_VIRTUAL_SIZE
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: MAX_REGISTER_VIRTUAL_SIZE # %s\n",
-                      XSTRING (MAX_REGISTER_VIRTUAL_SIZE));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: MAX_REGISTER_VIRTUAL_SIZE = %d\n",
-                      MAX_REGISTER_VIRTUAL_SIZE);
-#endif
 #ifdef MEMORY_INSERT_BREAKPOINT
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -1857,20 +1891,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->push_arguments
                         /*PUSH_ARGUMENTS ()*/);
 #endif
-#ifdef PUSH_DUMMY_FRAME
-#if GDB_MULTI_ARCH
-  /* Macro might contain `[{}]' when not multi-arch */
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "PUSH_DUMMY_FRAME(-)",
-                      XSTRING (PUSH_DUMMY_FRAME (-)));
-#endif
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: PUSH_DUMMY_FRAME = <0x%08lx>\n",
-                        (long) current_gdbarch->push_dummy_frame
-                        /*PUSH_DUMMY_FRAME ()*/);
-#endif
 #ifdef PUSH_RETURN_ADDRESS_P
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -2024,6 +2044,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->register_to_value
                         /*REGISTER_TO_VALUE ()*/);
 #endif
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: gdbarch_register_type_p() = %d\n",
+                        gdbarch_register_type_p (current_gdbarch));
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: register_type = 0x%08lx\n",
+                        (long) current_gdbarch->register_type);
 #ifdef REGISTER_VIRTUAL_SIZE
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -2035,6 +2063,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
                         (long) current_gdbarch->register_virtual_size
                         /*REGISTER_VIRTUAL_SIZE ()*/);
 #endif
+#ifdef REGISTER_VIRTUAL_TYPE_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "REGISTER_VIRTUAL_TYPE_P()",
+                      XSTRING (REGISTER_VIRTUAL_TYPE_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: REGISTER_VIRTUAL_TYPE_P() = %d\n",
+                      REGISTER_VIRTUAL_TYPE_P ());
+#endif
 #ifdef REGISTER_VIRTUAL_TYPE
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -3281,22 +3318,26 @@ set_gdbarch_register_raw_size (struct gdbarch *gdbarch,
 }
 
 int
-gdbarch_max_register_raw_size (struct gdbarch *gdbarch)
+gdbarch_deprecated_max_register_raw_size_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_max_register_raw_size != 0;
+}
+
+int
+gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  if (gdbarch->max_register_raw_size == -1)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_max_register_raw_size invalid");
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_raw_size called\n");
-  return gdbarch->max_register_raw_size;
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_max_register_raw_size called\n");
+  return gdbarch->deprecated_max_register_raw_size;
 }
 
 void
-set_gdbarch_max_register_raw_size (struct gdbarch *gdbarch,
-                                   int max_register_raw_size)
+set_gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch,
+                                              int deprecated_max_register_raw_size)
 {
-  gdbarch->max_register_raw_size = max_register_raw_size;
+  gdbarch->deprecated_max_register_raw_size = deprecated_max_register_raw_size;
 }
 
 int
@@ -3319,22 +3360,33 @@ set_gdbarch_register_virtual_size (struct gdbarch *gdbarch,
 }
 
 int
-gdbarch_max_register_virtual_size (struct gdbarch *gdbarch)
+gdbarch_deprecated_max_register_virtual_size_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_max_register_virtual_size != 0;
+}
+
+int
+gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  if (gdbarch->max_register_virtual_size == -1)
-    internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_max_register_virtual_size invalid");
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_max_register_virtual_size called\n");
-  return gdbarch->max_register_virtual_size;
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_max_register_virtual_size called\n");
+  return gdbarch->deprecated_max_register_virtual_size;
 }
 
 void
-set_gdbarch_max_register_virtual_size (struct gdbarch *gdbarch,
-                                       int max_register_virtual_size)
+set_gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch,
+                                                  int deprecated_max_register_virtual_size)
 {
-  gdbarch->max_register_virtual_size = max_register_virtual_size;
+  gdbarch->deprecated_max_register_virtual_size = deprecated_max_register_virtual_size;
+}
+
+int
+gdbarch_register_virtual_type_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->register_virtual_type != 0;
 }
 
 struct type *
@@ -3357,6 +3409,32 @@ set_gdbarch_register_virtual_type (struct gdbarch *gdbarch,
 }
 
 int
+gdbarch_register_type_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->register_type != 0;
+}
+
+struct type *
+gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->register_type == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_register_type invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_register_type called\n");
+  return gdbarch->register_type (gdbarch, reg_nr);
+}
+
+void
+set_gdbarch_register_type (struct gdbarch *gdbarch,
+                           gdbarch_register_type_ftype register_type)
+{
+  gdbarch->register_type = register_type;
+}
+
+int
 gdbarch_deprecated_do_registers_info_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
@@ -4154,23 +4232,30 @@ set_gdbarch_push_arguments (struct gdbarch *gdbarch,
   gdbarch->push_arguments = push_arguments;
 }
 
+int
+gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_push_dummy_frame != 0;
+}
+
 void
-gdbarch_push_dummy_frame (struct gdbarch *gdbarch)
+gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  if (gdbarch->push_dummy_frame == 0)
+  if (gdbarch->deprecated_push_dummy_frame == 0)
     internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_push_dummy_frame invalid");
+                    "gdbarch: gdbarch_deprecated_push_dummy_frame invalid");
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_push_dummy_frame called\n");
-  gdbarch->push_dummy_frame ();
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_push_dummy_frame called\n");
+  gdbarch->deprecated_push_dummy_frame ();
 }
 
 void
-set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch,
-                              gdbarch_push_dummy_frame_ftype push_dummy_frame)
+set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch,
+                                         gdbarch_deprecated_push_dummy_frame_ftype deprecated_push_dummy_frame)
 {
-  gdbarch->push_dummy_frame = push_dummy_frame;
+  gdbarch->deprecated_push_dummy_frame = deprecated_push_dummy_frame;
 }
 
 int
@@ -4392,55 +4477,55 @@ set_gdbarch_use_struct_convention (struct gdbarch *gdbarch,
 }
 
 int
-gdbarch_frame_init_saved_regs_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_frame_init_saved_regs_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->frame_init_saved_regs != 0;
+  return gdbarch->deprecated_frame_init_saved_regs != 0;
 }
 
 void
-gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame)
+gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame)
 {
   gdb_assert (gdbarch != NULL);
-  if (gdbarch->frame_init_saved_regs == 0)
+  if (gdbarch->deprecated_frame_init_saved_regs == 0)
     internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_frame_init_saved_regs invalid");
+                    "gdbarch: gdbarch_deprecated_frame_init_saved_regs invalid");
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_frame_init_saved_regs called\n");
-  gdbarch->frame_init_saved_regs (frame);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_frame_init_saved_regs called\n");
+  gdbarch->deprecated_frame_init_saved_regs (frame);
 }
 
 void
-set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch,
-                                   gdbarch_frame_init_saved_regs_ftype frame_init_saved_regs)
+set_gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch,
+                                              gdbarch_deprecated_frame_init_saved_regs_ftype deprecated_frame_init_saved_regs)
 {
-  gdbarch->frame_init_saved_regs = frame_init_saved_regs;
+  gdbarch->deprecated_frame_init_saved_regs = deprecated_frame_init_saved_regs;
 }
 
 int
-gdbarch_init_extra_frame_info_p (struct gdbarch *gdbarch)
+gdbarch_deprecated_init_extra_frame_info_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->init_extra_frame_info != 0;
+  return gdbarch->deprecated_init_extra_frame_info != 0;
 }
 
 void
-gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame)
+gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame)
 {
   gdb_assert (gdbarch != NULL);
-  if (gdbarch->init_extra_frame_info == 0)
+  if (gdbarch->deprecated_init_extra_frame_info == 0)
     internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_init_extra_frame_info invalid");
+                    "gdbarch: gdbarch_deprecated_init_extra_frame_info invalid");
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_init_extra_frame_info called\n");
-  gdbarch->init_extra_frame_info (fromleaf, frame);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_init_extra_frame_info called\n");
+  gdbarch->deprecated_init_extra_frame_info (fromleaf, frame);
 }
 
 void
-set_gdbarch_init_extra_frame_info (struct gdbarch *gdbarch,
-                                   gdbarch_init_extra_frame_info_ftype init_extra_frame_info)
+set_gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch,
+                                              gdbarch_deprecated_init_extra_frame_info_ftype deprecated_init_extra_frame_info)
 {
-  gdbarch->init_extra_frame_info = init_extra_frame_info;
+  gdbarch->deprecated_init_extra_frame_info = deprecated_init_extra_frame_info;
 }
 
 CORE_ADDR
index 0680916..59dd3d6 100644 (file)
@@ -62,7 +62,7 @@ extern struct gdbarch *current_gdbarch;
 
 #if GDB_MULTI_ARCH
 #if defined (FRAME_FIND_SAVED_REGS)
-#error "FRAME_FIND_SAVED_REGS: replaced by FRAME_INIT_SAVED_REGS"
+#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS"
 #endif
 #endif
 
@@ -721,6 +721,11 @@ extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register
 #endif
 #endif
 
+/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+   MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+   REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+   by REGISTER_TYPE. */
+
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE)
 #define REGISTER_RAW_SIZE(reg_nr) (generic_register_size (reg_nr))
@@ -738,17 +743,52 @@ extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_regi
 #endif
 #endif
 
-extern int gdbarch_max_register_raw_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_max_register_raw_size (struct gdbarch *gdbarch, int max_register_raw_size);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (MAX_REGISTER_RAW_SIZE)
-#error "Non multi-arch definition of MAX_REGISTER_RAW_SIZE"
+/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+   MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+   REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+   by REGISTER_TYPE. */
+
+#if defined (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+/* Legacy for systems yet to multi-arch DEPRECATED_MAX_REGISTER_RAW_SIZE */
+#if !defined (DEPRECATED_MAX_REGISTER_RAW_SIZE_P)
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_MAX_REGISTER_RAW_SIZE_P)
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE_P() (0)
+#endif
+
+extern int gdbarch_deprecated_max_register_raw_size_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_MAX_REGISTER_RAW_SIZE_P)
+#error "Non multi-arch definition of DEPRECATED_MAX_REGISTER_RAW_SIZE"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_MAX_REGISTER_RAW_SIZE_P)
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE_P() (gdbarch_deprecated_max_register_raw_size_p (current_gdbarch))
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE (0)
+#endif
+
+extern int gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarch, int deprecated_max_register_raw_size);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+#error "Non multi-arch definition of DEPRECATED_MAX_REGISTER_RAW_SIZE"
 #endif
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MAX_REGISTER_RAW_SIZE)
-#define MAX_REGISTER_RAW_SIZE (gdbarch_max_register_raw_size (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_MAX_REGISTER_RAW_SIZE)
+#define DEPRECATED_MAX_REGISTER_RAW_SIZE (gdbarch_deprecated_max_register_raw_size (current_gdbarch))
 #endif
 #endif
 
+/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+   MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+   REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+   by REGISTER_TYPE. */
+
 /* Default (function) for non- multi-arch platforms. */
 #if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE)
 #define REGISTER_VIRTUAL_SIZE(reg_nr) (generic_register_size (reg_nr))
@@ -766,17 +806,77 @@ extern void set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, gdbarch_
 #endif
 #endif
 
-extern int gdbarch_max_register_virtual_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_max_register_virtual_size (struct gdbarch *gdbarch, int max_register_virtual_size);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (MAX_REGISTER_VIRTUAL_SIZE)
-#error "Non multi-arch definition of MAX_REGISTER_VIRTUAL_SIZE"
+/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+   MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+   REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+   by REGISTER_TYPE. */
+
+#if defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE)
+/* Legacy for systems yet to multi-arch DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE */
+#if !defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P)
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P)
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P() (0)
+#endif
+
+extern int gdbarch_deprecated_max_register_virtual_size_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P)
+#error "Non multi-arch definition of DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P)
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P() (gdbarch_deprecated_max_register_virtual_size_p (current_gdbarch))
+#endif
+
+/* Default (value) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE)
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE (0)
+#endif
+
+extern int gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gdbarch, int deprecated_max_register_virtual_size);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE)
+#error "Non multi-arch definition of DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE"
 #endif
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (MAX_REGISTER_VIRTUAL_SIZE)
-#define MAX_REGISTER_VIRTUAL_SIZE (gdbarch_max_register_virtual_size (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE)
+#define DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE (gdbarch_deprecated_max_register_virtual_size (current_gdbarch))
 #endif
 #endif
 
+/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+   MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+   REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE have all being replaced
+   by REGISTER_TYPE. */
+
+#if defined (REGISTER_VIRTUAL_TYPE)
+/* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_TYPE */
+#if !defined (REGISTER_VIRTUAL_TYPE_P)
+#define REGISTER_VIRTUAL_TYPE_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_TYPE_P)
+#define REGISTER_VIRTUAL_TYPE_P() (0)
+#endif
+
+extern int gdbarch_register_virtual_type_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_VIRTUAL_TYPE_P)
+#error "Non multi-arch definition of REGISTER_VIRTUAL_TYPE"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (REGISTER_VIRTUAL_TYPE_P)
+#define REGISTER_VIRTUAL_TYPE_P() (gdbarch_register_virtual_type_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_TYPE)
+#define REGISTER_VIRTUAL_TYPE(reg_nr) (internal_error (__FILE__, __LINE__, "REGISTER_VIRTUAL_TYPE"), 0)
+#endif
+
 typedef struct type * (gdbarch_register_virtual_type_ftype) (int reg_nr);
 extern struct type * gdbarch_register_virtual_type (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, gdbarch_register_virtual_type_ftype *register_virtual_type);
@@ -789,6 +889,12 @@ extern void set_gdbarch_register_virtual_type (struct gdbarch *gdbarch, gdbarch_
 #endif
 #endif
 
+extern int gdbarch_register_type_p (struct gdbarch *gdbarch);
+
+typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr);
+extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
+extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
+
 #if defined (DEPRECATED_DO_REGISTERS_INFO)
 /* Legacy for systems yet to multi-arch DEPRECATED_DO_REGISTERS_INFO */
 #if !defined (DEPRECATED_DO_REGISTERS_INFO_P)
@@ -1526,15 +1632,41 @@ extern void set_gdbarch_push_arguments (struct gdbarch *gdbarch, gdbarch_push_ar
 #endif
 #endif
 
-typedef void (gdbarch_push_dummy_frame_ftype) (void);
-extern void gdbarch_push_dummy_frame (struct gdbarch *gdbarch);
-extern void set_gdbarch_push_dummy_frame (struct gdbarch *gdbarch, gdbarch_push_dummy_frame_ftype *push_dummy_frame);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PUSH_DUMMY_FRAME)
-#error "Non multi-arch definition of PUSH_DUMMY_FRAME"
+#if defined (DEPRECATED_PUSH_DUMMY_FRAME)
+/* Legacy for systems yet to multi-arch DEPRECATED_PUSH_DUMMY_FRAME */
+#if !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#define DEPRECATED_PUSH_DUMMY_FRAME_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#define DEPRECATED_PUSH_DUMMY_FRAME_P() (0)
+#endif
+
+extern int gdbarch_deprecated_push_dummy_frame_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#error "Non multi-arch definition of DEPRECATED_PUSH_DUMMY_FRAME"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_DUMMY_FRAME_P)
+#define DEPRECATED_PUSH_DUMMY_FRAME_P() (gdbarch_deprecated_push_dummy_frame_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_PUSH_DUMMY_FRAME)
+#define DEPRECATED_PUSH_DUMMY_FRAME (internal_error (__FILE__, __LINE__, "DEPRECATED_PUSH_DUMMY_FRAME"), 0)
+#define DEPRECATED_PUSH_DUMMY_FRAME (gdbarch_deprecated_push_dummy_frame (current_gdbarch))
+#endif
+
+typedef void (gdbarch_deprecated_push_dummy_frame_ftype) (void);
+extern void gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_push_dummy_frame (struct gdbarch *gdbarch, gdbarch_deprecated_push_dummy_frame_ftype *deprecated_push_dummy_frame);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_PUSH_DUMMY_FRAME)
+#error "Non multi-arch definition of DEPRECATED_PUSH_DUMMY_FRAME"
 #endif
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PUSH_DUMMY_FRAME)
-#define PUSH_DUMMY_FRAME (gdbarch_push_dummy_frame (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_PUSH_DUMMY_FRAME)
+#define DEPRECATED_PUSH_DUMMY_FRAME (gdbarch_deprecated_push_dummy_frame (current_gdbarch))
 #endif
 #endif
 
@@ -1774,77 +1906,77 @@ extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_
 #endif
 #endif
 
-#if defined (FRAME_INIT_SAVED_REGS)
-/* Legacy for systems yet to multi-arch FRAME_INIT_SAVED_REGS */
-#if !defined (FRAME_INIT_SAVED_REGS_P)
-#define FRAME_INIT_SAVED_REGS_P() (1)
+#if defined (DEPRECATED_FRAME_INIT_SAVED_REGS)
+/* Legacy for systems yet to multi-arch DEPRECATED_FRAME_INIT_SAVED_REGS */
+#if !defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P)
+#define DEPRECATED_FRAME_INIT_SAVED_REGS_P() (1)
 #endif
 #endif
 
 /* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_INIT_SAVED_REGS_P)
-#define FRAME_INIT_SAVED_REGS_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P)
+#define DEPRECATED_FRAME_INIT_SAVED_REGS_P() (0)
 #endif
 
-extern int gdbarch_frame_init_saved_regs_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_INIT_SAVED_REGS_P)
-#error "Non multi-arch definition of FRAME_INIT_SAVED_REGS"
+extern int gdbarch_deprecated_frame_init_saved_regs_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P)
+#error "Non multi-arch definition of DEPRECATED_FRAME_INIT_SAVED_REGS"
 #endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_INIT_SAVED_REGS_P)
-#define FRAME_INIT_SAVED_REGS_P() (gdbarch_frame_init_saved_regs_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_INIT_SAVED_REGS_P)
+#define DEPRECATED_FRAME_INIT_SAVED_REGS_P() (gdbarch_deprecated_frame_init_saved_regs_p (current_gdbarch))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (FRAME_INIT_SAVED_REGS)
-#define FRAME_INIT_SAVED_REGS(frame) (internal_error (__FILE__, __LINE__, "FRAME_INIT_SAVED_REGS"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_FRAME_INIT_SAVED_REGS)
+#define DEPRECATED_FRAME_INIT_SAVED_REGS(frame) (internal_error (__FILE__, __LINE__, "DEPRECATED_FRAME_INIT_SAVED_REGS"), 0)
 #endif
 
-typedef void (gdbarch_frame_init_saved_regs_ftype) (struct frame_info *frame);
-extern void gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame);
-extern void set_gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (FRAME_INIT_SAVED_REGS)
-#error "Non multi-arch definition of FRAME_INIT_SAVED_REGS"
+typedef void (gdbarch_deprecated_frame_init_saved_regs_ftype) (struct frame_info *frame);
+extern void gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame);
+extern void set_gdbarch_deprecated_frame_init_saved_regs (struct gdbarch *gdbarch, gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_FRAME_INIT_SAVED_REGS)
+#error "Non multi-arch definition of DEPRECATED_FRAME_INIT_SAVED_REGS"
 #endif
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (FRAME_INIT_SAVED_REGS)
-#define FRAME_INIT_SAVED_REGS(frame) (gdbarch_frame_init_saved_regs (current_gdbarch, frame))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_FRAME_INIT_SAVED_REGS)
+#define DEPRECATED_FRAME_INIT_SAVED_REGS(frame) (gdbarch_deprecated_frame_init_saved_regs (current_gdbarch, frame))
 #endif
 #endif
 
-#if defined (INIT_EXTRA_FRAME_INFO)
-/* Legacy for systems yet to multi-arch INIT_EXTRA_FRAME_INFO */
-#if !defined (INIT_EXTRA_FRAME_INFO_P)
-#define INIT_EXTRA_FRAME_INFO_P() (1)
+#if defined (DEPRECATED_INIT_EXTRA_FRAME_INFO)
+/* Legacy for systems yet to multi-arch DEPRECATED_INIT_EXTRA_FRAME_INFO */
+#if !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P)
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO_P() (1)
 #endif
 #endif
 
 /* Default predicate for non- multi-arch targets. */
-#if (!GDB_MULTI_ARCH) && !defined (INIT_EXTRA_FRAME_INFO_P)
-#define INIT_EXTRA_FRAME_INFO_P() (0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P)
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO_P() (0)
 #endif
 
-extern int gdbarch_init_extra_frame_info_p (struct gdbarch *gdbarch);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INIT_EXTRA_FRAME_INFO_P)
-#error "Non multi-arch definition of INIT_EXTRA_FRAME_INFO"
+extern int gdbarch_deprecated_init_extra_frame_info_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P)
+#error "Non multi-arch definition of DEPRECATED_INIT_EXTRA_FRAME_INFO"
 #endif
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_EXTRA_FRAME_INFO_P)
-#define INIT_EXTRA_FRAME_INFO_P() (gdbarch_init_extra_frame_info_p (current_gdbarch))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO_P)
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO_P() (gdbarch_deprecated_init_extra_frame_info_p (current_gdbarch))
 #endif
 
 /* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (INIT_EXTRA_FRAME_INFO)
-#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) (internal_error (__FILE__, __LINE__, "INIT_EXTRA_FRAME_INFO"), 0)
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO)
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame) (internal_error (__FILE__, __LINE__, "DEPRECATED_INIT_EXTRA_FRAME_INFO"), 0)
 #endif
 
-typedef void (gdbarch_init_extra_frame_info_ftype) (int fromleaf, struct frame_info *frame);
-extern void gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame);
-extern void set_gdbarch_init_extra_frame_info (struct gdbarch *gdbarch, gdbarch_init_extra_frame_info_ftype *init_extra_frame_info);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INIT_EXTRA_FRAME_INFO)
-#error "Non multi-arch definition of INIT_EXTRA_FRAME_INFO"
+typedef void (gdbarch_deprecated_init_extra_frame_info_ftype) (int fromleaf, struct frame_info *frame);
+extern void gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, int fromleaf, struct frame_info *frame);
+extern void set_gdbarch_deprecated_init_extra_frame_info (struct gdbarch *gdbarch, gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_EXTRA_FRAME_INFO)
+#error "Non multi-arch definition of DEPRECATED_INIT_EXTRA_FRAME_INFO"
 #endif
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_EXTRA_FRAME_INFO)
-#define INIT_EXTRA_FRAME_INFO(fromleaf, frame) (gdbarch_init_extra_frame_info (current_gdbarch, fromleaf, frame))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_INIT_EXTRA_FRAME_INFO)
+#define DEPRECATED_INIT_EXTRA_FRAME_INFO(fromleaf, frame) (gdbarch_deprecated_init_extra_frame_info (current_gdbarch, fromleaf, frame))
 #endif
 #endif
 
index 2408299..12953c2 100755 (executable)
@@ -470,11 +470,32 @@ f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_n
 v:2:REGISTER_SIZE:int:register_size::::0:-1
 v:2:REGISTER_BYTES:int:register_bytes::::0:-1
 f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte::0
+# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+# by REGISTER_TYPE.
 f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
-v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
+# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+# by REGISTER_TYPE.
+V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size
+# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+# by REGISTER_TYPE.
 f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0
-v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
-f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
+# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced
+# by REGISTER_TYPE.
+V:2:DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE:int:deprecated_max_register_virtual_size
+# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE,
+# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE,
+# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE have all being replaced
+# by REGISTER_TYPE.
+F:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
+M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0:
 #
 F:2:DEPRECATED_DO_REGISTERS_INFO:void:deprecated_do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs
 m:2:PRINT_REGISTERS_INFO:void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all:::default_print_registers_info::0
@@ -536,7 +557,7 @@ F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf
 #
 f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
 f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0
-f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
+F:2:DEPRECATED_PUSH_DUMMY_FRAME:void:deprecated_push_dummy_frame:void:-:::0
 F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
 F:2:POP_FRAME:void:pop_frame:void:-:::0
 #
@@ -551,8 +572,8 @@ F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct r
 F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf:::0
 f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0
 #
-F:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:frame:::0
-F:2:INIT_EXTRA_FRAME_INFO:void:init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame:::0
+F:2:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame:::0
+F:2:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame:::0
 #
 f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0
 f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0
@@ -797,7 +818,7 @@ extern struct gdbarch *current_gdbarch;
 
 #if GDB_MULTI_ARCH
 #if defined (FRAME_FIND_SAVED_REGS)
-#error "FRAME_FIND_SAVED_REGS: replaced by FRAME_INIT_SAVED_REGS"
+#error "FRAME_FIND_SAVED_REGS: replaced by DEPRECATED_FRAME_INIT_SAVED_REGS"
 #endif
 #endif
 
index 679822f..67567d9 100644 (file)
@@ -469,6 +469,9 @@ make_qualified_type (struct type *type, int new_flags,
   /* Now set the instance flags and return the new type.  */
   TYPE_INSTANCE_FLAGS (ntype) = new_flags;
 
+  /* Set length of new type to that of the original type.  */
+  TYPE_LENGTH (ntype) = TYPE_LENGTH (type);
+
   return ntype;
 }
 
@@ -556,10 +559,26 @@ make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
 void
 replace_type (struct type *ntype, struct type *type)
 {
-  struct type *cv_chain, *as_chain, *ptr, *ref;
+  struct type *chain;
 
   *TYPE_MAIN_TYPE (ntype) = *TYPE_MAIN_TYPE (type);
 
+  /* The type length is not a part of the main type.  Update it for each
+     type on the variant chain.  */
+  chain = ntype;
+  do {
+    /* Assert that this element of the chain has no address-class bits
+       set in its flags.  Such type variants might have type lengths
+       which are supposed to be different from the non-address-class
+       variants.  This assertion shouldn't ever be triggered because
+       symbol readers which do construct address-class variants don't
+       call replace_type().  */
+    gdb_assert (TYPE_ADDRESS_CLASS_ALL (chain) == 0);
+
+    TYPE_LENGTH (ntype) = TYPE_LENGTH (type);
+    chain = TYPE_CHAIN (chain);
+  } while (ntype != chain);
+
   /* Assert that the two types have equivalent instance qualifiers.
      This should be true for at least all of our debug readers.  */
   gdb_assert (TYPE_INSTANCE_FLAGS (ntype) == TYPE_INSTANCE_FLAGS (type));
@@ -2591,7 +2610,7 @@ rank_one_type (struct type *parm, struct type *arg)
                  if (TYPE_NOSIGN (arg))        /* plain char -> plain char */
                    return 0;
                  else
-                   return INTEGER_COERCION_BADNESS;    /* signed/unsigned char -> plain char */
+                   return INTEGER_CONVERSION_BADNESS;  /* signed/unsigned char -> plain char */
                }
              else if (TYPE_UNSIGNED (parm))
                {
@@ -2604,13 +2623,13 @@ rank_one_type (struct type *parm, struct type *arg)
                               && integer_types_same_name_p (TYPE_NAME (parm), "long"))
                        return INTEGER_PROMOTION_BADNESS;       /* unsigned int -> unsigned long */
                      else
-                       return INTEGER_COERCION_BADNESS;        /* unsigned long -> unsigned int */
+                       return INTEGER_CONVERSION_BADNESS;      /* unsigned long -> unsigned int */
                    }
                  else
                    {
                      if (integer_types_same_name_p (TYPE_NAME (arg), "long")
                          && integer_types_same_name_p (TYPE_NAME (parm), "int"))
-                       return INTEGER_COERCION_BADNESS;        /* signed long -> unsigned int */
+                       return INTEGER_CONVERSION_BADNESS;      /* signed long -> unsigned int */
                      else
                        return INTEGER_CONVERSION_BADNESS;      /* signed int/long -> unsigned int/long */
                    }
@@ -2623,15 +2642,15 @@ rank_one_type (struct type *parm, struct type *arg)
                           && integer_types_same_name_p (TYPE_NAME (parm), "long"))
                    return INTEGER_PROMOTION_BADNESS;
                  else
-                   return INTEGER_COERCION_BADNESS;
+                   return INTEGER_CONVERSION_BADNESS;
                }
              else
-               return INTEGER_COERCION_BADNESS;
+               return INTEGER_CONVERSION_BADNESS;
            }
          else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
            return INTEGER_PROMOTION_BADNESS;
          else
-           return INTEGER_COERCION_BADNESS;
+           return INTEGER_CONVERSION_BADNESS;
        case TYPE_CODE_ENUM:
        case TYPE_CODE_CHAR:
        case TYPE_CODE_RANGE:
@@ -2653,7 +2672,7 @@ rank_one_type (struct type *parm, struct type *arg)
        case TYPE_CODE_RANGE:
        case TYPE_CODE_BOOL:
        case TYPE_CODE_ENUM:
-         return INTEGER_COERCION_BADNESS;
+         return INTEGER_CONVERSION_BADNESS;
        case TYPE_CODE_FLT:
          return INT_FLOAT_CONVERSION_BADNESS;
        default:
@@ -2666,12 +2685,12 @@ rank_one_type (struct type *parm, struct type *arg)
        case TYPE_CODE_RANGE:
        case TYPE_CODE_BOOL:
        case TYPE_CODE_ENUM:
-         return INTEGER_COERCION_BADNESS;
+         return INTEGER_CONVERSION_BADNESS;
        case TYPE_CODE_FLT:
          return INT_FLOAT_CONVERSION_BADNESS;
        case TYPE_CODE_INT:
          if (TYPE_LENGTH (arg) > TYPE_LENGTH (parm))
-           return INTEGER_COERCION_BADNESS;
+           return INTEGER_CONVERSION_BADNESS;
          else if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
            return INTEGER_PROMOTION_BADNESS;
          /* >>> !! else fall through !! <<< */
@@ -2683,7 +2702,7 @@ rank_one_type (struct type *parm, struct type *arg)
              if (TYPE_NOSIGN (arg))
                return 0;
              else
-               return INTEGER_COERCION_BADNESS;
+               return INTEGER_CONVERSION_BADNESS;
            }
          else if (TYPE_UNSIGNED (parm))
            {
@@ -2695,7 +2714,7 @@ rank_one_type (struct type *parm, struct type *arg)
          else if (!TYPE_NOSIGN (arg) && !TYPE_UNSIGNED (arg))
            return 0;
          else
-           return INTEGER_COERCION_BADNESS;
+           return INTEGER_CONVERSION_BADNESS;
        default:
          return INCOMPATIBLE_TYPE_BADNESS;
        }
@@ -2708,7 +2727,7 @@ rank_one_type (struct type *parm, struct type *arg)
        case TYPE_CODE_RANGE:
        case TYPE_CODE_BOOL:
        case TYPE_CODE_ENUM:
-         return INTEGER_COERCION_BADNESS;
+         return INTEGER_CONVERSION_BADNESS;
        case TYPE_CODE_FLT:
          return INT_FLOAT_CONVERSION_BADNESS;
        default:
index 30cdb5f..5a079bf 100644 (file)
@@ -297,32 +297,6 @@ struct main_type
 
   char *tag_name;
 
-  /* Length of storage for a value of this type.  This is what
-     sizeof(type) would return; use it for address arithmetic,
-     memory reads and writes, etc.  This size includes padding.  For
-     example, an i386 extended-precision floating point value really
-     only occupies ten bytes, but most ABI's declare its size to be
-     12 bytes, to preserve alignment.  A `struct type' representing
-     such a floating-point type would have a `length' value of 12,
-     even though the last two bytes are unused.
-
-     There's a bit of a host/target mess here, if you're concerned
-     about machines whose bytes aren't eight bits long, or who don't
-     have byte-addressed memory.  Various places pass this to memcpy
-     and such, meaning it must be in units of host bytes.  Various
-     other places expect they can calculate addresses by adding it
-     and such, meaning it must be in units of target bytes.  For
-     some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8
-     and TARGET_CHAR_BIT will be (say) 32, this is a problem.
-
-     One fix would be to make this field in bits (requiring that it
-     always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) ---
-     the other choice would be to make it consistently in units of
-     HOST_CHAR_BIT.  However, this would still fail to address
-     machines based on a ternary or decimal representation.  */
-  
-  unsigned length;
-
   /* FIXME, these should probably be restricted to a Fortran-specific
      field in some fashion.  */
 #define BOUND_CANNOT_BE_DETERMINED   5
@@ -489,15 +463,42 @@ struct type
   struct type *reference_type;
 
   /* Variant chain.  This points to a type that differs from this one only
-     in qualifiers.  Currently, the possible qualifiers are const, volatile,
-     code-space, and data-space.  The variants are linked in a circular
-     ring and share MAIN_TYPE.  */
+     in qualifiers and length.  Currently, the possible qualifiers are
+     const, volatile, code-space, data-space, and address class.  The
+     length may differ only when one of the address class flags are set.
+     The variants are linked in a circular ring and share MAIN_TYPE.  */
   struct type *chain;
 
   /* Flags specific to this instance of the type, indicating where
      on the ring we are.  */
   int instance_flags;
 
+  /* Length of storage for a value of this type.  This is what
+     sizeof(type) would return; use it for address arithmetic,
+     memory reads and writes, etc.  This size includes padding.  For
+     example, an i386 extended-precision floating point value really
+     only occupies ten bytes, but most ABI's declare its size to be
+     12 bytes, to preserve alignment.  A `struct type' representing
+     such a floating-point type would have a `length' value of 12,
+     even though the last two bytes are unused.
+
+     There's a bit of a host/target mess here, if you're concerned
+     about machines whose bytes aren't eight bits long, or who don't
+     have byte-addressed memory.  Various places pass this to memcpy
+     and such, meaning it must be in units of host bytes.  Various
+     other places expect they can calculate addresses by adding it
+     and such, meaning it must be in units of target bytes.  For
+     some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8
+     and TARGET_CHAR_BIT will be (say) 32, this is a problem.
+
+     One fix would be to make this field in bits (requiring that it
+     always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) ---
+     the other choice would be to make it consistently in units of
+     HOST_CHAR_BIT.  However, this would still fail to address
+     machines based on a ternary or decimal representation.  */
+  
+  unsigned length;
+
   /* Core type, shared by a group of qualified types.  */
   struct main_type *main_type;
 };
@@ -758,7 +759,7 @@ extern void allocate_cplus_struct_type (struct type *);
    But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
    so you only have to call check_typedef once.  Since allocate_value
    calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe.  */
-#define TYPE_LENGTH(thistype) TYPE_MAIN_TYPE(thistype)->length
+#define TYPE_LENGTH(thistype) (thistype)->length
 #define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile
 #define TYPE_FLAGS(thistype) TYPE_MAIN_TYPE(thistype)->flags
 /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
@@ -1211,10 +1212,6 @@ extern int count_virtual_fns (struct type *);
 #define TOO_FEW_PARAMS_BADNESS       100
 /* Badness if no conversion among types */
 #define INCOMPATIBLE_TYPE_BADNESS    100
-/* Badness of coercing large integer to smaller size */
-#define INTEGER_COERCION_BADNESS     100
-/* Badness of coercing large floating type to smaller size */
-#define FLOAT_COERCION_BADNESS       100
 
 /* Badness of integral promotion */
 #define INTEGER_PROMOTION_BADNESS      1
index cb80c95..90186cc 100644 (file)
@@ -250,7 +250,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
   /* Try to find a symbol that is the vtable */
   minsym=lookup_minimal_symbol_by_pc(vtbl);
   if (minsym==NULL
-      || (demangled_name=SYMBOL_NAME(minsym))==NULL
+      || (demangled_name=DEPRECATED_SYMBOL_NAME (minsym))==NULL
       || !is_vtable_name (demangled_name))
     return NULL;
 
index 8119a2d..b90f6ed 100644 (file)
@@ -485,8 +485,8 @@ h8300_frame_init_saved_regs (struct frame_info *fi)
 
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame.
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame.
 
    For us, the frame address is its stack pointer value, so we look up
    the function prologue to determine the caller's sp value, and return it.  */
@@ -1108,9 +1108,9 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, E_NUM_REGS * BINWORD);
   set_gdbarch_register_byte (gdbarch, h8300_register_byte);
   set_gdbarch_register_raw_size (gdbarch, h8300_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, h8300h_reg_size);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, h8300h_reg_size);
   set_gdbarch_register_virtual_size (gdbarch, h8300_register_raw_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, h8300h_reg_size);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, h8300h_reg_size);
   set_gdbarch_register_virtual_type (gdbarch, h8300_register_virtual_type);
   set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info);
   set_gdbarch_print_float_info (gdbarch, h8300_print_float_info);
@@ -1118,8 +1118,8 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /*
    * Frame Info
    */
-  set_gdbarch_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info);
-  set_gdbarch_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, h8300_frame_init_saved_regs);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, h8300_init_extra_frame_info);
   set_gdbarch_frame_chain (gdbarch, h8300_frame_chain);
   set_gdbarch_saved_pc_after_call (gdbarch, h8300_saved_pc_after_call);
   set_gdbarch_frame_saved_pc (gdbarch, h8300_frame_saved_pc);
@@ -1148,7 +1148,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Call Dummies
    * 
    * These values and methods are used when gdb calls a target function.  */
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, h8300_push_return_address);
   set_gdbarch_deprecated_extract_return_value (gdbarch, h8300_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, h8300_push_arguments);
index 944a297..f30fbd0 100644 (file)
-/* Target-dependent code for Hitachi H8/500, for GDB.
-
-   Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software
-   Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/*
-   Contributed by Steve Chamberlain
-   sac@cygnus.com
- */
-
-#include "defs.h"
-#include "frame.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "gdbcmd.h"
-#include "value.h"
-#include "dis-asm.h"
-#include "gdbcore.h"
-#include "regcache.h"
-
-#define UNSIGNED_SHORT(X) ((X) & 0xffff)
-
-static int code_size = 2;
-
-static int data_size = 2;
-
-/* Shape of an H8/500 frame :
-
-   arg-n
-   ..
-   arg-2
-   arg-1
-   return address <2 or 4 bytes>
-   old fp         <2 bytes>
-   auto-n
-   ..
-   auto-1
-   saved registers
-
- */
-
-/* an easy to debug H8 stack frame looks like:
-   0x6df6               push    r6
-   0x0d76       mov.w   r7,r6
-   0x6dfn          push    reg
-   0x7905 nnnn          mov.w  #n,r5    or   0x1b87  subs #2,sp
-   0x1957               sub.w  r5,sp
-
- */
-
-#define IS_PUSH(x) (((x) & 0xff00)==0x6d00)
-#define IS_LINK_8(x) ((x) == 0x17)
-#define IS_LINK_16(x) ((x) == 0x1f)
-#define IS_MOVE_FP(x) ((x) == 0x0d76)
-#define IS_MOV_SP_FP(x) ((x) == 0x0d76)
-#define IS_SUB2_SP(x) ((x) == 0x1b87)
-#define IS_MOVK_R5(x) ((x) == 0x7905)
-#define IS_SUB_R5SP(x) ((x) == 0x1957)
-
-#define LINK_8 0x17
-#define LINK_16 0x1f
-
-int minimum_mode = 1;
-
-CORE_ADDR
-h8500_skip_prologue (CORE_ADDR start_pc)
-{
-  short int w;
-
-  w = read_memory_integer (start_pc, 1);
-  if (w == LINK_8)
-    {
-      start_pc += 2;
-      w = read_memory_integer (start_pc, 1);
-    }
-
-  if (w == LINK_16)
-    {
-      start_pc += 3;
-      w = read_memory_integer (start_pc, 2);
-    }
-
-  return start_pc;
-}
-
-CORE_ADDR
-h8500_addr_bits_remove (CORE_ADDR addr)
-{
-  return ((addr) & 0xffffff);
-}
-
-/* Given a GDB frame, determine the address of the calling function's
-   frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame.
-
-   For us, the frame address is its stack pointer value, so we look up
-   the function prologue to determine the caller's sp value, and return it.  */
-
-CORE_ADDR
-h8500_frame_chain (struct frame_info *thisframe)
-{
-  if (!inside_entry_file (thisframe->pc))
-    return (read_memory_integer (get_frame_base (thisframe), PTR_SIZE));
-  else
-    return 0;
-}
-
-/* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
-   is not the address of a valid instruction, the address of the next
-   instruction beyond ADDR otherwise.  *PWORD1 receives the first word
-   of the instruction. */
-
-CORE_ADDR
-NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, char *pword1)
-{
-  if (addr < lim + 8)
-    {
-      read_memory (addr, pword1, 1);
-      read_memory (addr, pword1 + 1, 1);
-      return 1;
-    }
-  return 0;
-}
-
-/* Examine the prologue of a function.  `ip' points to the first
-   instruction.  `limit' is the limit of the prologue (e.g. the addr
-   of the first linenumber, or perhaps the program counter if we're
-   stepping through).  `frame_sp' is the stack pointer value in use in
-   this frame.  `fsr' is a pointer to a frame_saved_regs structure
-   into which we put info about the registers saved by this frame.
-   `fi' is a struct frame_info pointer; we fill in various fields in
-   it to reflect the offsets of the arg pointer and the locals
-   pointer.  */
-
-/* Return the saved PC from this frame. */
-
-CORE_ADDR
-frame_saved_pc (struct frame_info *frame)
-{
-  return read_memory_integer (get_frame_base (frame) + 2, PTR_SIZE);
-}
-
-void
-h8500_pop_frame (void)
-{
-  unsigned regnum;
-  struct frame_saved_regs fsr;
-  struct frame_info *frame = get_current_frame ();
-
-  deprecated_get_frame_saved_regs (frame, &fsr);
-
-  for (regnum = 0; regnum < 8; regnum++)
-    {
-      if (fsr.regs[regnum])
-       write_register (regnum, read_memory_short (fsr.regs[regnum]));
-
-      flush_cached_frames ();
-    }
-}
-
-static void
-h8500_print_register_hook (int regno)
-{
-  if (regno == CCR_REGNUM)
-    {
-      /* CCR register */
-
-      int C, Z, N, V;
-      unsigned char b[2];
-      unsigned char l;
-
-      frame_register_read (deprecated_selected_frame, regno, b);
-      l = b[1];
-      printf_unfiltered ("\t");
-      printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
-      N = (l & 0x8) != 0;
-      Z = (l & 0x4) != 0;
-      V = (l & 0x2) != 0;
-      C = (l & 0x1) != 0;
-      printf_unfiltered ("N-%d ", N);
-      printf_unfiltered ("Z-%d ", Z);
-      printf_unfiltered ("V-%d ", V);
-      printf_unfiltered ("C-%d ", C);
-      if ((C | Z) == 0)
-       printf_unfiltered ("u> ");
-      if ((C | Z) == 1)
-       printf_unfiltered ("u<= ");
-      if ((C == 0))
-       printf_unfiltered ("u>= ");
-      if (C == 1)
-       printf_unfiltered ("u< ");
-      if (Z == 0)
-       printf_unfiltered ("!= ");
-      if (Z == 1)
-       printf_unfiltered ("== ");
-      if ((N ^ V) == 0)
-       printf_unfiltered (">= ");
-      if ((N ^ V) == 1)
-       printf_unfiltered ("< ");
-      if ((Z | (N ^ V)) == 0)
-       printf_unfiltered ("> ");
-      if ((Z | (N ^ V)) == 1)
-       printf_unfiltered ("<= ");
-    }
-}
-
-static void
-h8500_print_registers_info (struct gdbarch *gdbarch,
-                           struct ui_file *file,
-                           struct frame_info *frame,
-                           int regnum, int print_all)
-{
-  int i;
-  const int numregs = NUM_REGS + NUM_PSEUDO_REGS;
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
-  char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
-
-  for (i = 0; i < numregs; i++)
-    {
-      /* Decide between printing all regs, non-float / vector regs, or
-         specific reg.  */
-      if (regnum == -1)
-       {
-         if (!print_all)
-           {
-             if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
-               continue;
-             if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
-               continue;
-           }
-       }
-      else
-       {
-         if (i != regnum)
-           continue;
-       }
-
-      /* If the register name is empty, it is undefined for this
-         processor, so don't display anything.  */
-      if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
-       continue;
-
-      fputs_filtered (REGISTER_NAME (i), file);
-      print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file);
-
-      /* Get the data in raw format.  */
-      if (! frame_register_read (frame, i, raw_buffer))
-       {
-         fprintf_filtered (file, "*value not available*\n");
-         continue;
-       }
-
-      /* FIXME: cagney/2002-08-03: This code shouldn't be necessary.
-         The function frame_register_read() should have returned the
-         pre-cooked register so no conversion is necessary.  */
-      /* Convert raw data to virtual format if necessary.  */
-      if (REGISTER_CONVERTIBLE (i))
-       {
-         REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
-                                      raw_buffer, virtual_buffer);
-       }
-      else
-       {
-         memcpy (virtual_buffer, raw_buffer,
-                 REGISTER_VIRTUAL_SIZE (i));
-       }
-
-      /* If virtual format is floating, print it that way, and in raw
-         hex.  */
-      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
-       {
-         int j;
-
-         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-                    file, 0, 1, 0, Val_pretty_default);
-
-         fprintf_filtered (file, "\t(raw 0x");
-         for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
-           {
-             int idx;
-             if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-               idx = j;
-             else
-               idx = REGISTER_RAW_SIZE (i) - 1 - j;
-             fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]);
-           }
-         fprintf_filtered (file, ")");
-       }
-      else
-       {
-         /* Print the register in hex.  */
-         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-                    file, 'x', 1, 0, Val_pretty_default);
-          /* If not a vector register, print it also according to its
-             natural format.  */
-         if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
-           {
-             fprintf_filtered (file, "\t");
-             val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-                        file, 0, 1, 0, Val_pretty_default);
-           }
-       }
-
-      /* Some h8500 specific info.  */
-      h8500_print_register_hook (i);
-
-      fprintf_filtered (file, "\n");
-    }
-}
-
-void
-h8500_do_registers_info (int regnum, int all)
-{
-  h8500_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame,
-                             regnum, all);
-}
-
-int
-h8500_register_size (int regno)
-{
-  switch (regno)
-    {
-    case SEG_C_REGNUM:
-    case SEG_D_REGNUM:
-    case SEG_E_REGNUM:
-    case SEG_T_REGNUM:
-      return 1;
-    case R0_REGNUM:
-    case R1_REGNUM:
-    case R2_REGNUM:
-    case R3_REGNUM:
-    case R4_REGNUM:
-    case R5_REGNUM:
-    case R6_REGNUM:
-    case R7_REGNUM:
-    case CCR_REGNUM:
-      return 2;
-
-    case PR0_REGNUM:
-    case PR1_REGNUM:
-    case PR2_REGNUM:
-    case PR3_REGNUM:
-    case PR4_REGNUM:
-    case PR5_REGNUM:
-    case PR6_REGNUM:
-    case PR7_REGNUM:
-    case PC_REGNUM:
-      return 4;
-    default:
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-}
-
-struct type *
-h8500_register_virtual_type (int regno)
-{
-  switch (regno)
-    {
-    case SEG_C_REGNUM:
-    case SEG_E_REGNUM:
-    case SEG_D_REGNUM:
-    case SEG_T_REGNUM:
-      return builtin_type_unsigned_char;
-    case R0_REGNUM:
-    case R1_REGNUM:
-    case R2_REGNUM:
-    case R3_REGNUM:
-    case R4_REGNUM:
-    case R5_REGNUM:
-    case R6_REGNUM:
-    case R7_REGNUM:
-    case CCR_REGNUM:
-      return builtin_type_unsigned_short;
-    case PR0_REGNUM:
-    case PR1_REGNUM:
-    case PR2_REGNUM:
-    case PR3_REGNUM:
-    case PR4_REGNUM:
-    case PR5_REGNUM:
-    case PR6_REGNUM:
-    case PR7_REGNUM:
-    case PC_REGNUM:
-      return builtin_type_unsigned_long;
-    default:
-      internal_error (__FILE__, __LINE__, "failed internal consistency check");
-    }
-}
-
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of the saved registers of frame described by FRAME_INFO.
-   This includes special registers such as pc and fp saved in special
-   ways in the stack frame.  sp is even more special:
-   the address we return for it IS the sp for the next frame.  */
-
-void
-frame_find_saved_regs (struct frame_info *frame_info,
-                      struct frame_saved_regs *frame_saved_regs)
-{
-  register int regnum;
-  register int regmask;
-  register CORE_ADDR next_addr;
-  register CORE_ADDR pc;
-  unsigned char thebyte;
-
-  memset (frame_saved_regs, '\0', sizeof *frame_saved_regs);
-
-  if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4
-      && (frame_info)->pc <= (frame_info)->frame)
-    {
-      next_addr = (frame_info)->frame;
-      pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4;
-    }
-  else
-    {
-      pc = get_pc_function_start ((frame_info)->pc);
-      /* Verify we have a link a6 instruction next;
-         if not we lose.  If we win, find the address above the saved
-         regs using the amount of storage from the link instruction.
-       */
-
-      thebyte = read_memory_integer (pc, 1);
-      if (0x1f == thebyte)
-       next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 2), pc += 2;
-      else if (0x17 == thebyte)
-       next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 1), pc += 1;
-      else
-       goto lose;
-#if 0
-      /* FIXME steve */
-      /* If have an add:g.waddal #-n, sp next, adjust next_addr.  */
-      if ((0x0c0177777 & read_memory_integer (pc, 2)) == 0157774)
-       next_addr += read_memory_integer (pc += 2, 4), pc += 4;
-#endif
-    }
-
-  thebyte = read_memory_integer (pc, 1);
-  if (thebyte == 0x12)
-    {
-      /* Got stm */
-      pc++;
-      regmask = read_memory_integer (pc, 1);
-      pc++;
-      for (regnum = 0; regnum < 8; regnum++, regmask >>= 1)
-       {
-         if (regmask & 1)
-           {
-             (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2;
-           }
-       }
-      thebyte = read_memory_integer (pc, 1);
-    }
-  /* Maybe got a load of pushes */
-  while (thebyte == 0xbf)
-    {
-      pc++;
-      regnum = read_memory_integer (pc, 1) & 0x7;
-      pc++;
-      (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2;
-      thebyte = read_memory_integer (pc, 1);
-    }
-
-lose:;
-
-  /* Remember the address of the frame pointer */
-  (frame_saved_regs)->regs[FP_REGNUM] = (frame_info)->frame;
-
-  /* This is where the old sp is hidden */
-  (frame_saved_regs)->regs[SP_REGNUM] = (frame_info)->frame;
-
-  /* And the PC - remember the pushed FP is always two bytes long */
-  (frame_saved_regs)->regs[PC_REGNUM] = (frame_info)->frame + 2;
-}
-
-CORE_ADDR
-saved_pc_after_call (void)
-{
-  int x;
-  int a = read_register (SP_REGNUM);
-
-  x = read_memory_integer (a, code_size);
-  if (code_size == 2)
-    {
-      /* Stick current code segement onto top */
-      x &= 0xffff;
-      x |= read_register (SEG_C_REGNUM) << 16;
-    }
-  x &= 0xffffff;
-  return x;
-}
-
-void
-h8500_set_pointer_size (int newsize)
-{
-  static int oldsize = 0;
-
-  if (oldsize != newsize)
-    {
-      printf_unfiltered ("pointer size set to %d bits\n", newsize);
-      oldsize = newsize;
-      if (newsize == 32)
-       {
-         minimum_mode = 0;
-       }
-      else
-       {
-         minimum_mode = 1;
-       }
-      _initialize_gdbtypes ();
-    }
-}
-
-static void
-big_command (char *arg, int from_tty)
-{
-  h8500_set_pointer_size (32);
-  code_size = 4;
-  data_size = 4;
-}
-
-static void
-medium_command (char *arg, int from_tty)
-{
-  h8500_set_pointer_size (32);
-  code_size = 4;
-  data_size = 2;
-}
-
-static void
-compact_command (char *arg, int from_tty)
-{
-  h8500_set_pointer_size (32);
-  code_size = 2;
-  data_size = 4;
-}
-
-static void
-small_command (char *arg, int from_tty)
-{
-  h8500_set_pointer_size (16);
-  code_size = 2;
-  data_size = 2;
-}
-
-static struct cmd_list_element *setmemorylist;
-
-static void
-set_memory (char *args, int from_tty)
-{
-  printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
-  help_list (setmemorylist, "set memory ", -1, gdb_stdout);
-}
-
-/* See if variable name is ppc or pr[0-7] */
-
-int
-h8500_is_trapped_internalvar (char *name)
-{
-  if (name[0] != 'p')
-    return 0;
-
-  if (strcmp (name + 1, "pc") == 0)
-    return 1;
-
-  if (name[1] == 'r'
-      && name[2] >= '0'
-      && name[2] <= '7'
-      && name[3] == '\000')
-    return 1;
-  else
-    return 0;
-}
-
-struct value *
-h8500_value_of_trapped_internalvar (struct internalvar *var)
-{
-  LONGEST regval;
-  unsigned char regbuf[4];
-  int page_regnum, regnum;
-
-  regnum = var->name[2] == 'c' ? PC_REGNUM : var->name[2] - '0';
-
-  switch (var->name[2])
-    {
-    case 'c':
-      page_regnum = SEG_C_REGNUM;
-      break;
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-      page_regnum = SEG_D_REGNUM;
-      break;
-    case '4':
-    case '5':
-      page_regnum = SEG_E_REGNUM;
-      break;
-    case '6':
-    case '7':
-      page_regnum = SEG_T_REGNUM;
-      break;
-    }
-
-  get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, page_regnum, NULL);
-  regval = regbuf[0] << 16;
-
-  get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, regnum, NULL);
-  regval |= regbuf[0] << 8 | regbuf[1];                /* XXX host/target byte order */
-
-  xfree (var->value);          /* Free up old value */
-
-  var->value = value_from_longest (builtin_type_unsigned_long, regval);
-  release_value (var->value);  /* Unchain new value */
-
-  VALUE_LVAL (var->value) = lval_internalvar;
-  VALUE_INTERNALVAR (var->value) = var;
-  return var->value;
-}
-
-void
-h8500_set_trapped_internalvar (struct internalvar *var, struct value *newval,
-                              int bitpos, int bitsize, int offset)
-{
-  char *page_regnum, *regnum;
-  char expression[100];
-  unsigned new_regval;
-  struct type *type;
-  enum type_code newval_type_code;
-
-  type = check_typedef (VALUE_TYPE (newval));
-  newval_type_code = TYPE_CODE (type);
-
-  if ((newval_type_code != TYPE_CODE_INT
-       && newval_type_code != TYPE_CODE_PTR)
-      || TYPE_LENGTH (type) != sizeof (new_regval))
-    error ("Illegal type (%s) for assignment to $%s\n",
-          TYPE_NAME (VALUE_TYPE (newval)), var->name);
-
-  new_regval = *(long *) VALUE_CONTENTS_RAW (newval);
-
-  regnum = var->name + 1;
-
-  switch (var->name[2])
-    {
-    case 'c':
-      page_regnum = "cp";
-      break;
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-      page_regnum = "dp";
-      break;
-    case '4':
-    case '5':
-      page_regnum = "ep";
-      break;
-    case '6':
-    case '7':
-      page_regnum = "tp";
-      break;
-    }
-
-  sprintf (expression, "$%s=%d", page_regnum, new_regval >> 16);
-  parse_and_eval (expression);
-
-  sprintf (expression, "$%s=%d", regnum, new_regval & 0xffff);
-  parse_and_eval (expression);
-}
-
-CORE_ADDR
-h8500_read_sp (void)
-{
-  return read_register (PR7_REGNUM);
-}
-
-void
-h8500_write_sp (CORE_ADDR v)
-{
-  write_register (PR7_REGNUM, v);
-}
-
-CORE_ADDR
-h8500_read_pc (ptid_t ptid)
-{
-  return read_register (PC_REGNUM);
-}
-
-void
-h8500_write_pc (CORE_ADDR v, ptid_t ptid)
-{
-  write_register (PC_REGNUM, v);
-}
-
-CORE_ADDR
-h8500_read_fp (void)
-{
-  return read_register (PR6_REGNUM);
-}
-
-void
-_initialize_h8500_tdep (void)
-{
-  tm_print_insn = print_insn_h8500;
-
-  add_prefix_cmd ("memory", no_class, set_memory,
-                 "set the memory model", &setmemorylist, "set memory ", 0,
-                 &setlist);
-
-  add_cmd ("small", class_support, small_command,
-      "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist);
-
-  add_cmd ("big", class_support, big_command,
-       "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist);
-
-  add_cmd ("medium", class_support, medium_command,
-     "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist);
-
-  add_cmd ("compact", class_support, compact_command,
-    "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist);
-
-}
+// OBSOLETE /* Target-dependent code for Hitachi H8/500, for GDB.
+// OBSOLETE 
+// OBSOLETE    Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software
+// OBSOLETE    Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE /*
+// OBSOLETE    Contributed by Steve Chamberlain
+// OBSOLETE    sac@cygnus.com
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "frame.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "gdbtypes.h"
+// OBSOLETE #include "gdbcmd.h"
+// OBSOLETE #include "value.h"
+// OBSOLETE #include "dis-asm.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE #define UNSIGNED_SHORT(X) ((X) & 0xffff)
+// OBSOLETE 
+// OBSOLETE static int code_size = 2;
+// OBSOLETE 
+// OBSOLETE static int data_size = 2;
+// OBSOLETE 
+// OBSOLETE /* Shape of an H8/500 frame :
+// OBSOLETE 
+// OBSOLETE    arg-n
+// OBSOLETE    ..
+// OBSOLETE    arg-2
+// OBSOLETE    arg-1
+// OBSOLETE    return address <2 or 4 bytes>
+// OBSOLETE    old fp         <2 bytes>
+// OBSOLETE    auto-n
+// OBSOLETE    ..
+// OBSOLETE    auto-1
+// OBSOLETE    saved registers
+// OBSOLETE 
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE /* an easy to debug H8 stack frame looks like:
+// OBSOLETE    0x6df6               push    r6
+// OBSOLETE    0x0d76       mov.w   r7,r6
+// OBSOLETE    0x6dfn          push    reg
+// OBSOLETE    0x7905 nnnn          mov.w  #n,r5    or   0x1b87  subs #2,sp
+// OBSOLETE    0x1957               sub.w  r5,sp
+// OBSOLETE 
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE #define IS_PUSH(x) (((x) & 0xff00)==0x6d00)
+// OBSOLETE #define IS_LINK_8(x) ((x) == 0x17)
+// OBSOLETE #define IS_LINK_16(x) ((x) == 0x1f)
+// OBSOLETE #define IS_MOVE_FP(x) ((x) == 0x0d76)
+// OBSOLETE #define IS_MOV_SP_FP(x) ((x) == 0x0d76)
+// OBSOLETE #define IS_SUB2_SP(x) ((x) == 0x1b87)
+// OBSOLETE #define IS_MOVK_R5(x) ((x) == 0x7905)
+// OBSOLETE #define IS_SUB_R5SP(x) ((x) == 0x1957)
+// OBSOLETE 
+// OBSOLETE #define LINK_8 0x17
+// OBSOLETE #define LINK_16 0x1f
+// OBSOLETE 
+// OBSOLETE int minimum_mode = 1;
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE h8500_skip_prologue (CORE_ADDR start_pc)
+// OBSOLETE {
+// OBSOLETE   short int w;
+// OBSOLETE 
+// OBSOLETE   w = read_memory_integer (start_pc, 1);
+// OBSOLETE   if (w == LINK_8)
+// OBSOLETE     {
+// OBSOLETE       start_pc += 2;
+// OBSOLETE       w = read_memory_integer (start_pc, 1);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   if (w == LINK_16)
+// OBSOLETE     {
+// OBSOLETE       start_pc += 3;
+// OBSOLETE       w = read_memory_integer (start_pc, 2);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   return start_pc;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE h8500_addr_bits_remove (CORE_ADDR addr)
+// OBSOLETE {
+// OBSOLETE   return ((addr) & 0xffffff);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Given a GDB frame, determine the address of the calling function's
+// OBSOLETE    frame.  This will be used to create a new GDB frame struct, and
+// OBSOLETE    then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
+// OBSOLETE    called for the new frame.
+// OBSOLETE 
+// OBSOLETE    For us, the frame address is its stack pointer value, so we look up
+// OBSOLETE    the function prologue to determine the caller's sp value, and return it.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE h8500_frame_chain (struct frame_info *thisframe)
+// OBSOLETE {
+// OBSOLETE   if (!inside_entry_file (thisframe->pc))
+// OBSOLETE     return (read_memory_integer (get_frame_base (thisframe), PTR_SIZE));
+// OBSOLETE   else
+// OBSOLETE     return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
+// OBSOLETE    is not the address of a valid instruction, the address of the next
+// OBSOLETE    instruction beyond ADDR otherwise.  *PWORD1 receives the first word
+// OBSOLETE    of the instruction. */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, char *pword1)
+// OBSOLETE {
+// OBSOLETE   if (addr < lim + 8)
+// OBSOLETE     {
+// OBSOLETE       read_memory (addr, pword1, 1);
+// OBSOLETE       read_memory (addr, pword1 + 1, 1);
+// OBSOLETE       return 1;
+// OBSOLETE     }
+// OBSOLETE   return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Examine the prologue of a function.  `ip' points to the first
+// OBSOLETE    instruction.  `limit' is the limit of the prologue (e.g. the addr
+// OBSOLETE    of the first linenumber, or perhaps the program counter if we're
+// OBSOLETE    stepping through).  `frame_sp' is the stack pointer value in use in
+// OBSOLETE    this frame.  `fsr' is a pointer to a frame_saved_regs structure
+// OBSOLETE    into which we put info about the registers saved by this frame.
+// OBSOLETE    `fi' is a struct frame_info pointer; we fill in various fields in
+// OBSOLETE    it to reflect the offsets of the arg pointer and the locals
+// OBSOLETE    pointer.  */
+// OBSOLETE 
+// OBSOLETE /* Return the saved PC from this frame. */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE frame_saved_pc (struct frame_info *frame)
+// OBSOLETE {
+// OBSOLETE   return read_memory_integer (get_frame_base (frame) + 2, PTR_SIZE);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE h8500_pop_frame (void)
+// OBSOLETE {
+// OBSOLETE   unsigned regnum;
+// OBSOLETE   struct frame_saved_regs fsr;
+// OBSOLETE   struct frame_info *frame = get_current_frame ();
+// OBSOLETE 
+// OBSOLETE   deprecated_get_frame_saved_regs (frame, &fsr);
+// OBSOLETE 
+// OBSOLETE   for (regnum = 0; regnum < 8; regnum++)
+// OBSOLETE     {
+// OBSOLETE       if (fsr.regs[regnum])
+// OBSOLETE    write_register (regnum, read_memory_short (fsr.regs[regnum]));
+// OBSOLETE 
+// OBSOLETE       flush_cached_frames ();
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE h8500_print_register_hook (int regno)
+// OBSOLETE {
+// OBSOLETE   if (regno == CCR_REGNUM)
+// OBSOLETE     {
+// OBSOLETE       /* CCR register */
+// OBSOLETE 
+// OBSOLETE       int C, Z, N, V;
+// OBSOLETE       unsigned char b[2];
+// OBSOLETE       unsigned char l;
+// OBSOLETE 
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno, b);
+// OBSOLETE       l = b[1];
+// OBSOLETE       printf_unfiltered ("\t");
+// OBSOLETE       printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
+// OBSOLETE       N = (l & 0x8) != 0;
+// OBSOLETE       Z = (l & 0x4) != 0;
+// OBSOLETE       V = (l & 0x2) != 0;
+// OBSOLETE       C = (l & 0x1) != 0;
+// OBSOLETE       printf_unfiltered ("N-%d ", N);
+// OBSOLETE       printf_unfiltered ("Z-%d ", Z);
+// OBSOLETE       printf_unfiltered ("V-%d ", V);
+// OBSOLETE       printf_unfiltered ("C-%d ", C);
+// OBSOLETE       if ((C | Z) == 0)
+// OBSOLETE    printf_unfiltered ("u> ");
+// OBSOLETE       if ((C | Z) == 1)
+// OBSOLETE    printf_unfiltered ("u<= ");
+// OBSOLETE       if ((C == 0))
+// OBSOLETE    printf_unfiltered ("u>= ");
+// OBSOLETE       if (C == 1)
+// OBSOLETE    printf_unfiltered ("u< ");
+// OBSOLETE       if (Z == 0)
+// OBSOLETE    printf_unfiltered ("!= ");
+// OBSOLETE       if (Z == 1)
+// OBSOLETE    printf_unfiltered ("== ");
+// OBSOLETE       if ((N ^ V) == 0)
+// OBSOLETE    printf_unfiltered (">= ");
+// OBSOLETE       if ((N ^ V) == 1)
+// OBSOLETE    printf_unfiltered ("< ");
+// OBSOLETE       if ((Z | (N ^ V)) == 0)
+// OBSOLETE    printf_unfiltered ("> ");
+// OBSOLETE       if ((Z | (N ^ V)) == 1)
+// OBSOLETE    printf_unfiltered ("<= ");
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE h8500_print_registers_info (struct gdbarch *gdbarch,
+// OBSOLETE                        struct ui_file *file,
+// OBSOLETE                        struct frame_info *frame,
+// OBSOLETE                        int regnum, int print_all)
+// OBSOLETE {
+// OBSOLETE   int i;
+// OBSOLETE   const int numregs = NUM_REGS + NUM_PSEUDO_REGS;
+// OBSOLETE   char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+// OBSOLETE   char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
+// OBSOLETE 
+// OBSOLETE   for (i = 0; i < numregs; i++)
+// OBSOLETE     {
+// OBSOLETE       /* Decide between printing all regs, non-float / vector regs, or
+// OBSOLETE          specific reg.  */
+// OBSOLETE       if (regnum == -1)
+// OBSOLETE    {
+// OBSOLETE      if (!print_all)
+// OBSOLETE        {
+// OBSOLETE          if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+// OBSOLETE            continue;
+// OBSOLETE          if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
+// OBSOLETE            continue;
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      if (i != regnum)
+// OBSOLETE        continue;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* If the register name is empty, it is undefined for this
+// OBSOLETE          processor, so don't display anything.  */
+// OBSOLETE       if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
+// OBSOLETE    continue;
+// OBSOLETE 
+// OBSOLETE       fputs_filtered (REGISTER_NAME (i), file);
+// OBSOLETE       print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file);
+// OBSOLETE 
+// OBSOLETE       /* Get the data in raw format.  */
+// OBSOLETE       if (! frame_register_read (frame, i, raw_buffer))
+// OBSOLETE    {
+// OBSOLETE      fprintf_filtered (file, "*value not available*\n");
+// OBSOLETE      continue;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* FIXME: cagney/2002-08-03: This code shouldn't be necessary.
+// OBSOLETE          The function frame_register_read() should have returned the
+// OBSOLETE          pre-cooked register so no conversion is necessary.  */
+// OBSOLETE       /* Convert raw data to virtual format if necessary.  */
+// OBSOLETE       if (REGISTER_CONVERTIBLE (i))
+// OBSOLETE    {
+// OBSOLETE      REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
+// OBSOLETE                                   raw_buffer, virtual_buffer);
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      memcpy (virtual_buffer, raw_buffer,
+// OBSOLETE              REGISTER_VIRTUAL_SIZE (i));
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* If virtual format is floating, print it that way, and in raw
+// OBSOLETE          hex.  */
+// OBSOLETE       if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+// OBSOLETE    {
+// OBSOLETE      int j;
+// OBSOLETE 
+// OBSOLETE      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+// OBSOLETE                 file, 0, 1, 0, Val_pretty_default);
+// OBSOLETE 
+// OBSOLETE      fprintf_filtered (file, "\t(raw 0x");
+// OBSOLETE      for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
+// OBSOLETE        {
+// OBSOLETE          int idx;
+// OBSOLETE          if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+// OBSOLETE            idx = j;
+// OBSOLETE          else
+// OBSOLETE            idx = REGISTER_RAW_SIZE (i) - 1 - j;
+// OBSOLETE          fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]);
+// OBSOLETE        }
+// OBSOLETE      fprintf_filtered (file, ")");
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      /* Print the register in hex.  */
+// OBSOLETE      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+// OBSOLETE                 file, 'x', 1, 0, Val_pretty_default);
+// OBSOLETE           /* If not a vector register, print it also according to its
+// OBSOLETE              natural format.  */
+// OBSOLETE      if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+// OBSOLETE        {
+// OBSOLETE          fprintf_filtered (file, "\t");
+// OBSOLETE          val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+// OBSOLETE                     file, 0, 1, 0, Val_pretty_default);
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* Some h8500 specific info.  */
+// OBSOLETE       h8500_print_register_hook (i);
+// OBSOLETE 
+// OBSOLETE       fprintf_filtered (file, "\n");
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE h8500_do_registers_info (int regnum, int all)
+// OBSOLETE {
+// OBSOLETE   h8500_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame,
+// OBSOLETE                          regnum, all);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE int
+// OBSOLETE h8500_register_size (int regno)
+// OBSOLETE {
+// OBSOLETE   switch (regno)
+// OBSOLETE     {
+// OBSOLETE     case SEG_C_REGNUM:
+// OBSOLETE     case SEG_D_REGNUM:
+// OBSOLETE     case SEG_E_REGNUM:
+// OBSOLETE     case SEG_T_REGNUM:
+// OBSOLETE       return 1;
+// OBSOLETE     case R0_REGNUM:
+// OBSOLETE     case R1_REGNUM:
+// OBSOLETE     case R2_REGNUM:
+// OBSOLETE     case R3_REGNUM:
+// OBSOLETE     case R4_REGNUM:
+// OBSOLETE     case R5_REGNUM:
+// OBSOLETE     case R6_REGNUM:
+// OBSOLETE     case R7_REGNUM:
+// OBSOLETE     case CCR_REGNUM:
+// OBSOLETE       return 2;
+// OBSOLETE 
+// OBSOLETE     case PR0_REGNUM:
+// OBSOLETE     case PR1_REGNUM:
+// OBSOLETE     case PR2_REGNUM:
+// OBSOLETE     case PR3_REGNUM:
+// OBSOLETE     case PR4_REGNUM:
+// OBSOLETE     case PR5_REGNUM:
+// OBSOLETE     case PR6_REGNUM:
+// OBSOLETE     case PR7_REGNUM:
+// OBSOLETE     case PC_REGNUM:
+// OBSOLETE       return 4;
+// OBSOLETE     default:
+// OBSOLETE       internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE struct type *
+// OBSOLETE h8500_register_virtual_type (int regno)
+// OBSOLETE {
+// OBSOLETE   switch (regno)
+// OBSOLETE     {
+// OBSOLETE     case SEG_C_REGNUM:
+// OBSOLETE     case SEG_E_REGNUM:
+// OBSOLETE     case SEG_D_REGNUM:
+// OBSOLETE     case SEG_T_REGNUM:
+// OBSOLETE       return builtin_type_unsigned_char;
+// OBSOLETE     case R0_REGNUM:
+// OBSOLETE     case R1_REGNUM:
+// OBSOLETE     case R2_REGNUM:
+// OBSOLETE     case R3_REGNUM:
+// OBSOLETE     case R4_REGNUM:
+// OBSOLETE     case R5_REGNUM:
+// OBSOLETE     case R6_REGNUM:
+// OBSOLETE     case R7_REGNUM:
+// OBSOLETE     case CCR_REGNUM:
+// OBSOLETE       return builtin_type_unsigned_short;
+// OBSOLETE     case PR0_REGNUM:
+// OBSOLETE     case PR1_REGNUM:
+// OBSOLETE     case PR2_REGNUM:
+// OBSOLETE     case PR3_REGNUM:
+// OBSOLETE     case PR4_REGNUM:
+// OBSOLETE     case PR5_REGNUM:
+// OBSOLETE     case PR6_REGNUM:
+// OBSOLETE     case PR7_REGNUM:
+// OBSOLETE     case PC_REGNUM:
+// OBSOLETE       return builtin_type_unsigned_long;
+// OBSOLETE     default:
+// OBSOLETE       internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
+// OBSOLETE    the addresses of the saved registers of frame described by FRAME_INFO.
+// OBSOLETE    This includes special registers such as pc and fp saved in special
+// OBSOLETE    ways in the stack frame.  sp is even more special:
+// OBSOLETE    the address we return for it IS the sp for the next frame.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE frame_find_saved_regs (struct frame_info *frame_info,
+// OBSOLETE                   struct frame_saved_regs *frame_saved_regs)
+// OBSOLETE {
+// OBSOLETE   register int regnum;
+// OBSOLETE   register int regmask;
+// OBSOLETE   register CORE_ADDR next_addr;
+// OBSOLETE   register CORE_ADDR pc;
+// OBSOLETE   unsigned char thebyte;
+// OBSOLETE 
+// OBSOLETE   memset (frame_saved_regs, '\0', sizeof *frame_saved_regs);
+// OBSOLETE 
+// OBSOLETE   if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4
+// OBSOLETE       && (frame_info)->pc <= (frame_info)->frame)
+// OBSOLETE     {
+// OBSOLETE       next_addr = (frame_info)->frame;
+// OBSOLETE       pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4;
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       pc = get_pc_function_start ((frame_info)->pc);
+// OBSOLETE       /* Verify we have a link a6 instruction next;
+// OBSOLETE          if not we lose.  If we win, find the address above the saved
+// OBSOLETE          regs using the amount of storage from the link instruction.
+// OBSOLETE        */
+// OBSOLETE 
+// OBSOLETE       thebyte = read_memory_integer (pc, 1);
+// OBSOLETE       if (0x1f == thebyte)
+// OBSOLETE    next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 2), pc += 2;
+// OBSOLETE       else if (0x17 == thebyte)
+// OBSOLETE    next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 1), pc += 1;
+// OBSOLETE       else
+// OBSOLETE    goto lose;
+// OBSOLETE #if 0
+// OBSOLETE       /* FIXME steve */
+// OBSOLETE       /* If have an add:g.waddal #-n, sp next, adjust next_addr.  */
+// OBSOLETE       if ((0x0c0177777 & read_memory_integer (pc, 2)) == 0157774)
+// OBSOLETE    next_addr += read_memory_integer (pc += 2, 4), pc += 4;
+// OBSOLETE #endif
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   thebyte = read_memory_integer (pc, 1);
+// OBSOLETE   if (thebyte == 0x12)
+// OBSOLETE     {
+// OBSOLETE       /* Got stm */
+// OBSOLETE       pc++;
+// OBSOLETE       regmask = read_memory_integer (pc, 1);
+// OBSOLETE       pc++;
+// OBSOLETE       for (regnum = 0; regnum < 8; regnum++, regmask >>= 1)
+// OBSOLETE    {
+// OBSOLETE      if (regmask & 1)
+// OBSOLETE        {
+// OBSOLETE          (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2;
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE       thebyte = read_memory_integer (pc, 1);
+// OBSOLETE     }
+// OBSOLETE   /* Maybe got a load of pushes */
+// OBSOLETE   while (thebyte == 0xbf)
+// OBSOLETE     {
+// OBSOLETE       pc++;
+// OBSOLETE       regnum = read_memory_integer (pc, 1) & 0x7;
+// OBSOLETE       pc++;
+// OBSOLETE       (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2;
+// OBSOLETE       thebyte = read_memory_integer (pc, 1);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE lose:;
+// OBSOLETE 
+// OBSOLETE   /* Remember the address of the frame pointer */
+// OBSOLETE   (frame_saved_regs)->regs[FP_REGNUM] = (frame_info)->frame;
+// OBSOLETE 
+// OBSOLETE   /* This is where the old sp is hidden */
+// OBSOLETE   (frame_saved_regs)->regs[SP_REGNUM] = (frame_info)->frame;
+// OBSOLETE 
+// OBSOLETE   /* And the PC - remember the pushed FP is always two bytes long */
+// OBSOLETE   (frame_saved_regs)->regs[PC_REGNUM] = (frame_info)->frame + 2;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE saved_pc_after_call (void)
+// OBSOLETE {
+// OBSOLETE   int x;
+// OBSOLETE   int a = read_register (SP_REGNUM);
+// OBSOLETE 
+// OBSOLETE   x = read_memory_integer (a, code_size);
+// OBSOLETE   if (code_size == 2)
+// OBSOLETE     {
+// OBSOLETE       /* Stick current code segement onto top */
+// OBSOLETE       x &= 0xffff;
+// OBSOLETE       x |= read_register (SEG_C_REGNUM) << 16;
+// OBSOLETE     }
+// OBSOLETE   x &= 0xffffff;
+// OBSOLETE   return x;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE h8500_set_pointer_size (int newsize)
+// OBSOLETE {
+// OBSOLETE   static int oldsize = 0;
+// OBSOLETE 
+// OBSOLETE   if (oldsize != newsize)
+// OBSOLETE     {
+// OBSOLETE       printf_unfiltered ("pointer size set to %d bits\n", newsize);
+// OBSOLETE       oldsize = newsize;
+// OBSOLETE       if (newsize == 32)
+// OBSOLETE    {
+// OBSOLETE      minimum_mode = 0;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      minimum_mode = 1;
+// OBSOLETE    }
+// OBSOLETE       _initialize_gdbtypes ();
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE big_command (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE   h8500_set_pointer_size (32);
+// OBSOLETE   code_size = 4;
+// OBSOLETE   data_size = 4;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE medium_command (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE   h8500_set_pointer_size (32);
+// OBSOLETE   code_size = 4;
+// OBSOLETE   data_size = 2;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE compact_command (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE   h8500_set_pointer_size (32);
+// OBSOLETE   code_size = 2;
+// OBSOLETE   data_size = 4;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE small_command (char *arg, int from_tty)
+// OBSOLETE {
+// OBSOLETE   h8500_set_pointer_size (16);
+// OBSOLETE   code_size = 2;
+// OBSOLETE   data_size = 2;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static struct cmd_list_element *setmemorylist;
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE set_memory (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
+// OBSOLETE   help_list (setmemorylist, "set memory ", -1, gdb_stdout);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* See if variable name is ppc or pr[0-7] */
+// OBSOLETE 
+// OBSOLETE int
+// OBSOLETE h8500_is_trapped_internalvar (char *name)
+// OBSOLETE {
+// OBSOLETE   if (name[0] != 'p')
+// OBSOLETE     return 0;
+// OBSOLETE 
+// OBSOLETE   if (strcmp (name + 1, "pc") == 0)
+// OBSOLETE     return 1;
+// OBSOLETE 
+// OBSOLETE   if (name[1] == 'r'
+// OBSOLETE       && name[2] >= '0'
+// OBSOLETE       && name[2] <= '7'
+// OBSOLETE       && name[3] == '\000')
+// OBSOLETE     return 1;
+// OBSOLETE   else
+// OBSOLETE     return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE struct value *
+// OBSOLETE h8500_value_of_trapped_internalvar (struct internalvar *var)
+// OBSOLETE {
+// OBSOLETE   LONGEST regval;
+// OBSOLETE   unsigned char regbuf[4];
+// OBSOLETE   int page_regnum, regnum;
+// OBSOLETE 
+// OBSOLETE   regnum = var->name[2] == 'c' ? PC_REGNUM : var->name[2] - '0';
+// OBSOLETE 
+// OBSOLETE   switch (var->name[2])
+// OBSOLETE     {
+// OBSOLETE     case 'c':
+// OBSOLETE       page_regnum = SEG_C_REGNUM;
+// OBSOLETE       break;
+// OBSOLETE     case '0':
+// OBSOLETE     case '1':
+// OBSOLETE     case '2':
+// OBSOLETE     case '3':
+// OBSOLETE       page_regnum = SEG_D_REGNUM;
+// OBSOLETE       break;
+// OBSOLETE     case '4':
+// OBSOLETE     case '5':
+// OBSOLETE       page_regnum = SEG_E_REGNUM;
+// OBSOLETE       break;
+// OBSOLETE     case '6':
+// OBSOLETE     case '7':
+// OBSOLETE       page_regnum = SEG_T_REGNUM;
+// OBSOLETE       break;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, page_regnum, NULL);
+// OBSOLETE   regval = regbuf[0] << 16;
+// OBSOLETE 
+// OBSOLETE   get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, regnum, NULL);
+// OBSOLETE   regval |= regbuf[0] << 8 | regbuf[1];            /* XXX host/target byte order */
+// OBSOLETE 
+// OBSOLETE   xfree (var->value);              /* Free up old value */
+// OBSOLETE 
+// OBSOLETE   var->value = value_from_longest (builtin_type_unsigned_long, regval);
+// OBSOLETE   release_value (var->value);      /* Unchain new value */
+// OBSOLETE 
+// OBSOLETE   VALUE_LVAL (var->value) = lval_internalvar;
+// OBSOLETE   VALUE_INTERNALVAR (var->value) = var;
+// OBSOLETE   return var->value;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE h8500_set_trapped_internalvar (struct internalvar *var, struct value *newval,
+// OBSOLETE                           int bitpos, int bitsize, int offset)
+// OBSOLETE {
+// OBSOLETE   char *page_regnum, *regnum;
+// OBSOLETE   char expression[100];
+// OBSOLETE   unsigned new_regval;
+// OBSOLETE   struct type *type;
+// OBSOLETE   enum type_code newval_type_code;
+// OBSOLETE 
+// OBSOLETE   type = check_typedef (VALUE_TYPE (newval));
+// OBSOLETE   newval_type_code = TYPE_CODE (type);
+// OBSOLETE 
+// OBSOLETE   if ((newval_type_code != TYPE_CODE_INT
+// OBSOLETE        && newval_type_code != TYPE_CODE_PTR)
+// OBSOLETE       || TYPE_LENGTH (type) != sizeof (new_regval))
+// OBSOLETE     error ("Illegal type (%s) for assignment to $%s\n",
+// OBSOLETE       TYPE_NAME (VALUE_TYPE (newval)), var->name);
+// OBSOLETE 
+// OBSOLETE   new_regval = *(long *) VALUE_CONTENTS_RAW (newval);
+// OBSOLETE 
+// OBSOLETE   regnum = var->name + 1;
+// OBSOLETE 
+// OBSOLETE   switch (var->name[2])
+// OBSOLETE     {
+// OBSOLETE     case 'c':
+// OBSOLETE       page_regnum = "cp";
+// OBSOLETE       break;
+// OBSOLETE     case '0':
+// OBSOLETE     case '1':
+// OBSOLETE     case '2':
+// OBSOLETE     case '3':
+// OBSOLETE       page_regnum = "dp";
+// OBSOLETE       break;
+// OBSOLETE     case '4':
+// OBSOLETE     case '5':
+// OBSOLETE       page_regnum = "ep";
+// OBSOLETE       break;
+// OBSOLETE     case '6':
+// OBSOLETE     case '7':
+// OBSOLETE       page_regnum = "tp";
+// OBSOLETE       break;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   sprintf (expression, "$%s=%d", page_regnum, new_regval >> 16);
+// OBSOLETE   parse_and_eval (expression);
+// OBSOLETE 
+// OBSOLETE   sprintf (expression, "$%s=%d", regnum, new_regval & 0xffff);
+// OBSOLETE   parse_and_eval (expression);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE h8500_read_sp (void)
+// OBSOLETE {
+// OBSOLETE   return read_register (PR7_REGNUM);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE h8500_write_sp (CORE_ADDR v)
+// OBSOLETE {
+// OBSOLETE   write_register (PR7_REGNUM, v);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE h8500_read_pc (ptid_t ptid)
+// OBSOLETE {
+// OBSOLETE   return read_register (PC_REGNUM);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE h8500_write_pc (CORE_ADDR v, ptid_t ptid)
+// OBSOLETE {
+// OBSOLETE   write_register (PC_REGNUM, v);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE h8500_read_fp (void)
+// OBSOLETE {
+// OBSOLETE   return read_register (PR6_REGNUM);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE _initialize_h8500_tdep (void)
+// OBSOLETE {
+// OBSOLETE   tm_print_insn = print_insn_h8500;
+// OBSOLETE 
+// OBSOLETE   add_prefix_cmd ("memory", no_class, set_memory,
+// OBSOLETE              "set the memory model", &setmemorylist, "set memory ", 0,
+// OBSOLETE              &setlist);
+// OBSOLETE 
+// OBSOLETE   add_cmd ("small", class_support, small_command,
+// OBSOLETE       "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist);
+// OBSOLETE 
+// OBSOLETE   add_cmd ("big", class_support, big_command,
+// OBSOLETE    "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist);
+// OBSOLETE 
+// OBSOLETE   add_cmd ("medium", class_support, medium_command,
+// OBSOLETE      "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist);
+// OBSOLETE 
+// OBSOLETE   add_cmd ("compact", class_support, compact_command,
+// OBSOLETE     "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist);
+// OBSOLETE 
+// OBSOLETE }
index db497ef..9ba5ef9 100644 (file)
@@ -677,7 +677,7 @@ pc_in_interrupt_handler (CORE_ADDR pc)
   msym_us = lookup_minimal_symbol_by_pc (pc);
 
   return (u->HP_UX_interrupt_marker
-         && !PC_IN_SIGTRAMP (pc, SYMBOL_NAME (msym_us)));
+         && !PC_IN_SIGTRAMP (pc, DEPRECATED_SYMBOL_NAME (msym_us)));
 }
 
 /* Called when no unwind descriptor was found for PC.  Returns 1 if it
@@ -795,7 +795,7 @@ find_proc_framesize (CORE_ADDR pc)
   if (u->Save_SP
       && !pc_in_interrupt_handler (pc)
       && msym_us
-      && !PC_IN_SIGTRAMP (pc, SYMBOL_NAME (msym_us)))
+      && !PC_IN_SIGTRAMP (pc, DEPRECATED_SYMBOL_NAME (msym_us)))
     return -1;
 
   return u->Total_frame_size << 3;
@@ -1110,8 +1110,8 @@ hppa_init_extra_frame_info (int fromleaf, struct frame_info *frame)
 \f
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame.
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame.
 
    This may involve searching through prologues for several functions
    at boundaries where GCC calls HP C code, or where code which has
@@ -1153,7 +1153,7 @@ hppa_frame_chain (struct frame_info *frame)
          pthread library itself, you'd get errors.
 
          So for today, we don't make that check. */
-      frame_symbol_name = SYMBOL_NAME (min_frame_symbol);
+      frame_symbol_name = DEPRECATED_SYMBOL_NAME (min_frame_symbol);
       if (frame_symbol_name != 0)
        {
          if (0 == strncmp (frame_symbol_name,
@@ -1984,7 +1984,7 @@ find_stub_with_shl_get (struct minimal_symbol *function, CORE_ADDR handle)
   msymbol = lookup_minimal_symbol ("__shldp", NULL, NULL);
   symbol2 = lookup_symbol ("__shldp", NULL, VAR_NAMESPACE, NULL, NULL);
   endo_buff_addr = SYMBOL_VALUE_ADDRESS (buff_minsym);
-  namelen = strlen (SYMBOL_NAME (function));
+  namelen = strlen (DEPRECATED_SYMBOL_NAME (function));
   value_return_addr = endo_buff_addr + namelen;
   ftype = check_typedef (SYMBOL_TYPE (get_sym));
 
@@ -1997,7 +1997,7 @@ find_stub_with_shl_get (struct minimal_symbol *function, CORE_ADDR handle)
 
   /* set up stuff needed by __d_shl_get in buffer in end.o */
 
-  target_write_memory (endo_buff_addr, SYMBOL_NAME (function), namelen);
+  target_write_memory (endo_buff_addr, DEPRECATED_SYMBOL_NAME (function), namelen);
 
   target_write_memory (value_return_addr, (char *) &tmp, 4);
 
@@ -2235,10 +2235,10 @@ hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
          {
            stub_symbol
              = lookup_minimal_symbol_solib_trampoline
-             (SYMBOL_NAME (funsymbol), NULL, objfile);
+             (DEPRECATED_SYMBOL_NAME (funsymbol), NULL, objfile);
 
            if (!stub_symbol)
-             stub_symbol = lookup_minimal_symbol (SYMBOL_NAME (funsymbol),
+             stub_symbol = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (funsymbol),
                                                   NULL, objfile);
 
            /* Found a symbol with the right name.  */
@@ -2339,7 +2339,7 @@ hppa_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
          new_stub = find_stub_with_shl_get (fmsymbol, solib_handle);
 
          if (new_stub == 0)
-           error ("Can't find an import stub for %s", SYMBOL_NAME (fmsymbol));
+           error ("Can't find an import stub for %s", DEPRECATED_SYMBOL_NAME (fmsymbol));
 
          /* We have to store the address of the stub in __shlib_funcptr.  */
          msymbol = lookup_minimal_symbol ("__shlib_funcptr", NULL,
@@ -3015,7 +3015,7 @@ hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name)
     return 1;
 
   minsym = lookup_minimal_symbol_by_pc (pc);
-  if (minsym && strcmp (SYMBOL_NAME (minsym), ".stub") == 0)
+  if (minsym && strcmp (DEPRECATED_SYMBOL_NAME (minsym), ".stub") == 0)
     return 1;
 
   /* Get the unwind descriptor corresponding to PC, return zero
@@ -3258,7 +3258,7 @@ hppa_skip_trampoline_code (CORE_ADDR pc)
          ALL_MSYMBOLS (objfile, msymbol)
          {
            if (MSYMBOL_TYPE (msymbol) == mst_text
-               && STREQ (SYMBOL_NAME (msymbol), SYMBOL_NAME (msym)))
+               && STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (msym)))
              {
                function_found = 1;
                break;
@@ -3353,11 +3353,11 @@ hppa_skip_trampoline_code (CORE_ADDR pc)
              return orig_pc == pc ? 0 : pc & ~0x3;
            }
 
-         libsym = lookup_minimal_symbol (SYMBOL_NAME (stubsym), NULL, NULL);
+         libsym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (stubsym), NULL, NULL);
          if (libsym == NULL)
            {
              warning ("Unable to find library symbol for %s\n",
-                      SYMBOL_NAME (stubsym));
+                      DEPRECATED_SYMBOL_NAME (stubsym));
              return orig_pc == pc ? 0 : pc & ~0x3;
            }
 
@@ -4995,8 +4995,8 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, hppa_num_regs * 4);
   set_gdbarch_register_byte (gdbarch, hppa_register_byte);
   set_gdbarch_register_virtual_size (gdbarch, hppa_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 4);
-  set_gdbarch_max_register_virtual_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
   set_gdbarch_register_virtual_type (gdbarch, hppa_register_virtual_type);
   set_gdbarch_store_struct_return (gdbarch, hppa_store_struct_return);
   set_gdbarch_deprecated_extract_return_value (gdbarch,
@@ -5006,7 +5006,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_extract_struct_value_address
     (gdbarch, hppa_extract_struct_value_address);
   set_gdbarch_cannot_store_register (gdbarch, hppa_cannot_store_register);
-  set_gdbarch_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, hppa_init_extra_frame_info);
   set_gdbarch_frame_chain (gdbarch, hppa_frame_chain);
   set_gdbarch_frame_chain_valid (gdbarch, hppa_frame_chain_valid);
   set_gdbarch_frameless_function_invocation
@@ -5016,7 +5016,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_locals_address (gdbarch, hppa_frame_locals_address);
   set_gdbarch_frame_num_args (gdbarch, hppa_frame_num_args);
   set_gdbarch_frame_args_skip (gdbarch, 0);
-  /* set_gdbarch_push_dummy_frame (gdbarch, hppa_push_dummy_frame);  */
+  /* set_gdbarch_deprecated_push_dummy_frame (gdbarch, hppa_push_dummy_frame);  */
   set_gdbarch_pop_frame (gdbarch, hppa_pop_frame);
   set_gdbarch_call_dummy_length (gdbarch, INSTRUCTION_SIZE * 28);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
index bf53266..6acf576 100644 (file)
@@ -3123,7 +3123,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
       sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+      DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
                                        &objfile->symbol_obstack);
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -3157,7 +3157,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
        {
          struct symbol *xsym = syms->symbol[j];
          SYMBOL_TYPE (xsym) = type;
-         TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+         TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          TYPE_FIELD_BITSIZE (type, n) = 0;
          TYPE_FIELD_STATIC_KIND (type, n) = 0;
@@ -3231,7 +3231,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
       sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
       (void) memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+      DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
                                        &objfile->symbol_obstack);
 
       /* Figure out where it lives.  */
@@ -3318,7 +3318,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
       for (j = 0; j < syms->nsyms; j++, n++)
        {
          struct symbol *xsym = syms->symbol[j];
-         TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+         TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
          TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
          TYPE_FIELD_ARTIFICIAL (type, n) = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
@@ -3405,7 +3405,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
       sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                             sizeof (struct symbol));
       (void) memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = name;
+      DEPRECATED_SYMBOL_NAME (sym) = name;
 
       /* Figure out where it lives.  */
       if (paramp->dfparam.regparam)
@@ -3492,7 +3492,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
       for (j = 0; j < syms->nsyms; j++, n++)
        {
          struct symbol *xsym = syms->symbol[j];
-         TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+         TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
          TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
          TYPE_FIELD_ARTIFICIAL (type, n) = 0;
          TYPE_FIELD_BITSIZE (type, n) = 0;
@@ -5085,7 +5085,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
   sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                         sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
-  SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
+  DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
   SYMBOL_LANGUAGE (sym) = language_auto;
   SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
   SYMBOL_LINE (sym) = 0;
@@ -5255,22 +5255,22 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
        TYPE_FLAGS (SYMBOL_TYPE (sym)) |= TYPE_FLAG_PROTOTYPED;
 
-      /* The "SYMBOL_NAME" field is expected to be the mangled name
+      /* The "DEPRECATED_SYMBOL_NAME" field is expected to be the mangled name
        * (if any), which we get from the "alias" field of the SOM record
        * if that exists.
        */
       if ((dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
          dn_bufp->dfunc.alias &&       /* has an alias */
          *(char *) (VT (objfile) + dn_bufp->dfunc.alias))      /* not a null string */
-       SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
+       DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
       else
-       SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+       DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
 
       /* Special hack to get around HP compilers' insistence on
        * reporting "main" as "_MAIN_" for C/C++ */
-      if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0) &&
+      if ((strcmp (DEPRECATED_SYMBOL_NAME (sym), "_MAIN_") == 0) &&
          (strcmp (VT (objfile) + dn_bufp->dfunc.name, "main") == 0))
-       SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+       DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
 
       /* The SYMBOL_CPLUS_DEMANGLED_NAME field is expected to
        * be the demangled name.
@@ -5289,7 +5289,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
           * working around the issue in stack.c. - RT
           */
          SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
-         if ((SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) &&
+         if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) &&
              (!SYMBOL_CPLUS_DEMANGLED_NAME (sym)))
            {
 
@@ -5373,22 +5373,22 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
       SYMBOL_CLASS (sym) = LOC_BLOCK;
       SYMBOL_TYPE (sym) = hpread_read_doc_function_type (hp_type, dn_bufp, objfile, 1);
 
-      /* The "SYMBOL_NAME" field is expected to be the mangled name
+      /* The "DEPRECATED_SYMBOL_NAME" field is expected to be the mangled name
        * (if any), which we get from the "alias" field of the SOM record
        * if that exists.
        */
       if ((dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
          dn_bufp->ddocfunc.alias &&    /* has an alias */
          *(char *) (VT (objfile) + dn_bufp->ddocfunc.alias))   /* not a null string */
-       SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
+       DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
       else
-       SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
+       DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
 
       /* Special hack to get around HP compilers' insistence on
        * reporting "main" as "_MAIN_" for C/C++ */
-      if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0) &&
+      if ((strcmp (DEPRECATED_SYMBOL_NAME (sym), "_MAIN_") == 0) &&
          (strcmp (VT (objfile) + dn_bufp->ddocfunc.name, "main") == 0))
-       SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
+       DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
 
       if (dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS)
        {
@@ -5406,7 +5406,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
           */
          SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
 
-         if ((SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) &&
+         if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) &&
              (!SYMBOL_CPLUS_DEMANGLED_NAME (sym)))
            {
 
@@ -5711,7 +5711,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
        * in the symbol table contains a pointer to the real "g".
        * We use the storage class LOC_INDIRECT to indicate this. RT
        */
-      if (is_in_import_list (SYMBOL_NAME (sym), objfile))
+      if (is_in_import_list (DEPRECATED_SYMBOL_NAME (sym), objfile))
        SYMBOL_CLASS (sym) = LOC_INDIRECT;
 
       SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location + data_offset;
@@ -5826,8 +5826,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
         * record that actually defines the type.
         */
        SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
-       TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
-       TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
+       TYPE_NAME (sym->type) = DEPRECATED_SYMBOL_NAME (sym);
+       TYPE_TAG_NAME (sym->type) = DEPRECATED_SYMBOL_NAME (sym);
        if (dn_bufp->dtag.global)
          add_symbol_to_list (sym, &global_symbols);
        else if (WITHIN_FUNCTION (objfile))
@@ -5873,7 +5873,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
            newsym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
                                                    sizeof (struct symbol));
            memset (newsym, 0, sizeof (struct symbol));
-           SYMBOL_NAME (newsym) = name;
+           DEPRECATED_SYMBOL_NAME (newsym) = name;
            SYMBOL_LANGUAGE (newsym) = language_auto;
            SYMBOL_NAMESPACE (newsym) = VAR_NAMESPACE;
            SYMBOL_LINE (newsym) = 0;
index 29dce0b..b585ca5 100644 (file)
@@ -41,7 +41,7 @@
 #include "inferior.h"
 #include "regcache.h"
 #include <fcntl.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
 #include "gdbcore.h"
 
 extern int child_suppress_run;
index f8252e2..b9ad2ff 100644 (file)
@@ -100,7 +100,8 @@ static int
 i386_interix_pc_in_sigtramp (CORE_ADDR pc, char *name)
 {
   /* This is sufficient, where used, but is NOT a complete test; There
-     is more in INIT_EXTRA_FRAME_INFO (a.k.a. interix_back_one_frame).  */
+     is more in DEPRECATED_INIT_EXTRA_FRAME_INFO
+     (a.k.a. interix_back_one_frame).  */
   return ((pc >= tramp_start && pc < tramp_end)
           || (pc >= null_start && pc < null_end));
 }
@@ -330,7 +331,7 @@ i386_interix_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
                                         i386_interix_in_solib_call_trampoline);
   set_gdbarch_skip_trampoline_code (gdbarch,
                                     i386_interix_skip_trampoline_code);
-  set_gdbarch_init_extra_frame_info (gdbarch, i386_interix_back_one_frame);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, i386_interix_back_one_frame);
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
   set_gdbarch_frame_chain_valid (gdbarch, i386_interix_frame_chain_valid);
   set_gdbarch_frame_saved_pc (gdbarch, i386_interix_frame_saved_pc);
index 9bf5a16..f92f1ea 100644 (file)
@@ -332,8 +332,8 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p)
 
       ALL_OBJFILE_MSYMBOLS (objfile, msym)
        {
-         if (SYMBOL_NAME (msym)
-             && STREQ (SYMBOL_NAME (msym), name))
+         if (SYMBOL_LINKAGE_NAME (msym)
+             && strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
            {
              *objfile_p = objfile;
              return msym;
index d85073b..018f073 100644 (file)
@@ -1293,7 +1293,7 @@ i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name)
       unsigned long indirect = read_memory_unsigned_integer (pc + 2, 4);
       struct minimal_symbol *indsym =
        indirect ? lookup_minimal_symbol_by_pc (indirect) : 0;
-      char *symname = indsym ? SYMBOL_NAME (indsym) : 0;
+      char *symname = indsym ? SYMBOL_LINKAGE_NAME (indsym) : 0;
 
       if (symname)
        {
@@ -1558,8 +1558,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_name (gdbarch, i386_register_name);
   set_gdbarch_register_size (gdbarch, 4);
   set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS);
-  set_gdbarch_max_register_raw_size (gdbarch, I386_MAX_REGISTER_SIZE);
-  set_gdbarch_max_register_virtual_size (gdbarch, I386_MAX_REGISTER_SIZE);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, I386_MAX_REGISTER_SIZE);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, I386_MAX_REGISTER_SIZE);
   set_gdbarch_register_virtual_type (gdbarch, i386_register_virtual_type);
 
   set_gdbarch_print_float_info (gdbarch, i387_print_float_info);
@@ -1590,7 +1590,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_extract_return_value (gdbarch, i386_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, i386_push_arguments);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, i386_push_return_address);
   set_gdbarch_pop_frame (gdbarch, i386_pop_frame);
   set_gdbarch_store_struct_return (gdbarch, i386_store_struct_return);
@@ -1599,7 +1598,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
                                            i386_extract_struct_value_address);
   set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, i386_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, i386_frame_init_saved_regs);
   set_gdbarch_skip_prologue (gdbarch, i386_skip_prologue);
 
   /* Stack grows downward.  */
index af30df1..c0c544d 100644 (file)
@@ -50,11 +50,13 @@ i386bsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
 CORE_ADDR
 i386bsd_sigcontext_addr (struct frame_info *frame)
 {
-  if (frame->next)
+  struct frame_info *next_frame = get_next_frame (frame);
+
+  if (next_frame)
     /* If this isn't the top frame, the next frame must be for the
        signal handler itself.  A pointer to the sigcontext structure
        is passed as the third argument to the signal handler.  */
-    return read_memory_unsigned_integer (frame->next->frame + 16, 4);
+    return read_memory_unsigned_integer (get_frame_base (next_frame) + 16, 4);
 
   /* This is the top frame.  We'll have to find the address of the
      sigcontext structure by looking at the stack pointer.  */
index 492da07..7d4cc43 100644 (file)
@@ -1,7 +1,8 @@
 /* Functions specific to running gdb native on IA-64 running
    GNU/Linux.
 
-   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+   Inc.
 
    This file is part of GDB.
 
@@ -29,7 +30,7 @@
 
 #include <signal.h>
 #include <sys/ptrace.h>
-#include <sys/wait.h>
+#include "gdb_wait.h"
 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
 #endif
index b37da52..36036f2 100644 (file)
@@ -94,13 +94,11 @@ static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc;
 static gdbarch_frame_chain_ftype ia64_frame_chain;
 static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc;
 static gdbarch_skip_prologue_ftype ia64_skip_prologue;
-static gdbarch_frame_init_saved_regs_ftype ia64_frame_init_saved_regs;
 static gdbarch_get_saved_register_ftype ia64_get_saved_register;
 static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value;
 static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address;
 static gdbarch_use_struct_convention_ftype ia64_use_struct_convention;
 static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation;
-static gdbarch_init_extra_frame_info_ftype ia64_init_extra_frame_info;
 static gdbarch_store_struct_return_ftype ia64_store_struct_return;
 static gdbarch_push_arguments_ftype ia64_push_arguments;
 static gdbarch_push_return_address_ftype ia64_push_return_address;
@@ -711,7 +709,7 @@ ia64_frame_chain (struct frame_info *frame)
     return get_frame_base (frame);
   else
     {
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
       if (get_frame_saved_regs (frame)[IA64_VFP_REGNUM])
        return read_memory_integer (get_frame_saved_regs (frame)[IA64_VFP_REGNUM], 8);
       else
@@ -732,7 +730,7 @@ ia64_frame_saved_pc (struct frame_info *frame)
                                           get_frame_base (frame), pc_regnum);
   else
     {
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
       if (get_frame_saved_regs (frame)[IA64_VRAP_REGNUM])
        return read_memory_integer (get_frame_saved_regs (frame)[IA64_VRAP_REGNUM], 8);
@@ -1312,7 +1310,7 @@ ia64_get_saved_register (char *raw_buffer,
 
       if (!is_dummy_frame)
        {
-         FRAME_INIT_SAVED_REGS (frame);
+         DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
          gr_addr = get_frame_saved_regs (frame)[ regnum - IA64_NAT0_REGNUM 
                                                + IA64_GR0_REGNUM];
        }
@@ -1354,7 +1352,7 @@ ia64_get_saved_register (char *raw_buffer,
       CORE_ADDR addr = 0;
       if (!is_dummy_frame)
        {
-         FRAME_INIT_SAVED_REGS (frame);
+         DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
          addr = get_frame_saved_regs (frame)[regnum];
        }
 
@@ -1462,7 +1460,7 @@ ia64_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 int
 ia64_frameless_function_invocation (struct frame_info *frame)
 {
-  FRAME_INIT_SAVED_REGS (frame);
+  DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
   return (get_frame_extra_info (frame)->mem_stack_frame_size == 0);
 }
 
@@ -1523,7 +1521,7 @@ ia64_init_extra_frame_info (int fromleaf, struct frame_info *frame)
     {
       struct frame_info *frn = get_next_frame (frame);
 
-      FRAME_INIT_SAVED_REGS (frn);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frn);
 
       if (get_frame_saved_regs (frn)[IA64_CFM_REGNUM] != 0)
        cfm = read_memory_integer (get_frame_saved_regs (frn)[IA64_CFM_REGNUM], 8);
@@ -1990,7 +1988,7 @@ ia64_pop_frame_regular (struct frame_info *frame)
   int regno;
   CORE_ADDR bsp, cfm, pfs;
 
-  FRAME_INIT_SAVED_REGS (frame);
+  DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
   for (regno = 0; regno < ia64_num_regs; regno++)
     {
@@ -2186,9 +2184,9 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, ia64_num_regs * 8 + 128*8);
   set_gdbarch_register_byte (gdbarch, ia64_register_byte);
   set_gdbarch_register_raw_size (gdbarch, ia64_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 16);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16);
   set_gdbarch_register_virtual_size (gdbarch, ia64_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 16);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16);
   set_gdbarch_register_virtual_type (gdbarch, ia64_register_virtual_type);
 
   set_gdbarch_skip_prologue (gdbarch, ia64_skip_prologue);
@@ -2201,7 +2199,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_chain (gdbarch, ia64_frame_chain);
   set_gdbarch_frame_saved_pc (gdbarch, ia64_frame_saved_pc);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ia64_frame_init_saved_regs);
   set_gdbarch_get_saved_register (gdbarch, ia64_get_saved_register);
 
   set_gdbarch_register_convertible (gdbarch, ia64_register_convertible);
@@ -2231,7 +2229,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_words (gdbarch, ia64_call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (ia64_call_dummy_words));
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
-  set_gdbarch_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, ia64_init_extra_frame_info);
   set_gdbarch_frame_args_address (gdbarch, ia64_frame_args_address);
   set_gdbarch_frame_locals_address (gdbarch, ia64_frame_locals_address);
 
@@ -2252,7 +2250,6 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
index 7a96900..19077b4 100644 (file)
@@ -1,6 +1,6 @@
 /* Memory-access and commands for "inferior" process, for GDB.
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002
+   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -42,6 +42,7 @@
 #include "parser-defs.h"
 #include "regcache.h"
 #include "reggroups.h"
+#include "block.h"
 #include <ctype.h>
 
 /* Functions exported for general use, in inferior.h: */
@@ -854,7 +855,7 @@ jump_command (char *arg, int from_tty)
   if (fn != NULL && sfn != fn)
     {
       if (!query ("Line %d is not in `%s'.  Jump anyway? ", sal.line,
-                 SYMBOL_SOURCE_NAME (fn)))
+                 SYMBOL_PRINT_NAME (fn)))
        {
          error ("Not confirmed.");
          /* NOTREACHED */
@@ -1664,7 +1665,7 @@ default_print_registers_info (struct gdbarch *gdbarch,
       /* Convert raw data to virtual format if necessary.  */
       if (REGISTER_CONVERTIBLE (i))
        {
-         REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
+         REGISTER_CONVERT_TO_VIRTUAL (i, register_type (current_gdbarch, i),
                                       raw_buffer, virtual_buffer);
        }
       else
@@ -1675,11 +1676,11 @@ default_print_registers_info (struct gdbarch *gdbarch,
 
       /* If virtual format is floating, print it that way, and in raw
          hex.  */
-      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+      if (TYPE_CODE (register_type (current_gdbarch, i)) == TYPE_CODE_FLT)
        {
          int j;
 
-         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+         val_print (register_type (current_gdbarch, i), virtual_buffer, 0, 0,
                     file, 0, 1, 0, Val_pretty_default);
 
          fprintf_filtered (file, "\t(raw 0x");
@@ -1697,14 +1698,14 @@ default_print_registers_info (struct gdbarch *gdbarch,
       else
        {
          /* Print the register in hex.  */
-         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+         val_print (register_type (current_gdbarch, i), virtual_buffer, 0, 0,
                     file, 'x', 1, 0, Val_pretty_default);
           /* If not a vector register, print it also according to its
              natural format.  */
-         if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+         if (TYPE_VECTOR (register_type (current_gdbarch, i)) == 0)
            {
              fprintf_filtered (file, "\t");
-             val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+             val_print (register_type (current_gdbarch, i), virtual_buffer, 0, 0,
                         file, 0, 1, 0, Val_pretty_default);
            }
        }
index c8df106..2a41f57 100644 (file)
 #include <sys/select.h>
 #endif
 
-#ifdef HAVE_TERMIOS
-#define PROCESS_GROUP_TYPE pid_t
-#endif
-
-#ifdef HAVE_TERMIO
-#define PROCESS_GROUP_TYPE int
-#endif
-
-#ifdef HAVE_SGTTY
-#ifdef SHORT_PGRP
-/* This is only used for the ultra.  Does it have pid_t?  */
-#define PROCESS_GROUP_TYPE short
-#else
-#define PROCESS_GROUP_TYPE int
-#endif
-#endif /* sgtty */
+#include "inflow.h"
 
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
diff --git a/gdb/inflow.h b/gdb/inflow.h
new file mode 100644 (file)
index 0000000..1cbfa71
--- /dev/null
@@ -0,0 +1,51 @@
+/* Low level interface to ptrace, for GDB when running under Unix.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef INFLOW_H
+#define INFLOW_H
+
+#include "terminal.h"          /* For HAVE_TERMIOS et.al.  */
+
+#ifdef HAVE_TERMIOS
+#define PROCESS_GROUP_TYPE pid_t
+#endif
+
+#ifdef HAVE_TERMIO
+#define PROCESS_GROUP_TYPE int
+#endif
+
+#ifdef HAVE_SGTTY
+#ifdef SHORT_PGRP
+/* This is only used for the ultra.  Does it have pid_t?  */
+#define PROCESS_GROUP_TYPE short
+#else
+#define PROCESS_GROUP_TYPE int
+#endif
+#endif /* sgtty */
+
+#ifdef PROCESS_GROUP_TYPE
+/* Process group for us and the inferior.  Saved and restored just like
+   {our,inferior}_ttystate.  */
+extern PROCESS_GROUP_TYPE our_process_group;
+extern PROCESS_GROUP_TYPE inferior_process_group;
+#endif
+
+#endif
index 601e157..a142080 100644 (file)
@@ -301,7 +301,7 @@ detach (int signal)
   errno = 0;
   ptrace (PT_DETACH, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) 1,
           signal);
-  if (errno)
+  if (errno && errno != ESRCH)
     perror_with_name ("ptrace");
   attach_flag = 0;
 }
@@ -629,7 +629,7 @@ static void
 udot_info (char *dummy1, int dummy2)
 {
 #if defined (KERNEL_U_SIZE)
-  int udot_off;                        /* Offset into user struct */
+  long udot_off;                       /* Offset into user struct */
   int udot_val;                        /* Value from user struct at udot_off */
   char mess[128];              /* For messages */
 #endif
@@ -657,12 +657,13 @@ udot_info (char *dummy1, int dummy2)
            {
              printf_filtered ("\n");
            }
-         printf_filtered ("%04x:", udot_off);
+         printf_filtered ("%s:", paddr (udot_off));
        }
       udot_val = ptrace (PT_READ_U, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) udot_off, 0);
       if (errno != 0)
        {
-         sprintf (mess, "\nreading user struct at offset 0x%x", udot_off);
+         sprintf (mess, "\nreading user struct at offset 0x%s",
+                  paddr_nz (udot_off));
          perror_with_name (mess);
        }
       /* Avoid using nonportable (?) "*" in print specs */
index f864442..f65af35 100644 (file)
@@ -226,13 +226,6 @@ a command like `return' or `jump' to continue execution.");
 #define HAVE_STEPPABLE_WATCHPOINT 1
 #endif
 
-#ifndef HAVE_CONTINUABLE_WATCHPOINT
-#define HAVE_CONTINUABLE_WATCHPOINT 0
-#else
-#undef  HAVE_CONTINUABLE_WATCHPOINT
-#define HAVE_CONTINUABLE_WATCHPOINT 1
-#endif
-
 #ifndef CANNOT_STEP_HW_WATCHPOINTS
 #define CANNOT_STEP_HW_WATCHPOINTS 0
 #else
index 629f37d..7786579 100644 (file)
@@ -36,6 +36,7 @@
 #include <fcntl.h>
 
 #include "gdb_wait.h"
+#include "inflow.h"
 
 extern struct symtab_and_line *child_enable_exception_callback (enum
                                                                exception_event_kind,
@@ -512,8 +513,6 @@ child_can_run (void)
 static void
 child_stop (void)
 {
-  extern pid_t inferior_process_group;
-
   kill (-inferior_process_group, SIGINT);
 }
 
index 589a0e2..02a5576 100644 (file)
@@ -1,6 +1,6 @@
 /* Low level Unix child interface to ttrace, for GDB when running under HP-UX.
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000, 2001
+   1999, 2000, 2001, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -3951,7 +3951,7 @@ threads_continue_all_but_one (lwpid_t gdb_tid, int signal)
        * state.tts_flags & TTS_STATEMASK == TTS_WASSUSPENDED
        */
       if (debug_on)
-       if (state.tts_flags & TTS_STATEMASK != TTS_WASSUSPENDED)
+       if ((state.tts_flags & TTS_STATEMASK) != TTS_WASSUSPENDED)
          printf ("About to continue non-stopped thread %d\n", scan_tid);
 #endif
 
@@ -4085,7 +4085,7 @@ threads_continue_all_with_signals (lwpid_t gdb_tid, int signal)
 
 #ifdef THREAD_DEBUG
       if (debug_on)
-       if (state.tts_flags & TTS_STATEMASK != TTS_WASSUSPENDED)
+       if ((state.tts_flags & TTS_STATEMASK) != TTS_WASSUSPENDED)
          warning ("About to continue non-stopped thread %d\n", scan_tid);
 #endif
 
diff --git a/gdb/interps.c b/gdb/interps.c
new file mode 100644 (file)
index 0000000..748b5b6
--- /dev/null
@@ -0,0 +1,486 @@
+/* Manages interpreters for GDB, the GNU debugger.
+
+   Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
+
+   Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA. */
+
+/* This is just a first cut at separating out the "interpreter"
+   functions of gdb into self-contained modules.  There are a couple
+   of open areas that need to be sorted out:
+
+   1) The interpreter explicitly contains a UI_OUT, and can insert itself
+   into the event loop, but it doesn't explicitly contain hooks for readline.
+   I did this because it seems to me many interpreters won't want to use
+   the readline command interface, and it is probably simpler to just let
+   them take over the input in their resume proc.  */
+
+#include "defs.h"
+#include "gdbcmd.h"
+#include "ui-out.h"
+#include "event-loop.h"
+#include "event-top.h"
+#include "interps.h"
+#include "completer.h"
+#include "gdb_string.h"
+#include "gdb-events.h"
+#include "gdb_assert.h"
+#include "top.h"               /* For command_loop.  */
+
+struct interp
+{
+  /* This is the name in "-i=" and set interpreter. */
+  const char *name;
+
+  /* Interpreters are stored in a linked list, this is the next
+     one...  */
+  struct interp *next;
+
+  /* This is a cookie that an instance of the interpreter can use.
+     This is a bit confused right now as the exact initialization
+     sequence for it, and how it relates to the interpreter's uiout
+     object is a bit confused.  */
+  void *data;
+
+  /* Has the init_proc been run? */
+  int inited;
+
+  /* This is the ui_out used to collect results for this interpreter.
+     It can be a formatter for stdout, as is the case for the console
+     & mi outputs, or it might be a result formatter.  */
+  struct ui_out *interpreter_out;
+
+  const struct interp_procs *procs;
+  int quiet_p;
+};
+
+/* Functions local to this file. */
+static void initialize_interps (void);
+static char **interpreter_completer (char *text, char *word);
+
+/* The magic initialization routine for this module. */
+
+void _initialize_interpreter (void);
+
+/* Variables local to this file: */
+
+static struct interp *interp_list = NULL;
+static struct interp *current_interpreter = NULL;
+
+static int interpreter_initialized = 0;
+
+/* interp_new - This allocates space for a new interpreter,
+   fills the fields from the inputs, and returns a pointer to the
+   interpreter. */
+struct interp *
+interp_new (const char *name, void *data, struct ui_out *uiout,
+           const struct interp_procs *procs)
+{
+  struct interp *new_interp;
+
+  new_interp = XMALLOC (struct interp);
+
+  new_interp->name = xstrdup (name);
+  new_interp->data = data;
+  new_interp->interpreter_out = uiout;
+  new_interp->quiet_p = 0;
+  new_interp->procs = procs;
+  new_interp->inited = 0;
+
+  return new_interp;
+}
+
+/* Add interpreter INTERP to the gdb interpreter list.  The
+   interpreter must not have previously been added.  */
+void
+interp_add (struct interp *interp)
+{
+  if (!interpreter_initialized)
+    initialize_interps ();
+
+  gdb_assert (interp_lookup (interp->name) == NULL);
+
+  interp->next = interp_list;
+  interp_list = interp;
+}
+
+/* This sets the current interpreter to be INTERP.  If INTERP has not
+   been initialized, then this will also run the init proc.  If the
+   init proc is successful, return 1, if it fails, set the old
+   interpreter back in place and return 0.  If we can't restore the
+   old interpreter, then raise an internal error, since we are in
+   pretty bad shape at this point. */
+int
+interp_set (struct interp *interp)
+{
+  struct interp *old_interp = current_interpreter;
+  int first_time = 0;
+
+
+  char buffer[64];
+
+  if (current_interpreter != NULL)
+    {
+      do_all_continuations ();
+      ui_out_flush (uiout);
+      if (current_interpreter->procs->suspend_proc
+         && !current_interpreter->procs->suspend_proc (current_interpreter->
+                                                       data))
+       {
+         error ("Could not suspend interpreter \"%s\"\n",
+                current_interpreter->name);
+       }
+    }
+  else
+    {
+      first_time = 1;
+    }
+
+  current_interpreter = interp;
+
+  /* We use interpreter_p for the "set interpreter" variable, so we need
+     to make sure we have a malloc'ed copy for the set command to free. */
+  if (interpreter_p != NULL
+      && strcmp (current_interpreter->name, interpreter_p) != 0)
+    {
+      xfree (interpreter_p);
+
+      interpreter_p = xstrdup (current_interpreter->name);
+    }
+
+  uiout = interp->interpreter_out;
+
+  /* Run the init proc.  If it fails, try to restore the old interp. */
+
+  if (!interp->inited)
+    {
+      if (interp->procs->init_proc != NULL)
+       {
+         interp->data = interp->procs->init_proc ();
+       }
+      interp->inited = 1;
+    }
+
+  /* Clear out any installed interpreter hooks/event handlers. */
+  clear_interpreter_hooks ();
+
+  if (interp->procs->resume_proc != NULL
+      && (!interp->procs->resume_proc (interp->data)))
+    {
+      if (!interp_set (old_interp))
+       internal_error (__FILE__, __LINE__,
+                       "Failed to initialize new interp \"%s\" %s",
+                       interp->name, "and could not restore old interp!\n");
+      return 0;
+    }
+
+  /* Finally, put up the new prompt to show that we are indeed here. 
+     Also, display_gdb_prompt for the console does some readline magic
+     which is needed for the console interpreter, at least... */
+
+  if (!first_time)
+    {
+      if (!interp_quiet_p (interp))
+       {
+         sprintf (buffer, "Switching to interpreter \"%.24s\".\n",
+                  interp->name);
+         ui_out_text (uiout, buffer);
+       }
+      display_gdb_prompt (NULL);
+    }
+
+  return 1;
+}
+
+/* interp_lookup - Looks up the interpreter for NAME.  If no such
+   interpreter exists, return NULL, otherwise return a pointer to the
+   interpreter.  */
+struct interp *
+interp_lookup (const char *name)
+{
+  struct interp *interp;
+
+  if (name == NULL || strlen (name) == 0)
+    return NULL;
+
+  for (interp = interp_list; interp != NULL; interp = interp->next)
+    {
+      if (strcmp (interp->name, name) == 0)
+       return interp;
+    }
+
+  return NULL;
+}
+
+/* Returns the current interpreter. */
+
+struct ui_out *
+interp_ui_out (struct interp *interp)
+{
+  if (interp != NULL)
+    return interp->interpreter_out;
+
+  return current_interpreter->interpreter_out;
+}
+
+/* Returns true if the current interp is the passed in name. */
+int
+current_interp_named_p (const char *interp_name)
+{
+  if (current_interpreter)
+    return (strcmp (current_interpreter->name, interp_name) == 0);
+
+  return 0;
+}
+
+/* This is called in display_gdb_prompt.  If the proc returns a zero
+   value, display_gdb_prompt will return without displaying the
+   prompt.  */
+int
+current_interp_display_prompt_p (void)
+{
+  if (current_interpreter == NULL
+      || current_interpreter->procs->prompt_proc_p == NULL)
+    return 0;
+  else
+    return current_interpreter->procs->prompt_proc_p (current_interpreter->
+                                                     data);
+}
+
+/* Run the current command interpreter's main loop.  */
+void
+current_interp_command_loop (void)
+{
+  /* Somewhat messy.  For the moment prop up all the old ways of
+     selecting the command loop.  `command_loop_hook' should be
+     deprecated.  */
+  if (command_loop_hook != NULL)
+    command_loop_hook ();
+  else if (current_interpreter != NULL
+          && current_interpreter->procs->command_loop_proc != NULL)
+    current_interpreter->procs->command_loop_proc (current_interpreter->data);
+  else if (event_loop_p)
+    cli_command_loop ();
+  else
+    command_loop ();
+}
+
+int
+interp_quiet_p (struct interp *interp)
+{
+  if (interp != NULL)
+    return interp->quiet_p;
+  else
+    return current_interpreter->quiet_p;
+}
+
+int
+interp_set_quiet (struct interp *interp, int quiet)
+{
+  int old_val = interp->quiet_p;
+  interp->quiet_p = quiet;
+  return old_val;
+}
+
+/* interp_exec - This executes COMMAND_STR in the current 
+   interpreter. */
+int
+interp_exec_p (struct interp *interp)
+{
+  return interp->procs->exec_proc != NULL;
+}
+
+int
+interp_exec (struct interp *interp, const char *command_str)
+{
+  if (interp->procs->exec_proc != NULL)
+    {
+      return interp->procs->exec_proc (interp->data, command_str);
+    }
+  return 0;
+}
+
+/* A convenience routine that nulls out all the
+   common command hooks.  Use it when removing your interpreter in its 
+   suspend proc. */
+void
+clear_interpreter_hooks (void)
+{
+  init_ui_hook = 0;
+  print_frame_info_listing_hook = 0;
+  /*print_frame_more_info_hook = 0; */
+  query_hook = 0;
+  warning_hook = 0;
+  create_breakpoint_hook = 0;
+  delete_breakpoint_hook = 0;
+  modify_breakpoint_hook = 0;
+  interactive_hook = 0;
+  registers_changed_hook = 0;
+  readline_begin_hook = 0;
+  readline_hook = 0;
+  readline_end_hook = 0;
+  register_changed_hook = 0;
+  memory_changed_hook = 0;
+  context_hook = 0;
+  target_wait_hook = 0;
+  call_command_hook = 0;
+  error_hook = 0;
+  error_begin_hook = 0;
+  command_loop_hook = 0;
+  clear_gdb_event_hooks ();
+}
+
+/* This is a lazy init routine, called the first time
+   the interpreter module is used.  I put it here just in case, but I haven't
+   thought of a use for it yet.  I will probably bag it soon, since I don't
+   think it will be necessary. */
+static void
+initialize_interps (void)
+{
+  interpreter_initialized = 1;
+  /* Don't know if anything needs to be done here... */
+}
+
+void
+interpreter_exec_cmd (char *args, int from_tty)
+{
+  struct interp *old_interp, *interp_to_use;
+  char **prules = NULL;
+  char **trule = NULL;
+  unsigned int nrules;
+  unsigned int i;
+  int old_quiet, use_quiet;
+
+  prules = buildargv (args);
+  if (prules == NULL)
+    {
+      error ("unable to parse arguments");
+    }
+
+  nrules = 0;
+  if (prules != NULL)
+    {
+      for (trule = prules; *trule != NULL; trule++)
+       {
+         nrules++;
+       }
+    }
+
+  if (nrules < 2)
+    error ("usage: interpreter-exec <interpreter> [ <command> ... ]");
+
+  old_interp = current_interpreter;
+
+  interp_to_use = interp_lookup (prules[0]);
+  if (interp_to_use == NULL)
+    error ("Could not find interpreter \"%s\".", prules[0]);
+
+  /* Temporarily set interpreters quiet */
+  old_quiet = interp_set_quiet (old_interp, 1);
+  use_quiet = interp_set_quiet (interp_to_use, 1);
+
+  if (!interp_set (interp_to_use))
+    error ("Could not switch to interpreter \"%s\".", prules[0]);
+
+  for (i = 1; i < nrules; i++)
+    {
+      if (!interp_exec (interp_to_use, prules[i]))
+       {
+         interp_set (old_interp);
+         interp_set_quiet (interp_to_use, old_quiet);
+         error ("error in command: \"%s\".", prules[i]);
+         break;
+       }
+    }
+
+  interp_set (old_interp);
+  interp_set_quiet (interp_to_use, use_quiet);
+  interp_set_quiet (old_interp, old_quiet);
+}
+
+/* List the possible interpreters which could complete the given text. */
+static char **
+interpreter_completer (char *text, char *word)
+{
+  int alloced = 0;
+  int textlen;
+  int num_matches;
+  char **matches;
+  struct interp *interp;
+
+  /* We expect only a very limited number of interpreters, so just
+     allocate room for all of them. */
+  for (interp = interp_list; interp != NULL; interp = interp->next)
+    ++alloced;
+  matches = (char **) xmalloc (alloced * sizeof (char *));
+
+  num_matches = 0;
+  textlen = strlen (text);
+  for (interp = interp_list; interp != NULL; interp = interp->next)
+    {
+      if (strncmp (interp->name, text, textlen) == 0)
+       {
+         matches[num_matches] =
+           (char *) xmalloc (strlen (word) + strlen (interp->name) + 1);
+         if (word == text)
+           strcpy (matches[num_matches], interp->name);
+         else if (word > text)
+           {
+             /* Return some portion of interp->name */
+             strcpy (matches[num_matches], interp->name + (word - text));
+           }
+         else
+           {
+             /* Return some of text plus interp->name */
+             strncpy (matches[num_matches], word, text - word);
+             matches[num_matches][text - word] = '\0';
+             strcat (matches[num_matches], interp->name);
+           }
+         ++num_matches;
+       }
+    }
+
+  if (num_matches == 0)
+    {
+      xfree (matches);
+      matches = NULL;
+    }
+  else if (num_matches < alloced)
+    {
+      matches = (char **) xrealloc ((char *) matches, ((num_matches + 1)
+                                                      * sizeof (char *)));
+      matches[num_matches] = NULL;
+    }
+
+  return matches;
+}
+
+/* This just adds the "interpreter-exec" command.  */
+void
+_initialize_interpreter (void)
+{
+  struct cmd_list_element *c;
+
+  c = add_cmd ("interpreter-exec", class_support,
+              interpreter_exec_cmd,
+              "Execute a command in an interpreter.  It takes two arguments:\n\
+The first argument is the name of the interpreter to use.\n\
+The second argument is the command to execute.\n", &cmdlist);
+  set_cmd_completer (c, interpreter_completer);
+}
diff --git a/gdb/interps.h b/gdb/interps.h
new file mode 100644 (file)
index 0000000..3954e55
--- /dev/null
@@ -0,0 +1,73 @@
+/* Manages interpreters for GDB, the GNU debugger.
+
+   Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
+
+   Written by Jim Ingham <jingham@apple.com> of Apple Computer, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA. */
+
+#ifndef INTERPS_H
+#define INTERPS_H
+
+struct ui_out;
+struct interp;
+
+extern int interp_resume (struct interp *interp);
+extern int interp_suspend (struct interp *interp);
+extern int interp_prompt_p (struct interp *interp);
+extern int interp_exec_p (struct interp *interp);
+extern int interp_exec (struct interp *interp, const char *command);
+extern int interp_quiet_p (struct interp *interp);
+
+typedef void *(interp_init_ftype) (void);
+typedef int (interp_resume_ftype) (void *data);
+typedef int (interp_suspend_ftype) (void *data);
+typedef int (interp_prompt_p_ftype) (void *data);
+typedef int (interp_exec_ftype) (void *data, const char *command);
+typedef void (interp_command_loop_ftype) (void *data);
+
+struct interp_procs
+{
+  interp_init_ftype *init_proc;
+  interp_resume_ftype *resume_proc;
+  interp_suspend_ftype *suspend_proc;
+  interp_exec_ftype *exec_proc;
+  interp_prompt_p_ftype *prompt_proc_p;
+  interp_command_loop_ftype *command_loop_proc;
+};
+
+extern struct interp *interp_new (const char *name, void *data,
+                                 struct ui_out *uiout,
+                                 const struct interp_procs *procs);
+extern void interp_add (struct interp *interp);
+extern int interp_set (struct interp *interp);
+extern struct interp *interp_lookup (const char *name);
+extern struct ui_out *interp_ui_out (struct interp *interp);
+
+extern int current_interp_named_p (const char *name);
+extern int current_interp_display_prompt_p (void);
+extern void current_interp_command_loop (void);
+
+extern void clear_interpreter_hooks ();
+
+/* well-known interpreters */
+#define INTERP_CONSOLE         "console"
+#define INTERP_MI1             "mi1"
+#define INTERP_MI              "mi"
+
+#endif
index b4ae340..565881d 100644 (file)
@@ -48,6 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "bfd.h" /* Required by objfiles.h.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
index 3afdebd..903404d 100644 (file)
@@ -1,5 +1,5 @@
 /* Java language support routines for GDB, the GNU debugger.
-   Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -33,6 +33,7 @@
 #include "c-lang.h"
 #include "jv-lang.h"
 #include "gdbcore.h"
+#include "block.h"
 #include <ctype.h>
 
 struct type *java_int_type;
@@ -68,6 +69,12 @@ static struct objfile *dynamics_objfile = NULL;
 
 static struct type *java_link_class_type (struct type *, struct value *);
 
+/* FIXME: carlton/2003-02-04: This is the main or only caller of
+   allocate_objfile with first argument NULL; as a result, this code
+   breaks every so often.  Somebody should write a test case that
+   exercises GDB in various ways (e.g. something involving loading a
+   dynamic library) after this code has been called.  */
+
 static struct objfile *
 get_dynamics_objfile (void)
 {
@@ -157,7 +164,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr)
     obstack_alloc (&dynamics_objfile->symbol_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
   SYMBOL_LANGUAGE (sym) = language_java;
-  SYMBOL_NAME (sym) = TYPE_TAG_NAME (type);
+  DEPRECATED_SYMBOL_NAME (sym) = TYPE_TAG_NAME (type);
   SYMBOL_CLASS (sym) = LOC_TYPEDEF;
   /*  SYMBOL_VALUE (sym) = valu; */
   SYMBOL_TYPE (sym) = type;
index b6dac57..0d4c187 100644 (file)
@@ -166,12 +166,12 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
            {
              QUIT;
              /* Don't print out virtual function table.  */
-             if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5)
+             if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0
                  && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
                continue;
 
              /* Don't print the dummy field "class". */
-             if (STREQN (TYPE_FIELD_NAME (type, i), "class", 5))
+             if (strncmp (TYPE_FIELD_NAME (type, i), "class", 5) == 0)
                continue;
 
              print_spaces_filtered (level + 4, stream);
index 1ddfcb5..f25cd09 100644 (file)
@@ -199,8 +199,9 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 
   if (TYPE_CODE (type) == TYPE_CODE_PTR
       && TYPE_TARGET_TYPE (type)
-      && TYPE_NAME (TYPE_TARGET_TYPE (type))
-      && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
+      && TYPE_TAG_NAME (TYPE_TARGET_TYPE (type))
+      && strcmp (TYPE_TAG_NAME (TYPE_TARGET_TYPE (type)),
+                "java.lang.String") == 0
       && (format == 0 || format == 's')
       && address != 0
       && value_as_address (val) != 0)
index 37633cc..2738b1e 100644 (file)
@@ -32,6 +32,7 @@
 #include "completer.h"
 #include "cp-abi.h"
 #include "parser-defs.h"
+#include "block.h"
 
 /* We share this one with symtab.c, but it is not exported widely. */
 
@@ -54,6 +55,18 @@ static struct symtabs_and_lines decode_compound (char **argptr,
                                                 char *saved_arg,
                                                 char *p);
 
+static struct symbol *lookup_prefix_sym (char **argptr, char *p);
+
+static struct symtabs_and_lines find_method (int funfirstline,
+                                            char ***canonical,
+                                            char *saved_arg,
+                                            char *copy,
+                                            struct type *t,
+                                            struct symbol *sym_class);
+
+static int collect_methods (char *copy, struct type *t,
+                           struct symbol **sym_arr);
+
 static NORETURN void cplusplus_error (const char *name,
                                      const char *fmt, ...)
      ATTR_NORETURN ATTR_FORMAT (printf, 2, 3);
@@ -427,7 +440,7 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
          values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
          printf_unfiltered ("[%d] %s at %s:%d\n",
                             (i + 2),
-                            SYMBOL_SOURCE_NAME (sym_arr[i]),
+                            SYMBOL_PRINT_NAME (sym_arr[i]),
                             values.sals[i].symtab->filename,
                             values.sals[i].line);
        }
@@ -436,7 +449,8 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
       i++;
     }
 
-  if ((prompt = getenv ("PS2")) == NULL)
+  prompt = getenv ("PS2");
+  if (prompt == NULL)
     {
       prompt = "> ";
     }
@@ -468,7 +482,7 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
                {
                  if (canonical_arr[i] == NULL)
                    {
-                     symname = SYMBOL_NAME (sym_arr[i]);
+                     symname = DEPRECATED_SYMBOL_NAME (sym_arr[i]);
                      canonical_arr[i] = savestring (symname, strlen (symname));
                    }
                }
@@ -491,7 +505,7 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
            {
              if (canonical_arr)
                {
-                 symname = SYMBOL_NAME (sym_arr[num]);
+                 symname = DEPRECATED_SYMBOL_NAME (sym_arr[num]);
                  make_cleanup (xfree, symname);
                  canonical_arr[i] = savestring (symname, strlen (symname));
                }
@@ -930,7 +944,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
                 char *saved_arg, char *p)
 {
   struct symtabs_and_lines values;
-  char *p1, *p2;
+  char *p2;
 #if 0
   char *q, *q1;
 #endif
@@ -941,7 +955,6 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
   struct symtab *sym_symtab;
   char *copy;
   struct symbol *sym_class;
-  int i1;
   struct symbol **sym_arr;
   struct type *t;
 
@@ -975,22 +988,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
   p2 = p;              /* Save for restart.  */
   while (1)
     {
-      /* Extract the class name.  */
-      p1 = p;
-      while (p != *argptr && p[-1] == ' ')
-       --p;
-      copy = (char *) alloca (p - *argptr + 1);
-      memcpy (copy, *argptr, p - *argptr);
-      copy[p - *argptr] = 0;
-
-      /* Discard the class name from the arg.  */
-      p = p1 + (p1[0] == ':' ? 2 : 1);
-      while (*p == ' ' || *p == '\t')
-       p++;
-      *argptr = p;
-
-      sym_class = lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0,
-                                (struct symtab **) NULL);
+      sym_class = lookup_prefix_sym (argptr, p);
 
       if (sym_class &&
          (t = check_typedef (SYMBOL_TYPE (sym_class)),
@@ -1048,76 +1046,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
            p++;
          *argptr = p;
 
-         sym = 0;
-         i1 = 0;       /*  Counter for the symbol array.  */
-         sym_arr = (struct symbol **) alloca (total_number_of_methods (t)
-                                              * sizeof (struct symbol *));
-
-         if (destructor_name_p (copy, t))
-           {
-             /* Destructors are a special case.  */
-             int m_index, f_index;
-
-             if (get_destructor_fn_field (t, &m_index, &f_index))
-               {
-                 struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
-
-                 sym_arr[i1] =
-                   lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
-                                  NULL, VAR_NAMESPACE, (int *) NULL,
-                                  (struct symtab **) NULL);
-                 if (sym_arr[i1])
-                   i1++;
-               }
-           }
-         else
-           i1 = find_methods (t, copy, sym_arr);
-         if (i1 == 1)
-           {
-             /* There is exactly one field with that name.  */
-             sym = sym_arr[0];
-
-             if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
-               {
-                 values.sals = (struct symtab_and_line *)
-                   xmalloc (sizeof (struct symtab_and_line));
-                 values.nelts = 1;
-                 values.sals[0] = find_function_start_sal (sym,
-                                                           funfirstline);
-               }
-             else
-               {
-                 values.nelts = 0;
-               }
-             return values;
-           }
-         if (i1 > 0)
-           {
-             /* There is more than one field with that name
-                (overloaded).  Ask the user which one to use.  */
-             return decode_line_2 (sym_arr, i1, funfirstline, canonical);
-           }
-         else
-           {
-             char *tmp;
-
-             if (is_operator_name (copy))
-               {
-                 tmp = (char *) alloca (strlen (copy + 3) + 9);
-                 strcpy (tmp, "operator ");
-                 strcat (tmp, copy + 3);
-               }
-             else
-               tmp = copy;
-             if (tmp[0] == '~')
-               cplusplus_error (saved_arg,
-                                "the class `%s' does not have destructor defined\n",
-                                SYMBOL_SOURCE_NAME (sym_class));
-             else
-               cplusplus_error (saved_arg,
-                                "the class %s does not have any method named %s\n",
-                                SYMBOL_SOURCE_NAME (sym_class), tmp);
-           }
+         return find_method (funfirstline, canonical, saved_arg,
+                             copy, t, sym_class);
        }
 
       /* Move pointer up to next possible class/namespace token.  */
@@ -1168,6 +1098,135 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
                   copy);
 }
 
+/* Next come some helper functions for decode_compound.  */
+
+/* Return the symbol corresponding to the substring of *ARGPTR ending
+   at P, allowing whitespace.  Also, advance *ARGPTR past the symbol
+   name in question, the compound object separator ("::" or "."), and
+   whitespace.  */
+
+static struct symbol *
+lookup_prefix_sym (char **argptr, char *p)
+{
+  char *p1;
+  char *copy;
+
+  /* Extract the class name.  */
+  p1 = p;
+  while (p != *argptr && p[-1] == ' ')
+    --p;
+  copy = (char *) alloca (p - *argptr + 1);
+  memcpy (copy, *argptr, p - *argptr);
+  copy[p - *argptr] = 0;
+
+  /* Discard the class name from the arg.  */
+  p = p1 + (p1[0] == ':' ? 2 : 1);
+  while (*p == ' ' || *p == '\t')
+    p++;
+  *argptr = p;
+
+  return lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0,
+                       (struct symtab **) NULL);
+}
+
+/* This finds the method COPY in the class whose type is T and whose
+   symbol is SYM_CLASS.  */
+
+static struct symtabs_and_lines
+find_method (int funfirstline, char ***canonical, char *saved_arg,
+            char *copy, struct type *t, struct symbol *sym_class)
+{
+  struct symtabs_and_lines values;
+  struct symbol *sym = 0;
+  int i1;      /*  Counter for the symbol array.  */
+  struct symbol **sym_arr =  alloca (total_number_of_methods (t)
+                                    * sizeof (struct symbol *));
+
+  /* Find all methods with a matching name, and put them in
+     sym_arr.  */
+
+  i1 = collect_methods (copy, t, sym_arr);
+
+  if (i1 == 1)
+    {
+      /* There is exactly one field with that name.  */
+      sym = sym_arr[0];
+
+      if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
+       {
+         values.sals = (struct symtab_and_line *)
+           xmalloc (sizeof (struct symtab_and_line));
+         values.nelts = 1;
+         values.sals[0] = find_function_start_sal (sym,
+                                                   funfirstline);
+       }
+      else
+       {
+         values.nelts = 0;
+       }
+      return values;
+    }
+  if (i1 > 0)
+    {
+      /* There is more than one field with that name
+        (overloaded).  Ask the user which one to use.  */
+      return decode_line_2 (sym_arr, i1, funfirstline, canonical);
+    }
+  else
+    {
+      char *tmp;
+
+      if (is_operator_name (copy))
+       {
+         tmp = (char *) alloca (strlen (copy + 3) + 9);
+         strcpy (tmp, "operator ");
+         strcat (tmp, copy + 3);
+       }
+      else
+       tmp = copy;
+      if (tmp[0] == '~')
+       cplusplus_error (saved_arg,
+                        "the class `%s' does not have destructor defined\n",
+                        SYMBOL_PRINT_NAME (sym_class));
+      else
+       cplusplus_error (saved_arg,
+                        "the class %s does not have any method named %s\n",
+                        SYMBOL_PRINT_NAME (sym_class), tmp);
+    }
+}
+
+/* Find all methods named COPY in the class whose type is T, and put
+   them in SYM_ARR.  Return the number of methods found.  */
+
+static int
+collect_methods (char *copy, struct type *t,
+                struct symbol **sym_arr)
+{
+  int i1 = 0;  /*  Counter for the symbol array.  */
+
+  if (destructor_name_p (copy, t))
+    {
+      /* Destructors are a special case.  */
+      int m_index, f_index;
+
+      if (get_destructor_fn_field (t, &m_index, &f_index))
+       {
+         struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
+
+         sym_arr[i1] =
+           lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
+                          NULL, VAR_NAMESPACE, (int *) NULL,
+                          (struct symtab **) NULL);
+         if (sym_arr[i1])
+           i1++;
+       }
+    }
+  else
+    i1 = find_methods (t, copy, sym_arr);
+
+  return i1;
+}
+
 \f
 
 /* Return the symtab associated to the filename given by the substring
index 2f43ae6..00383e9 100644 (file)
@@ -23,7 +23,7 @@
 #include "inferior.h"
 #include <sys/param.h> /* for MAXPATHLEN */
 #include <sys/procfs.h>        /* for elf_gregset etc. */
-#include <sys/stat.h>  /* for struct stat */
+#include "gdb_stat.h"  /* for struct stat */
 #include <ctype.h>     /* for isdigit */
 #include <unistd.h>    /* for open, pread64 */
 #include <fcntl.h>     /* for O_RDONLY */
index b5cb29a..4be7fb8 100644 (file)
@@ -1,6 +1,7 @@
 /* Native-dependent code for LynxOS.
-   Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+
+   Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2003 Free
+   Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,7 +28,7 @@
 #include "regcache.h"
 
 #include <sys/ptrace.h>
-#include <sys/wait.h>
+#Include "gdb_wait.h"
 #include <sys/fpp.h>
 
 static unsigned long registers_addr (int pid);
index 3fb4685..b318bcc 100644 (file)
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "bfd.h" /* Required by objfiles.h.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
@@ -1040,6 +1041,8 @@ yylex ()
        case LOC_CONST:
        case LOC_CONST_BYTES:
        case LOC_OPTIMIZED_OUT:
+       case LOC_COMPUTED:
+       case LOC_COMPUTED_ARG:
          return NAME;
 
        case LOC_TYPEDEF:
index b4bfefd..f8ac154 100644 (file)
-/* Remote debugging interface to m32r and mon2000 ROM monitors for GDB, 
-   the GNU debugger.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
-
-   Adapted by Michael Snyder of Cygnus Support.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* This module defines communication with the Mitsubishi m32r monitor */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "symtab.h"
-#include "command.h"
-#include "gdbcmd.h"
-#include "symfile.h"           /* for generic load */
-#include <time.h>              /* for time_t */
-#include "gdb_string.h"
-#include "objfiles.h"          /* for ALL_OBJFILES etc. */
-#include "inferior.h"          /* for write_pc() */
-#include <ctype.h>
-#include "regcache.h"
-
-extern void report_transfer_performance (unsigned long, time_t, time_t);
-
-/*
- * All this stuff just to get my host computer's IP address!
- */
-#include <sys/types.h>
-#include <netdb.h>             /* for hostent */
-#include <netinet/in.h>                /* for struct in_addr */
-#if 1
-#include <arpa/inet.h>         /* for inet_ntoa */
-#endif
-
-static char *board_addr;       /* user-settable IP address for M32R-EVA */
-static char *server_addr;      /* user-settable IP address for gdb host */
-static char *download_path;    /* user-settable path for SREC files     */
-
-
-/* 
- * Function: m32r_load_1 (helper function)
- */
-
-static void
-m32r_load_section (bfd *abfd, asection *s, void *obj)
-{
-  unsigned int *data_count = obj;
-  if (s->flags & SEC_LOAD)
-    {
-      bfd_size_type section_size = bfd_section_size (abfd, s);
-      bfd_vma section_base = bfd_section_lma (abfd, s);
-      unsigned int buffer, i;
-
-      *data_count += section_size;
-
-      printf_filtered ("Loading section %s, size 0x%lx lma ",
-                      bfd_section_name (abfd, s), section_size);
-      print_address_numeric (section_base, 1, gdb_stdout);
-      printf_filtered ("\n");
-      gdb_flush (gdb_stdout);
-      monitor_printf ("%s mw\r", paddr_nz (section_base));
-      for (i = 0; i < section_size; i += 4)
-       {
-         QUIT;
-         monitor_expect (" -> ", NULL, 0);
-         bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
-         monitor_printf ("%x\n", buffer);
-       }
-      monitor_expect (" -> ", NULL, 0);
-      monitor_printf ("q\n");
-      monitor_expect_prompt (NULL, 0);
-    }
-}
-
-static int
-m32r_load_1 (void *dummy)
-{
-  int data_count = 0;
-
-  bfd_map_over_sections ((bfd *) dummy, m32r_load_section, &data_count);
-  return data_count;
-}
-
-/* 
- * Function: m32r_load (an alternate way to load) 
- */
-
-static void
-m32r_load (char *filename, int from_tty)
-{
-  bfd *abfd;
-  asection *s;
-  unsigned int i, data_count = 0;
-  time_t start_time, end_time; /* for timing of download */
-
-  if (filename == NULL || filename[0] == 0)
-    filename = get_exec_file (1);
-
-  abfd = bfd_openr (filename, 0);
-  if (!abfd)
-    error ("Unable to open file %s\n", filename);
-  if (bfd_check_format (abfd, bfd_object) == 0)
-    error ("File is not an object file\n");
-  start_time = time (NULL);
-#if 0
-  for (s = abfd->sections; s; s = s->next)
-    if (s->flags & SEC_LOAD)
-      {
-       bfd_size_type section_size = bfd_section_size (abfd, s);
-       bfd_vma section_base = bfd_section_vma (abfd, s);
-       unsigned int buffer;
-
-       data_count += section_size;
-
-       printf_filtered ("Loading section %s, size 0x%lx vma ",
-                        bfd_section_name (abfd, s), section_size);
-       print_address_numeric (section_base, 1, gdb_stdout);
-       printf_filtered ("\n");
-       gdb_flush (gdb_stdout);
-       monitor_printf ("%x mw\r", section_base);
-       for (i = 0; i < section_size; i += 4)
-         {
-           monitor_expect (" -> ", NULL, 0);
-           bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
-           monitor_printf ("%x\n", buffer);
-         }
-       monitor_expect (" -> ", NULL, 0);
-       monitor_printf ("q\n");
-       monitor_expect_prompt (NULL, 0);
-      }
-#else
-  if (!(catch_errors (m32r_load_1, abfd, "Load aborted!\n", RETURN_MASK_ALL)))
-    {
-      monitor_printf ("q\n");
-      return;
-    }
-#endif
-  end_time = time (NULL);
-  printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
-  report_transfer_performance (data_count, start_time, end_time);
-
-  /* Finally, make the PC point at the start address */
-  if (exec_bfd)
-    write_pc (bfd_get_start_address (exec_bfd));
-
-  inferior_ptid = null_ptid;   /* No process now */
-
-  /* This is necessary because many things were based on the PC at the
-     time that we attached to the monitor, which is no longer valid
-     now that we have loaded new code (and just changed the PC).
-     Another way to do this might be to call normal_stop, except that
-     the stack may not be valid, and things would get horribly
-     confused... */
-
-  clear_symtab_users ();
-}
-
-static void
-m32r_load_gen (char *filename, int from_tty)
-{
-  generic_load (filename, from_tty);
-}
-
-static void m32r_open (char *args, int from_tty);
-static void mon2000_open (char *args, int from_tty);
-
-/* This array of registers needs to match the indexes used by GDB. The
-   whole reason this exists is because the various ROM monitors use
-   different names than GDB does, and don't support all the registers
-   either. So, typing "info reg sp" becomes an "A7". */
-
-static char *m32r_regnames[] =
-{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
-};
-
-static void
-m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
-  int regno;
-  int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
-
-  for (regno = 0; regno < num_regs; regno++)
-    if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
-      break;
-
-  if (regno >= num_regs)
-    return;                    /* no match */
-
-  if (regno == ACCL_REGNUM)
-    {                          /* special handling for 64-bit acc reg */
-      monitor_supply_register (ACCH_REGNUM, val);
-      val = strchr (val, ':'); /* skip past ':' to get 2nd word */
-      if (val != NULL)
-       monitor_supply_register (ACCL_REGNUM, val + 1);
-    }
-  else
-    {
-      monitor_supply_register (regno, val);
-      if (regno == PSW_REGNUM)
-       {
-         unsigned long psw = strtoul (val, NULL, 16);
-         char *zero = "00000000", *one = "00000001";
-
-#ifdef SM_REGNUM
-         /* Stack mode bit */
-         monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
-#endif
-#ifdef BSM_REGNUM
-         /* Backup stack mode bit */
-         monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
-#endif
-#ifdef IE_REGNUM
-         /* Interrupt enable bit */
-         monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
-#endif
-#ifdef BIE_REGNUM
-         /* Backup interrupt enable bit */
-         monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
-#endif
-#ifdef COND_REGNUM
-         /* Condition bit (carry etc.) */
-         monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
-#endif
-#ifdef CBR_REGNUM
-         monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
-#endif
-#ifdef BPC_REGNUM
-         monitor_supply_register (BPC_REGNUM, zero);   /* KLUDGE:   (???????) */
-#endif
-#ifdef BCARRY_REGNUM
-         monitor_supply_register (BCARRY_REGNUM, zero);        /* KLUDGE: (??????) */
-#endif
-       }
-
-      if (regno == SPI_REGNUM || regno == SPU_REGNUM)
-       {                       /* special handling for stack pointer (spu or spi) */
-         unsigned long stackmode = read_register (PSW_REGNUM) & 0x80;
-
-         if (regno == SPI_REGNUM && !stackmode)        /* SP == SPI */
-           monitor_supply_register (SP_REGNUM, val);
-         else if (regno == SPU_REGNUM && stackmode)    /* SP == SPU */
-           monitor_supply_register (SP_REGNUM, val);
-       }
-    }
-}
-
-/* m32r RevC board monitor */
-
-static struct target_ops m32r_ops;
-
-static char *m32r_inits[] =
-{"\r", NULL};
-
-static struct monitor_ops m32r_cmds;
-
-static void
-init_m32r_cmds (void)
-{
-  m32r_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
-  m32r_cmds.init = m32r_inits; /* Init strings */
-  m32r_cmds.cont = "go\r";     /* continue command */
-  m32r_cmds.step = "step\r";   /* single step */
-  m32r_cmds.stop = NULL;       /* interrupt command */
-  m32r_cmds.set_break = "%x +bp\r";    /* set a breakpoint */
-  m32r_cmds.clr_break = "%x -bp\r";    /* clear a breakpoint */
-  m32r_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
-  m32r_cmds.fill = "%x %x %x fill\r";  /* fill (start length val) */
-  m32r_cmds.setmem.cmdb = "%x 1 %x fill\r";    /* setmem.cmdb (addr, value) */
-  m32r_cmds.setmem.cmdw = "%x 1 %x fillh\r";   /* setmem.cmdw (addr, value) */
-  m32r_cmds.setmem.cmdl = "%x 1 %x fillw\r";   /* setmem.cmdl (addr, value) */
-  m32r_cmds.setmem.cmdll = NULL;       /* setmem.cmdll (addr, value) */
-  m32r_cmds.setmem.resp_delim = NULL;  /* setmem.resp_delim */
-  m32r_cmds.setmem.term = NULL;        /* setmem.term */
-  m32r_cmds.setmem.term_cmd = NULL;    /* setmem.term_cmd */
-  m32r_cmds.getmem.cmdb = "%x %x dump\r";      /* getmem.cmdb (addr, len) */
-  m32r_cmds.getmem.cmdw = NULL;        /* getmem.cmdw (addr, len) */
-  m32r_cmds.getmem.cmdl = NULL;        /* getmem.cmdl (addr, len) */
-  m32r_cmds.getmem.cmdll = NULL;       /* getmem.cmdll (addr, len) */
-  m32r_cmds.getmem.resp_delim = ": ";  /* getmem.resp_delim */
-  m32r_cmds.getmem.term = NULL;        /* getmem.term */
-  m32r_cmds.getmem.term_cmd = NULL;    /* getmem.term_cmd */
-  m32r_cmds.setreg.cmd = "%x to %%%s\r";       /* setreg.cmd (name, value) */
-  m32r_cmds.setreg.resp_delim = NULL;  /* setreg.resp_delim */
-  m32r_cmds.setreg.term = NULL;        /* setreg.term */
-  m32r_cmds.setreg.term_cmd = NULL;    /* setreg.term_cmd */
-  m32r_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
-  m32r_cmds.getreg.resp_delim = NULL;  /* getreg.resp_delim */
-  m32r_cmds.getreg.term = NULL;        /* getreg.term */
-  m32r_cmds.getreg.term_cmd = NULL;    /* getreg.term_cmd */
-  m32r_cmds.dump_registers = ".reg\r"; /* dump_registers */
-  m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";  /* register_pattern */
-  m32r_cmds.supply_register = m32r_supply_register;    /* supply_register */
-  m32r_cmds.load_routine = NULL;       /* load_routine (defaults to SRECs) */
-  m32r_cmds.load = NULL;       /* download command */
-  m32r_cmds.loadresp = NULL;   /* load response */
-  m32r_cmds.prompt = "ok ";    /* monitor command prompt */
-  m32r_cmds.line_term = "\r";  /* end-of-line terminator */
-  m32r_cmds.cmd_end = NULL;    /* optional command terminator */
-  m32r_cmds.target = &m32r_ops;        /* target operations */
-  m32r_cmds.stopbits = SERIAL_1_STOPBITS;      /* number of stop bits */
-  m32r_cmds.regnames = m32r_regnames;  /* registers names */
-  m32r_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-}                              /* init_m32r_cmds */
-
-static void
-m32r_open (char *args, int from_tty)
-{
-  monitor_open (args, &m32r_cmds, from_tty);
-}
-
-/* Mon2000 monitor (MSA2000 board) */
-
-static struct target_ops mon2000_ops;
-static struct monitor_ops mon2000_cmds;
-
-static void
-init_mon2000_cmds (void)
-{
-  mon2000_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
-  mon2000_cmds.init = m32r_inits;      /* Init strings */
-  mon2000_cmds.cont = "go\r";  /* continue command */
-  mon2000_cmds.step = "step\r";        /* single step */
-  mon2000_cmds.stop = NULL;    /* interrupt command */
-  mon2000_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
-  mon2000_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
-  mon2000_cmds.clr_all_break = "bpoff\r";      /* clear all breakpoints */
-  mon2000_cmds.fill = "%x %x %x fill\r";       /* fill (start length val) */
-  mon2000_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
-  mon2000_cmds.setmem.cmdw = "%x 1 %x fillh\r";                /* setmem.cmdw (addr, value) */
-  mon2000_cmds.setmem.cmdl = "%x 1 %x fillw\r";                /* setmem.cmdl (addr, value) */
-  mon2000_cmds.setmem.cmdll = NULL;    /* setmem.cmdll (addr, value) */
-  mon2000_cmds.setmem.resp_delim = NULL;       /* setmem.resp_delim */
-  mon2000_cmds.setmem.term = NULL;     /* setmem.term */
-  mon2000_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
-  mon2000_cmds.getmem.cmdb = "%x %x dump\r";   /* getmem.cmdb (addr, len) */
-  mon2000_cmds.getmem.cmdw = NULL;     /* getmem.cmdw (addr, len) */
-  mon2000_cmds.getmem.cmdl = NULL;     /* getmem.cmdl (addr, len) */
-  mon2000_cmds.getmem.cmdll = NULL;    /* getmem.cmdll (addr, len) */
-  mon2000_cmds.getmem.resp_delim = ": ";       /* getmem.resp_delim */
-  mon2000_cmds.getmem.term = NULL;     /* getmem.term */
-  mon2000_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
-  mon2000_cmds.setreg.cmd = "%x to %%%s\r";    /* setreg.cmd (name, value) */
-  mon2000_cmds.setreg.resp_delim = NULL;       /* setreg.resp_delim */
-  mon2000_cmds.setreg.term = NULL;     /* setreg.term */
-  mon2000_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
-  mon2000_cmds.getreg.cmd = NULL;      /* getreg.cmd (name) */
-  mon2000_cmds.getreg.resp_delim = NULL;       /* getreg.resp_delim */
-  mon2000_cmds.getreg.term = NULL;     /* getreg.term */
-  mon2000_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
-  mon2000_cmds.dump_registers = ".reg\r";      /* dump_registers */
-  mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";       /* register_pattern */
-  mon2000_cmds.supply_register = m32r_supply_register; /* supply_register */
-  mon2000_cmds.load_routine = NULL;    /* load_routine (defaults to SRECs) */
-  mon2000_cmds.load = NULL;    /* download command */
-  mon2000_cmds.loadresp = NULL;        /* load response */
-  mon2000_cmds.prompt = "Mon2000>";    /* monitor command prompt */
-  mon2000_cmds.line_term = "\r";       /* end-of-line terminator */
-  mon2000_cmds.cmd_end = NULL; /* optional command terminator */
-  mon2000_cmds.target = &mon2000_ops;  /* target operations */
-  mon2000_cmds.stopbits = SERIAL_1_STOPBITS;   /* number of stop bits */
-  mon2000_cmds.regnames = m32r_regnames;       /* registers names */
-  mon2000_cmds.magic = MONITOR_OPS_MAGIC;      /* magic */
-}                              /* init_mon2000_cmds */
-
-static void
-mon2000_open (char *args, int from_tty)
-{
-  monitor_open (args, &mon2000_cmds, from_tty);
-}
-
-/* Function: set_board_address
-   Tell the BootOne monitor what it's ethernet IP address is. */
-
-static void
-m32r_set_board_address (char *args, int from_tty)
-{
-  int resp_len;
-  char buf[1024];
-
-  if (args && *args)
-    {
-      monitor_printf ("ulip %s\n", args);
-      resp_len = monitor_expect_prompt (buf, sizeof (buf));
-      /* now parse the result for success */
-    }
-  else
-    error ("Requires argument (IP address for M32R-EVA board)");
-}
-
-/* Function: set_server_address
-   Tell the BootOne monitor what gdb's ethernet IP address is. */
-
-static void
-m32r_set_server_address (char *args, int from_tty)
-{
-  int resp_len;
-  char buf[1024];
-
-  if (args && *args)
-    {
-      monitor_printf ("uhip %s\n", args);
-      resp_len = monitor_expect_prompt (buf, sizeof (buf));
-      /* now parse the result for success */
-    }
-  else
-    error ("Requires argument (IP address of GDB's host computer)");
-}
-
-/* Function: set_download_path
-   Tell the BootOne monitor the default path for downloadable SREC files. */
-
-static void
-m32r_set_download_path (char *args, int from_tty)
-{
-  int resp_len;
-  char buf[1024];
-
-  if (args && *args)
-    {
-      monitor_printf ("up %s\n", args);
-      resp_len = monitor_expect_prompt (buf, sizeof (buf));
-      /* now parse the result for success */
-    }
-  else
-    error ("Requires argument (default path for downloadable SREC files)");
-}
-
-static void
-m32r_upload_command (char *args, int from_tty)
-{
-  bfd *abfd;
-  asection *s;
-  time_t start_time, end_time; /* for timing of download */
-  int resp_len, data_count = 0;
-  char buf[1024];
-  struct hostent *hostent;
-  struct in_addr inet_addr;
-
-  /* first check to see if there's an ethernet port! */
-  monitor_printf ("ust\r");
-  resp_len = monitor_expect_prompt (buf, sizeof (buf));
-  if (!strchr (buf, ':'))
-    error ("No ethernet connection!");
-
-  if (board_addr == 0)
-    {
-      /* scan second colon in the output from the "ust" command */
-      char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1;
-
-      while (isspace (*myIPaddress))
-       myIPaddress++;
-
-      if (!strncmp (myIPaddress, "0.0.", 4))   /* empty */
-       error ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
-      if (strchr (myIPaddress, '('))
-       *(strchr (myIPaddress, '(')) = '\0';    /* delete trailing junk */
-      board_addr = xstrdup (myIPaddress);
-    }
-  if (server_addr == 0)
-    {
-      buf[0] = 0;
-      gethostname (buf, sizeof (buf));
-      if (buf[0] != 0)
-       hostent = gethostbyname (buf);
-      if (hostent != 0)
-       {
-#if 1
-         memcpy (&inet_addr.s_addr, hostent->h_addr,
-                 sizeof (inet_addr.s_addr));
-         server_addr = (char *) inet_ntoa (inet_addr);
-#else
-         server_addr = (char *) inet_ntoa (hostent->h_addr);
-#endif
-       }
-      if (server_addr == 0)    /* failed? */
-       error ("Need to know gdb host computer's IP address (use 'set server-address')");
-    }
-
-  if (args == 0 || args[0] == 0)       /* no args: upload the current file */
-    args = get_exec_file (1);
-
-  if (args[0] != '/' && download_path == 0)
-    {
-      if (current_directory)
-       download_path = xstrdup (current_directory);
-      else
-       error ("Need to know default download path (use 'set download-path')");
-    }
-
-  start_time = time (NULL);
-  monitor_printf ("uhip %s\r", server_addr);
-  resp_len = monitor_expect_prompt (buf, sizeof (buf));                /* parse result? */
-  monitor_printf ("ulip %s\r", board_addr);
-  resp_len = monitor_expect_prompt (buf, sizeof (buf));                /* parse result? */
-  if (args[0] != '/')
-    monitor_printf ("up %s\r", download_path); /* use default path */
-  else
-    monitor_printf ("up\r");   /* rooted filename/path */
-  resp_len = monitor_expect_prompt (buf, sizeof (buf));                /* parse result? */
-
-  if (strrchr (args, '.') && !strcmp (strrchr (args, '.'), ".srec"))
-    monitor_printf ("ul %s\r", args);
-  else                         /* add ".srec" suffix */
-    monitor_printf ("ul %s.srec\r", args);
-  resp_len = monitor_expect_prompt (buf, sizeof (buf));                /* parse result? */
-
-  if (buf[0] == 0 || strstr (buf, "complete") == 0)
-    error ("Upload file not found: %s.srec\nCheck IP addresses and download path.", args);
-  else
-    printf_filtered (" -- Ethernet load complete.\n");
-
-  end_time = time (NULL);
-  abfd = bfd_openr (args, 0);
-  if (abfd != NULL)
-    {                          /* Download is done -- print section statistics */
-      if (bfd_check_format (abfd, bfd_object) == 0)
-       {
-         printf_filtered ("File is not an object file\n");
-       }
-      for (s = abfd->sections; s; s = s->next)
-       if (s->flags & SEC_LOAD)
-         {
-           bfd_size_type section_size = bfd_section_size (abfd, s);
-           bfd_vma section_base = bfd_section_lma (abfd, s);
-           unsigned int buffer;
-
-           data_count += section_size;
-
-           printf_filtered ("Loading section %s, size 0x%lx lma ",
-                            bfd_section_name (abfd, s), section_size);
-           print_address_numeric (section_base, 1, gdb_stdout);
-           printf_filtered ("\n");
-           gdb_flush (gdb_stdout);
-         }
-      /* Finally, make the PC point at the start address */
-      write_pc (bfd_get_start_address (abfd));
-      report_transfer_performance (data_count, start_time, end_time);
-      printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
-    }
-  inferior_ptid = null_ptid;   /* No process now */
-
-  /* This is necessary because many things were based on the PC at the
-     time that we attached to the monitor, which is no longer valid
-     now that we have loaded new code (and just changed the PC).
-     Another way to do this might be to call normal_stop, except that
-     the stack may not be valid, and things would get horribly
-     confused... */
-
-  clear_symtab_users ();
-}
-
-void
-_initialize_m32r_rom (void)
-{
-  /* Initialize m32r RevC monitor target */
-  init_m32r_cmds ();
-  init_monitor_ops (&m32r_ops);
-
-  m32r_ops.to_shortname = "m32r";
-  m32r_ops.to_longname = "m32r monitor";
-  m32r_ops.to_load = m32r_load_gen;    /* monitor lacks a download command */
-  m32r_ops.to_doc = "Debug via the m32r monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
-  m32r_ops.to_open = m32r_open;
-  add_target (&m32r_ops);
-
-  /* Initialize mon2000 monitor target */
-  init_mon2000_cmds ();
-  init_monitor_ops (&mon2000_ops);
-
-  mon2000_ops.to_shortname = "mon2000";
-  mon2000_ops.to_longname = "Mon2000 monitor";
-  mon2000_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
-  mon2000_ops.to_doc = "Debug via the Mon2000 monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
-  mon2000_ops.to_open = mon2000_open;
-  add_target (&mon2000_ops);
-
-  add_show_from_set
-    (add_set_cmd ("download-path", class_obscure, var_string,
-                 (char *) &download_path,
-                 "Set the default path for downloadable SREC files.",
-                 &setlist),
-     &showlist);
-
-  add_show_from_set
-    (add_set_cmd ("board-address", class_obscure, var_string,
-                 (char *) &board_addr,
-                 "Set IP address for M32R-EVA target board.",
-                 &setlist),
-     &showlist);
-
-  add_show_from_set
-    (add_set_cmd ("server-address", class_obscure, var_string,
-                 (char *) &server_addr,
-               "Set IP address for download server (GDB's host computer).",
-                 &setlist),
-     &showlist);
-
-  add_com ("upload", class_obscure, m32r_upload_command,
-      "Upload the srec file via the monitor's Ethernet upload capability.");
-
-  add_com ("tload", class_obscure, m32r_load, "test upload command.");
-}
+// OBSOLETE /* Remote debugging interface to m32r and mon2000 ROM monitors for GDB, 
+// OBSOLETE    the GNU debugger.
+// OBSOLETE    Copyright 1996, 1997, 1998, 1999, 2000, 2001
+// OBSOLETE    Free Software Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    Adapted by Michael Snyder of Cygnus Support.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE /* This module defines communication with the Mitsubishi m32r monitor */
+// OBSOLETE 
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "monitor.h"
+// OBSOLETE #include "serial.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "command.h"
+// OBSOLETE #include "gdbcmd.h"
+// OBSOLETE #include "symfile.h"               /* for generic load */
+// OBSOLETE #include <time.h>          /* for time_t */
+// OBSOLETE #include "gdb_string.h"
+// OBSOLETE #include "objfiles.h"              /* for ALL_OBJFILES etc. */
+// OBSOLETE #include "inferior.h"              /* for write_pc() */
+// OBSOLETE #include <ctype.h>
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE extern void report_transfer_performance (unsigned long, time_t, time_t);
+// OBSOLETE 
+// OBSOLETE /*
+// OBSOLETE  * All this stuff just to get my host computer's IP address!
+// OBSOLETE  */
+// OBSOLETE #include <sys/types.h>
+// OBSOLETE #include <netdb.h>         /* for hostent */
+// OBSOLETE #include <netinet/in.h>            /* for struct in_addr */
+// OBSOLETE #if 1
+// OBSOLETE #include <arpa/inet.h>             /* for inet_ntoa */
+// OBSOLETE #endif
+// OBSOLETE 
+// OBSOLETE static char *board_addr;   /* user-settable IP address for M32R-EVA */
+// OBSOLETE static char *server_addr;  /* user-settable IP address for gdb host */
+// OBSOLETE static char *download_path;        /* user-settable path for SREC files     */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /
+// OBSOLETE  * Function: m32r_load_1 (helper function)
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_load_section (bfd *abfd, asection *s, void *obj)
+// OBSOLETE {
+// OBSOLETE   unsigned int *data_count = obj;
+// OBSOLETE   if (s->flags & SEC_LOAD)
+// OBSOLETE     {
+// OBSOLETE       bfd_size_type section_size = bfd_section_size (abfd, s);
+// OBSOLETE       bfd_vma section_base = bfd_section_lma (abfd, s);
+// OBSOLETE       unsigned int buffer, i;
+// OBSOLETE 
+// OBSOLETE       *data_count += section_size;
+// OBSOLETE 
+// OBSOLETE       printf_filtered ("Loading section %s, size 0x%lx lma ",
+// OBSOLETE                   bfd_section_name (abfd, s), section_size);
+// OBSOLETE       print_address_numeric (section_base, 1, gdb_stdout);
+// OBSOLETE       printf_filtered ("\n");
+// OBSOLETE       gdb_flush (gdb_stdout);
+// OBSOLETE       monitor_printf ("%s mw\r", paddr_nz (section_base));
+// OBSOLETE       for (i = 0; i < section_size; i += 4)
+// OBSOLETE    {
+// OBSOLETE      QUIT;
+// OBSOLETE      monitor_expect (" -> ", NULL, 0);
+// OBSOLETE      bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
+// OBSOLETE      monitor_printf ("%x\n", buffer);
+// OBSOLETE    }
+// OBSOLETE       monitor_expect (" -> ", NULL, 0);
+// OBSOLETE       monitor_printf ("q\n");
+// OBSOLETE       monitor_expect_prompt (NULL, 0);
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE m32r_load_1 (void *dummy)
+// OBSOLETE {
+// OBSOLETE   int data_count = 0;
+// OBSOLETE 
+// OBSOLETE   bfd_map_over_sections ((bfd *) dummy, m32r_load_section, &data_count);
+// OBSOLETE   return data_count;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /
+// OBSOLETE  * Function: m32r_load (an alternate way to load) 
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_load (char *filename, int from_tty)
+// OBSOLETE {
+// OBSOLETE   bfd *abfd;
+// OBSOLETE   asection *s;
+// OBSOLETE   unsigned int i, data_count = 0;
+// OBSOLETE   time_t start_time, end_time;     /* for timing of download */
+// OBSOLETE 
+// OBSOLETE   if (filename == NULL || filename[0] == 0)
+// OBSOLETE     filename = get_exec_file (1);
+// OBSOLETE 
+// OBSOLETE   abfd = bfd_openr (filename, 0);
+// OBSOLETE   if (!abfd)
+// OBSOLETE     error ("Unable to open file %s\n", filename);
+// OBSOLETE   if (bfd_check_format (abfd, bfd_object) == 0)
+// OBSOLETE     error ("File is not an object file\n");
+// OBSOLETE   start_time = time (NULL);
+// OBSOLETE #if 0
+// OBSOLETE   for (s = abfd->sections; s; s = s->next)
+// OBSOLETE     if (s->flags & SEC_LOAD)
+// OBSOLETE       {
+// OBSOLETE    bfd_size_type section_size = bfd_section_size (abfd, s);
+// OBSOLETE    bfd_vma section_base = bfd_section_vma (abfd, s);
+// OBSOLETE    unsigned int buffer;
+// OBSOLETE 
+// OBSOLETE    data_count += section_size;
+// OBSOLETE 
+// OBSOLETE    printf_filtered ("Loading section %s, size 0x%lx vma ",
+// OBSOLETE                     bfd_section_name (abfd, s), section_size);
+// OBSOLETE    print_address_numeric (section_base, 1, gdb_stdout);
+// OBSOLETE    printf_filtered ("\n");
+// OBSOLETE    gdb_flush (gdb_stdout);
+// OBSOLETE    monitor_printf ("%x mw\r", section_base);
+// OBSOLETE    for (i = 0; i < section_size; i += 4)
+// OBSOLETE      {
+// OBSOLETE        monitor_expect (" -> ", NULL, 0);
+// OBSOLETE        bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
+// OBSOLETE        monitor_printf ("%x\n", buffer);
+// OBSOLETE      }
+// OBSOLETE    monitor_expect (" -> ", NULL, 0);
+// OBSOLETE    monitor_printf ("q\n");
+// OBSOLETE    monitor_expect_prompt (NULL, 0);
+// OBSOLETE       }
+// OBSOLETE #else
+// OBSOLETE   if (!(catch_errors (m32r_load_1, abfd, "Load aborted!\n", RETURN_MASK_ALL)))
+// OBSOLETE     {
+// OBSOLETE       monitor_printf ("q\n");
+// OBSOLETE       return;
+// OBSOLETE     }
+// OBSOLETE #endif
+// OBSOLETE   end_time = time (NULL);
+// OBSOLETE   printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+// OBSOLETE   report_transfer_performance (data_count, start_time, end_time);
+// OBSOLETE 
+// OBSOLETE   /* Finally, make the PC point at the start address */
+// OBSOLETE   if (exec_bfd)
+// OBSOLETE     write_pc (bfd_get_start_address (exec_bfd));
+// OBSOLETE 
+// OBSOLETE   inferior_ptid = null_ptid;       /* No process now */
+// OBSOLETE 
+// OBSOLETE   /* This is necessary because many things were based on the PC at the
+// OBSOLETE      time that we attached to the monitor, which is no longer valid
+// OBSOLETE      now that we have loaded new code (and just changed the PC).
+// OBSOLETE      Another way to do this might be to call normal_stop, except that
+// OBSOLETE      the stack may not be valid, and things would get horribly
+// OBSOLETE      confused... */
+// OBSOLETE 
+// OBSOLETE   clear_symtab_users ();
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_load_gen (char *filename, int from_tty)
+// OBSOLETE {
+// OBSOLETE   generic_load (filename, from_tty);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void m32r_open (char *args, int from_tty);
+// OBSOLETE static void mon2000_open (char *args, int from_tty);
+// OBSOLETE 
+// OBSOLETE /* This array of registers needs to match the indexes used by GDB. The
+// OBSOLETE    whole reason this exists is because the various ROM monitors use
+// OBSOLETE    different names than GDB does, and don't support all the registers
+// OBSOLETE    either. So, typing "info reg sp" becomes an "A7". */
+// OBSOLETE 
+// OBSOLETE static char *m32r_regnames[] =
+// OBSOLETE {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+// OBSOLETE  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+// OBSOLETE  "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
+// OBSOLETE };
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
+// OBSOLETE {
+// OBSOLETE   int regno;
+// OBSOLETE   int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
+// OBSOLETE 
+// OBSOLETE   for (regno = 0; regno < num_regs; regno++)
+// OBSOLETE     if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
+// OBSOLETE       break;
+// OBSOLETE 
+// OBSOLETE   if (regno >= num_regs)
+// OBSOLETE     return;                        /* no match */
+// OBSOLETE 
+// OBSOLETE   if (regno == ACCL_REGNUM)
+// OBSOLETE     {                              /* special handling for 64-bit acc reg */
+// OBSOLETE       monitor_supply_register (ACCH_REGNUM, val);
+// OBSOLETE       val = strchr (val, ':');     /* skip past ':' to get 2nd word */
+// OBSOLETE       if (val != NULL)
+// OBSOLETE    monitor_supply_register (ACCL_REGNUM, val + 1);
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       monitor_supply_register (regno, val);
+// OBSOLETE       if (regno == PSW_REGNUM)
+// OBSOLETE    {
+// OBSOLETE      unsigned long psw = strtoul (val, NULL, 16);
+// OBSOLETE      char *zero = "00000000", *one = "00000001";
+// OBSOLETE 
+// OBSOLETE #ifdef SM_REGNUM
+// OBSOLETE      /* Stack mode bit */
+// OBSOLETE      monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef BSM_REGNUM
+// OBSOLETE      /* Backup stack mode bit */
+// OBSOLETE      monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef IE_REGNUM
+// OBSOLETE      /* Interrupt enable bit */
+// OBSOLETE      monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef BIE_REGNUM
+// OBSOLETE      /* Backup interrupt enable bit */
+// OBSOLETE      monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef COND_REGNUM
+// OBSOLETE      /* Condition bit (carry etc.) */
+// OBSOLETE      monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef CBR_REGNUM
+// OBSOLETE      monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
+// OBSOLETE #endif
+// OBSOLETE #ifdef BPC_REGNUM
+// OBSOLETE      monitor_supply_register (BPC_REGNUM, zero);   /* KLUDGE:   (???????) */
+// OBSOLETE #endif
+// OBSOLETE #ifdef BCARRY_REGNUM
+// OBSOLETE      monitor_supply_register (BCARRY_REGNUM, zero);        /* KLUDGE: (??????) */
+// OBSOLETE #endif
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       if (regno == SPI_REGNUM || regno == SPU_REGNUM)
+// OBSOLETE    {                       /* special handling for stack pointer (spu or spi) */
+// OBSOLETE      unsigned long stackmode = read_register (PSW_REGNUM) & 0x80;
+// OBSOLETE 
+// OBSOLETE      if (regno == SPI_REGNUM && !stackmode)        /* SP == SPI */
+// OBSOLETE        monitor_supply_register (SP_REGNUM, val);
+// OBSOLETE      else if (regno == SPU_REGNUM && stackmode)    /* SP == SPU */
+// OBSOLETE        monitor_supply_register (SP_REGNUM, val);
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* m32r RevC board monitor */
+// OBSOLETE 
+// OBSOLETE static struct target_ops m32r_ops;
+// OBSOLETE 
+// OBSOLETE static char *m32r_inits[] =
+// OBSOLETE {"\r", NULL};
+// OBSOLETE 
+// OBSOLETE static struct monitor_ops m32r_cmds;
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE init_m32r_cmds (void)
+// OBSOLETE {
+// OBSOLETE   m32r_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
+// OBSOLETE   m32r_cmds.init = m32r_inits;     /* Init strings */
+// OBSOLETE   m32r_cmds.cont = "go\r"; /* continue command */
+// OBSOLETE   m32r_cmds.step = "step\r";       /* single step */
+// OBSOLETE   m32r_cmds.stop = NULL;   /* interrupt command */
+// OBSOLETE   m32r_cmds.set_break = "%x +bp\r";        /* set a breakpoint */
+// OBSOLETE   m32r_cmds.clr_break = "%x -bp\r";        /* clear a breakpoint */
+// OBSOLETE   m32r_cmds.clr_all_break = "bpoff\r";     /* clear all breakpoints */
+// OBSOLETE   m32r_cmds.fill = "%x %x %x fill\r";      /* fill (start length val) */
+// OBSOLETE   m32r_cmds.setmem.cmdb = "%x 1 %x fill\r";        /* setmem.cmdb (addr, value) */
+// OBSOLETE   m32r_cmds.setmem.cmdw = "%x 1 %x fillh\r";       /* setmem.cmdw (addr, value) */
+// OBSOLETE   m32r_cmds.setmem.cmdl = "%x 1 %x fillw\r";       /* setmem.cmdl (addr, value) */
+// OBSOLETE   m32r_cmds.setmem.cmdll = NULL;   /* setmem.cmdll (addr, value) */
+// OBSOLETE   m32r_cmds.setmem.resp_delim = NULL;      /* setmem.resp_delim */
+// OBSOLETE   m32r_cmds.setmem.term = NULL;    /* setmem.term */
+// OBSOLETE   m32r_cmds.setmem.term_cmd = NULL;        /* setmem.term_cmd */
+// OBSOLETE   m32r_cmds.getmem.cmdb = "%x %x dump\r";  /* getmem.cmdb (addr, len) */
+// OBSOLETE   m32r_cmds.getmem.cmdw = NULL;    /* getmem.cmdw (addr, len) */
+// OBSOLETE   m32r_cmds.getmem.cmdl = NULL;    /* getmem.cmdl (addr, len) */
+// OBSOLETE   m32r_cmds.getmem.cmdll = NULL;   /* getmem.cmdll (addr, len) */
+// OBSOLETE   m32r_cmds.getmem.resp_delim = ": ";      /* getmem.resp_delim */
+// OBSOLETE   m32r_cmds.getmem.term = NULL;    /* getmem.term */
+// OBSOLETE   m32r_cmds.getmem.term_cmd = NULL;        /* getmem.term_cmd */
+// OBSOLETE   m32r_cmds.setreg.cmd = "%x to %%%s\r";   /* setreg.cmd (name, value) */
+// OBSOLETE   m32r_cmds.setreg.resp_delim = NULL;      /* setreg.resp_delim */
+// OBSOLETE   m32r_cmds.setreg.term = NULL;    /* setreg.term */
+// OBSOLETE   m32r_cmds.setreg.term_cmd = NULL;        /* setreg.term_cmd */
+// OBSOLETE   m32r_cmds.getreg.cmd = NULL;     /* getreg.cmd (name) */
+// OBSOLETE   m32r_cmds.getreg.resp_delim = NULL;      /* getreg.resp_delim */
+// OBSOLETE   m32r_cmds.getreg.term = NULL;    /* getreg.term */
+// OBSOLETE   m32r_cmds.getreg.term_cmd = NULL;        /* getreg.term_cmd */
+// OBSOLETE   m32r_cmds.dump_registers = ".reg\r";     /* dump_registers */
+// OBSOLETE   m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";      /* register_pattern */
+// OBSOLETE   m32r_cmds.supply_register = m32r_supply_register;        /* supply_register */
+// OBSOLETE   m32r_cmds.load_routine = NULL;   /* load_routine (defaults to SRECs) */
+// OBSOLETE   m32r_cmds.load = NULL;   /* download command */
+// OBSOLETE   m32r_cmds.loadresp = NULL;       /* load response */
+// OBSOLETE   m32r_cmds.prompt = "ok ";        /* monitor command prompt */
+// OBSOLETE   m32r_cmds.line_term = "\r";      /* end-of-line terminator */
+// OBSOLETE   m32r_cmds.cmd_end = NULL;        /* optional command terminator */
+// OBSOLETE   m32r_cmds.target = &m32r_ops;    /* target operations */
+// OBSOLETE   m32r_cmds.stopbits = SERIAL_1_STOPBITS;  /* number of stop bits */
+// OBSOLETE   m32r_cmds.regnames = m32r_regnames;      /* registers names */
+// OBSOLETE   m32r_cmds.magic = MONITOR_OPS_MAGIC;     /* magic */
+// OBSOLETE }                          /* init_m32r_cmds */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_open (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   monitor_open (args, &m32r_cmds, from_tty);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Mon2000 monitor (MSA2000 board) */
+// OBSOLETE 
+// OBSOLETE static struct target_ops mon2000_ops;
+// OBSOLETE static struct monitor_ops mon2000_cmds;
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE init_mon2000_cmds (void)
+// OBSOLETE {
+// OBSOLETE   mon2000_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
+// OBSOLETE   mon2000_cmds.init = m32r_inits;  /* Init strings */
+// OBSOLETE   mon2000_cmds.cont = "go\r";      /* continue command */
+// OBSOLETE   mon2000_cmds.step = "step\r";    /* single step */
+// OBSOLETE   mon2000_cmds.stop = NULL;        /* interrupt command */
+// OBSOLETE   mon2000_cmds.set_break = "%x +bp\r";     /* set a breakpoint */
+// OBSOLETE   mon2000_cmds.clr_break = "%x -bp\r";     /* clear a breakpoint */
+// OBSOLETE   mon2000_cmds.clr_all_break = "bpoff\r";  /* clear all breakpoints */
+// OBSOLETE   mon2000_cmds.fill = "%x %x %x fill\r";   /* fill (start length val) */
+// OBSOLETE   mon2000_cmds.setmem.cmdb = "%x 1 %x fill\r";     /* setmem.cmdb (addr, value) */
+// OBSOLETE   mon2000_cmds.setmem.cmdw = "%x 1 %x fillh\r";            /* setmem.cmdw (addr, value) */
+// OBSOLETE   mon2000_cmds.setmem.cmdl = "%x 1 %x fillw\r";            /* setmem.cmdl (addr, value) */
+// OBSOLETE   mon2000_cmds.setmem.cmdll = NULL;        /* setmem.cmdll (addr, value) */
+// OBSOLETE   mon2000_cmds.setmem.resp_delim = NULL;   /* setmem.resp_delim */
+// OBSOLETE   mon2000_cmds.setmem.term = NULL; /* setmem.term */
+// OBSOLETE   mon2000_cmds.setmem.term_cmd = NULL;     /* setmem.term_cmd */
+// OBSOLETE   mon2000_cmds.getmem.cmdb = "%x %x dump\r";       /* getmem.cmdb (addr, len) */
+// OBSOLETE   mon2000_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
+// OBSOLETE   mon2000_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
+// OBSOLETE   mon2000_cmds.getmem.cmdll = NULL;        /* getmem.cmdll (addr, len) */
+// OBSOLETE   mon2000_cmds.getmem.resp_delim = ": ";   /* getmem.resp_delim */
+// OBSOLETE   mon2000_cmds.getmem.term = NULL; /* getmem.term */
+// OBSOLETE   mon2000_cmds.getmem.term_cmd = NULL;     /* getmem.term_cmd */
+// OBSOLETE   mon2000_cmds.setreg.cmd = "%x to %%%s\r";        /* setreg.cmd (name, value) */
+// OBSOLETE   mon2000_cmds.setreg.resp_delim = NULL;   /* setreg.resp_delim */
+// OBSOLETE   mon2000_cmds.setreg.term = NULL; /* setreg.term */
+// OBSOLETE   mon2000_cmds.setreg.term_cmd = NULL;     /* setreg.term_cmd */
+// OBSOLETE   mon2000_cmds.getreg.cmd = NULL;  /* getreg.cmd (name) */
+// OBSOLETE   mon2000_cmds.getreg.resp_delim = NULL;   /* getreg.resp_delim */
+// OBSOLETE   mon2000_cmds.getreg.term = NULL; /* getreg.term */
+// OBSOLETE   mon2000_cmds.getreg.term_cmd = NULL;     /* getreg.term_cmd */
+// OBSOLETE   mon2000_cmds.dump_registers = ".reg\r";  /* dump_registers */
+// OBSOLETE   mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)";   /* register_pattern */
+// OBSOLETE   mon2000_cmds.supply_register = m32r_supply_register;     /* supply_register */
+// OBSOLETE   mon2000_cmds.load_routine = NULL;        /* load_routine (defaults to SRECs) */
+// OBSOLETE   mon2000_cmds.load = NULL;        /* download command */
+// OBSOLETE   mon2000_cmds.loadresp = NULL;    /* load response */
+// OBSOLETE   mon2000_cmds.prompt = "Mon2000>";        /* monitor command prompt */
+// OBSOLETE   mon2000_cmds.line_term = "\r";   /* end-of-line terminator */
+// OBSOLETE   mon2000_cmds.cmd_end = NULL;     /* optional command terminator */
+// OBSOLETE   mon2000_cmds.target = &mon2000_ops;      /* target operations */
+// OBSOLETE   mon2000_cmds.stopbits = SERIAL_1_STOPBITS;       /* number of stop bits */
+// OBSOLETE   mon2000_cmds.regnames = m32r_regnames;   /* registers names */
+// OBSOLETE   mon2000_cmds.magic = MONITOR_OPS_MAGIC;  /* magic */
+// OBSOLETE }                          /* init_mon2000_cmds */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE mon2000_open (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   monitor_open (args, &mon2000_cmds, from_tty);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: set_board_address
+// OBSOLETE    Tell the BootOne monitor what it's ethernet IP address is. */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_set_board_address (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   int resp_len;
+// OBSOLETE   char buf[1024];
+// OBSOLETE 
+// OBSOLETE   if (args && *args)
+// OBSOLETE     {
+// OBSOLETE       monitor_printf ("ulip %s\n", args);
+// OBSOLETE       resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE       /* now parse the result for success */
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     error ("Requires argument (IP address for M32R-EVA board)");
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: set_server_address
+// OBSOLETE    Tell the BootOne monitor what gdb's ethernet IP address is. */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_set_server_address (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   int resp_len;
+// OBSOLETE   char buf[1024];
+// OBSOLETE 
+// OBSOLETE   if (args && *args)
+// OBSOLETE     {
+// OBSOLETE       monitor_printf ("uhip %s\n", args);
+// OBSOLETE       resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE       /* now parse the result for success */
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     error ("Requires argument (IP address of GDB's host computer)");
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: set_download_path
+// OBSOLETE    Tell the BootOne monitor the default path for downloadable SREC files. */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_set_download_path (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   int resp_len;
+// OBSOLETE   char buf[1024];
+// OBSOLETE 
+// OBSOLETE   if (args && *args)
+// OBSOLETE     {
+// OBSOLETE       monitor_printf ("up %s\n", args);
+// OBSOLETE       resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE       /* now parse the result for success */
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     error ("Requires argument (default path for downloadable SREC files)");
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE m32r_upload_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   bfd *abfd;
+// OBSOLETE   asection *s;
+// OBSOLETE   time_t start_time, end_time;     /* for timing of download */
+// OBSOLETE   int resp_len, data_count = 0;
+// OBSOLETE   char buf[1024];
+// OBSOLETE   struct hostent *hostent;
+// OBSOLETE   struct in_addr inet_addr;
+// OBSOLETE 
+// OBSOLETE   /* first check to see if there's an ethernet port! */
+// OBSOLETE   monitor_printf ("ust\r");
+// OBSOLETE   resp_len = monitor_expect_prompt (buf, sizeof (buf));
+// OBSOLETE   if (!strchr (buf, ':'))
+// OBSOLETE     error ("No ethernet connection!");
+// OBSOLETE 
+// OBSOLETE   if (board_addr == 0)
+// OBSOLETE     {
+// OBSOLETE       /* scan second colon in the output from the "ust" command */
+// OBSOLETE       char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1;
+// OBSOLETE 
+// OBSOLETE       while (isspace (*myIPaddress))
+// OBSOLETE    myIPaddress++;
+// OBSOLETE 
+// OBSOLETE       if (!strncmp (myIPaddress, "0.0.", 4))       /* empty */
+// OBSOLETE    error ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
+// OBSOLETE       if (strchr (myIPaddress, '('))
+// OBSOLETE    *(strchr (myIPaddress, '(')) = '\0';    /* delete trailing junk */
+// OBSOLETE       board_addr = xstrdup (myIPaddress);
+// OBSOLETE     }
+// OBSOLETE   if (server_addr == 0)
+// OBSOLETE     {
+// OBSOLETE       buf[0] = 0;
+// OBSOLETE       gethostname (buf, sizeof (buf));
+// OBSOLETE       if (buf[0] != 0)
+// OBSOLETE    hostent = gethostbyname (buf);
+// OBSOLETE       if (hostent != 0)
+// OBSOLETE    {
+// OBSOLETE #if 1
+// OBSOLETE      memcpy (&inet_addr.s_addr, hostent->h_addr,
+// OBSOLETE              sizeof (inet_addr.s_addr));
+// OBSOLETE      server_addr = (char *) inet_ntoa (inet_addr);
+// OBSOLETE #else
+// OBSOLETE      server_addr = (char *) inet_ntoa (hostent->h_addr);
+// OBSOLETE #endif
+// OBSOLETE    }
+// OBSOLETE       if (server_addr == 0)        /* failed? */
+// OBSOLETE    error ("Need to know gdb host computer's IP address (use 'set server-address')");
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   if (args == 0 || args[0] == 0)   /* no args: upload the current file */
+// OBSOLETE     args = get_exec_file (1);
+// OBSOLETE 
+// OBSOLETE   if (args[0] != '/' && download_path == 0)
+// OBSOLETE     {
+// OBSOLETE       if (current_directory)
+// OBSOLETE    download_path = xstrdup (current_directory);
+// OBSOLETE       else
+// OBSOLETE    error ("Need to know default download path (use 'set download-path')");
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   start_time = time (NULL);
+// OBSOLETE   monitor_printf ("uhip %s\r", server_addr);
+// OBSOLETE   resp_len = monitor_expect_prompt (buf, sizeof (buf));            /* parse result? */
+// OBSOLETE   monitor_printf ("ulip %s\r", board_addr);
+// OBSOLETE   resp_len = monitor_expect_prompt (buf, sizeof (buf));            /* parse result? */
+// OBSOLETE   if (args[0] != '/')
+// OBSOLETE     monitor_printf ("up %s\r", download_path);     /* use default path */
+// OBSOLETE   else
+// OBSOLETE     monitor_printf ("up\r");       /* rooted filename/path */
+// OBSOLETE   resp_len = monitor_expect_prompt (buf, sizeof (buf));            /* parse result? */
+// OBSOLETE 
+// OBSOLETE   if (strrchr (args, '.') && !strcmp (strrchr (args, '.'), ".srec"))
+// OBSOLETE     monitor_printf ("ul %s\r", args);
+// OBSOLETE   else                             /* add ".srec" suffix */
+// OBSOLETE     monitor_printf ("ul %s.srec\r", args);
+// OBSOLETE   resp_len = monitor_expect_prompt (buf, sizeof (buf));            /* parse result? */
+// OBSOLETE 
+// OBSOLETE   if (buf[0] == 0 || strstr (buf, "complete") == 0)
+// OBSOLETE     error ("Upload file not found: %s.srec\nCheck IP addresses and download path.", args);
+// OBSOLETE   else
+// OBSOLETE     printf_filtered (" -- Ethernet load complete.\n");
+// OBSOLETE 
+// OBSOLETE   end_time = time (NULL);
+// OBSOLETE   abfd = bfd_openr (args, 0);
+// OBSOLETE   if (abfd != NULL)
+// OBSOLETE     {                              /* Download is done -- print section statistics */
+// OBSOLETE       if (bfd_check_format (abfd, bfd_object) == 0)
+// OBSOLETE    {
+// OBSOLETE      printf_filtered ("File is not an object file\n");
+// OBSOLETE    }
+// OBSOLETE       for (s = abfd->sections; s; s = s->next)
+// OBSOLETE    if (s->flags & SEC_LOAD)
+// OBSOLETE      {
+// OBSOLETE        bfd_size_type section_size = bfd_section_size (abfd, s);
+// OBSOLETE        bfd_vma section_base = bfd_section_lma (abfd, s);
+// OBSOLETE        unsigned int buffer;
+// OBSOLETE 
+// OBSOLETE        data_count += section_size;
+// OBSOLETE 
+// OBSOLETE        printf_filtered ("Loading section %s, size 0x%lx lma ",
+// OBSOLETE                         bfd_section_name (abfd, s), section_size);
+// OBSOLETE        print_address_numeric (section_base, 1, gdb_stdout);
+// OBSOLETE        printf_filtered ("\n");
+// OBSOLETE        gdb_flush (gdb_stdout);
+// OBSOLETE      }
+// OBSOLETE       /* Finally, make the PC point at the start address */
+// OBSOLETE       write_pc (bfd_get_start_address (abfd));
+// OBSOLETE       report_transfer_performance (data_count, start_time, end_time);
+// OBSOLETE       printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+// OBSOLETE     }
+// OBSOLETE   inferior_ptid = null_ptid;       /* No process now */
+// OBSOLETE 
+// OBSOLETE   /* This is necessary because many things were based on the PC at the
+// OBSOLETE      time that we attached to the monitor, which is no longer valid
+// OBSOLETE      now that we have loaded new code (and just changed the PC).
+// OBSOLETE      Another way to do this might be to call normal_stop, except that
+// OBSOLETE      the stack may not be valid, and things would get horribly
+// OBSOLETE      confused... */
+// OBSOLETE 
+// OBSOLETE   clear_symtab_users ();
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE _initialize_m32r_rom (void)
+// OBSOLETE {
+// OBSOLETE   /* Initialize m32r RevC monitor target */
+// OBSOLETE   init_m32r_cmds ();
+// OBSOLETE   init_monitor_ops (&m32r_ops);
+// OBSOLETE 
+// OBSOLETE   m32r_ops.to_shortname = "m32r";
+// OBSOLETE   m32r_ops.to_longname = "m32r monitor";
+// OBSOLETE   m32r_ops.to_load = m32r_load_gen;        /* monitor lacks a download command */
+// OBSOLETE   m32r_ops.to_doc = "Debug via the m32r monitor.\n\
+// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
+// OBSOLETE   m32r_ops.to_open = m32r_open;
+// OBSOLETE   add_target (&m32r_ops);
+// OBSOLETE 
+// OBSOLETE   /* Initialize mon2000 monitor target */
+// OBSOLETE   init_mon2000_cmds ();
+// OBSOLETE   init_monitor_ops (&mon2000_ops);
+// OBSOLETE 
+// OBSOLETE   mon2000_ops.to_shortname = "mon2000";
+// OBSOLETE   mon2000_ops.to_longname = "Mon2000 monitor";
+// OBSOLETE   mon2000_ops.to_load = m32r_load_gen;     /* monitor lacks a download command */
+// OBSOLETE   mon2000_ops.to_doc = "Debug via the Mon2000 monitor.\n\
+// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
+// OBSOLETE   mon2000_ops.to_open = mon2000_open;
+// OBSOLETE   add_target (&mon2000_ops);
+// OBSOLETE 
+// OBSOLETE   add_show_from_set
+// OBSOLETE     (add_set_cmd ("download-path", class_obscure, var_string,
+// OBSOLETE              (char *) &download_path,
+// OBSOLETE              "Set the default path for downloadable SREC files.",
+// OBSOLETE              &setlist),
+// OBSOLETE      &showlist);
+// OBSOLETE 
+// OBSOLETE   add_show_from_set
+// OBSOLETE     (add_set_cmd ("board-address", class_obscure, var_string,
+// OBSOLETE              (char *) &board_addr,
+// OBSOLETE              "Set IP address for M32R-EVA target board.",
+// OBSOLETE              &setlist),
+// OBSOLETE      &showlist);
+// OBSOLETE 
+// OBSOLETE   add_show_from_set
+// OBSOLETE     (add_set_cmd ("server-address", class_obscure, var_string,
+// OBSOLETE              (char *) &server_addr,
+// OBSOLETE            "Set IP address for download server (GDB's host computer).",
+// OBSOLETE              &setlist),
+// OBSOLETE      &showlist);
+// OBSOLETE 
+// OBSOLETE   add_com ("upload", class_obscure, m32r_upload_command,
+// OBSOLETE       "Upload the srec file via the monitor's Ethernet upload capability.");
+// OBSOLETE 
+// OBSOLETE   add_com ("tload", class_obscure, m32r_load, "test upload command.");
+// OBSOLETE }
index 2e69b44..d9be3eb 100644 (file)
-/****************************************************************************
-
-               THIS SOFTWARE IS NOT COPYRIGHTED
-
-   HP offers the following for use in the public domain.  HP makes no
-   warranty with regard to the software or it's performance and the
-   user accepts the software "AS IS" with all faults.
-
-   HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
-   TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-****************************************************************************/
-
-/****************************************************************************
- *  Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
- *
- *  Module name: remcom.c $
- *  Revision: 1.34 $
- *  Date: 91/03/09 12:29:49 $
- *  Contributor:     Lake Stevens Instrument Division$
- *
- *  Description:     low level support for gdb debugger. $
- *
- *  Considerations:  only works on target hardware $
- *
- *  Written by:      Glenn Engel $
- *  ModuleState:     Experimental $
- *
- *  NOTES:           See Below $
- *
- *  Modified for M32R by Michael Snyder, Cygnus Support.
- *
- *  To enable debugger support, two things need to happen.  One, a
- *  call to set_debug_traps() is necessary in order to allow any breakpoints
- *  or error conditions to be properly intercepted and reported to gdb.
- *  Two, a breakpoint needs to be generated to begin communication.  This
- *  is most easily accomplished by a call to breakpoint().  Breakpoint()
- *  simulates a breakpoint by executing a trap #1.
- *
- *  The external function exceptionHandler() is
- *  used to attach a specific handler to a specific M32R vector number.
- *  It should use the same privilege level it runs at.  It should
- *  install it as an interrupt gate so that interrupts are masked
- *  while the handler runs.
- *
- *  Because gdb will sometimes write to the stack area to execute function
- *  calls, this program cannot rely on using the supervisor stack so it
- *  uses it's own stack area reserved in the int array remcomStack.
- *
- *************
- *
- *    The following gdb commands are supported:
- *
- * command          function                               Return value
- *
- *    g             return the value of the CPU registers  hex data or ENN
- *    G             set the value of the CPU registers     OK or ENN
- *
- *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
- *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
- *    XAA..AA,LLLL: Write LLLL binary bytes at address     OK or ENN
- *                  AA..AA
- *
- *    c             Resume at current address              SNN   ( signal NN)
- *    cAA..AA       Continue at address AA..AA             SNN
- *
- *    s             Step one instruction                   SNN
- *    sAA..AA       Step one instruction from AA..AA       SNN
- *
- *    k             kill
- *
- *    ?             What was the last sigval ?             SNN   (signal NN)
- *
- * All commands and responses are sent with a packet which includes a
- * checksum.  A packet consists of
- *
- * $<packet info>#<checksum>.
- *
- * where
- * <packet info> :: <characters representing the command or response>
- * <checksum>    :: <two hex digits computed as modulo 256 sum of <packetinfo>>
- *
- * When a packet is received, it is first acknowledged with either '+' or '-'.
- * '+' indicates a successful transfer.  '-' indicates a failed transfer.
- *
- * Example:
- *
- * Host:                  Reply:
- * $m0,10#2a               +$00010203040506070809101112131415#42
- *
- ****************************************************************************/
-
-
-/************************************************************************
- *
- * external low-level support routines
- */
-extern void putDebugChar();    /* write a single character      */
-extern int getDebugChar();     /* read and return a single char */
-extern void exceptionHandler();        /* assign an exception handler   */
-
-/*****************************************************************************
- * BUFMAX defines the maximum number of characters in inbound/outbound buffers
- * at least NUMREGBYTES*2 are needed for register packets 
- */
-#define BUFMAX 400
-
-static char initialized;  /* boolean flag. != 0 means we've been initialized */
-
-int     remote_debug;
-/*  debug >  0 prints ill-formed commands in valid packets & checksum errors */
-
-static const unsigned char hexchars[]="0123456789abcdef";
-
-#define NUMREGS 24
-
-/* Number of bytes of registers.  */
-#define NUMREGBYTES (NUMREGS * 4)
-enum regnames { R0,  R1,  R2,  R3,  R4,  R5,  R6,   R7,
-               R8,  R9,  R10, R11, R12, R13, R14,  R15,
-               PSW, CBR, SPI, SPU, BPC, PC,  ACCL, ACCH };
-
-enum SYS_calls {
-       SYS_null, 
-       SYS_exit,
-       SYS_open,
-       SYS_close,
-       SYS_read,
-       SYS_write,
-       SYS_lseek,
-       SYS_unlink,
-       SYS_getpid,
-       SYS_kill,
-       SYS_fstat,
-       SYS_sbrk,
-       SYS_fork,
-       SYS_execve,
-       SYS_wait4,
-       SYS_link,
-       SYS_chdir,
-       SYS_stat,
-       SYS_utime,
-       SYS_chown,
-       SYS_chmod,
-       SYS_time,
-       SYS_pipe };
-
-static int registers[NUMREGS];
-
-#define STACKSIZE 8096
-static unsigned char remcomInBuffer[BUFMAX];
-static unsigned char remcomOutBuffer[BUFMAX];
-static int  remcomStack[STACKSIZE/sizeof(int)];
-static int*  stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
-
-static unsigned int save_vectors[18];  /* previous exception vectors */
-
-/* Indicate to caller of mem2hex or hex2mem that there has been an error. */
-static volatile int mem_err = 0;
-
-/* Store the vector number here (since GDB only gets the signal
-   number through the usual means, and that's not very specific).  */
-int gdb_m32r_vector = -1;
-
-#if 0
-#include "syscall.h" /* for SYS_exit, SYS_write etc. */
-#endif
-
-/* Global entry points:
- */
-
-extern void handle_exception(int);
-extern void set_debug_traps(void);
-extern void breakpoint(void);
-
-/* Local functions:
- */
-
-static int  computeSignal(int);
-static void putpacket(unsigned char *);
-static unsigned char *getpacket(void);
-
-static unsigned char *mem2hex(unsigned char *, unsigned char *, int, int);
-static unsigned char *hex2mem(unsigned char *, unsigned char *, int, int);
-static int  hexToInt(unsigned char **, int *);
-static unsigned char *bin2mem(unsigned char *, unsigned char *, int, int);
-static void stash_registers(void);
-static void restore_registers(void);
-static int  prepare_to_step(int);
-static int  finish_from_step(void);
-static unsigned long crc32 (unsigned char *, int, unsigned long);
-
-static void gdb_error(char *, char *);
-static int  gdb_putchar(int), gdb_puts(char *), gdb_write(char *, int);
-
-static unsigned char *strcpy (unsigned char *, const unsigned char *);
-static int   strlen (const unsigned char *);
-
-/*
- * This function does all command procesing for interfacing to gdb.
- */
-
-void 
-handle_exception(int exceptionVector)
-{
-  int    sigval, stepping;
-  int    addr, length, i;
-  unsigned char * ptr;
-  unsigned char   buf[16];
-  int binary;
-
-  /* Do not call finish_from_step() if this is not a trap #1
-   * (breakpoint trap).  Without this check, the finish_from_step()
-   * might interpret a system call trap as a single step trap.  This
-   * can happen if: the stub receives 's' and exits, but an interrupt
-   * was pending; the interrupt is now handled and causes the stub to
-   * be reentered because some function makes a system call.  
-   */
-  if (exceptionVector == 1)    /* Trap exception? */
-    if (!finish_from_step())   /* Go see if stepping state needs update. */
-      return;          /* "false step": let the target continue */
-
-  gdb_m32r_vector = exceptionVector;
-
-  if (remote_debug)
-    {
-      mem2hex((unsigned char *) &exceptionVector, buf, 4, 0);
-      gdb_error("Handle exception %s, ", buf);
-      mem2hex((unsigned char *) &registers[PC], buf, 4, 0);
-      gdb_error("PC == 0x%s\n", buf);
-    }
-
-  /* reply to host that an exception has occurred */
-  sigval = computeSignal( exceptionVector );
-
-  ptr = remcomOutBuffer;
-  *ptr++ = 'T';         /* notify gdb with signo, PC, FP and SP */
-  *ptr++ = hexchars[sigval >> 4];
-  *ptr++ = hexchars[sigval & 0xf];
-  *ptr++ = hexchars[PC >> 4];
-  *ptr++ = hexchars[PC & 0xf];
-  *ptr++ = ':';
-  ptr = mem2hex((unsigned char *)&registers[PC], ptr, 4, 0);     /* PC */
-  *ptr++ = ';';
-  *ptr++ = hexchars[R13 >> 4];
-  *ptr++ = hexchars[R13 & 0xf];
-  *ptr++ = ':';
-  ptr = mem2hex((unsigned char *)&registers[R13], ptr, 4, 0);    /* FP */
-  *ptr++ = ';';
-  *ptr++ = hexchars[R15 >> 4];
-  *ptr++ = hexchars[R15 & 0xf];
-  *ptr++ = ':';
-  ptr = mem2hex((unsigned char *)&registers[R15], ptr, 4, 0);    /* SP */
-  *ptr++ = ';';
-  *ptr++ = 0;
-  if (exceptionVector == 0)     /* simulated SYS call stuff */
-    {
-      mem2hex((unsigned char *) &registers[PC], buf, 4, 0);
-      switch (registers[R0]) {
-      case SYS_exit:
-       gdb_error("Target program has exited at %s\n", buf);
-       ptr = remcomOutBuffer;
-       *ptr++ = 'W';
-       sigval = registers[R1] & 0xff;
-       *ptr++ = hexchars[sigval >> 4];
-       *ptr++ = hexchars[sigval & 0xf];
-       *ptr++ = 0;
-       break;
-      case SYS_open:
-       gdb_error("Target attempts SYS_open call at %s\n", buf);
-       break;
-      case SYS_close:
-       gdb_error("Target attempts SYS_close call at %s\n", buf);
-       break;
-      case SYS_read:
-       gdb_error("Target attempts SYS_read call at %s\n", buf);
-       break;
-      case SYS_write:
-       if (registers[R1] == 1 ||       /* write to stdout  */
-           registers[R1] == 2)         /* write to stderr  */
-         {                             /* (we can do that) */
-           registers[R0] = gdb_write((void *) registers[R2], registers[R3]);
-           return;
-         }
-       else
-         gdb_error("Target attempts SYS_write call at %s\n", buf);
-       break;
-      case SYS_lseek:
-       gdb_error("Target attempts SYS_lseek call at %s\n", buf);
-       break;
-      case SYS_unlink:
-       gdb_error("Target attempts SYS_unlink call at %s\n", buf);
-       break;
-      case SYS_getpid:
-       gdb_error("Target attempts SYS_getpid call at %s\n", buf);
-       break;
-      case SYS_kill:
-       gdb_error("Target attempts SYS_kill call at %s\n", buf);
-       break;
-      case SYS_fstat:
-       gdb_error("Target attempts SYS_fstat call at %s\n", buf);
-       break;
-      default:
-       gdb_error("Target attempts unknown SYS call at %s\n", buf);
-       break;
-      }
-    }
-
-  putpacket(remcomOutBuffer);
-
-  stepping = 0;
-
-  while (1==1) {
-    remcomOutBuffer[0] = 0;
-    ptr = getpacket();
-    binary = 0;
-    switch (*ptr++) {
-      default: /* Unknown code.  Return an empty reply message. */
-       break;
-      case 'R':
-       if (hexToInt (&ptr, &addr))
-         registers[PC] = addr;
-       strcpy(remcomOutBuffer, "OK");
-       break;
-      case '!':
-       strcpy(remcomOutBuffer, "OK");
-       break;
-    case 'X': /* XAA..AA,LLLL:<binary data>#cs */
-      binary = 1;
-    case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
-      /* TRY TO READ '%x,%x:'.  IF SUCCEED, SET PTR = 0 */
-      {
-        if (hexToInt(&ptr,&addr))
-          if (*(ptr++) == ',')
-            if (hexToInt(&ptr,&length))
-              if (*(ptr++) == ':')
-                {
-                  mem_err = 0;
-                  if (binary)
-                    bin2mem (ptr, (unsigned char *) addr, length, 1);
-                  else
-                    hex2mem(ptr, (unsigned char*) addr, length, 1);
-                  if (mem_err) {
-                    strcpy (remcomOutBuffer, "E03");
-                    gdb_error ("memory fault", "");
-                  } else {
-                    strcpy(remcomOutBuffer,"OK");
-                  }
-                  ptr = 0;
-                }
-        if (ptr)
-          {
-            strcpy(remcomOutBuffer,"E02");
-          }
-      }
-       break;
-      case 'm': /* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
-               /* TRY TO READ %x,%x.  IF SUCCEED, SET PTR = 0 */
-       if (hexToInt(&ptr,&addr))
-         if (*(ptr++) == ',')
-           if (hexToInt(&ptr,&length))
-             {
-               ptr = 0;
-               mem_err = 0;
-               mem2hex((unsigned char*) addr, remcomOutBuffer, length, 1);
-               if (mem_err) {
-                 strcpy (remcomOutBuffer, "E03");
-                 gdb_error ("memory fault", "");
-               }
-             }
-       if (ptr)
-         {
-           strcpy(remcomOutBuffer,"E01");
-         }
-       break;
-      case '?': 
-       remcomOutBuffer[0] = 'S';
-       remcomOutBuffer[1] =  hexchars[sigval >> 4];
-       remcomOutBuffer[2] =  hexchars[sigval % 16];
-       remcomOutBuffer[3] = 0;
-       break;
-      case 'd': 
-       remote_debug = !(remote_debug);  /* toggle debug flag */
-       break;
-      case 'g': /* return the value of the CPU registers */
-       mem2hex((unsigned char*) registers, remcomOutBuffer, NUMREGBYTES, 0);
-       break;
-      case 'P': /* set the value of a single CPU register - return OK */
-       {
-         int regno;
-
-         if (hexToInt (&ptr, &regno) && *ptr++ == '=')
-           if (regno >= 0 && regno < NUMREGS)
-             {
-               int stackmode;
-
-               hex2mem (ptr, (unsigned char *) &registers[regno], 4, 0);
-               /*
-                * Since we just changed a single CPU register, let's
-                * make sure to keep the several stack pointers consistant.
-                */
-               stackmode = registers[PSW] & 0x80;
-               if (regno == R15)       /* stack pointer changed */
-                 {                     /* need to change SPI or SPU */
-                   if (stackmode == 0)
-                     registers[SPI] = registers[R15];
-                   else
-                     registers[SPU] = registers[R15];
-                 }
-               else if (regno == SPU)  /* "user" stack pointer changed */
-                 {
-                   if (stackmode != 0) /* stack in user mode: copy SP */
-                     registers[R15] = registers[SPU];
-                 }
-               else if (regno == SPI)  /* "interrupt" stack pointer changed */
-                 {
-                   if (stackmode == 0) /* stack in interrupt mode: copy SP */
-                     registers[R15] = registers[SPI];
-                 }
-               else if (regno == PSW)  /* stack mode may have changed! */
-                 {                     /* force SP to either SPU or SPI */
-                   if (stackmode == 0) /* stack in user mode */
-                     registers[R15] = registers[SPI];
-                   else                /* stack in interrupt mode */
-                     registers[R15] = registers[SPU];
-                 }
-               strcpy (remcomOutBuffer, "OK");
-               break;
-             }
-         strcpy (remcomOutBuffer, "E01");
-         break;
-       }
-      case 'G': /* set the value of the CPU registers - return OK */
-       hex2mem(ptr, (unsigned char*) registers, NUMREGBYTES, 0);
-       strcpy(remcomOutBuffer,"OK");
-       break;
-      case 's': /* sAA..AA     Step one instruction from AA..AA(optional) */
-       stepping = 1;
-      case 'c': /* cAA..AA     Continue from address AA..AA(optional) */
-               /* try to read optional parameter, pc unchanged if no parm */
-       if (hexToInt(&ptr,&addr))
-         registers[ PC ] = addr;
-       
-       if (stepping)   /* single-stepping */
-         {
-           if (!prepare_to_step(0))    /* set up for single-step */
-             {
-               /* prepare_to_step has already emulated the target insn:
-                  Send SIGTRAP to gdb, don't resume the target at all.  */
-               ptr = remcomOutBuffer;
-               *ptr++ = 'T';           /* Simulate stopping with SIGTRAP */
-               *ptr++ = '0';
-               *ptr++ = '5';
-
-               *ptr++ = hexchars[PC >> 4];     /* send PC */
-               *ptr++ = hexchars[PC & 0xf];
-               *ptr++ = ':';
-               ptr = mem2hex((unsigned char *)&registers[PC], ptr, 4, 0);
-               *ptr++ = ';';
-
-               *ptr++ = hexchars[R13 >> 4];    /* send FP */
-               *ptr++ = hexchars[R13 & 0xf];
-               *ptr++ = ':';
-               ptr = mem2hex((unsigned char *)&registers[R13], ptr, 4, 0);
-               *ptr++ = ';';
-
-               *ptr++ = hexchars[R15 >> 4];    /* send SP */
-               *ptr++ = hexchars[R15 & 0xf];
-               *ptr++ = ':';
-               ptr = mem2hex((unsigned char *)&registers[R15], ptr, 4, 0);
-               *ptr++ = ';';
-               *ptr++ = 0;
-
-               break;  
-             }
-         }
-       else    /* continuing, not single-stepping */
-         {
-           /* OK, about to do a "continue".  First check to see if the 
-              target pc is on an odd boundary (second instruction in the 
-              word).  If so, we must do a single-step first, because 
-              ya can't jump or return back to an odd boundary!  */
-           if ((registers[PC] & 2) != 0)
-             prepare_to_step(1);
-         }
-
-       return;
-
-      case 'D':        /* Detach */
-#if 0
-       /* I am interpreting this to mean, release the board from control 
-          by the remote stub.  To do this, I am restoring the original
-          (or at least previous) exception vectors.
-        */
-       for (i = 0; i < 18; i++)
-         exceptionHandler (i, save_vectors[i]);
-       putpacket ("OK");
-       return;         /* continue the inferior */
-#else
-       strcpy(remcomOutBuffer,"OK");
-       break;
-#endif
-    case 'q':
-      if (*ptr++ == 'C' &&
-         *ptr++ == 'R' &&
-         *ptr++ == 'C' &&
-         *ptr++ == ':')
-       {
-         unsigned long start, len, our_crc;
-
-         if (hexToInt (&ptr, (int *) &start) &&
-             *ptr++ == ','                   &&
-             hexToInt (&ptr, (int *) &len))
-           {
-             remcomOutBuffer[0] = 'C';
-             our_crc = crc32 ((unsigned char *) start, len, 0xffffffff);
-             mem2hex ((char *) &our_crc, 
-                      &remcomOutBuffer[1], 
-                      sizeof (long), 
-                      0); 
-           } /* else do nothing */
-       } /* else do nothing */
-      break;
-
-      case 'k': /* kill the program */
-       continue;
-      } /* switch */
-
-    /* reply to the request */
-    putpacket(remcomOutBuffer);
-  }
-}
-
-/* qCRC support */
-
-/* Table used by the crc32 function to calcuate the checksum. */
-static unsigned long crc32_table[256] = {0, 0};
-
-static unsigned long
-crc32 (unsigned char *buf, int len, unsigned long crc)
-{
-  if (! crc32_table[1])
-    {
-      /* Initialize the CRC table and the decoding table. */
-      int i, j;
-      unsigned long c;
-
-      for (i = 0; i < 256; i++)
-       {
-         for (c = i << 24, j = 8; j > 0; --j)
-           c = c & 0x80000000 ? (c << 1) ^ 0x04c11db7 : (c << 1);
-         crc32_table[i] = c;
-       }
-    }
-
-  while (len--)
-    {
-      crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buf) & 255];
-      buf++;
-    }
-  return crc;
-}
-
-static int 
-hex (unsigned char ch)
-{
-  if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10);
-  if ((ch >= '0') && (ch <= '9')) return (ch-'0');
-  if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10);
-  return (-1);
-}
-
-/* scan for the sequence $<data>#<checksum>     */
-
-unsigned char *
-getpacket (void)
-{
-  unsigned char *buffer = &remcomInBuffer[0];
-  unsigned char checksum;
-  unsigned char xmitcsum;
-  int count;
-  char ch;
-
-  while (1)
-    {
-      /* wait around for the start character, ignore all other characters */
-      while ((ch = getDebugChar ()) != '$')
-       ;
-
-retry:
-      checksum = 0;
-      xmitcsum = -1;
-      count = 0;
-
-      /* now, read until a # or end of buffer is found */
-      while (count < BUFMAX)
-       {
-         ch = getDebugChar ();
-          if (ch == '$')
-           goto retry;
-         if (ch == '#')
-           break;
-         checksum = checksum + ch;
-         buffer[count] = ch;
-         count = count + 1;
-       }
-      buffer[count] = 0;
-
-      if (ch == '#')
-       {
-         ch = getDebugChar ();
-         xmitcsum = hex (ch) << 4;
-         ch = getDebugChar ();
-         xmitcsum += hex (ch);
-
-         if (checksum != xmitcsum)
-           {
-             if (remote_debug)
-               {
-                 unsigned char buf[16];
-
-                 mem2hex((unsigned char *) &checksum, buf, 4, 0);
-                 gdb_error("Bad checksum: my count = %s, ", buf);
-                 mem2hex((unsigned char *) &xmitcsum, buf, 4, 0);
-                 gdb_error("sent count = %s\n", buf);
-                 gdb_error(" -- Bad buffer: \"%s\"\n", buffer); 
-               }
-             putDebugChar ('-');       /* failed checksum */
-           }
-         else
-           {
-             putDebugChar ('+');       /* successful transfer */
-
-             /* if a sequence char is present, reply the sequence ID */
-             if (buffer[2] == ':')
-               {
-                 putDebugChar (buffer[0]);
-                 putDebugChar (buffer[1]);
-
-                 return &buffer[3];
-               }
-
-             return &buffer[0];
-           }
-       }
-    }
-}
-
-/* send the packet in buffer.  */
-
-static void 
-putpacket (unsigned char *buffer)
-{
-  unsigned char checksum;
-  int  count;
-  char ch;
-
-  /*  $<packet info>#<checksum>. */
-  do {
-    putDebugChar('$');
-    checksum = 0;
-    count    = 0;
-
-    while (ch=buffer[count]) {
-      putDebugChar(ch);
-      checksum += ch;
-      count += 1;
-    }
-    putDebugChar('#');
-    putDebugChar(hexchars[checksum >> 4]);
-    putDebugChar(hexchars[checksum % 16]);
-  } while (getDebugChar() != '+');
-}
-
-/* Address of a routine to RTE to if we get a memory fault.  */
-
-static void (*volatile mem_fault_routine)() = 0;
-
-static void
-set_mem_err (void)
-{
-  mem_err = 1;
-}
-
-/* Check the address for safe access ranges.  As currently defined,
-   this routine will reject the "expansion bus" address range(s).
-   To make those ranges useable, someone must implement code to detect
-   whether there's anything connected to the expansion bus. */
-
-static int
-mem_safe (unsigned char *addr)
-{
-#define BAD_RANGE_ONE_START    ((unsigned char *) 0x600000)
-#define BAD_RANGE_ONE_END      ((unsigned char *) 0xa00000)
-#define BAD_RANGE_TWO_START    ((unsigned char *) 0xff680000)
-#define BAD_RANGE_TWO_END      ((unsigned char *) 0xff800000)
-
-  if (addr < BAD_RANGE_ONE_START)      return 1;       /* safe */
-  if (addr < BAD_RANGE_ONE_END)                return 0;       /* unsafe */
-  if (addr < BAD_RANGE_TWO_START)      return 1;       /* safe */
-  if (addr < BAD_RANGE_TWO_END)                return 0;       /* unsafe */
-}
-
-/* These are separate functions so that they are so short and sweet
-   that the compiler won't save any registers (if there is a fault
-   to mem_fault, they won't get restored, so there better not be any
-   saved).  */
-static int
-get_char (unsigned char *addr)
-{
-#if 1
-  if (mem_fault_routine && !mem_safe(addr))
-    {
-      mem_fault_routine ();
-      return 0;
-    }
-#endif
-  return *addr;
-}
-
-static void
-set_char (unsigned char *addr, unsigned char val)
-{
-#if 1
-  if (mem_fault_routine && !mem_safe (addr))
-    {
-      mem_fault_routine ();
-      return;
-    }
-#endif
-  *addr = val;
-}
-
-/* Convert the memory pointed to by mem into hex, placing result in buf.
-   Return a pointer to the last char put in buf (null).
-   If MAY_FAULT is non-zero, then we should set mem_err in response to
-   a fault; if zero treat a fault like any other fault in the stub.  */
-
-static unsigned char *
-mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
-{
-  int i;
-  unsigned char ch;
-
-  if (may_fault)
-    mem_fault_routine = set_mem_err;
-  for (i=0;i<count;i++) {
-    ch = get_char (mem++);
-    if (may_fault && mem_err)
-      return (buf);
-    *buf++ = hexchars[ch >> 4];
-    *buf++ = hexchars[ch % 16];
-  }
-  *buf = 0;
-  if (may_fault)
-    mem_fault_routine = 0;
-  return(buf);
-}
-
-/* Convert the hex array pointed to by buf into binary to be placed in mem.
-   Return a pointer to the character AFTER the last byte written. */
-
-static unsigned char* 
-hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
-{
-  int i;
-  unsigned char ch;
-
-  if (may_fault)
-    mem_fault_routine = set_mem_err;
-  for (i=0;i<count;i++) {
-    ch = hex(*buf++) << 4;
-    ch = ch + hex(*buf++);
-    set_char (mem++, ch);
-    if (may_fault && mem_err)
-      return (mem);
-  }
-  if (may_fault)
-    mem_fault_routine = 0;
-  return(mem);
-}
-
-/* Convert the binary stream in BUF to memory.
-
-   Gdb will escape $, #, and the escape char (0x7d).
-   COUNT is the total number of bytes to write into
-   memory. */
-static unsigned char *
-bin2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
-{
-  int i;
-  unsigned char ch;
-
-  if (may_fault)
-    mem_fault_routine = set_mem_err;
-  for (i = 0; i < count; i++)
-    {
-      /* Check for any escaped characters. Be paranoid and
-         only unescape chars that should be escaped. */
-      if (*buf == 0x7d)
-        {
-          switch (*(buf+1))
-            {
-            case 0x3:  /* # */
-            case 0x4:  /* $ */
-            case 0x5d: /* escape char */
-              buf++;
-              *buf |= 0x20;
-              break;
-            default:
-              /* nothing */
-              break;
-            }
-        }
-
-      set_char (mem++, *buf++);
-
-      if (may_fault && mem_err)
-        return mem;
-    }
-
-  if (may_fault)
-    mem_fault_routine = 0;
-  return mem;
-}
-
-/* this function takes the m32r exception vector and attempts to
-   translate this number into a unix compatible signal value */
-
-static int 
-computeSignal (int exceptionVector)
-{
-  int sigval;
-  switch (exceptionVector) {
-    case 0  : sigval = 23; break; /* I/O trap                    */
-    case 1  : sigval = 5;  break; /* breakpoint                  */
-    case 2  : sigval = 5;  break; /* breakpoint                  */
-    case 3  : sigval = 5;  break; /* breakpoint                  */
-    case 4  : sigval = 5;  break; /* breakpoint                  */
-    case 5  : sigval = 5;  break; /* breakpoint                  */
-    case 6  : sigval = 5;  break; /* breakpoint                  */
-    case 7  : sigval = 5;  break; /* breakpoint                  */
-    case 8  : sigval = 5;  break; /* breakpoint                  */
-    case 9  : sigval = 5;  break; /* breakpoint                  */
-    case 10 : sigval = 5;  break; /* breakpoint                  */
-    case 11 : sigval = 5;  break; /* breakpoint                  */
-    case 12 : sigval = 5;  break; /* breakpoint                  */
-    case 13 : sigval = 5;  break; /* breakpoint                  */
-    case 14 : sigval = 5;  break; /* breakpoint                  */
-    case 15 : sigval = 5;  break; /* breakpoint                  */
-    case 16 : sigval = 10; break; /* BUS ERROR (alignment)       */
-    case 17 : sigval = 2;  break; /* INTerrupt                   */
-    default : sigval = 7;  break; /* "software generated"        */
-  }
-  return (sigval);
-}
-
-/**********************************************/
-/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */
-/* RETURN NUMBER OF CHARS PROCESSED           */
-/**********************************************/
-static int 
-hexToInt (unsigned char **ptr, int *intValue)
-{
-  int numChars = 0;
-  int hexValue;
-
-  *intValue = 0;
-  while (**ptr)
-    {
-      hexValue = hex(**ptr);
-      if (hexValue >=0)
-        {
-         *intValue = (*intValue <<4) | hexValue;
-         numChars ++;
-        }
-      else
-       break;
-      (*ptr)++;
-    }
-  return (numChars);
-}
-
-/*
-  Table of branch instructions:
-  
-  10B6         RTE     return from trap or exception
-  1FCr         JMP     jump
-  1ECr         JL      jump and link
-  7Fxx         BRA     branch
-  FFxxxxxx     BRA     branch (long)
-  B09rxxxx     BNEZ    branch not-equal-zero
-  Br1rxxxx     BNE     branch not-equal
-  7Dxx         BNC     branch not-condition
-  FDxxxxxx     BNC     branch not-condition (long)
-  B0Arxxxx     BLTZ    branch less-than-zero
-  B0Crxxxx     BLEZ    branch less-equal-zero
-  7Exx         BL      branch and link
-  FExxxxxx     BL      branch and link (long)
-  B0Drxxxx     BGTZ    branch greater-than-zero
-  B0Brxxxx     BGEZ    branch greater-equal-zero
-  B08rxxxx     BEQZ    branch equal-zero
-  Br0rxxxx     BEQ     branch equal
-  7Cxx         BC      branch condition
-  FCxxxxxx     BC      branch condition (long)
-  */
-
-static int 
-isShortBranch (unsigned char *instr)
-{
-  unsigned char instr0 = instr[0] & 0x7F;              /* mask off high bit */
-
-  if (instr0 == 0x10 && instr[1] == 0xB6)      /* RTE */
-    return 1;          /* return from trap or exception */
-
-  if (instr0 == 0x1E || instr0 == 0x1F)                /* JL or JMP */
-    if ((instr[1] & 0xF0) == 0xC0)
-      return 2;                                        /* jump thru a register */
-
-  if (instr0 == 0x7C || instr0 == 0x7D ||      /* BC, BNC, BL, BRA */
-      instr0 == 0x7E || instr0 == 0x7F)
-    return 3;                                  /* eight bit PC offset */
-
-  return 0;
-}
-
-static int
-isLongBranch (unsigned char *instr)
-{
-  if (instr[0] == 0xFC || instr[0] == 0xFD ||  /* BRA, BNC, BL, BC */
-      instr[0] == 0xFE || instr[0] == 0xFF)    /* 24 bit relative */
-    return 4;
-  if ((instr[0] & 0xF0) == 0xB0)               /* 16 bit relative */
-    {
-      if ((instr[1] & 0xF0) == 0x00 ||                 /* BNE, BEQ */
-         (instr[1] & 0xF0) == 0x10)
-       return 5;
-      if (instr[0] == 0xB0)    /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ, BEQZ */
-       if ((instr[1] & 0xF0) == 0x80 || (instr[1] & 0xF0) == 0x90 || 
-           (instr[1] & 0xF0) == 0xA0 || (instr[1] & 0xF0) == 0xB0 ||
-           (instr[1] & 0xF0) == 0xC0 || (instr[1] & 0xF0) == 0xD0)
-         return 6;
-    }
-  return 0;
-}
-
-/* if address is NOT on a 4-byte boundary, or high-bit of instr is zero, 
-   then it's a 2-byte instruction, else it's a 4-byte instruction.  */
-
-#define INSTRUCTION_SIZE(addr) \
-    ((((int) addr & 2) || (((unsigned char *) addr)[0] & 0x80) == 0) ? 2 : 4)
-
-static int
-isBranch (unsigned char *instr)
-{
-  if (INSTRUCTION_SIZE(instr) == 2)
-    return isShortBranch(instr);
-  else
-    return isLongBranch(instr);
-}
-
-static int
-willBranch (unsigned char *instr, int branchCode)
-{
-  switch (branchCode) 
-    {
-    case 0:    return 0;       /* not a branch */
-    case 1:    return 1;       /* RTE */
-    case 2:    return 1;       /* JL or JMP    */
-    case 3:                    /* BC, BNC, BL, BRA (short) */
-    case 4:                    /* BC, BNC, BL, BRA (long) */
-      switch (instr[0] & 0x0F) 
-       {
-       case 0xC:               /* Branch if Condition Register */
-         return (registers[CBR] != 0);
-       case 0xD:               /* Branch if NOT Condition Register */
-         return (registers[CBR] == 0);
-       case 0xE:               /* Branch and Link */
-       case 0xF:               /* Branch (unconditional) */
-         return 1;
-       default:                /* oops? */
-         return 0;
-       }
-    case 5:                    /* BNE, BEQ */
-      switch (instr[1] & 0xF0) 
-       {
-       case 0x00:              /* Branch if r1 equal to r2 */
-         return (registers[instr[0] & 0x0F] == registers[instr[1] & 0x0F]);
-       case 0x10:              /* Branch if r1 NOT equal to r2 */
-         return (registers[instr[0] & 0x0F] != registers[instr[1] & 0x0F]);
-       default:                /* oops? */
-         return 0;
-       }
-    case 6:                    /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ */
-      switch (instr[1] & 0xF0) 
-       {
-       case 0x80:              /* Branch if reg equal to zero */
-         return (registers[instr[1] & 0x0F] == 0);
-       case 0x90:              /* Branch if reg NOT equal to zero */
-         return (registers[instr[1] & 0x0F] != 0);
-       case 0xA0:              /* Branch if reg less than zero */
-         return (registers[instr[1] & 0x0F] < 0);
-       case 0xB0:              /* Branch if reg greater or equal to zero */
-         return (registers[instr[1] & 0x0F] >= 0);
-       case 0xC0:              /* Branch if reg less than or equal to zero */
-         return (registers[instr[1] & 0x0F] <= 0);
-       case 0xD0:              /* Branch if reg greater than zero */
-         return (registers[instr[1] & 0x0F] > 0);
-       default:                /* oops? */
-         return 0;
-       }
-    default:                   /* oops? */
-      return 0;
-    }
-}
-
-static int 
-branchDestination (unsigned char *instr, int branchCode)
-{ 
-  switch (branchCode) { 
-  default: 
-  case 0:                                      /* not a branch */ 
-    return 0;
-  case 1:                                      /* RTE */ 
-    return registers[BPC] & ~3;                /* pop BPC into PC */
-  case 2:                                      /* JL or JMP */ 
-    return registers[instr[1] & 0x0F] & ~3;    /* jump thru a register */ 
-  case 3:              /* BC, BNC, BL, BRA (short, 8-bit relative offset) */ 
-    return (((int) instr) & ~3) + ((char) instr[1] << 2);
-  case 4:              /* BC, BNC, BL, BRA (long, 24-bit relative offset) */ 
-    return ((int) instr + 
-           ((((char) instr[1] << 16) | (instr[2] << 8) | (instr[3])) << 2)); 
-  case 5:              /* BNE, BEQ (16-bit relative offset) */ 
-  case 6:              /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ (ditto) */ 
-    return ((int) instr + ((((char) instr[2] << 8) | (instr[3])) << 2)); 
-  }
-
-  /* An explanatory note: in the last three return expressions, I have
-     cast the most-significant byte of the return offset to char.
-     What this accomplishes is sign extension.  If the other
-     less-significant bytes were signed as well, they would get sign
-     extended too and, if negative, their leading bits would clobber
-     the bits of the more-significant bytes ahead of them.  There are
-     other ways I could have done this, but sign extension from
-     odd-sized integers is always a pain. */
-}
-
-static void
-branchSideEffects (unsigned char *instr, int branchCode)
-{
-  switch (branchCode)
-    {
-    case 1:                    /* RTE */
-      return;                  /* I <THINK> this is already handled... */
-    case 2:                    /* JL (or JMP) */
-    case 3:                    /* BL (or BC, BNC, BRA) */
-    case 4:
-      if ((instr[0] & 0x0F) == 0x0E)           /* branch/jump and link */
-       registers[R14] = (registers[PC] & ~3) + 4;
-      return;
-    default:                   /* any other branch has no side effects */
-      return;
-    }
-}
-
-static struct STEPPING_CONTEXT {
-  int stepping;                        /* true when we've started a single-step */
-  unsigned long  target_addr;  /* the instr we're trying to execute */
-  unsigned long  target_size;  /* the size of the target instr */
-  unsigned long  noop_addr;    /* where we've inserted a no-op, if any */
-  unsigned long  trap1_addr;   /* the trap following the target instr */
-  unsigned long  trap2_addr;   /* the trap at a branch destination, if any */
-  unsigned short noop_save;    /* instruction overwritten by our no-op */
-  unsigned short trap1_save;   /* instruction overwritten by trap1 */
-  unsigned short trap2_save;   /* instruction overwritten by trap2 */
-  unsigned short continue_p;   /* true if NOT returning to gdb after step */
-} stepping;
-
-/* Function: prepare_to_step
-   Called from handle_exception to prepare the user program to single-step.
-   Places a trap instruction after the target instruction, with special 
-   extra handling for branch instructions and for instructions in the 
-   second half-word of a word.  
-
-   Returns: True  if we should actually execute the instruction; 
-           False if we are going to emulate executing the instruction,
-           in which case we simply report to GDB that the instruction 
-           has already been executed.  */
-
-#define TRAP1  0x10f1; /* trap #1 instruction */
-#define NOOP   0x7000;  /* noop    instruction */
-
-static unsigned short trap1 = TRAP1;
-static unsigned short noop  = NOOP;
-
-static int
-prepare_to_step(continue_p)
-     int continue_p;   /* if this isn't REALLY a single-step (see below) */
-{
-  unsigned long pc = registers[PC];
-  int branchCode   = isBranch((unsigned char *) pc);
-  unsigned char *p;
-
-  /* zero out the stepping context 
-     (paranoia -- it should already be zeroed) */
-  for (p = (unsigned char *) &stepping;
-       p < ((unsigned char *) &stepping) + sizeof(stepping);
-       p++)
-    *p = 0;
-
-  if (branchCode != 0)                 /* next instruction is a branch */
-    {
-      branchSideEffects((unsigned char *) pc, branchCode);
-      if (willBranch((unsigned char *)pc, branchCode))
-       registers[PC] = branchDestination((unsigned char *) pc, branchCode);
-      else
-       registers[PC] = pc + INSTRUCTION_SIZE(pc);
-      return 0;                        /* branch "executed" -- just notify GDB */
-    }
-  else if (((int) pc & 2) != 0)                /* "second-slot" instruction */
-    {
-      /* insert no-op before pc */
-      stepping.noop_addr  =  pc - 2;
-      stepping.noop_save  = *(unsigned short *) stepping.noop_addr;
-      *(unsigned short *) stepping.noop_addr  = noop;
-      /* insert trap  after  pc */
-      stepping.trap1_addr =  pc + 2;
-      stepping.trap1_save = *(unsigned short *) stepping.trap1_addr;
-      *(unsigned short *) stepping.trap1_addr = trap1;
-    }
-  else                                 /* "first-slot" instruction */
-    {
-      /* insert trap  after  pc */
-      stepping.trap1_addr = pc + INSTRUCTION_SIZE(pc); 
-      stepping.trap1_save = *(unsigned short *) stepping.trap1_addr;
-      *(unsigned short *) stepping.trap1_addr = trap1;
-    }
-  /* "continue_p" means that we are actually doing a continue, and not 
-     being requested to single-step by GDB.  Sometimes we have to do
-     one single-step before continuing, because the PC is on a half-word
-     boundary.  There's no way to simply resume at such an address.  */
-  stepping.continue_p = continue_p;
-  stepping.stepping = 1;               /* starting a single-step */
-  return 1;
-}
-
-/* Function: finish_from_step
-   Called from handle_exception to finish up when the user program 
-   returns from a single-step.  Replaces the instructions that had
-   been overwritten by traps or no-ops, 
-
-   Returns: True  if we should notify GDB that the target stopped.
-           False if we only single-stepped because we had to before we
-           could continue (ie. we were trying to continue at a 
-           half-word boundary).  In that case don't notify GDB:
-           just "continue continuing".  */
-
-static int
-finish_from_step (void)
-{
-  if (stepping.stepping)       /* anything to do? */
-    {
-      int continue_p = stepping.continue_p;
-      unsigned char *p;
-
-      if (stepping.noop_addr)  /* replace instr "under" our no-op */
-       *(unsigned short *) stepping.noop_addr  = stepping.noop_save;
-      if (stepping.trap1_addr) /* replace instr "under" our trap  */
-       *(unsigned short *) stepping.trap1_addr = stepping.trap1_save;
-      if (stepping.trap2_addr)  /* ditto our other trap, if any    */
-       *(unsigned short *) stepping.trap2_addr = stepping.trap2_save;
-
-      for (p = (unsigned char *) &stepping;    /* zero out the stepping context */
-          p < ((unsigned char *) &stepping) + sizeof(stepping);
-          p++)
-       *p = 0;
-
-      return !(continue_p);
-    }
-  else         /* we didn't single-step, therefore this must be a legitimate stop */
-    return 1;
-}
-
-struct PSWreg {                /* separate out the bit flags in the PSW register */
-  int pad1 : 16;
-  int bsm  : 1;
-  int bie  : 1;
-  int pad2 : 5;
-  int bc   : 1;
-  int sm   : 1;
-  int ie   : 1;
-  int pad3 : 5;
-  int c    : 1;
-} *psw;
-
-/* Upon entry the value for LR to save has been pushed.
-   We unpush that so that the value for the stack pointer saved is correct.
-   Upon entry, all other registers are assumed to have not been modified
-   since the interrupt/trap occured.  */
-
-asm ("
-stash_registers:
-       push r0
-       push r1
-       seth r1, #shigh(registers)
-       add3 r1, r1, #low(registers)
-       pop r0          ; r1
-       st r0, @(4,r1)
-       pop r0          ; r0
-       st r0, @r1
-       addi r1, #4     ; only add 4 as subsequent saves are `pre inc'
-       st r2, @+r1
-       st r3, @+r1
-       st r4, @+r1
-       st r5, @+r1
-       st r6, @+r1
-       st r7, @+r1
-       st r8, @+r1
-       st r9, @+r1
-       st r10, @+r1
-       st r11, @+r1
-       st r12, @+r1
-       st r13, @+r1    ; fp
-       pop r0          ; lr (r14)
-       st r0, @+r1
-       st sp, @+r1     ; sp contains right value at this point
-       mvfc r0, cr0
-       st r0, @+r1     ; cr0 == PSW
-       mvfc r0, cr1
-       st r0, @+r1     ; cr1 == CBR
-       mvfc r0, cr2
-       st r0, @+r1     ; cr2 == SPI
-       mvfc r0, cr3
-       st r0, @+r1     ; cr3 == SPU
-       mvfc r0, cr6
-       st r0, @+r1     ; cr6 == BPC
-       st r0, @+r1     ; PC  == BPC
-       mvfaclo r0
-       st r0, @+r1     ; ACCL
-       mvfachi r0
-       st r0, @+r1     ; ACCH
-       jmp lr");
-
-/* C routine to clean up what stash_registers did.
-   It is called after calling stash_registers.
-   This is separate from stash_registers as we want to do this in C
-   but doing stash_registers in C isn't straightforward.  */
-
-static void
-cleanup_stash (void)
-{
-  psw = (struct PSWreg *) &registers[PSW];     /* fields of PSW register */
-  psw->sm = psw->bsm;          /* fix up pre-trap values of psw fields */
-  psw->ie = psw->bie;
-  psw->c  = psw->bc;
-  registers[CBR] = psw->bc;            /* fix up pre-trap "C" register */
-
-#if 0 /* FIXME: Was in previous version.  Necessary?
-        (Remember that we use the "rte" insn to return from the
-        trap/interrupt so the values of bsm, bie, bc are important.  */
-  psw->bsm = psw->bie = psw->bc = 0;   /* zero post-trap values */
-#endif
-
-  /* FIXME: Copied from previous version.  This can probably be deleted
-     since methinks stash_registers has already done this.  */
-  registers[PC] = registers[BPC];      /* pre-trap PC */
-
-  /* FIXME: Copied from previous version.  Necessary?  */
-  if (psw->sm)                 /* copy R15 into (psw->sm ? SPU : SPI) */
-    registers[SPU] = registers[R15];
-  else
-    registers[SPI] = registers[R15];
-}
-
-asm ("
-restore_and_return:
-       seth r0, #shigh(registers+8)
-       add3 r0, r0, #low(registers+8)
-       ld r2, @r0+     ; restore r2
-       ld r3, @r0+     ; restore r3
-       ld r4, @r0+     ; restore r4
-       ld r5, @r0+     ; restore r5
-       ld r6, @r0+     ; restore r6
-       ld r7, @r0+     ; restore r7
-       ld r8, @r0+     ; restore r8
-       ld r9, @r0+     ; restore r9
-       ld r10, @r0+    ; restore r10
-       ld r11, @r0+    ; restore r11
-       ld r12, @r0+    ; restore r12
-       ld r13, @r0+    ; restore r13
-       ld r14, @r0+    ; restore r14
-       ld r15, @r0+    ; restore r15
-       addi r0, #4     ; don't restore PSW (rte will do it)
-       ld r1, @r0+     ; restore cr1 == CBR (no-op, because it's read only)
-       mvtc r1, cr1
-       ld r1, @r0+     ; restore cr2 == SPI
-       mvtc r1, cr2
-       ld r1, @r0+     ; restore cr3 == SPU
-       mvtc r1, cr3
-       addi r0, #4     ; skip BPC
-       ld r1, @r0+     ; restore cr6 (BPC) == PC
-       mvtc r1, cr6
-       ld r1, @r0+     ; restore ACCL
-       mvtaclo r1
-       ld r1, @r0+     ; restore ACCH
-       mvtachi r1
-       seth r0, #shigh(registers)
-       add3 r0, r0, #low(registers)
-       ld r1, @(4,r0)  ; restore r1
-       ld r0, @r0      ; restore r0
-       rte");
-
-/* General trap handler, called after the registers have been stashed.
-   NUM is the trap/exception number.  */
-
-static void
-process_exception (int num)
-{
-  cleanup_stash ();
-  asm volatile ("
-       seth r1, #shigh(stackPtr)
-       add3 r1, r1, #low(stackPtr)
-       ld r15, @r1             ; setup local stack (protect user stack)
-       mv r0, %0
-       bl handle_exception
-       bl restore_and_return"
-               : : "r" (num) : "r0", "r1");
-}
-
-void _catchException0 ();
-
-asm ("
-_catchException0:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #0
-       bl process_exception");
-
-void _catchException1 ();
-
-asm ("
-_catchException1:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       bl cleanup_stash
-       seth r1, #shigh(stackPtr)
-       add3 r1, r1, #low(stackPtr)
-       ld r15, @r1             ; setup local stack (protect user stack)
-       seth r1, #shigh(registers + 21*4) ; PC
-       add3 r1, r1, #low(registers + 21*4)
-       ld r0, @r1
-       addi r0, #-4            ; back up PC for breakpoint trap.
-       st r0, @r1              ; FIXME: what about bp in right slot?
-       ldi r0, #1
-       bl handle_exception
-       bl restore_and_return");
-
-void _catchException2 ();
-
-asm ("
-_catchException2:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #2
-       bl process_exception");
-
-void _catchException3 ();
-
-asm ("
-_catchException3:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #3
-       bl process_exception");
-
-void _catchException4 ();
-
-asm ("
-_catchException4:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #4
-       bl process_exception");
-
-void _catchException5 ();
-
-asm ("
-_catchException5:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #5
-       bl process_exception");
-
-void _catchException6 ();
-
-asm ("
-_catchException6:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #6
-       bl process_exception");
-
-void _catchException7 ();
-
-asm ("
-_catchException7:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #7
-       bl process_exception");
-
-void _catchException8 ();
-
-asm ("
-_catchException8:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #8
-       bl process_exception");
-
-void _catchException9 ();
-
-asm ("
-_catchException9:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #9
-       bl process_exception");
-
-void _catchException10 ();
-
-asm ("
-_catchException10:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #10
-       bl process_exception");
-
-void _catchException11 ();
-
-asm ("
-_catchException11:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #11
-       bl process_exception");
-
-void _catchException12 ();
-
-asm ("
-_catchException12:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #12
-       bl process_exception");
-
-void _catchException13 ();
-
-asm ("
-_catchException13:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #13
-       bl process_exception");
-
-void _catchException14 ();
-
-asm ("
-_catchException14:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #14
-       bl process_exception");
-
-void _catchException15 ();
-
-asm ("
-_catchException15:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #15
-       bl process_exception");
-
-void _catchException16 ();
-
-asm ("
-_catchException16:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #16
-       bl process_exception");
-
-void _catchException17 ();
-
-asm ("
-_catchException17:
-       push lr
-       bl stash_registers
-       ; Note that at this point the pushed value of `lr' has been popped
-       ldi r0, #17
-       bl process_exception");
-
-
-/* this function is used to set up exception handlers for tracing and
-   breakpoints */
-void 
-set_debug_traps (void)
-{
-  /*  extern void remcomHandler(); */
-  int i;
-
-  for (i = 0; i < 18; i++)             /* keep a copy of old vectors */
-    if (save_vectors[i] == 0)          /* only copy them the first time */
-      save_vectors[i] = getExceptionHandler (i);
-
-  stackPtr  = &remcomStack[STACKSIZE/sizeof(int) - 1];
-
-  exceptionHandler (0, _catchException0);
-  exceptionHandler (1, _catchException1);
-  exceptionHandler (2, _catchException2);
-  exceptionHandler (3, _catchException3);
-  exceptionHandler (4, _catchException4);
-  exceptionHandler (5, _catchException5);
-  exceptionHandler (6, _catchException6);
-  exceptionHandler (7, _catchException7);
-  exceptionHandler (8, _catchException8);
-  exceptionHandler (9, _catchException9);
-  exceptionHandler (10, _catchException10);
-  exceptionHandler (11, _catchException11);
-  exceptionHandler (12, _catchException12);
-  exceptionHandler (13, _catchException13);
-  exceptionHandler (14, _catchException14);
-  exceptionHandler (15, _catchException15);
-  exceptionHandler (16, _catchException16);
-  /*  exceptionHandler (17, _catchException17); */
-
-  initialized = 1;
-}
-
-/* This function will generate a breakpoint exception.  It is used at the
-   beginning of a program to sync up with a debugger and can be used
-   otherwise as a quick means to stop program execution and "break" into
-   the debugger. */
-
-#define BREAKPOINT() asm volatile ("   trap #2");
-
-void 
-breakpoint (void)
-{
-  if (initialized)
-    BREAKPOINT();
-}
-
-/* STDOUT section:
-   Stuff pertaining to simulating stdout by sending chars to gdb to be echoed.
-   Functions: gdb_putchar(char ch)
-              gdb_puts(char *str)
-              gdb_write(char *str, int len)
-              gdb_error(char *format, char *parm)
-             */
-/* Function: gdb_putchar(int)
-   Make gdb write a char to stdout.
-   Returns: the char */
-static int
-gdb_putchar (int ch)
-{
-  char buf[4];
-  buf[0] = 'O';
-  buf[1] = hexchars[ch >> 4];
-  buf[2] = hexchars[ch & 0x0F];
-  buf[3] = 0;
-  putpacket(buf);
-  return ch;
-}
-/* Function: gdb_write(char *, int)
-   Make gdb write n bytes to stdout (not assumed to be null-terminated).
-   Returns: number of bytes written */
-static int
-gdb_write (char *data, int len)
-{
-  char *buf, *cpy;
-  int i;
-  buf = remcomOutBuffer;
-  buf[0] = 'O';
-  i = 0;
-  while (i < len)
-    {
-      for (cpy = buf+1; 
-          i < len && cpy < buf + sizeof(remcomOutBuffer) - 3; 
-          i++)
-       {
-         *cpy++ = hexchars[data[i] >> 4];
-         *cpy++ = hexchars[data[i] & 0x0F];
-       }
-      *cpy = 0;
-      putpacket(buf);
-    }
-  return len;
-}
-
-/* Function: gdb_puts(char *)
-   Make gdb write a null-terminated string to stdout.
-   Returns: the length of the string */
-static int
-gdb_puts (char *str)
-{
-  return gdb_write(str, strlen(str));
-}
-/* Function: gdb_error(char *, char *)
-   Send an error message to gdb's stdout.
-   First string may have 1 (one) optional "%s" in it, which
-   will cause the optional second string to be inserted.  */
-static void
-gdb_error (char *format, char *parm)
-{
-  char buf[400], *cpy;
-  int len;
-  if (remote_debug)
-    {
-      if (format && *format)
-       len = strlen(format);
-      else
-       return;             /* empty input */
-
-      if (parm && *parm)
-       len += strlen(parm);
-      for (cpy = buf; *format; )
-       {
-         if (format[0] == '%' && format[1] == 's') /* include second string */
-           {
-             format += 2;          /* advance two chars instead of just one */
-             while (parm && *parm)
-               *cpy++ = *parm++;
-           }
-         else
-           *cpy++ = *format++;
-       }
-      *cpy = '\0';
-      gdb_puts(buf);
-    }
-}
-static unsigned char *
-strcpy (unsigned char *dest, const unsigned char *src)
-{
-  unsigned char *ret = dest;
-
-  if (dest && src)
-    {
-      while (*src)
-       *dest++ = *src++;
-      *dest = 0;
-    }
-  return ret;
-}
-
-static int
-strlen (const unsigned char *src)
-{
-  int ret;
-
-  for (ret = 0; *src; src++)
-    ret++;
-
-  return ret;
-}
-
-#if 0
-void exit (code)
-     int code;
-{
-  _exit (code);
-}
-
-int atexit (void *p)
-{
-  return 0;
-}
-
-void abort (void)
-{
-  _exit (1);
-}
-#endif
+// OBSOLETE /****************************************************************************
+// OBSOLETE 
+// OBSOLETE            THIS SOFTWARE IS NOT COPYRIGHTED
+// OBSOLETE 
+// OBSOLETE    HP offers the following for use in the public domain.  HP makes no
+// OBSOLETE    warranty with regard to the software or it's performance and the
+// OBSOLETE    user accepts the software "AS IS" with all faults.
+// OBSOLETE 
+// OBSOLETE    HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD
+// OBSOLETE    TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OBSOLETE    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+// OBSOLETE 
+// OBSOLETE ****************************************************************************/
+// OBSOLETE 
+// OBSOLETE /****************************************************************************
+// OBSOLETE  *  Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $
+// OBSOLETE  *
+// OBSOLETE  *  Module name: remcom.c $
+// OBSOLETE  *  Revision: 1.34 $
+// OBSOLETE  *  Date: 91/03/09 12:29:49 $
+// OBSOLETE  *  Contributor:     Lake Stevens Instrument Division$
+// OBSOLETE  *
+// OBSOLETE  *  Description:     low level support for gdb debugger. $
+// OBSOLETE  *
+// OBSOLETE  *  Considerations:  only works on target hardware $
+// OBSOLETE  *
+// OBSOLETE  *  Written by:      Glenn Engel $
+// OBSOLETE  *  ModuleState:     Experimental $
+// OBSOLETE  *
+// OBSOLETE  *  NOTES:           See Below $
+// OBSOLETE  *
+// OBSOLETE  *  Modified for M32R by Michael Snyder, Cygnus Support.
+// OBSOLETE  *
+// OBSOLETE  *  To enable debugger support, two things need to happen.  One, a
+// OBSOLETE  *  call to set_debug_traps() is necessary in order to allow any breakpoints
+// OBSOLETE  *  or error conditions to be properly intercepted and reported to gdb.
+// OBSOLETE  *  Two, a breakpoint needs to be generated to begin communication.  This
+// OBSOLETE  *  is most easily accomplished by a call to breakpoint().  Breakpoint()
+// OBSOLETE  *  simulates a breakpoint by executing a trap #1.
+// OBSOLETE  *
+// OBSOLETE  *  The external function exceptionHandler() is
+// OBSOLETE  *  used to attach a specific handler to a specific M32R vector number.
+// OBSOLETE  *  It should use the same privilege level it runs at.  It should
+// OBSOLETE  *  install it as an interrupt gate so that interrupts are masked
+// OBSOLETE  *  while the handler runs.
+// OBSOLETE  *
+// OBSOLETE  *  Because gdb will sometimes write to the stack area to execute function
+// OBSOLETE  *  calls, this program cannot rely on using the supervisor stack so it
+// OBSOLETE  *  uses it's own stack area reserved in the int array remcomStack.
+// OBSOLETE  *
+// OBSOLETE  *************
+// OBSOLETE  *
+// OBSOLETE  *    The following gdb commands are supported:
+// OBSOLETE  *
+// OBSOLETE  * command          function                               Return value
+// OBSOLETE  *
+// OBSOLETE  *    g             return the value of the CPU registers  hex data or ENN
+// OBSOLETE  *    G             set the value of the CPU registers     OK or ENN
+// OBSOLETE  *
+// OBSOLETE  *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
+// OBSOLETE  *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
+// OBSOLETE  *    XAA..AA,LLLL: Write LLLL binary bytes at address     OK or ENN
+// OBSOLETE  *                  AA..AA
+// OBSOLETE  *
+// OBSOLETE  *    c             Resume at current address              SNN   ( signal NN)
+// OBSOLETE  *    cAA..AA       Continue at address AA..AA             SNN
+// OBSOLETE  *
+// OBSOLETE  *    s             Step one instruction                   SNN
+// OBSOLETE  *    sAA..AA       Step one instruction from AA..AA       SNN
+// OBSOLETE  *
+// OBSOLETE  *    k             kill
+// OBSOLETE  *
+// OBSOLETE  *    ?             What was the last sigval ?             SNN   (signal NN)
+// OBSOLETE  *
+// OBSOLETE  * All commands and responses are sent with a packet which includes a
+// OBSOLETE  * checksum.  A packet consists of
+// OBSOLETE  *
+// OBSOLETE  * $<packet info>#<checksum>.
+// OBSOLETE  *
+// OBSOLETE  * where
+// OBSOLETE  * <packet info> :: <characters representing the command or response>
+// OBSOLETE  * <checksum>    :: <two hex digits computed as modulo 256 sum of <packetinfo>>
+// OBSOLETE  *
+// OBSOLETE  * When a packet is received, it is first acknowledged with either '+' or '-'.
+// OBSOLETE  * '+' indicates a successful transfer.  '-' indicates a failed transfer.
+// OBSOLETE  *
+// OBSOLETE  * Example:
+// OBSOLETE  *
+// OBSOLETE  * Host:                  Reply:
+// OBSOLETE  * $m0,10#2a               +$00010203040506070809101112131415#42
+// OBSOLETE  *
+// OBSOLETE  ****************************************************************************/
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /************************************************************************
+// OBSOLETE  *
+// OBSOLETE  * external low-level support routines
+// OBSOLETE  */
+// OBSOLETE extern void putDebugChar();        /* write a single character      */
+// OBSOLETE extern int getDebugChar(); /* read and return a single char */
+// OBSOLETE extern void exceptionHandler();    /* assign an exception handler   */
+// OBSOLETE 
+// OBSOLETE /*****************************************************************************
+// OBSOLETE  * BUFMAX defines the maximum number of characters in inbound/outbound buffers
+// OBSOLETE  * at least NUMREGBYTES*2 are needed for register packets 
+// OBSOLETE  */
+// OBSOLETE #define BUFMAX 400
+// OBSOLETE 
+// OBSOLETE static char initialized;  /* boolean flag. != 0 means we've been initialized */
+// OBSOLETE 
+// OBSOLETE int     remote_debug;
+// OBSOLETE /*  debug >  0 prints ill-formed commands in valid packets & checksum errors */
+// OBSOLETE 
+// OBSOLETE static const unsigned char hexchars[]="0123456789abcdef";
+// OBSOLETE 
+// OBSOLETE #define NUMREGS 24
+// OBSOLETE 
+// OBSOLETE /* Number of bytes of registers.  */
+// OBSOLETE #define NUMREGBYTES (NUMREGS * 4)
+// OBSOLETE enum regnames { R0,  R1,  R2,  R3,  R4,  R5,  R6,   R7,
+// OBSOLETE            R8,  R9,  R10, R11, R12, R13, R14,  R15,
+// OBSOLETE            PSW, CBR, SPI, SPU, BPC, PC,  ACCL, ACCH };
+// OBSOLETE 
+// OBSOLETE enum SYS_calls {
+// OBSOLETE    SYS_null, 
+// OBSOLETE    SYS_exit,
+// OBSOLETE    SYS_open,
+// OBSOLETE    SYS_close,
+// OBSOLETE    SYS_read,
+// OBSOLETE    SYS_write,
+// OBSOLETE    SYS_lseek,
+// OBSOLETE    SYS_unlink,
+// OBSOLETE    SYS_getpid,
+// OBSOLETE    SYS_kill,
+// OBSOLETE    SYS_fstat,
+// OBSOLETE    SYS_sbrk,
+// OBSOLETE    SYS_fork,
+// OBSOLETE    SYS_execve,
+// OBSOLETE    SYS_wait4,
+// OBSOLETE    SYS_link,
+// OBSOLETE    SYS_chdir,
+// OBSOLETE    SYS_stat,
+// OBSOLETE    SYS_utime,
+// OBSOLETE    SYS_chown,
+// OBSOLETE    SYS_chmod,
+// OBSOLETE    SYS_time,
+// OBSOLETE    SYS_pipe };
+// OBSOLETE 
+// OBSOLETE static int registers[NUMREGS];
+// OBSOLETE 
+// OBSOLETE #define STACKSIZE 8096
+// OBSOLETE static unsigned char remcomInBuffer[BUFMAX];
+// OBSOLETE static unsigned char remcomOutBuffer[BUFMAX];
+// OBSOLETE static int  remcomStack[STACKSIZE/sizeof(int)];
+// OBSOLETE static int*  stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
+// OBSOLETE 
+// OBSOLETE static unsigned int save_vectors[18];      /* previous exception vectors */
+// OBSOLETE 
+// OBSOLETE /* Indicate to caller of mem2hex or hex2mem that there has been an error. */
+// OBSOLETE static volatile int mem_err = 0;
+// OBSOLETE 
+// OBSOLETE /* Store the vector number here (since GDB only gets the signal
+// OBSOLETE    number through the usual means, and that's not very specific).  */
+// OBSOLETE int gdb_m32r_vector = -1;
+// OBSOLETE 
+// OBSOLETE #if 0
+// OBSOLETE #include "syscall.h" /* for SYS_exit, SYS_write etc. */
+// OBSOLETE #endif
+// OBSOLETE 
+// OBSOLETE /* Global entry points:
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE extern void handle_exception(int);
+// OBSOLETE extern void set_debug_traps(void);
+// OBSOLETE extern void breakpoint(void);
+// OBSOLETE 
+// OBSOLETE /* Local functions:
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE static int  computeSignal(int);
+// OBSOLETE static void putpacket(unsigned char *);
+// OBSOLETE static unsigned char *getpacket(void);
+// OBSOLETE 
+// OBSOLETE static unsigned char *mem2hex(unsigned char *, unsigned char *, int, int);
+// OBSOLETE static unsigned char *hex2mem(unsigned char *, unsigned char *, int, int);
+// OBSOLETE static int  hexToInt(unsigned char **, int *);
+// OBSOLETE static unsigned char *bin2mem(unsigned char *, unsigned char *, int, int);
+// OBSOLETE static void stash_registers(void);
+// OBSOLETE static void restore_registers(void);
+// OBSOLETE static int  prepare_to_step(int);
+// OBSOLETE static int  finish_from_step(void);
+// OBSOLETE static unsigned long crc32 (unsigned char *, int, unsigned long);
+// OBSOLETE 
+// OBSOLETE static void gdb_error(char *, char *);
+// OBSOLETE static int  gdb_putchar(int), gdb_puts(char *), gdb_write(char *, int);
+// OBSOLETE 
+// OBSOLETE static unsigned char *strcpy (unsigned char *, const unsigned char *);
+// OBSOLETE static int   strlen (const unsigned char *);
+// OBSOLETE 
+// OBSOLETE /*
+// OBSOLETE  * This function does all command procesing for interfacing to gdb.
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE void 
+// OBSOLETE handle_exception(int exceptionVector)
+// OBSOLETE {
+// OBSOLETE   int    sigval, stepping;
+// OBSOLETE   int    addr, length, i;
+// OBSOLETE   unsigned char * ptr;
+// OBSOLETE   unsigned char   buf[16];
+// OBSOLETE   int binary;
+// OBSOLETE 
+// OBSOLETE   /* Do not call finish_from_step() if this is not a trap #1
+// OBSOLETE    * (breakpoint trap).  Without this check, the finish_from_step()
+// OBSOLETE    * might interpret a system call trap as a single step trap.  This
+// OBSOLETE    * can happen if: the stub receives 's' and exits, but an interrupt
+// OBSOLETE    * was pending; the interrupt is now handled and causes the stub to
+// OBSOLETE    * be reentered because some function makes a system call.  
+// OBSOLETE    */
+// OBSOLETE   if (exceptionVector == 1)        /* Trap exception? */
+// OBSOLETE     if (!finish_from_step())       /* Go see if stepping state needs update. */
+// OBSOLETE       return;              /* "false step": let the target continue */
+// OBSOLETE 
+// OBSOLETE   gdb_m32r_vector = exceptionVector;
+// OBSOLETE 
+// OBSOLETE   if (remote_debug)
+// OBSOLETE     {
+// OBSOLETE       mem2hex((unsigned char *) &exceptionVector, buf, 4, 0);
+// OBSOLETE       gdb_error("Handle exception %s, ", buf);
+// OBSOLETE       mem2hex((unsigned char *) &registers[PC], buf, 4, 0);
+// OBSOLETE       gdb_error("PC == 0x%s\n", buf);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* reply to host that an exception has occurred */
+// OBSOLETE   sigval = computeSignal( exceptionVector );
+// OBSOLETE 
+// OBSOLETE   ptr = remcomOutBuffer;
+// OBSOLETE  
+// OBSOLETE   *ptr++ = 'T';         /* notify gdb with signo, PC, FP and SP */
+// OBSOLETE   *ptr++ = hexchars[sigval >> 4];
+// OBSOLETE   *ptr++ = hexchars[sigval & 0xf];
+// OBSOLETE  
+// OBSOLETE   *ptr++ = hexchars[PC >> 4];
+// OBSOLETE   *ptr++ = hexchars[PC & 0xf];
+// OBSOLETE   *ptr++ = ':';
+// OBSOLETE   ptr = mem2hex((unsigned char *)&registers[PC], ptr, 4, 0);     /* PC */
+// OBSOLETE   *ptr++ = ';';
+// OBSOLETE  
+// OBSOLETE   *ptr++ = hexchars[R13 >> 4];
+// OBSOLETE   *ptr++ = hexchars[R13 & 0xf];
+// OBSOLETE   *ptr++ = ':';
+// OBSOLETE   ptr = mem2hex((unsigned char *)&registers[R13], ptr, 4, 0);    /* FP */
+// OBSOLETE   *ptr++ = ';';
+// OBSOLETE  
+// OBSOLETE   *ptr++ = hexchars[R15 >> 4];
+// OBSOLETE   *ptr++ = hexchars[R15 & 0xf];
+// OBSOLETE   *ptr++ = ':';
+// OBSOLETE   ptr = mem2hex((unsigned char *)&registers[R15], ptr, 4, 0);    /* SP */
+// OBSOLETE   *ptr++ = ';';
+// OBSOLETE   *ptr++ = 0;
+// OBSOLETE  
+// OBSOLETE   if (exceptionVector == 0)     /* simulated SYS call stuff */
+// OBSOLETE     {
+// OBSOLETE       mem2hex((unsigned char *) &registers[PC], buf, 4, 0);
+// OBSOLETE       switch (registers[R0]) {
+// OBSOLETE       case SYS_exit:
+// OBSOLETE    gdb_error("Target program has exited at %s\n", buf);
+// OBSOLETE    ptr = remcomOutBuffer;
+// OBSOLETE    *ptr++ = 'W';
+// OBSOLETE    sigval = registers[R1] & 0xff;
+// OBSOLETE    *ptr++ = hexchars[sigval >> 4];
+// OBSOLETE    *ptr++ = hexchars[sigval & 0xf];
+// OBSOLETE    *ptr++ = 0;
+// OBSOLETE    break;
+// OBSOLETE       case SYS_open:
+// OBSOLETE    gdb_error("Target attempts SYS_open call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_close:
+// OBSOLETE    gdb_error("Target attempts SYS_close call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_read:
+// OBSOLETE    gdb_error("Target attempts SYS_read call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_write:
+// OBSOLETE    if (registers[R1] == 1 ||       /* write to stdout  */
+// OBSOLETE        registers[R1] == 2)         /* write to stderr  */
+// OBSOLETE      {                             /* (we can do that) */
+// OBSOLETE        registers[R0] = gdb_write((void *) registers[R2], registers[R3]);
+// OBSOLETE        return;
+// OBSOLETE      }
+// OBSOLETE    else
+// OBSOLETE      gdb_error("Target attempts SYS_write call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_lseek:
+// OBSOLETE    gdb_error("Target attempts SYS_lseek call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_unlink:
+// OBSOLETE    gdb_error("Target attempts SYS_unlink call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_getpid:
+// OBSOLETE    gdb_error("Target attempts SYS_getpid call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_kill:
+// OBSOLETE    gdb_error("Target attempts SYS_kill call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       case SYS_fstat:
+// OBSOLETE    gdb_error("Target attempts SYS_fstat call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       default:
+// OBSOLETE    gdb_error("Target attempts unknown SYS call at %s\n", buf);
+// OBSOLETE    break;
+// OBSOLETE       }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   putpacket(remcomOutBuffer);
+// OBSOLETE 
+// OBSOLETE   stepping = 0;
+// OBSOLETE 
+// OBSOLETE   while (1==1) {
+// OBSOLETE     remcomOutBuffer[0] = 0;
+// OBSOLETE     ptr = getpacket();
+// OBSOLETE     binary = 0;
+// OBSOLETE     switch (*ptr++) {
+// OBSOLETE       default:     /* Unknown code.  Return an empty reply message. */
+// OBSOLETE    break;
+// OBSOLETE       case 'R':
+// OBSOLETE    if (hexToInt (&ptr, &addr))
+// OBSOLETE      registers[PC] = addr;
+// OBSOLETE    strcpy(remcomOutBuffer, "OK");
+// OBSOLETE    break;
+// OBSOLETE       case '!':
+// OBSOLETE    strcpy(remcomOutBuffer, "OK");
+// OBSOLETE    break;
+// OBSOLETE     case 'X': /* XAA..AA,LLLL:<binary data>#cs */
+// OBSOLETE       binary = 1;
+// OBSOLETE     case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+// OBSOLETE       /* TRY TO READ '%x,%x:'.  IF SUCCEED, SET PTR = 0 */
+// OBSOLETE       {
+// OBSOLETE         if (hexToInt(&ptr,&addr))
+// OBSOLETE           if (*(ptr++) == ',')
+// OBSOLETE             if (hexToInt(&ptr,&length))
+// OBSOLETE               if (*(ptr++) == ':')
+// OBSOLETE                 {
+// OBSOLETE                   mem_err = 0;
+// OBSOLETE                   if (binary)
+// OBSOLETE                     bin2mem (ptr, (unsigned char *) addr, length, 1);
+// OBSOLETE                   else
+// OBSOLETE                     hex2mem(ptr, (unsigned char*) addr, length, 1);
+// OBSOLETE                   if (mem_err) {
+// OBSOLETE                     strcpy (remcomOutBuffer, "E03");
+// OBSOLETE                     gdb_error ("memory fault", "");
+// OBSOLETE                   } else {
+// OBSOLETE                     strcpy(remcomOutBuffer,"OK");
+// OBSOLETE                   }
+// OBSOLETE                   ptr = 0;
+// OBSOLETE                 }
+// OBSOLETE         if (ptr)
+// OBSOLETE           {
+// OBSOLETE             strcpy(remcomOutBuffer,"E02");
+// OBSOLETE           }
+// OBSOLETE       }
+// OBSOLETE    break;
+// OBSOLETE       case 'm': /* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
+// OBSOLETE            /* TRY TO READ %x,%x.  IF SUCCEED, SET PTR = 0 */
+// OBSOLETE    if (hexToInt(&ptr,&addr))
+// OBSOLETE      if (*(ptr++) == ',')
+// OBSOLETE        if (hexToInt(&ptr,&length))
+// OBSOLETE          {
+// OBSOLETE            ptr = 0;
+// OBSOLETE            mem_err = 0;
+// OBSOLETE            mem2hex((unsigned char*) addr, remcomOutBuffer, length, 1);
+// OBSOLETE            if (mem_err) {
+// OBSOLETE              strcpy (remcomOutBuffer, "E03");
+// OBSOLETE              gdb_error ("memory fault", "");
+// OBSOLETE            }
+// OBSOLETE          }
+// OBSOLETE    if (ptr)
+// OBSOLETE      {
+// OBSOLETE        strcpy(remcomOutBuffer,"E01");
+// OBSOLETE      }
+// OBSOLETE    break;
+// OBSOLETE       case '?': 
+// OBSOLETE    remcomOutBuffer[0] = 'S';
+// OBSOLETE    remcomOutBuffer[1] =  hexchars[sigval >> 4];
+// OBSOLETE    remcomOutBuffer[2] =  hexchars[sigval % 16];
+// OBSOLETE    remcomOutBuffer[3] = 0;
+// OBSOLETE    break;
+// OBSOLETE       case 'd': 
+// OBSOLETE    remote_debug = !(remote_debug);  /* toggle debug flag */
+// OBSOLETE    break;
+// OBSOLETE       case 'g': /* return the value of the CPU registers */
+// OBSOLETE    mem2hex((unsigned char*) registers, remcomOutBuffer, NUMREGBYTES, 0);
+// OBSOLETE    break;
+// OBSOLETE       case 'P': /* set the value of a single CPU register - return OK */
+// OBSOLETE    {
+// OBSOLETE      int regno;
+// OBSOLETE 
+// OBSOLETE      if (hexToInt (&ptr, &regno) && *ptr++ == '=')
+// OBSOLETE        if (regno >= 0 && regno < NUMREGS)
+// OBSOLETE          {
+// OBSOLETE            int stackmode;
+// OBSOLETE 
+// OBSOLETE            hex2mem (ptr, (unsigned char *) &registers[regno], 4, 0);
+// OBSOLETE            /*
+// OBSOLETE             * Since we just changed a single CPU register, let's
+// OBSOLETE             * make sure to keep the several stack pointers consistant.
+// OBSOLETE             */
+// OBSOLETE            stackmode = registers[PSW] & 0x80;
+// OBSOLETE            if (regno == R15)       /* stack pointer changed */
+// OBSOLETE              {                     /* need to change SPI or SPU */
+// OBSOLETE                if (stackmode == 0)
+// OBSOLETE                  registers[SPI] = registers[R15];
+// OBSOLETE                else
+// OBSOLETE                  registers[SPU] = registers[R15];
+// OBSOLETE              }
+// OBSOLETE            else if (regno == SPU)  /* "user" stack pointer changed */
+// OBSOLETE              {
+// OBSOLETE                if (stackmode != 0) /* stack in user mode: copy SP */
+// OBSOLETE                  registers[R15] = registers[SPU];
+// OBSOLETE              }
+// OBSOLETE            else if (regno == SPI)  /* "interrupt" stack pointer changed */
+// OBSOLETE              {
+// OBSOLETE                if (stackmode == 0) /* stack in interrupt mode: copy SP */
+// OBSOLETE                  registers[R15] = registers[SPI];
+// OBSOLETE              }
+// OBSOLETE            else if (regno == PSW)  /* stack mode may have changed! */
+// OBSOLETE              {                     /* force SP to either SPU or SPI */
+// OBSOLETE                if (stackmode == 0) /* stack in user mode */
+// OBSOLETE                  registers[R15] = registers[SPI];
+// OBSOLETE                else                /* stack in interrupt mode */
+// OBSOLETE                  registers[R15] = registers[SPU];
+// OBSOLETE              }
+// OBSOLETE            strcpy (remcomOutBuffer, "OK");
+// OBSOLETE            break;
+// OBSOLETE          }
+// OBSOLETE      strcpy (remcomOutBuffer, "E01");
+// OBSOLETE      break;
+// OBSOLETE    }
+// OBSOLETE       case 'G': /* set the value of the CPU registers - return OK */
+// OBSOLETE    hex2mem(ptr, (unsigned char*) registers, NUMREGBYTES, 0);
+// OBSOLETE    strcpy(remcomOutBuffer,"OK");
+// OBSOLETE    break;
+// OBSOLETE       case 's': /* sAA..AA Step one instruction from AA..AA(optional) */
+// OBSOLETE    stepping = 1;
+// OBSOLETE       case 'c': /* cAA..AA Continue from address AA..AA(optional) */
+// OBSOLETE            /* try to read optional parameter, pc unchanged if no parm */
+// OBSOLETE    if (hexToInt(&ptr,&addr))
+// OBSOLETE      registers[ PC ] = addr;
+// OBSOLETE    
+// OBSOLETE    if (stepping)   /* single-stepping */
+// OBSOLETE      {
+// OBSOLETE        if (!prepare_to_step(0))    /* set up for single-step */
+// OBSOLETE          {
+// OBSOLETE            /* prepare_to_step has already emulated the target insn:
+// OBSOLETE               Send SIGTRAP to gdb, don't resume the target at all.  */
+// OBSOLETE            ptr = remcomOutBuffer;
+// OBSOLETE            *ptr++ = 'T';           /* Simulate stopping with SIGTRAP */
+// OBSOLETE            *ptr++ = '0';
+// OBSOLETE            *ptr++ = '5';
+// OBSOLETE 
+// OBSOLETE            *ptr++ = hexchars[PC >> 4];     /* send PC */
+// OBSOLETE            *ptr++ = hexchars[PC & 0xf];
+// OBSOLETE            *ptr++ = ':';
+// OBSOLETE            ptr = mem2hex((unsigned char *)&registers[PC], ptr, 4, 0);
+// OBSOLETE            *ptr++ = ';';
+// OBSOLETE 
+// OBSOLETE            *ptr++ = hexchars[R13 >> 4];    /* send FP */
+// OBSOLETE            *ptr++ = hexchars[R13 & 0xf];
+// OBSOLETE            *ptr++ = ':';
+// OBSOLETE            ptr = mem2hex((unsigned char *)&registers[R13], ptr, 4, 0);
+// OBSOLETE            *ptr++ = ';';
+// OBSOLETE 
+// OBSOLETE            *ptr++ = hexchars[R15 >> 4];    /* send SP */
+// OBSOLETE            *ptr++ = hexchars[R15 & 0xf];
+// OBSOLETE            *ptr++ = ':';
+// OBSOLETE            ptr = mem2hex((unsigned char *)&registers[R15], ptr, 4, 0);
+// OBSOLETE            *ptr++ = ';';
+// OBSOLETE            *ptr++ = 0;
+// OBSOLETE 
+// OBSOLETE            break;  
+// OBSOLETE          }
+// OBSOLETE      }
+// OBSOLETE    else    /* continuing, not single-stepping */
+// OBSOLETE      {
+// OBSOLETE        /* OK, about to do a "continue".  First check to see if the 
+// OBSOLETE           target pc is on an odd boundary (second instruction in the 
+// OBSOLETE           word).  If so, we must do a single-step first, because 
+// OBSOLETE           ya can't jump or return back to an odd boundary!  */
+// OBSOLETE        if ((registers[PC] & 2) != 0)
+// OBSOLETE          prepare_to_step(1);
+// OBSOLETE      }
+// OBSOLETE 
+// OBSOLETE    return;
+// OBSOLETE 
+// OBSOLETE       case 'D':    /* Detach */
+// OBSOLETE #if 0
+// OBSOLETE    /* I am interpreting this to mean, release the board from control 
+// OBSOLETE       by the remote stub.  To do this, I am restoring the original
+// OBSOLETE       (or at least previous) exception vectors.
+// OBSOLETE     */
+// OBSOLETE    for (i = 0; i < 18; i++)
+// OBSOLETE      exceptionHandler (i, save_vectors[i]);
+// OBSOLETE    putpacket ("OK");
+// OBSOLETE    return;         /* continue the inferior */
+// OBSOLETE #else
+// OBSOLETE    strcpy(remcomOutBuffer,"OK");
+// OBSOLETE    break;
+// OBSOLETE #endif
+// OBSOLETE     case 'q':
+// OBSOLETE       if (*ptr++ == 'C' &&
+// OBSOLETE      *ptr++ == 'R' &&
+// OBSOLETE      *ptr++ == 'C' &&
+// OBSOLETE      *ptr++ == ':')
+// OBSOLETE    {
+// OBSOLETE      unsigned long start, len, our_crc;
+// OBSOLETE 
+// OBSOLETE      if (hexToInt (&ptr, (int *) &start) &&
+// OBSOLETE          *ptr++ == ','                   &&
+// OBSOLETE          hexToInt (&ptr, (int *) &len))
+// OBSOLETE        {
+// OBSOLETE          remcomOutBuffer[0] = 'C';
+// OBSOLETE          our_crc = crc32 ((unsigned char *) start, len, 0xffffffff);
+// OBSOLETE          mem2hex ((char *) &our_crc, 
+// OBSOLETE                   &remcomOutBuffer[1], 
+// OBSOLETE                   sizeof (long), 
+// OBSOLETE                   0); 
+// OBSOLETE        } /* else do nothing */
+// OBSOLETE    } /* else do nothing */
+// OBSOLETE       break;
+// OBSOLETE 
+// OBSOLETE       case 'k': /* kill the program */
+// OBSOLETE    continue;
+// OBSOLETE       } /* switch */
+// OBSOLETE 
+// OBSOLETE     /* reply to the request */
+// OBSOLETE     putpacket(remcomOutBuffer);
+// OBSOLETE   }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* qCRC support */
+// OBSOLETE 
+// OBSOLETE /* Table used by the crc32 function to calcuate the checksum. */
+// OBSOLETE static unsigned long crc32_table[256] = {0, 0};
+// OBSOLETE 
+// OBSOLETE static unsigned long
+// OBSOLETE crc32 (unsigned char *buf, int len, unsigned long crc)
+// OBSOLETE {
+// OBSOLETE   if (! crc32_table[1])
+// OBSOLETE     {
+// OBSOLETE       /* Initialize the CRC table and the decoding table. */
+// OBSOLETE       int i, j;
+// OBSOLETE       unsigned long c;
+// OBSOLETE 
+// OBSOLETE       for (i = 0; i < 256; i++)
+// OBSOLETE    {
+// OBSOLETE      for (c = i << 24, j = 8; j > 0; --j)
+// OBSOLETE        c = c & 0x80000000 ? (c << 1) ^ 0x04c11db7 : (c << 1);
+// OBSOLETE      crc32_table[i] = c;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   while (len--)
+// OBSOLETE     {
+// OBSOLETE       crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buf) & 255];
+// OBSOLETE       buf++;
+// OBSOLETE     }
+// OBSOLETE   return crc;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int 
+// OBSOLETE hex (unsigned char ch)
+// OBSOLETE {
+// OBSOLETE   if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10);
+// OBSOLETE   if ((ch >= '0') && (ch <= '9')) return (ch-'0');
+// OBSOLETE   if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10);
+// OBSOLETE   return (-1);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* scan for the sequence $<data>#<checksum>     */
+// OBSOLETE 
+// OBSOLETE unsigned char *
+// OBSOLETE getpacket (void)
+// OBSOLETE {
+// OBSOLETE   unsigned char *buffer = &remcomInBuffer[0];
+// OBSOLETE   unsigned char checksum;
+// OBSOLETE   unsigned char xmitcsum;
+// OBSOLETE   int count;
+// OBSOLETE   char ch;
+// OBSOLETE 
+// OBSOLETE   while (1)
+// OBSOLETE     {
+// OBSOLETE       /* wait around for the start character, ignore all other characters */
+// OBSOLETE       while ((ch = getDebugChar ()) != '$')
+// OBSOLETE    ;
+// OBSOLETE 
+// OBSOLETE retry:
+// OBSOLETE       checksum = 0;
+// OBSOLETE       xmitcsum = -1;
+// OBSOLETE       count = 0;
+// OBSOLETE 
+// OBSOLETE       /* now, read until a # or end of buffer is found */
+// OBSOLETE       while (count < BUFMAX)
+// OBSOLETE    {
+// OBSOLETE      ch = getDebugChar ();
+// OBSOLETE           if (ch == '$')
+// OBSOLETE        goto retry;
+// OBSOLETE      if (ch == '#')
+// OBSOLETE        break;
+// OBSOLETE      checksum = checksum + ch;
+// OBSOLETE      buffer[count] = ch;
+// OBSOLETE      count = count + 1;
+// OBSOLETE    }
+// OBSOLETE       buffer[count] = 0;
+// OBSOLETE 
+// OBSOLETE       if (ch == '#')
+// OBSOLETE    {
+// OBSOLETE      ch = getDebugChar ();
+// OBSOLETE      xmitcsum = hex (ch) << 4;
+// OBSOLETE      ch = getDebugChar ();
+// OBSOLETE      xmitcsum += hex (ch);
+// OBSOLETE 
+// OBSOLETE      if (checksum != xmitcsum)
+// OBSOLETE        {
+// OBSOLETE          if (remote_debug)
+// OBSOLETE            {
+// OBSOLETE              unsigned char buf[16];
+// OBSOLETE 
+// OBSOLETE              mem2hex((unsigned char *) &checksum, buf, 4, 0);
+// OBSOLETE              gdb_error("Bad checksum: my count = %s, ", buf);
+// OBSOLETE              mem2hex((unsigned char *) &xmitcsum, buf, 4, 0);
+// OBSOLETE              gdb_error("sent count = %s\n", buf);
+// OBSOLETE              gdb_error(" -- Bad buffer: \"%s\"\n", buffer); 
+// OBSOLETE            }
+// OBSOLETE          putDebugChar ('-');       /* failed checksum */
+// OBSOLETE        }
+// OBSOLETE      else
+// OBSOLETE        {
+// OBSOLETE          putDebugChar ('+');       /* successful transfer */
+// OBSOLETE 
+// OBSOLETE          /* if a sequence char is present, reply the sequence ID */
+// OBSOLETE          if (buffer[2] == ':')
+// OBSOLETE            {
+// OBSOLETE              putDebugChar (buffer[0]);
+// OBSOLETE              putDebugChar (buffer[1]);
+// OBSOLETE 
+// OBSOLETE              return &buffer[3];
+// OBSOLETE            }
+// OBSOLETE 
+// OBSOLETE          return &buffer[0];
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* send the packet in buffer.  */
+// OBSOLETE 
+// OBSOLETE static void 
+// OBSOLETE putpacket (unsigned char *buffer)
+// OBSOLETE {
+// OBSOLETE   unsigned char checksum;
+// OBSOLETE   int  count;
+// OBSOLETE   char ch;
+// OBSOLETE 
+// OBSOLETE   /*  $<packet info>#<checksum>. */
+// OBSOLETE   do {
+// OBSOLETE     putDebugChar('$');
+// OBSOLETE     checksum = 0;
+// OBSOLETE     count    = 0;
+// OBSOLETE 
+// OBSOLETE     while (ch=buffer[count]) {
+// OBSOLETE       putDebugChar(ch);
+// OBSOLETE       checksum += ch;
+// OBSOLETE       count += 1;
+// OBSOLETE     }
+// OBSOLETE     putDebugChar('#');
+// OBSOLETE     putDebugChar(hexchars[checksum >> 4]);
+// OBSOLETE     putDebugChar(hexchars[checksum % 16]);
+// OBSOLETE   } while (getDebugChar() != '+');
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Address of a routine to RTE to if we get a memory fault.  */
+// OBSOLETE 
+// OBSOLETE static void (*volatile mem_fault_routine)() = 0;
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE set_mem_err (void)
+// OBSOLETE {
+// OBSOLETE   mem_err = 1;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Check the address for safe access ranges.  As currently defined,
+// OBSOLETE    this routine will reject the "expansion bus" address range(s).
+// OBSOLETE    To make those ranges useable, someone must implement code to detect
+// OBSOLETE    whether there's anything connected to the expansion bus. */
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE mem_safe (unsigned char *addr)
+// OBSOLETE {
+// OBSOLETE #define BAD_RANGE_ONE_START        ((unsigned char *) 0x600000)
+// OBSOLETE #define BAD_RANGE_ONE_END  ((unsigned char *) 0xa00000)
+// OBSOLETE #define BAD_RANGE_TWO_START        ((unsigned char *) 0xff680000)
+// OBSOLETE #define BAD_RANGE_TWO_END  ((unsigned char *) 0xff800000)
+// OBSOLETE 
+// OBSOLETE   if (addr < BAD_RANGE_ONE_START)  return 1;       /* safe */
+// OBSOLETE   if (addr < BAD_RANGE_ONE_END)            return 0;       /* unsafe */
+// OBSOLETE   if (addr < BAD_RANGE_TWO_START)  return 1;       /* safe */
+// OBSOLETE   if (addr < BAD_RANGE_TWO_END)            return 0;       /* unsafe */
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* These are separate functions so that they are so short and sweet
+// OBSOLETE    that the compiler won't save any registers (if there is a fault
+// OBSOLETE    to mem_fault, they won't get restored, so there better not be any
+// OBSOLETE    saved).  */
+// OBSOLETE static int
+// OBSOLETE get_char (unsigned char *addr)
+// OBSOLETE {
+// OBSOLETE #if 1
+// OBSOLETE   if (mem_fault_routine && !mem_safe(addr))
+// OBSOLETE     {
+// OBSOLETE       mem_fault_routine ();
+// OBSOLETE       return 0;
+// OBSOLETE     }
+// OBSOLETE #endif
+// OBSOLETE   return *addr;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE set_char (unsigned char *addr, unsigned char val)
+// OBSOLETE {
+// OBSOLETE #if 1
+// OBSOLETE   if (mem_fault_routine && !mem_safe (addr))
+// OBSOLETE     {
+// OBSOLETE       mem_fault_routine ();
+// OBSOLETE       return;
+// OBSOLETE     }
+// OBSOLETE #endif
+// OBSOLETE   *addr = val;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Convert the memory pointed to by mem into hex, placing result in buf.
+// OBSOLETE    Return a pointer to the last char put in buf (null).
+// OBSOLETE    If MAY_FAULT is non-zero, then we should set mem_err in response to
+// OBSOLETE    a fault; if zero treat a fault like any other fault in the stub.  */
+// OBSOLETE 
+// OBSOLETE static unsigned char *
+// OBSOLETE mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE   int i;
+// OBSOLETE   unsigned char ch;
+// OBSOLETE 
+// OBSOLETE   if (may_fault)
+// OBSOLETE     mem_fault_routine = set_mem_err;
+// OBSOLETE   for (i=0;i<count;i++) {
+// OBSOLETE     ch = get_char (mem++);
+// OBSOLETE     if (may_fault && mem_err)
+// OBSOLETE       return (buf);
+// OBSOLETE     *buf++ = hexchars[ch >> 4];
+// OBSOLETE     *buf++ = hexchars[ch % 16];
+// OBSOLETE   }
+// OBSOLETE   *buf = 0;
+// OBSOLETE   if (may_fault)
+// OBSOLETE     mem_fault_routine = 0;
+// OBSOLETE   return(buf);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Convert the hex array pointed to by buf into binary to be placed in mem.
+// OBSOLETE    Return a pointer to the character AFTER the last byte written. */
+// OBSOLETE 
+// OBSOLETE static unsigned char* 
+// OBSOLETE hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE   int i;
+// OBSOLETE   unsigned char ch;
+// OBSOLETE 
+// OBSOLETE   if (may_fault)
+// OBSOLETE     mem_fault_routine = set_mem_err;
+// OBSOLETE   for (i=0;i<count;i++) {
+// OBSOLETE     ch = hex(*buf++) << 4;
+// OBSOLETE     ch = ch + hex(*buf++);
+// OBSOLETE     set_char (mem++, ch);
+// OBSOLETE     if (may_fault && mem_err)
+// OBSOLETE       return (mem);
+// OBSOLETE   }
+// OBSOLETE   if (may_fault)
+// OBSOLETE     mem_fault_routine = 0;
+// OBSOLETE   return(mem);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Convert the binary stream in BUF to memory.
+// OBSOLETE 
+// OBSOLETE    Gdb will escape $, #, and the escape char (0x7d).
+// OBSOLETE    COUNT is the total number of bytes to write into
+// OBSOLETE    memory. */
+// OBSOLETE static unsigned char *
+// OBSOLETE bin2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
+// OBSOLETE {
+// OBSOLETE   int i;
+// OBSOLETE   unsigned char ch;
+// OBSOLETE 
+// OBSOLETE   if (may_fault)
+// OBSOLETE     mem_fault_routine = set_mem_err;
+// OBSOLETE   for (i = 0; i < count; i++)
+// OBSOLETE     {
+// OBSOLETE       /* Check for any escaped characters. Be paranoid and
+// OBSOLETE          only unescape chars that should be escaped. */
+// OBSOLETE       if (*buf == 0x7d)
+// OBSOLETE         {
+// OBSOLETE           switch (*(buf+1))
+// OBSOLETE             {
+// OBSOLETE             case 0x3:  /* # */
+// OBSOLETE             case 0x4:  /* $ */
+// OBSOLETE             case 0x5d: /* escape char */
+// OBSOLETE               buf++;
+// OBSOLETE               *buf |= 0x20;
+// OBSOLETE               break;
+// OBSOLETE             default:
+// OBSOLETE               /* nothing */
+// OBSOLETE               break;
+// OBSOLETE             }
+// OBSOLETE         }
+// OBSOLETE 
+// OBSOLETE       set_char (mem++, *buf++);
+// OBSOLETE 
+// OBSOLETE       if (may_fault && mem_err)
+// OBSOLETE         return mem;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   if (may_fault)
+// OBSOLETE     mem_fault_routine = 0;
+// OBSOLETE   return mem;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* this function takes the m32r exception vector and attempts to
+// OBSOLETE    translate this number into a unix compatible signal value */
+// OBSOLETE 
+// OBSOLETE static int 
+// OBSOLETE computeSignal (int exceptionVector)
+// OBSOLETE {
+// OBSOLETE   int sigval;
+// OBSOLETE   switch (exceptionVector) {
+// OBSOLETE     case 0  : sigval = 23; break; /* I/O trap                    */
+// OBSOLETE     case 1  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 2  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 3  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 4  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 5  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 6  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 7  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 8  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 9  : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 10 : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 11 : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 12 : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 13 : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 14 : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 15 : sigval = 5;  break; /* breakpoint                  */
+// OBSOLETE     case 16 : sigval = 10; break; /* BUS ERROR (alignment)       */
+// OBSOLETE     case 17 : sigval = 2;  break; /* INTerrupt                   */
+// OBSOLETE     default : sigval = 7;  break; /* "software generated"        */
+// OBSOLETE   }
+// OBSOLETE   return (sigval);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /**********************************************/
+// OBSOLETE /* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */
+// OBSOLETE /* RETURN NUMBER OF CHARS PROCESSED           */
+// OBSOLETE /**********************************************/
+// OBSOLETE static int 
+// OBSOLETE hexToInt (unsigned char **ptr, int *intValue)
+// OBSOLETE {
+// OBSOLETE   int numChars = 0;
+// OBSOLETE   int hexValue;
+// OBSOLETE 
+// OBSOLETE   *intValue = 0;
+// OBSOLETE   while (**ptr)
+// OBSOLETE     {
+// OBSOLETE       hexValue = hex(**ptr);
+// OBSOLETE       if (hexValue >=0)
+// OBSOLETE         {
+// OBSOLETE      *intValue = (*intValue <<4) | hexValue;
+// OBSOLETE      numChars ++;
+// OBSOLETE         }
+// OBSOLETE       else
+// OBSOLETE    break;
+// OBSOLETE       (*ptr)++;
+// OBSOLETE     }
+// OBSOLETE   return (numChars);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /*
+// OBSOLETE   Table of branch instructions:
+// OBSOLETE   
+// OBSOLETE   10B6             RTE     return from trap or exception
+// OBSOLETE   1FCr             JMP     jump
+// OBSOLETE   1ECr             JL      jump and link
+// OBSOLETE   7Fxx             BRA     branch
+// OBSOLETE   FFxxxxxx BRA     branch (long)
+// OBSOLETE   B09rxxxx BNEZ    branch not-equal-zero
+// OBSOLETE   Br1rxxxx BNE     branch not-equal
+// OBSOLETE   7Dxx             BNC     branch not-condition
+// OBSOLETE   FDxxxxxx BNC     branch not-condition (long)
+// OBSOLETE   B0Arxxxx BLTZ    branch less-than-zero
+// OBSOLETE   B0Crxxxx BLEZ    branch less-equal-zero
+// OBSOLETE   7Exx             BL      branch and link
+// OBSOLETE   FExxxxxx BL      branch and link (long)
+// OBSOLETE   B0Drxxxx BGTZ    branch greater-than-zero
+// OBSOLETE   B0Brxxxx BGEZ    branch greater-equal-zero
+// OBSOLETE   B08rxxxx BEQZ    branch equal-zero
+// OBSOLETE   Br0rxxxx BEQ     branch equal
+// OBSOLETE   7Cxx             BC      branch condition
+// OBSOLETE   FCxxxxxx BC      branch condition (long)
+// OBSOLETE   */
+// OBSOLETE 
+// OBSOLETE static int 
+// OBSOLETE isShortBranch (unsigned char *instr)
+// OBSOLETE {
+// OBSOLETE   unsigned char instr0 = instr[0] & 0x7F;          /* mask off high bit */
+// OBSOLETE 
+// OBSOLETE   if (instr0 == 0x10 && instr[1] == 0xB6)  /* RTE */
+// OBSOLETE     return 1;              /* return from trap or exception */
+// OBSOLETE 
+// OBSOLETE   if (instr0 == 0x1E || instr0 == 0x1F)            /* JL or JMP */
+// OBSOLETE     if ((instr[1] & 0xF0) == 0xC0)
+// OBSOLETE       return 2;                                    /* jump thru a register */
+// OBSOLETE 
+// OBSOLETE   if (instr0 == 0x7C || instr0 == 0x7D ||  /* BC, BNC, BL, BRA */
+// OBSOLETE       instr0 == 0x7E || instr0 == 0x7F)
+// OBSOLETE     return 3;                                      /* eight bit PC offset */
+// OBSOLETE 
+// OBSOLETE   return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE isLongBranch (unsigned char *instr)
+// OBSOLETE {
+// OBSOLETE   if (instr[0] == 0xFC || instr[0] == 0xFD ||      /* BRA, BNC, BL, BC */
+// OBSOLETE       instr[0] == 0xFE || instr[0] == 0xFF)        /* 24 bit relative */
+// OBSOLETE     return 4;
+// OBSOLETE   if ((instr[0] & 0xF0) == 0xB0)           /* 16 bit relative */
+// OBSOLETE     {
+// OBSOLETE       if ((instr[1] & 0xF0) == 0x00 ||             /* BNE, BEQ */
+// OBSOLETE      (instr[1] & 0xF0) == 0x10)
+// OBSOLETE    return 5;
+// OBSOLETE       if (instr[0] == 0xB0)        /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ, BEQZ */
+// OBSOLETE    if ((instr[1] & 0xF0) == 0x80 || (instr[1] & 0xF0) == 0x90 || 
+// OBSOLETE        (instr[1] & 0xF0) == 0xA0 || (instr[1] & 0xF0) == 0xB0 ||
+// OBSOLETE        (instr[1] & 0xF0) == 0xC0 || (instr[1] & 0xF0) == 0xD0)
+// OBSOLETE      return 6;
+// OBSOLETE     }
+// OBSOLETE   return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* if address is NOT on a 4-byte boundary, or high-bit of instr is zero, 
+// OBSOLETE    then it's a 2-byte instruction, else it's a 4-byte instruction.  */
+// OBSOLETE 
+// OBSOLETE #define INSTRUCTION_SIZE(addr) \
+// OBSOLETE     ((((int) addr & 2) || (((unsigned char *) addr)[0] & 0x80) == 0) ? 2 : 4)
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE isBranch (unsigned char *instr)
+// OBSOLETE {
+// OBSOLETE   if (INSTRUCTION_SIZE(instr) == 2)
+// OBSOLETE     return isShortBranch(instr);
+// OBSOLETE   else
+// OBSOLETE     return isLongBranch(instr);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE willBranch (unsigned char *instr, int branchCode)
+// OBSOLETE {
+// OBSOLETE   switch (branchCode) 
+// OBSOLETE     {
+// OBSOLETE     case 0:        return 0;       /* not a branch */
+// OBSOLETE     case 1:        return 1;       /* RTE */
+// OBSOLETE     case 2:        return 1;       /* JL or JMP    */
+// OBSOLETE     case 3:                        /* BC, BNC, BL, BRA (short) */
+// OBSOLETE     case 4:                        /* BC, BNC, BL, BRA (long) */
+// OBSOLETE       switch (instr[0] & 0x0F) 
+// OBSOLETE    {
+// OBSOLETE    case 0xC:               /* Branch if Condition Register */
+// OBSOLETE      return (registers[CBR] != 0);
+// OBSOLETE    case 0xD:               /* Branch if NOT Condition Register */
+// OBSOLETE      return (registers[CBR] == 0);
+// OBSOLETE    case 0xE:               /* Branch and Link */
+// OBSOLETE    case 0xF:               /* Branch (unconditional) */
+// OBSOLETE      return 1;
+// OBSOLETE    default:                /* oops? */
+// OBSOLETE      return 0;
+// OBSOLETE    }
+// OBSOLETE     case 5:                        /* BNE, BEQ */
+// OBSOLETE       switch (instr[1] & 0xF0) 
+// OBSOLETE    {
+// OBSOLETE    case 0x00:              /* Branch if r1 equal to r2 */
+// OBSOLETE      return (registers[instr[0] & 0x0F] == registers[instr[1] & 0x0F]);
+// OBSOLETE    case 0x10:              /* Branch if r1 NOT equal to r2 */
+// OBSOLETE      return (registers[instr[0] & 0x0F] != registers[instr[1] & 0x0F]);
+// OBSOLETE    default:                /* oops? */
+// OBSOLETE      return 0;
+// OBSOLETE    }
+// OBSOLETE     case 6:                        /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ */
+// OBSOLETE       switch (instr[1] & 0xF0) 
+// OBSOLETE    {
+// OBSOLETE    case 0x80:              /* Branch if reg equal to zero */
+// OBSOLETE      return (registers[instr[1] & 0x0F] == 0);
+// OBSOLETE    case 0x90:              /* Branch if reg NOT equal to zero */
+// OBSOLETE      return (registers[instr[1] & 0x0F] != 0);
+// OBSOLETE    case 0xA0:              /* Branch if reg less than zero */
+// OBSOLETE      return (registers[instr[1] & 0x0F] < 0);
+// OBSOLETE    case 0xB0:              /* Branch if reg greater or equal to zero */
+// OBSOLETE      return (registers[instr[1] & 0x0F] >= 0);
+// OBSOLETE    case 0xC0:              /* Branch if reg less than or equal to zero */
+// OBSOLETE      return (registers[instr[1] & 0x0F] <= 0);
+// OBSOLETE    case 0xD0:              /* Branch if reg greater than zero */
+// OBSOLETE      return (registers[instr[1] & 0x0F] > 0);
+// OBSOLETE    default:                /* oops? */
+// OBSOLETE      return 0;
+// OBSOLETE    }
+// OBSOLETE     default:                       /* oops? */
+// OBSOLETE       return 0;
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int 
+// OBSOLETE branchDestination (unsigned char *instr, int branchCode)
+// OBSOLETE 
+// OBSOLETE   switch (branchCode) { 
+// OBSOLETE   default: 
+// OBSOLETE   case 0:                                  /* not a branch */ 
+// OBSOLETE     return 0;
+// OBSOLETE   case 1:                                  /* RTE */ 
+// OBSOLETE     return registers[BPC] & ~3;            /* pop BPC into PC */
+// OBSOLETE   case 2:                                  /* JL or JMP */ 
+// OBSOLETE     return registers[instr[1] & 0x0F] & ~3;        /* jump thru a register */ 
+// OBSOLETE   case 3:          /* BC, BNC, BL, BRA (short, 8-bit relative offset) */ 
+// OBSOLETE     return (((int) instr) & ~3) + ((char) instr[1] << 2);
+// OBSOLETE   case 4:          /* BC, BNC, BL, BRA (long, 24-bit relative offset) */ 
+// OBSOLETE     return ((int) instr + 
+// OBSOLETE        ((((char) instr[1] << 16) | (instr[2] << 8) | (instr[3])) << 2)); 
+// OBSOLETE   case 5:          /* BNE, BEQ (16-bit relative offset) */ 
+// OBSOLETE   case 6:          /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ (ditto) */ 
+// OBSOLETE     return ((int) instr + ((((char) instr[2] << 8) | (instr[3])) << 2)); 
+// OBSOLETE   }
+// OBSOLETE 
+// OBSOLETE   /* An explanatory note: in the last three return expressions, I have
+// OBSOLETE      cast the most-significant byte of the return offset to char.
+// OBSOLETE      What this accomplishes is sign extension.  If the other
+// OBSOLETE      less-significant bytes were signed as well, they would get sign
+// OBSOLETE      extended too and, if negative, their leading bits would clobber
+// OBSOLETE      the bits of the more-significant bytes ahead of them.  There are
+// OBSOLETE      other ways I could have done this, but sign extension from
+// OBSOLETE      odd-sized integers is always a pain. */
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE branchSideEffects (unsigned char *instr, int branchCode)
+// OBSOLETE {
+// OBSOLETE   switch (branchCode)
+// OBSOLETE     {
+// OBSOLETE     case 1:                        /* RTE */
+// OBSOLETE       return;                      /* I <THINK> this is already handled... */
+// OBSOLETE     case 2:                        /* JL (or JMP) */
+// OBSOLETE     case 3:                        /* BL (or BC, BNC, BRA) */
+// OBSOLETE     case 4:
+// OBSOLETE       if ((instr[0] & 0x0F) == 0x0E)               /* branch/jump and link */
+// OBSOLETE    registers[R14] = (registers[PC] & ~3) + 4;
+// OBSOLETE       return;
+// OBSOLETE     default:                       /* any other branch has no side effects */
+// OBSOLETE       return;
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static struct STEPPING_CONTEXT {
+// OBSOLETE   int stepping;                    /* true when we've started a single-step */
+// OBSOLETE   unsigned long  target_addr;      /* the instr we're trying to execute */
+// OBSOLETE   unsigned long  target_size;      /* the size of the target instr */
+// OBSOLETE   unsigned long  noop_addr;        /* where we've inserted a no-op, if any */
+// OBSOLETE   unsigned long  trap1_addr;       /* the trap following the target instr */
+// OBSOLETE   unsigned long  trap2_addr;       /* the trap at a branch destination, if any */
+// OBSOLETE   unsigned short noop_save;        /* instruction overwritten by our no-op */
+// OBSOLETE   unsigned short trap1_save;       /* instruction overwritten by trap1 */
+// OBSOLETE   unsigned short trap2_save;       /* instruction overwritten by trap2 */
+// OBSOLETE   unsigned short continue_p;       /* true if NOT returning to gdb after step */
+// OBSOLETE } stepping;
+// OBSOLETE 
+// OBSOLETE /* Function: prepare_to_step
+// OBSOLETE    Called from handle_exception to prepare the user program to single-step.
+// OBSOLETE    Places a trap instruction after the target instruction, with special 
+// OBSOLETE    extra handling for branch instructions and for instructions in the 
+// OBSOLETE    second half-word of a word.  
+// OBSOLETE 
+// OBSOLETE    Returns: True  if we should actually execute the instruction; 
+// OBSOLETE        False if we are going to emulate executing the instruction,
+// OBSOLETE        in which case we simply report to GDB that the instruction 
+// OBSOLETE        has already been executed.  */
+// OBSOLETE 
+// OBSOLETE #define TRAP1  0x10f1;     /* trap #1 instruction */
+// OBSOLETE #define NOOP   0x7000;  /* noop    instruction */
+// OBSOLETE 
+// OBSOLETE static unsigned short trap1 = TRAP1;
+// OBSOLETE static unsigned short noop  = NOOP;
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE prepare_to_step(continue_p)
+// OBSOLETE      int continue_p;       /* if this isn't REALLY a single-step (see below) */
+// OBSOLETE {
+// OBSOLETE   unsigned long pc = registers[PC];
+// OBSOLETE   int branchCode   = isBranch((unsigned char *) pc);
+// OBSOLETE   unsigned char *p;
+// OBSOLETE 
+// OBSOLETE   /* zero out the stepping context 
+// OBSOLETE      (paranoia -- it should already be zeroed) */
+// OBSOLETE   for (p = (unsigned char *) &stepping;
+// OBSOLETE        p < ((unsigned char *) &stepping) + sizeof(stepping);
+// OBSOLETE        p++)
+// OBSOLETE     *p = 0;
+// OBSOLETE 
+// OBSOLETE   if (branchCode != 0)                     /* next instruction is a branch */
+// OBSOLETE     {
+// OBSOLETE       branchSideEffects((unsigned char *) pc, branchCode);
+// OBSOLETE       if (willBranch((unsigned char *)pc, branchCode))
+// OBSOLETE    registers[PC] = branchDestination((unsigned char *) pc, branchCode);
+// OBSOLETE       else
+// OBSOLETE    registers[PC] = pc + INSTRUCTION_SIZE(pc);
+// OBSOLETE       return 0;                    /* branch "executed" -- just notify GDB */
+// OBSOLETE     }
+// OBSOLETE   else if (((int) pc & 2) != 0)            /* "second-slot" instruction */
+// OBSOLETE     {
+// OBSOLETE       /* insert no-op before pc */
+// OBSOLETE       stepping.noop_addr  =  pc - 2;
+// OBSOLETE       stepping.noop_save  = *(unsigned short *) stepping.noop_addr;
+// OBSOLETE       *(unsigned short *) stepping.noop_addr  = noop;
+// OBSOLETE       /* insert trap  after  pc */
+// OBSOLETE       stepping.trap1_addr =  pc + 2;
+// OBSOLETE       stepping.trap1_save = *(unsigned short *) stepping.trap1_addr;
+// OBSOLETE       *(unsigned short *) stepping.trap1_addr = trap1;
+// OBSOLETE     }
+// OBSOLETE   else                                     /* "first-slot" instruction */
+// OBSOLETE     {
+// OBSOLETE       /* insert trap  after  pc */
+// OBSOLETE       stepping.trap1_addr = pc + INSTRUCTION_SIZE(pc);     
+// OBSOLETE       stepping.trap1_save = *(unsigned short *) stepping.trap1_addr;
+// OBSOLETE       *(unsigned short *) stepping.trap1_addr = trap1;
+// OBSOLETE     }
+// OBSOLETE   /* "continue_p" means that we are actually doing a continue, and not 
+// OBSOLETE      being requested to single-step by GDB.  Sometimes we have to do
+// OBSOLETE      one single-step before continuing, because the PC is on a half-word
+// OBSOLETE      boundary.  There's no way to simply resume at such an address.  */
+// OBSOLETE   stepping.continue_p = continue_p;
+// OBSOLETE   stepping.stepping = 1;           /* starting a single-step */
+// OBSOLETE   return 1;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: finish_from_step
+// OBSOLETE    Called from handle_exception to finish up when the user program 
+// OBSOLETE    returns from a single-step.  Replaces the instructions that had
+// OBSOLETE    been overwritten by traps or no-ops, 
+// OBSOLETE 
+// OBSOLETE    Returns: True  if we should notify GDB that the target stopped.
+// OBSOLETE        False if we only single-stepped because we had to before we
+// OBSOLETE        could continue (ie. we were trying to continue at a 
+// OBSOLETE        half-word boundary).  In that case don't notify GDB:
+// OBSOLETE        just "continue continuing".  */
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE finish_from_step (void)
+// OBSOLETE {
+// OBSOLETE   if (stepping.stepping)   /* anything to do? */
+// OBSOLETE     {
+// OBSOLETE       int continue_p = stepping.continue_p;
+// OBSOLETE       unsigned char *p;
+// OBSOLETE 
+// OBSOLETE       if (stepping.noop_addr)      /* replace instr "under" our no-op */
+// OBSOLETE    *(unsigned short *) stepping.noop_addr  = stepping.noop_save;
+// OBSOLETE       if (stepping.trap1_addr)     /* replace instr "under" our trap  */
+// OBSOLETE    *(unsigned short *) stepping.trap1_addr = stepping.trap1_save;
+// OBSOLETE       if (stepping.trap2_addr)  /* ditto our other trap, if any    */
+// OBSOLETE    *(unsigned short *) stepping.trap2_addr = stepping.trap2_save;
+// OBSOLETE 
+// OBSOLETE       for (p = (unsigned char *) &stepping;        /* zero out the stepping context */
+// OBSOLETE       p < ((unsigned char *) &stepping) + sizeof(stepping);
+// OBSOLETE       p++)
+// OBSOLETE    *p = 0;
+// OBSOLETE 
+// OBSOLETE       return !(continue_p);
+// OBSOLETE     }
+// OBSOLETE   else     /* we didn't single-step, therefore this must be a legitimate stop */
+// OBSOLETE     return 1;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE struct PSWreg {            /* separate out the bit flags in the PSW register */
+// OBSOLETE   int pad1 : 16;
+// OBSOLETE   int bsm  : 1;
+// OBSOLETE   int bie  : 1;
+// OBSOLETE   int pad2 : 5;
+// OBSOLETE   int bc   : 1;
+// OBSOLETE   int sm   : 1;
+// OBSOLETE   int ie   : 1;
+// OBSOLETE   int pad3 : 5;
+// OBSOLETE   int c    : 1;
+// OBSOLETE } *psw;
+// OBSOLETE 
+// OBSOLETE /* Upon entry the value for LR to save has been pushed.
+// OBSOLETE    We unpush that so that the value for the stack pointer saved is correct.
+// OBSOLETE    Upon entry, all other registers are assumed to have not been modified
+// OBSOLETE    since the interrupt/trap occured.  */
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE stash_registers:
+// OBSOLETE    push r0
+// OBSOLETE    push r1
+// OBSOLETE    seth r1, #shigh(registers)
+// OBSOLETE    add3 r1, r1, #low(registers)
+// OBSOLETE    pop r0          ; r1
+// OBSOLETE    st r0, @(4,r1)
+// OBSOLETE    pop r0          ; r0
+// OBSOLETE    st r0, @r1
+// OBSOLETE    addi r1, #4     ; only add 4 as subsequent saves are `pre inc'
+// OBSOLETE    st r2, @+r1
+// OBSOLETE    st r3, @+r1
+// OBSOLETE    st r4, @+r1
+// OBSOLETE    st r5, @+r1
+// OBSOLETE    st r6, @+r1
+// OBSOLETE    st r7, @+r1
+// OBSOLETE    st r8, @+r1
+// OBSOLETE    st r9, @+r1
+// OBSOLETE    st r10, @+r1
+// OBSOLETE    st r11, @+r1
+// OBSOLETE    st r12, @+r1
+// OBSOLETE    st r13, @+r1    ; fp
+// OBSOLETE    pop r0          ; lr (r14)
+// OBSOLETE    st r0, @+r1
+// OBSOLETE    st sp, @+r1     ; sp contains right value at this point
+// OBSOLETE    mvfc r0, cr0
+// OBSOLETE    st r0, @+r1     ; cr0 == PSW
+// OBSOLETE    mvfc r0, cr1
+// OBSOLETE    st r0, @+r1     ; cr1 == CBR
+// OBSOLETE    mvfc r0, cr2
+// OBSOLETE    st r0, @+r1     ; cr2 == SPI
+// OBSOLETE    mvfc r0, cr3
+// OBSOLETE    st r0, @+r1     ; cr3 == SPU
+// OBSOLETE    mvfc r0, cr6
+// OBSOLETE    st r0, @+r1     ; cr6 == BPC
+// OBSOLETE    st r0, @+r1     ; PC  == BPC
+// OBSOLETE    mvfaclo r0
+// OBSOLETE    st r0, @+r1     ; ACCL
+// OBSOLETE    mvfachi r0
+// OBSOLETE    st r0, @+r1     ; ACCH
+// OBSOLETE    jmp lr");
+// OBSOLETE 
+// OBSOLETE /* C routine to clean up what stash_registers did.
+// OBSOLETE    It is called after calling stash_registers.
+// OBSOLETE    This is separate from stash_registers as we want to do this in C
+// OBSOLETE    but doing stash_registers in C isn't straightforward.  */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE cleanup_stash (void)
+// OBSOLETE {
+// OBSOLETE   psw = (struct PSWreg *) &registers[PSW]; /* fields of PSW register */
+// OBSOLETE   psw->sm = psw->bsm;              /* fix up pre-trap values of psw fields */
+// OBSOLETE   psw->ie = psw->bie;
+// OBSOLETE   psw->c  = psw->bc;
+// OBSOLETE   registers[CBR] = psw->bc;                /* fix up pre-trap "C" register */
+// OBSOLETE 
+// OBSOLETE #if 0 /* FIXME: Was in previous version.  Necessary?
+// OBSOLETE     (Remember that we use the "rte" insn to return from the
+// OBSOLETE     trap/interrupt so the values of bsm, bie, bc are important.  */
+// OBSOLETE   psw->bsm = psw->bie = psw->bc = 0;       /* zero post-trap values */
+// OBSOLETE #endif
+// OBSOLETE 
+// OBSOLETE   /* FIXME: Copied from previous version.  This can probably be deleted
+// OBSOLETE      since methinks stash_registers has already done this.  */
+// OBSOLETE   registers[PC] = registers[BPC];  /* pre-trap PC */
+// OBSOLETE 
+// OBSOLETE   /* FIXME: Copied from previous version.  Necessary?  */
+// OBSOLETE   if (psw->sm)                     /* copy R15 into (psw->sm ? SPU : SPI) */
+// OBSOLETE     registers[SPU] = registers[R15];
+// OBSOLETE   else
+// OBSOLETE     registers[SPI] = registers[R15];
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE restore_and_return:
+// OBSOLETE    seth r0, #shigh(registers+8)
+// OBSOLETE    add3 r0, r0, #low(registers+8)
+// OBSOLETE    ld r2, @r0+     ; restore r2
+// OBSOLETE    ld r3, @r0+     ; restore r3
+// OBSOLETE    ld r4, @r0+     ; restore r4
+// OBSOLETE    ld r5, @r0+     ; restore r5
+// OBSOLETE    ld r6, @r0+     ; restore r6
+// OBSOLETE    ld r7, @r0+     ; restore r7
+// OBSOLETE    ld r8, @r0+     ; restore r8
+// OBSOLETE    ld r9, @r0+     ; restore r9
+// OBSOLETE    ld r10, @r0+    ; restore r10
+// OBSOLETE    ld r11, @r0+    ; restore r11
+// OBSOLETE    ld r12, @r0+    ; restore r12
+// OBSOLETE    ld r13, @r0+    ; restore r13
+// OBSOLETE    ld r14, @r0+    ; restore r14
+// OBSOLETE    ld r15, @r0+    ; restore r15
+// OBSOLETE    addi r0, #4     ; don't restore PSW (rte will do it)
+// OBSOLETE    ld r1, @r0+     ; restore cr1 == CBR (no-op, because it's read only)
+// OBSOLETE    mvtc r1, cr1
+// OBSOLETE    ld r1, @r0+     ; restore cr2 == SPI
+// OBSOLETE    mvtc r1, cr2
+// OBSOLETE    ld r1, @r0+     ; restore cr3 == SPU
+// OBSOLETE    mvtc r1, cr3
+// OBSOLETE    addi r0, #4     ; skip BPC
+// OBSOLETE    ld r1, @r0+     ; restore cr6 (BPC) == PC
+// OBSOLETE    mvtc r1, cr6
+// OBSOLETE    ld r1, @r0+     ; restore ACCL
+// OBSOLETE    mvtaclo r1
+// OBSOLETE    ld r1, @r0+     ; restore ACCH
+// OBSOLETE    mvtachi r1
+// OBSOLETE    seth r0, #shigh(registers)
+// OBSOLETE    add3 r0, r0, #low(registers)
+// OBSOLETE    ld r1, @(4,r0)  ; restore r1
+// OBSOLETE    ld r0, @r0      ; restore r0
+// OBSOLETE    rte");
+// OBSOLETE 
+// OBSOLETE /* General trap handler, called after the registers have been stashed.
+// OBSOLETE    NUM is the trap/exception number.  */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE process_exception (int num)
+// OBSOLETE {
+// OBSOLETE   cleanup_stash ();
+// OBSOLETE   asm volatile ("
+// OBSOLETE    seth r1, #shigh(stackPtr)
+// OBSOLETE    add3 r1, r1, #low(stackPtr)
+// OBSOLETE    ld r15, @r1             ; setup local stack (protect user stack)
+// OBSOLETE    mv r0, %0
+// OBSOLETE    bl handle_exception
+// OBSOLETE    bl restore_and_return"
+// OBSOLETE            : : "r" (num) : "r0", "r1");
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void _catchException0 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException0:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #0
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException1 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException1:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    bl cleanup_stash
+// OBSOLETE    seth r1, #shigh(stackPtr)
+// OBSOLETE    add3 r1, r1, #low(stackPtr)
+// OBSOLETE    ld r15, @r1             ; setup local stack (protect user stack)
+// OBSOLETE    seth r1, #shigh(registers + 21*4) ; PC
+// OBSOLETE    add3 r1, r1, #low(registers + 21*4)
+// OBSOLETE    ld r0, @r1
+// OBSOLETE    addi r0, #-4            ; back up PC for breakpoint trap.
+// OBSOLETE    st r0, @r1              ; FIXME: what about bp in right slot?
+// OBSOLETE    ldi r0, #1
+// OBSOLETE    bl handle_exception
+// OBSOLETE    bl restore_and_return");
+// OBSOLETE 
+// OBSOLETE void _catchException2 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException2:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #2
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException3 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException3:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #3
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException4 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException4:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #4
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException5 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException5:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #5
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException6 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException6:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #6
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException7 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException7:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #7
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException8 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException8:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #8
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException9 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException9:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #9
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException10 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException10:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #10
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException11 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException11:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #11
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException12 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException12:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #12
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException13 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException13:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #13
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException14 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException14:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #14
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException15 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException15:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #15
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException16 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException16:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #16
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE void _catchException17 ();
+// OBSOLETE 
+// OBSOLETE asm ("
+// OBSOLETE _catchException17:
+// OBSOLETE    push lr
+// OBSOLETE    bl stash_registers
+// OBSOLETE    ; Note that at this point the pushed value of `lr' has been popped
+// OBSOLETE    ldi r0, #17
+// OBSOLETE    bl process_exception");
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* this function is used to set up exception handlers for tracing and
+// OBSOLETE    breakpoints */
+// OBSOLETE void 
+// OBSOLETE set_debug_traps (void)
+// OBSOLETE {
+// OBSOLETE   /*  extern void remcomHandler(); */
+// OBSOLETE   int i;
+// OBSOLETE 
+// OBSOLETE   for (i = 0; i < 18; i++)         /* keep a copy of old vectors */
+// OBSOLETE     if (save_vectors[i] == 0)              /* only copy them the first time */
+// OBSOLETE       save_vectors[i] = getExceptionHandler (i);
+// OBSOLETE 
+// OBSOLETE   stackPtr  = &remcomStack[STACKSIZE/sizeof(int) - 1];
+// OBSOLETE 
+// OBSOLETE   exceptionHandler (0, _catchException0);
+// OBSOLETE   exceptionHandler (1, _catchException1);
+// OBSOLETE   exceptionHandler (2, _catchException2);
+// OBSOLETE   exceptionHandler (3, _catchException3);
+// OBSOLETE   exceptionHandler (4, _catchException4);
+// OBSOLETE   exceptionHandler (5, _catchException5);
+// OBSOLETE   exceptionHandler (6, _catchException6);
+// OBSOLETE   exceptionHandler (7, _catchException7);
+// OBSOLETE   exceptionHandler (8, _catchException8);
+// OBSOLETE   exceptionHandler (9, _catchException9);
+// OBSOLETE   exceptionHandler (10, _catchException10);
+// OBSOLETE   exceptionHandler (11, _catchException11);
+// OBSOLETE   exceptionHandler (12, _catchException12);
+// OBSOLETE   exceptionHandler (13, _catchException13);
+// OBSOLETE   exceptionHandler (14, _catchException14);
+// OBSOLETE   exceptionHandler (15, _catchException15);
+// OBSOLETE   exceptionHandler (16, _catchException16);
+// OBSOLETE   /*  exceptionHandler (17, _catchException17); */
+// OBSOLETE 
+// OBSOLETE   initialized = 1;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* This function will generate a breakpoint exception.  It is used at the
+// OBSOLETE    beginning of a program to sync up with a debugger and can be used
+// OBSOLETE    otherwise as a quick means to stop program execution and "break" into
+// OBSOLETE    the debugger. */
+// OBSOLETE 
+// OBSOLETE #define BREAKPOINT() asm volatile ("       trap #2");
+// OBSOLETE 
+// OBSOLETE void 
+// OBSOLETE breakpoint (void)
+// OBSOLETE {
+// OBSOLETE   if (initialized)
+// OBSOLETE     BREAKPOINT();
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* STDOUT section:
+// OBSOLETE    Stuff pertaining to simulating stdout by sending chars to gdb to be echoed.
+// OBSOLETE    Functions: gdb_putchar(char ch)
+// OBSOLETE               gdb_puts(char *str)
+// OBSOLETE               gdb_write(char *str, int len)
+// OBSOLETE               gdb_error(char *format, char *parm)
+// OBSOLETE          */
+// OBSOLETE  
+// OBSOLETE /* Function: gdb_putchar(int)
+// OBSOLETE    Make gdb write a char to stdout.
+// OBSOLETE    Returns: the char */
+// OBSOLETE  
+// OBSOLETE static int
+// OBSOLETE gdb_putchar (int ch)
+// OBSOLETE {
+// OBSOLETE   char buf[4];
+// OBSOLETE  
+// OBSOLETE   buf[0] = 'O';
+// OBSOLETE   buf[1] = hexchars[ch >> 4];
+// OBSOLETE   buf[2] = hexchars[ch & 0x0F];
+// OBSOLETE   buf[3] = 0;
+// OBSOLETE   putpacket(buf);
+// OBSOLETE   return ch;
+// OBSOLETE }
+// OBSOLETE  
+// OBSOLETE /* Function: gdb_write(char *, int)
+// OBSOLETE    Make gdb write n bytes to stdout (not assumed to be null-terminated).
+// OBSOLETE    Returns: number of bytes written */
+// OBSOLETE  
+// OBSOLETE static int
+// OBSOLETE gdb_write (char *data, int len)
+// OBSOLETE {
+// OBSOLETE   char *buf, *cpy;
+// OBSOLETE   int i;
+// OBSOLETE  
+// OBSOLETE   buf = remcomOutBuffer;
+// OBSOLETE   buf[0] = 'O';
+// OBSOLETE   i = 0;
+// OBSOLETE   while (i < len)
+// OBSOLETE     {
+// OBSOLETE       for (cpy = buf+1; 
+// OBSOLETE       i < len && cpy < buf + sizeof(remcomOutBuffer) - 3; 
+// OBSOLETE       i++)
+// OBSOLETE    {
+// OBSOLETE      *cpy++ = hexchars[data[i] >> 4];
+// OBSOLETE      *cpy++ = hexchars[data[i] & 0x0F];
+// OBSOLETE    }
+// OBSOLETE       *cpy = 0;
+// OBSOLETE       putpacket(buf);
+// OBSOLETE     }
+// OBSOLETE   return len;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: gdb_puts(char *)
+// OBSOLETE    Make gdb write a null-terminated string to stdout.
+// OBSOLETE    Returns: the length of the string */
+// OBSOLETE  
+// OBSOLETE static int
+// OBSOLETE gdb_puts (char *str)
+// OBSOLETE {
+// OBSOLETE   return gdb_write(str, strlen(str));
+// OBSOLETE }
+// OBSOLETE  
+// OBSOLETE /* Function: gdb_error(char *, char *)
+// OBSOLETE    Send an error message to gdb's stdout.
+// OBSOLETE    First string may have 1 (one) optional "%s" in it, which
+// OBSOLETE    will cause the optional second string to be inserted.  */
+// OBSOLETE  
+// OBSOLETE static void
+// OBSOLETE gdb_error (char *format, char *parm)
+// OBSOLETE {
+// OBSOLETE   char buf[400], *cpy;
+// OBSOLETE   int len;
+// OBSOLETE  
+// OBSOLETE   if (remote_debug)
+// OBSOLETE     {
+// OBSOLETE       if (format && *format)
+// OBSOLETE    len = strlen(format);
+// OBSOLETE       else
+// OBSOLETE    return;             /* empty input */
+// OBSOLETE 
+// OBSOLETE       if (parm && *parm)
+// OBSOLETE    len += strlen(parm);
+// OBSOLETE  
+// OBSOLETE       for (cpy = buf; *format; )
+// OBSOLETE    {
+// OBSOLETE      if (format[0] == '%' && format[1] == 's') /* include second string */
+// OBSOLETE        {
+// OBSOLETE          format += 2;          /* advance two chars instead of just one */
+// OBSOLETE          while (parm && *parm)
+// OBSOLETE            *cpy++ = *parm++;
+// OBSOLETE        }
+// OBSOLETE      else
+// OBSOLETE        *cpy++ = *format++;
+// OBSOLETE    }
+// OBSOLETE       *cpy = '\0';
+// OBSOLETE       gdb_puts(buf);
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE  
+// OBSOLETE static unsigned char *
+// OBSOLETE strcpy (unsigned char *dest, const unsigned char *src)
+// OBSOLETE {
+// OBSOLETE   unsigned char *ret = dest;
+// OBSOLETE 
+// OBSOLETE   if (dest && src)
+// OBSOLETE     {
+// OBSOLETE       while (*src)
+// OBSOLETE    *dest++ = *src++;
+// OBSOLETE       *dest = 0;
+// OBSOLETE     }
+// OBSOLETE   return ret;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE strlen (const unsigned char *src)
+// OBSOLETE {
+// OBSOLETE   int ret;
+// OBSOLETE 
+// OBSOLETE   for (ret = 0; *src; src++)
+// OBSOLETE     ret++;
+// OBSOLETE 
+// OBSOLETE   return ret;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE #if 0
+// OBSOLETE void exit (code)
+// OBSOLETE      int code;
+// OBSOLETE {
+// OBSOLETE   _exit (code);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE int atexit (void *p)
+// OBSOLETE {
+// OBSOLETE   return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void abort (void)
+// OBSOLETE {
+// OBSOLETE   _exit (1);
+// OBSOLETE }
+// OBSOLETE #endif
index 6484234..93edbf9 100644 (file)
-/* Target-dependent code for the Mitsubishi m32r for GDB, the GNU debugger.
-
-   Copyright 1996, 1998, 1999, 2000, 2001, 2003 Free Software
-   Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "defs.h"
-#include "frame.h"
-#include "inferior.h"
-#include "target.h"
-#include "value.h"
-#include "bfd.h"
-#include "gdb_string.h"
-#include "gdbcore.h"
-#include "symfile.h"
-#include "regcache.h"
-
-/* Function: m32r_use_struct_convention
-   Return nonzero if call_function should allocate stack space for a
-   struct return? */
-int
-m32r_use_struct_convention (int gcc_p, struct type *type)
-{
-  return (TYPE_LENGTH (type) > 8);
-}
-
-/* Function: frame_find_saved_regs
-   Return the frame_saved_regs structure for the frame.
-   Doesn't really work for dummy frames, but it does pass back
-   an empty frame_saved_regs, so I guess that's better than total failure */
-
-void
-m32r_frame_find_saved_regs (struct frame_info *fi,
-                           struct frame_saved_regs *regaddr)
-{
-  memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
-}
-
-/* Turn this on if you want to see just how much instruction decoding
-   if being done, its quite a lot
- */
-#if 0
-static void
-dump_insn (char *commnt, CORE_ADDR pc, int insn)
-{
-  printf_filtered ("  %s %08x %08x ",
-                  commnt, (unsigned int) pc, (unsigned int) insn);
-  TARGET_PRINT_INSN (pc, &tm_print_insn_info);
-  printf_filtered ("\n");
-}
-#define insn_debug(args) { printf_filtered args; }
-#else
-#define dump_insn(a,b,c) {}
-#define insn_debug(args) {}
-#endif
-
-#define DEFAULT_SEARCH_LIMIT 44
-
-/* Function: scan_prologue
-   This function decodes the target function prologue to determine
-   1) the size of the stack frame, and 2) which registers are saved on it.
-   It saves the offsets of saved regs in the frame_saved_regs argument,
-   and returns the frame size.  */
-
-/*
-   The sequence it currently generates is:
-
-   if (varargs function) { ddi sp,#n }
-   push registers
-   if (additional stack <= 256) {       addi sp,#-stack }
-   else if (additional stack < 65k) { add3 sp,sp,#-stack
-
-   } else if (additional stack) {
-   seth sp,#(stack & 0xffff0000)
-   or3 sp,sp,#(stack & 0x0000ffff)
-   sub sp,r4
-   }
-   if (frame pointer) {
-   mv sp,fp
-   }
-
-   These instructions are scheduled like everything else, so you should stop at
-   the first branch instruction.
-
- */
-
-/* This is required by skip prologue and by m32r_init_extra_frame_info. 
-   The results of decoding a prologue should be cached because this
-   thrashing is getting nuts.
-   I am thinking of making a container class with two indexes, name and
-   address. It may be better to extend the symbol table.
- */
-
-static void
-decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit, CORE_ADDR *pl_endptr,       /* var parameter */
-                unsigned long *framelength, struct frame_info *fi,
-                struct frame_saved_regs *fsr)
-{
-  unsigned long framesize;
-  int insn;
-  int op1;
-  int maybe_one_more = 0;
-  CORE_ADDR after_prologue = 0;
-  CORE_ADDR after_stack_adjust = 0;
-  CORE_ADDR current_pc;
-
-
-  framesize = 0;
-  after_prologue = 0;
-  insn_debug (("rd prolog l(%d)\n", scan_limit - current_pc));
-
-  for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2)
-    {
-
-      insn = read_memory_unsigned_integer (current_pc, 2);
-      dump_insn ("insn-1", current_pc, insn);  /* MTZ */
-
-      /* If this is a 32 bit instruction, we dont want to examine its
-         immediate data as though it were an instruction */
-      if (current_pc & 0x02)
-       {                       /* Clear the parallel execution bit from 16 bit instruction */
-         if (maybe_one_more)
-           {                   /* The last instruction was a branch, usually terminates
-                                  the series, but if this is a parallel instruction,
-                                  it may be a stack framing instruction */
-             if (!(insn & 0x8000))
-               {
-                 insn_debug (("Really done"));
-                 break;        /* nope, we are really done */
-               }
-           }
-         insn &= 0x7fff;       /* decode this instruction further */
-       }
-      else
-       {
-         if (maybe_one_more)
-           break;              /* This isnt the one more */
-         if (insn & 0x8000)
-           {
-             insn_debug (("32 bit insn\n"));
-             if (current_pc == scan_limit)
-               scan_limit += 2;        /* extend the search */
-             current_pc += 2;  /* skip the immediate data */
-             if (insn == 0x8faf)       /* add3 sp, sp, xxxx */
-               /* add 16 bit sign-extended offset */
-               {
-                 insn_debug (("stack increment\n"));
-                 framesize += -((short) read_memory_unsigned_integer (current_pc, 2));
-               }
-             else
-               {
-                 if (((insn >> 8) == 0xe4) &&  /* ld24 r4, xxxxxx; sub sp, r4 */
-                 read_memory_unsigned_integer (current_pc + 2, 2) == 0x0f24)
-                   {           /* subtract 24 bit sign-extended negative-offset */
-                     dump_insn ("insn-2", current_pc + 2, insn);
-                     insn = read_memory_unsigned_integer (current_pc - 2, 4);
-                     dump_insn ("insn-3(l4)", current_pc - 2, insn);
-                     if (insn & 0x00800000)    /* sign extend */
-                       insn |= 0xff000000;     /* negative */
-                     else
-                       insn &= 0x00ffffff;     /* positive */
-                     framesize += insn;
-                   }
-               }
-             after_prologue = current_pc;
-             continue;
-           }
-       }
-      op1 = insn & 0xf000;     /* isolate just the first nibble */
-
-      if ((insn & 0xf0ff) == 0x207f)
-       {                       /* st reg, @-sp */
-         int regno;
-         insn_debug (("push\n"));
-#if 0                          /* No, PUSH FP is not an indication that we will use a frame pointer. */
-         if (((insn & 0xffff) == 0x2d7f) && fi)
-           fi->using_frame_pointer = 1;
-#endif
-         framesize += 4;
-#if 0
-/* Why should we increase the scan limit, just because we did a push? 
-   And if there is a reason, surely we would only want to do it if we
-   had already reached the scan limit... */
-         if (current_pc == scan_limit)
-           scan_limit += 2;
-#endif
-         regno = ((insn >> 8) & 0xf);
-         if (fsr)              /* save_regs offset */
-           fsr->regs[regno] = framesize;
-         after_prologue = 0;
-         continue;
-       }
-      if ((insn >> 8) == 0x4f) /* addi sp, xx */
-       /* add 8 bit sign-extended offset */
-       {
-         int stack_adjust = (char) (insn & 0xff);
-
-         /* there are probably two of these stack adjustments:
-            1) A negative one in the prologue, and
-            2) A positive one in the epilogue.
-            We are only interested in the first one.  */
-
-         if (stack_adjust < 0)
-           {
-             framesize -= stack_adjust;
-             after_prologue = 0;
-             /* A frameless function may have no "mv fp, sp".
-                In that case, this is the end of the prologue.  */
-             after_stack_adjust = current_pc + 2;
-           }
-         continue;
-       }
-      if (insn == 0x1d8f)
-       {                       /* mv fp, sp */
-         if (fi)
-           fi->using_frame_pointer = 1;        /* fp is now valid */
-         insn_debug (("done fp found\n"));
-         after_prologue = current_pc + 2;
-         break;                /* end of stack adjustments */
-       }
-      if (insn == 0x7000)      /* Nop looks like a branch, continue explicitly */
-       {
-         insn_debug (("nop\n"));
-         after_prologue = current_pc + 2;
-         continue;             /* nop occurs between pushes */
-       }
-      /* End of prolog if any of these are branch instructions */
-      if ((op1 == 0x7000)
-         || (op1 == 0xb000)
-         || (op1 == 0xf000))
-       {
-         after_prologue = current_pc;
-         insn_debug (("Done: branch\n"));
-         maybe_one_more = 1;
-         continue;
-       }
-      /* Some of the branch instructions are mixed with other types */
-      if (op1 == 0x1000)
-       {
-         int subop = insn & 0x0ff0;
-         if ((subop == 0x0ec0) || (subop == 0x0fc0))
-           {
-             insn_debug (("done: jmp\n"));
-             after_prologue = current_pc;
-             maybe_one_more = 1;
-             continue;         /* jmp , jl */
-           }
-       }
-    }
-
-  if (current_pc >= scan_limit)
-    {
-      if (pl_endptr)
-       {
-#if 1
-         if (after_stack_adjust != 0)
-           /* We did not find a "mv fp,sp", but we DID find
-              a stack_adjust.  Is it safe to use that as the
-              end of the prologue?  I just don't know. */
-           {
-             *pl_endptr = after_stack_adjust;
-             if (framelength)
-               *framelength = framesize;
-           }
-         else
-#endif
-           /* We reached the end of the loop without finding the end
-              of the prologue.  No way to win -- we should report failure.  
-              The way we do that is to return the original start_pc.
-              GDB will set a breakpoint at the start of the function (etc.) */
-           *pl_endptr = start_pc;
-       }
-      return;
-    }
-  if (after_prologue == 0)
-    after_prologue = current_pc;
-
-  insn_debug ((" framesize %d, firstline %08x\n", framesize, after_prologue));
-  if (framelength)
-    *framelength = framesize;
-  if (pl_endptr)
-    *pl_endptr = after_prologue;
-}                              /*  decode_prologue */
-
-/* Function: skip_prologue
-   Find end of function prologue */
-
-CORE_ADDR
-m32r_skip_prologue (CORE_ADDR pc)
-{
-  CORE_ADDR func_addr, func_end;
-  struct symtab_and_line sal;
-
-  /* See what the symbol table says */
-
-  if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
-    {
-      sal = find_pc_line (func_addr, 0);
-
-      if (sal.line != 0 && sal.end <= func_end)
-       {
-
-         insn_debug (("BP after prologue %08x\n", sal.end));
-         func_end = sal.end;
-       }
-      else
-       /* Either there's no line info, or the line after the prologue is after
-          the end of the function.  In this case, there probably isn't a
-          prologue.  */
-       {
-         insn_debug (("No line info, line(%x) sal_end(%x) funcend(%x)\n",
-                      sal.line, sal.end, func_end));
-         func_end = min (func_end, func_addr + DEFAULT_SEARCH_LIMIT);
-       }
-    }
-  else
-    func_end = pc + DEFAULT_SEARCH_LIMIT;
-  decode_prologue (pc, func_end, &sal.end, 0, 0, 0);
-  return sal.end;
-}
-
-static unsigned long
-m32r_scan_prologue (struct frame_info *fi, struct frame_saved_regs *fsr)
-{
-  struct symtab_and_line sal;
-  CORE_ADDR prologue_start, prologue_end, current_pc;
-  unsigned long framesize = 0;
-
-  /* this code essentially duplicates skip_prologue, 
-     but we need the start address below.  */
-
-  if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end))
-    {
-      sal = find_pc_line (prologue_start, 0);
-
-      if (sal.line == 0)       /* no line info, use current PC */
-       if (prologue_start == entry_point_address ())
-         return 0;
-    }
-  else
-    {
-      prologue_start = fi->pc;
-      prologue_end = prologue_start + 48;      /* We're in the boondocks: 
-                                                  allow for 16 pushes, an add, 
-                                                  and "mv fp,sp" */
-    }
-#if 0
-  prologue_end = min (prologue_end, fi->pc);
-#endif
-  insn_debug (("fipc(%08x) start(%08x) end(%08x)\n",
-              fi->pc, prologue_start, prologue_end));
-  prologue_end = min (prologue_end, prologue_start + DEFAULT_SEARCH_LIMIT);
-  decode_prologue (prologue_start, prologue_end, &prologue_end, &framesize,
-                  fi, fsr);
-  return framesize;
-}
-
-/* Function: init_extra_frame_info
-   This function actually figures out the frame address for a given pc and
-   sp.  This is tricky on the m32r because we sometimes don't use an explicit
-   frame pointer, and the previous stack pointer isn't necessarily recorded
-   on the stack.  The only reliable way to get this info is to
-   examine the prologue.  */
-
-void
-m32r_init_extra_frame_info (struct frame_info *fi)
-{
-  int reg;
-
-  if (fi->next)
-    fi->pc = FRAME_SAVED_PC (fi->next);
-
-  memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
-
-  if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
-    {
-      /* We need to setup fi->frame here because run_stack_dummy gets it wrong
-         by assuming it's always FP.  */
-      fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame,
-                                                 SP_REGNUM);
-      fi->framesize = 0;
-      return;
-    }
-  else
-    {
-      fi->using_frame_pointer = 0;
-      fi->framesize = m32r_scan_prologue (fi, &fi->fsr);
-
-      if (!fi->next)
-       if (fi->using_frame_pointer)
-         {
-           fi->frame = read_register (FP_REGNUM);
-         }
-       else
-         fi->frame = read_register (SP_REGNUM);
-      else
-       /* fi->next means this is not the innermost frame */ if (fi->using_frame_pointer)
-       /* we have an FP */
-       if (fi->next->fsr.regs[FP_REGNUM] != 0)         /* caller saved our FP */
-         fi->frame = read_memory_integer (fi->next->fsr.regs[FP_REGNUM], 4);
-      for (reg = 0; reg < NUM_REGS; reg++)
-       if (fi->fsr.regs[reg] != 0)
-         fi->fsr.regs[reg] = fi->frame + fi->framesize - fi->fsr.regs[reg];
-    }
-}
-
-/* Function: m32r_virtual_frame_pointer
-   Return the register that the function uses for a frame pointer, 
-   plus any necessary offset to be applied to the register before
-   any frame pointer offsets.  */
-
-void
-m32r_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
-{
-  struct frame_info *fi = deprecated_frame_xmalloc ();
-  struct cleanup *old_chain = make_cleanup (xfree, fi);
-
-  /* Set up a dummy frame_info. */
-  fi->next = NULL;
-  fi->prev = NULL;
-  fi->frame = 0;
-  fi->pc = pc;
-
-  /* Analyze the prolog and fill in the extra info.  */
-  m32r_init_extra_frame_info (fi);
-
-  /* Results will tell us which type of frame it uses.  */
-  if (fi->using_frame_pointer)
-    {
-      *reg = FP_REGNUM;
-      *offset = 0;
-    }
-  else
-    {
-      *reg = SP_REGNUM;
-      *offset = 0;
-    }
-  do_cleanups (old_chain);
-}
-
-/* Function: find_callers_reg
-   Find REGNUM on the stack.  Otherwise, it's in an active register.  One thing
-   we might want to do here is to check REGNUM against the clobber mask, and
-   somehow flag it as invalid if it isn't saved on the stack somewhere.  This
-   would provide a graceful failure mode when trying to get the value of
-   caller-saves registers for an inner frame.  */
-
-CORE_ADDR
-m32r_find_callers_reg (struct frame_info *fi, int regnum)
-{
-  for (; fi; fi = fi->next)
-    if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
-      return deprecated_read_register_dummy (fi->pc, fi->frame, regnum);
-    else if (fi->fsr.regs[regnum] != 0)
-      return read_memory_integer (fi->fsr.regs[regnum],
-                                 REGISTER_RAW_SIZE (regnum));
-  return read_register (regnum);
-}
-
-/* Function: frame_chain Given a GDB frame, determine the address of
-   the calling function's frame.  This will be used to create a new
-   GDB frame struct, and then INIT_EXTRA_FRAME_INFO and
-   DEPRECATED_INIT_FRAME_PC will be called for the new frame.  For
-   m32r, we save the frame size when we initialize the frame_info.  */
-
-CORE_ADDR
-m32r_frame_chain (struct frame_info *fi)
-{
-  CORE_ADDR fn_start, callers_pc, fp;
-
-  /* is this a dummy frame? */
-  if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
-    return fi->frame;          /* dummy frame same as caller's frame */
-
-  /* is caller-of-this a dummy frame? */
-  callers_pc = FRAME_SAVED_PC (fi);    /* find out who called us: */
-  fp = m32r_find_callers_reg (fi, FP_REGNUM);
-  if (DEPRECATED_PC_IN_CALL_DUMMY (callers_pc, fp, fp))
-    return fp;                 /* dummy frame's frame may bear no relation to ours */
-
-  if (find_pc_partial_function (fi->pc, 0, &fn_start, 0))
-    if (fn_start == entry_point_address ())
-      return 0;                        /* in _start fn, don't chain further */
-  if (fi->framesize == 0)
-    {
-      printf_filtered ("cannot determine frame size @ %s , pc(%s)\n",
-                      paddr (fi->frame),
-                      paddr (fi->pc));
-      return 0;
-    }
-  insn_debug (("m32rx frame %08x\n", fi->frame + fi->framesize));
-  return fi->frame + fi->framesize;
-}
-
-/* Function: push_return_address (pc)
-   Set up the return address for the inferior function call.
-   Necessary for targets that don't actually execute a JSR/BSR instruction 
-   (ie. when using an empty CALL_DUMMY) */
-
-CORE_ADDR
-m32r_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ());
-  return sp;
-}
-
-
-/* Function: pop_frame
-   Discard from the stack the innermost frame,
-   restoring all saved registers.  */
-
-struct frame_info *
-m32r_pop_frame (struct frame_info *frame)
-{
-  int regnum;
-
-  if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
-    generic_pop_dummy_frame ();
-  else
-    {
-      for (regnum = 0; regnum < NUM_REGS; regnum++)
-       if (frame->fsr.regs[regnum] != 0)
-         write_register (regnum,
-                         read_memory_integer (frame->fsr.regs[regnum], 4));
-
-      write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
-      write_register (SP_REGNUM, read_register (FP_REGNUM));
-      if (read_register (PSW_REGNUM) & 0x80)
-       write_register (SPU_REGNUM, read_register (SP_REGNUM));
-      else
-       write_register (SPI_REGNUM, read_register (SP_REGNUM));
-    }
-  flush_cached_frames ();
-  return NULL;
-}
-
-/* Function: frame_saved_pc
-   Find the caller of this frame.  We do this by seeing if RP_REGNUM is saved
-   in the stack anywhere, otherwise we get it from the registers. */
-
-CORE_ADDR
-m32r_frame_saved_pc (struct frame_info *fi)
-{
-  if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
-    return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
-  else
-    return m32r_find_callers_reg (fi, RP_REGNUM);
-}
-
-/* Function: push_arguments
-   Setup the function arguments for calling a function in the inferior.
-
-   On the Mitsubishi M32R architecture, there are four registers (R0 to R3)
-   which are dedicated for passing function arguments.  Up to the first 
-   four arguments (depending on size) may go into these registers.
-   The rest go on the stack.
-
-   Arguments that are smaller than 4 bytes will still take up a whole
-   register or a whole 32-bit word on the stack, and will be
-   right-justified in the register or the stack word.  This includes
-   chars, shorts, and small aggregate types.
-
-   Arguments of 8 bytes size are split between two registers, if 
-   available.  If only one register is available, the argument will 
-   be split between the register and the stack.  Otherwise it is
-   passed entirely on the stack.  Aggregate types with sizes between
-   4 and 8 bytes are passed entirely on the stack, and are left-justified
-   within the double-word (as opposed to aggregates smaller than 4 bytes
-   which are right-justified).
-
-   Aggregates of greater than 8 bytes are first copied onto the stack, 
-   and then a pointer to the copy is passed in the place of the normal
-   argument (either in a register if available, or on the stack).
-
-   Functions that must return an aggregate type can return it in the 
-   normal return value registers (R0 and R1) if its size is 8 bytes or
-   less.  For larger return values, the caller must allocate space for 
-   the callee to copy the return value to.  A pointer to this space is
-   passed as an implicit first argument, always in R0. */
-
-CORE_ADDR
-m32r_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
-                    unsigned char struct_return, CORE_ADDR struct_addr)
-{
-  int stack_offset, stack_alloc;
-  int argreg;
-  int argnum;
-  struct type *type;
-  CORE_ADDR regval;
-  char *val;
-  char valbuf[4];
-  int len;
-  int odd_sized_struct;
-
-  /* first force sp to a 4-byte alignment */
-  sp = sp & ~3;
-
-  argreg = ARG0_REGNUM;
-  /* The "struct return pointer" pseudo-argument goes in R0 */
-  if (struct_return)
-    write_register (argreg++, struct_addr);
-
-  /* Now make sure there's space on the stack */
-  for (argnum = 0, stack_alloc = 0;
-       argnum < nargs; argnum++)
-    stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3);
-  sp -= stack_alloc;           /* make room on stack for args */
-
-
-  /* Now load as many as possible of the first arguments into
-     registers, and push the rest onto the stack.  There are 16 bytes
-     in four registers available.  Loop thru args from first to last.  */
-
-  argreg = ARG0_REGNUM;
-  for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
-    {
-      type = VALUE_TYPE (args[argnum]);
-      len = TYPE_LENGTH (type);
-      memset (valbuf, 0, sizeof (valbuf));
-      if (len < 4)
-       {                       /* value gets right-justified in the register or stack word */
-         memcpy (valbuf + (4 - len),
-                 (char *) VALUE_CONTENTS (args[argnum]), len);
-         val = valbuf;
-       }
-      else
-       val = (char *) VALUE_CONTENTS (args[argnum]);
-
-      if (len > 4 && (len & 3) != 0)
-       odd_sized_struct = 1;   /* such structs go entirely on stack */
-      else
-       odd_sized_struct = 0;
-      while (len > 0)
-       {
-         if (argreg > ARGLAST_REGNUM || odd_sized_struct)
-           {                   /* must go on the stack */
-             write_memory (sp + stack_offset, val, 4);
-             stack_offset += 4;
-           }
-         /* NOTE WELL!!!!!  This is not an "else if" clause!!!
-            That's because some *&^%$ things get passed on the stack
-            AND in the registers!   */
-         if (argreg <= ARGLAST_REGNUM)
-           {                   /* there's room in a register */
-             regval = extract_address (val, REGISTER_RAW_SIZE (argreg));
-             write_register (argreg++, regval);
-           }
-         /* Store the value 4 bytes at a time.  This means that things
-            larger than 4 bytes may go partly in registers and partly
-            on the stack.  */
-         len -= REGISTER_RAW_SIZE (argreg);
-         val += REGISTER_RAW_SIZE (argreg);
-       }
-    }
-  return sp;
-}
-
-/* Function: fix_call_dummy 
-   If there is real CALL_DUMMY code (eg. on the stack), this function
-   has the responsability to insert the address of the actual code that
-   is the target of the target function call.  */
-
-void
-m32r_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
-                    struct value **args, struct type *type, int gcc_p)
-{
-  /* ld24 r8, <(imm24) fun> */
-  *(unsigned long *) (dummy) = (fun & 0x00ffffff) | 0xe8000000;
-}
-
-
-/* Function: m32r_write_sp
-   Because SP is really a read-only register that mirrors either SPU or SPI,
-   we must actually write one of those two as well, depending on PSW. */
-
-void
-m32r_write_sp (CORE_ADDR val)
-{
-  unsigned long psw = read_register (PSW_REGNUM);
-
-  if (psw & 0x80)              /* stack mode: user or interrupt */
-    write_register (SPU_REGNUM, val);
-  else
-    write_register (SPI_REGNUM, val);
-  write_register (SP_REGNUM, val);
-}
-
-void
-_initialize_m32r_tdep (void)
-{
-  tm_print_insn = print_insn_m32r;
-}
+// OBSOLETE /* Target-dependent code for the Mitsubishi m32r for GDB, the GNU debugger.
+// OBSOLETE 
+// OBSOLETE    Copyright 1996, 1998, 1999, 2000, 2001, 2003 Free Software
+// OBSOLETE    Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "frame.h"
+// OBSOLETE #include "inferior.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "value.h"
+// OBSOLETE #include "bfd.h"
+// OBSOLETE #include "gdb_string.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "symfile.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE /* Function: m32r_use_struct_convention
+// OBSOLETE    Return nonzero if call_function should allocate stack space for a
+// OBSOLETE    struct return? */
+// OBSOLETE int
+// OBSOLETE m32r_use_struct_convention (int gcc_p, struct type *type)
+// OBSOLETE {
+// OBSOLETE   return (TYPE_LENGTH (type) > 8);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: frame_find_saved_regs
+// OBSOLETE    Return the frame_saved_regs structure for the frame.
+// OBSOLETE    Doesn't really work for dummy frames, but it does pass back
+// OBSOLETE    an empty frame_saved_regs, so I guess that's better than total failure */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE m32r_frame_find_saved_regs (struct frame_info *fi,
+// OBSOLETE                        struct frame_saved_regs *regaddr)
+// OBSOLETE {
+// OBSOLETE   memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Turn this on if you want to see just how much instruction decoding
+// OBSOLETE    if being done, its quite a lot
+// OBSOLETE  */
+// OBSOLETE #if 0
+// OBSOLETE static void
+// OBSOLETE dump_insn (char *commnt, CORE_ADDR pc, int insn)
+// OBSOLETE {
+// OBSOLETE   printf_filtered ("  %s %08x %08x ",
+// OBSOLETE               commnt, (unsigned int) pc, (unsigned int) insn);
+// OBSOLETE   TARGET_PRINT_INSN (pc, &tm_print_insn_info);
+// OBSOLETE   printf_filtered ("\n");
+// OBSOLETE }
+// OBSOLETE #define insn_debug(args) { printf_filtered args; }
+// OBSOLETE #else
+// OBSOLETE #define dump_insn(a,b,c) {}
+// OBSOLETE #define insn_debug(args) {}
+// OBSOLETE #endif
+// OBSOLETE 
+// OBSOLETE #define DEFAULT_SEARCH_LIMIT 44
+// OBSOLETE 
+// OBSOLETE /* Function: scan_prologue
+// OBSOLETE    This function decodes the target function prologue to determine
+// OBSOLETE    1) the size of the stack frame, and 2) which registers are saved on it.
+// OBSOLETE    It saves the offsets of saved regs in the frame_saved_regs argument,
+// OBSOLETE    and returns the frame size.  */
+// OBSOLETE 
+// OBSOLETE /*
+// OBSOLETE    The sequence it currently generates is:
+// OBSOLETE 
+// OBSOLETE    if (varargs function) { ddi sp,#n }
+// OBSOLETE    push registers
+// OBSOLETE    if (additional stack <= 256) {       addi sp,#-stack }
+// OBSOLETE    else if (additional stack < 65k) { add3 sp,sp,#-stack
+// OBSOLETE 
+// OBSOLETE    } else if (additional stack) {
+// OBSOLETE    seth sp,#(stack & 0xffff0000)
+// OBSOLETE    or3 sp,sp,#(stack & 0x0000ffff)
+// OBSOLETE    sub sp,r4
+// OBSOLETE    }
+// OBSOLETE    if (frame pointer) {
+// OBSOLETE    mv sp,fp
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE    These instructions are scheduled like everything else, so you should stop at
+// OBSOLETE    the first branch instruction.
+// OBSOLETE 
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE /* This is required by skip prologue and by m32r_init_extra_frame_info. 
+// OBSOLETE    The results of decoding a prologue should be cached because this
+// OBSOLETE    thrashing is getting nuts.
+// OBSOLETE    I am thinking of making a container class with two indexes, name and
+// OBSOLETE    address. It may be better to extend the symbol table.
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit, CORE_ADDR *pl_endptr,   /* var parameter */
+// OBSOLETE             unsigned long *framelength, struct frame_info *fi,
+// OBSOLETE             struct frame_saved_regs *fsr)
+// OBSOLETE {
+// OBSOLETE   unsigned long framesize;
+// OBSOLETE   int insn;
+// OBSOLETE   int op1;
+// OBSOLETE   int maybe_one_more = 0;
+// OBSOLETE   CORE_ADDR after_prologue = 0;
+// OBSOLETE   CORE_ADDR after_stack_adjust = 0;
+// OBSOLETE   CORE_ADDR current_pc;
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE   framesize = 0;
+// OBSOLETE   after_prologue = 0;
+// OBSOLETE   insn_debug (("rd prolog l(%d)\n", scan_limit - current_pc));
+// OBSOLETE 
+// OBSOLETE   for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2)
+// OBSOLETE     {
+// OBSOLETE 
+// OBSOLETE       insn = read_memory_unsigned_integer (current_pc, 2);
+// OBSOLETE       dump_insn ("insn-1", current_pc, insn);      /* MTZ */
+// OBSOLETE 
+// OBSOLETE       /* If this is a 32 bit instruction, we dont want to examine its
+// OBSOLETE          immediate data as though it were an instruction */
+// OBSOLETE       if (current_pc & 0x02)
+// OBSOLETE    {                       /* Clear the parallel execution bit from 16 bit instruction */
+// OBSOLETE      if (maybe_one_more)
+// OBSOLETE        {                   /* The last instruction was a branch, usually terminates
+// OBSOLETE                               the series, but if this is a parallel instruction,
+// OBSOLETE                               it may be a stack framing instruction */
+// OBSOLETE          if (!(insn & 0x8000))
+// OBSOLETE            {
+// OBSOLETE              insn_debug (("Really done"));
+// OBSOLETE              break;        /* nope, we are really done */
+// OBSOLETE            }
+// OBSOLETE        }
+// OBSOLETE      insn &= 0x7fff;       /* decode this instruction further */
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      if (maybe_one_more)
+// OBSOLETE        break;              /* This isnt the one more */
+// OBSOLETE      if (insn & 0x8000)
+// OBSOLETE        {
+// OBSOLETE          insn_debug (("32 bit insn\n"));
+// OBSOLETE          if (current_pc == scan_limit)
+// OBSOLETE            scan_limit += 2;        /* extend the search */
+// OBSOLETE          current_pc += 2;  /* skip the immediate data */
+// OBSOLETE          if (insn == 0x8faf)       /* add3 sp, sp, xxxx */
+// OBSOLETE            /* add 16 bit sign-extended offset */
+// OBSOLETE            {
+// OBSOLETE              insn_debug (("stack increment\n"));
+// OBSOLETE              framesize += -((short) read_memory_unsigned_integer (current_pc, 2));
+// OBSOLETE            }
+// OBSOLETE          else
+// OBSOLETE            {
+// OBSOLETE              if (((insn >> 8) == 0xe4) &&  /* ld24 r4, xxxxxx; sub sp, r4 */
+// OBSOLETE              read_memory_unsigned_integer (current_pc + 2, 2) == 0x0f24)
+// OBSOLETE                {           /* subtract 24 bit sign-extended negative-offset */
+// OBSOLETE                  dump_insn ("insn-2", current_pc + 2, insn);
+// OBSOLETE                  insn = read_memory_unsigned_integer (current_pc - 2, 4);
+// OBSOLETE                  dump_insn ("insn-3(l4)", current_pc - 2, insn);
+// OBSOLETE                  if (insn & 0x00800000)    /* sign extend */
+// OBSOLETE                    insn |= 0xff000000;     /* negative */
+// OBSOLETE                  else
+// OBSOLETE                    insn &= 0x00ffffff;     /* positive */
+// OBSOLETE                  framesize += insn;
+// OBSOLETE                }
+// OBSOLETE            }
+// OBSOLETE          after_prologue = current_pc;
+// OBSOLETE          continue;
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE       op1 = insn & 0xf000; /* isolate just the first nibble */
+// OBSOLETE 
+// OBSOLETE       if ((insn & 0xf0ff) == 0x207f)
+// OBSOLETE    {                       /* st reg, @-sp */
+// OBSOLETE      int regno;
+// OBSOLETE      insn_debug (("push\n"));
+// OBSOLETE #if 0                              /* No, PUSH FP is not an indication that we will use a frame pointer. */
+// OBSOLETE      if (((insn & 0xffff) == 0x2d7f) && fi)
+// OBSOLETE        fi->using_frame_pointer = 1;
+// OBSOLETE #endif
+// OBSOLETE      framesize += 4;
+// OBSOLETE #if 0
+// OBSOLETE /* Why should we increase the scan limit, just because we did a push? 
+// OBSOLETE    And if there is a reason, surely we would only want to do it if we
+// OBSOLETE    had already reached the scan limit... */
+// OBSOLETE      if (current_pc == scan_limit)
+// OBSOLETE        scan_limit += 2;
+// OBSOLETE #endif
+// OBSOLETE      regno = ((insn >> 8) & 0xf);
+// OBSOLETE      if (fsr)              /* save_regs offset */
+// OBSOLETE        fsr->regs[regno] = framesize;
+// OBSOLETE      after_prologue = 0;
+// OBSOLETE      continue;
+// OBSOLETE    }
+// OBSOLETE       if ((insn >> 8) == 0x4f)     /* addi sp, xx */
+// OBSOLETE    /* add 8 bit sign-extended offset */
+// OBSOLETE    {
+// OBSOLETE      int stack_adjust = (char) (insn & 0xff);
+// OBSOLETE 
+// OBSOLETE      /* there are probably two of these stack adjustments:
+// OBSOLETE         1) A negative one in the prologue, and
+// OBSOLETE         2) A positive one in the epilogue.
+// OBSOLETE         We are only interested in the first one.  */
+// OBSOLETE 
+// OBSOLETE      if (stack_adjust < 0)
+// OBSOLETE        {
+// OBSOLETE          framesize -= stack_adjust;
+// OBSOLETE          after_prologue = 0;
+// OBSOLETE          /* A frameless function may have no "mv fp, sp".
+// OBSOLETE             In that case, this is the end of the prologue.  */
+// OBSOLETE          after_stack_adjust = current_pc + 2;
+// OBSOLETE        }
+// OBSOLETE      continue;
+// OBSOLETE    }
+// OBSOLETE       if (insn == 0x1d8f)
+// OBSOLETE    {                       /* mv fp, sp */
+// OBSOLETE      if (fi)
+// OBSOLETE        fi->using_frame_pointer = 1;        /* fp is now valid */
+// OBSOLETE      insn_debug (("done fp found\n"));
+// OBSOLETE      after_prologue = current_pc + 2;
+// OBSOLETE      break;                /* end of stack adjustments */
+// OBSOLETE    }
+// OBSOLETE       if (insn == 0x7000)  /* Nop looks like a branch, continue explicitly */
+// OBSOLETE    {
+// OBSOLETE      insn_debug (("nop\n"));
+// OBSOLETE      after_prologue = current_pc + 2;
+// OBSOLETE      continue;             /* nop occurs between pushes */
+// OBSOLETE    }
+// OBSOLETE       /* End of prolog if any of these are branch instructions */
+// OBSOLETE       if ((op1 == 0x7000)
+// OBSOLETE      || (op1 == 0xb000)
+// OBSOLETE      || (op1 == 0xf000))
+// OBSOLETE    {
+// OBSOLETE      after_prologue = current_pc;
+// OBSOLETE      insn_debug (("Done: branch\n"));
+// OBSOLETE      maybe_one_more = 1;
+// OBSOLETE      continue;
+// OBSOLETE    }
+// OBSOLETE       /* Some of the branch instructions are mixed with other types */
+// OBSOLETE       if (op1 == 0x1000)
+// OBSOLETE    {
+// OBSOLETE      int subop = insn & 0x0ff0;
+// OBSOLETE      if ((subop == 0x0ec0) || (subop == 0x0fc0))
+// OBSOLETE        {
+// OBSOLETE          insn_debug (("done: jmp\n"));
+// OBSOLETE          after_prologue = current_pc;
+// OBSOLETE          maybe_one_more = 1;
+// OBSOLETE          continue;         /* jmp , jl */
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   if (current_pc >= scan_limit)
+// OBSOLETE     {
+// OBSOLETE       if (pl_endptr)
+// OBSOLETE    {
+// OBSOLETE #if 1
+// OBSOLETE      if (after_stack_adjust != 0)
+// OBSOLETE        /* We did not find a "mv fp,sp", but we DID find
+// OBSOLETE           a stack_adjust.  Is it safe to use that as the
+// OBSOLETE           end of the prologue?  I just don't know. */
+// OBSOLETE        {
+// OBSOLETE          *pl_endptr = after_stack_adjust;
+// OBSOLETE          if (framelength)
+// OBSOLETE            *framelength = framesize;
+// OBSOLETE        }
+// OBSOLETE      else
+// OBSOLETE #endif
+// OBSOLETE        /* We reached the end of the loop without finding the end
+// OBSOLETE           of the prologue.  No way to win -- we should report failure.  
+// OBSOLETE           The way we do that is to return the original start_pc.
+// OBSOLETE           GDB will set a breakpoint at the start of the function (etc.) */
+// OBSOLETE        *pl_endptr = start_pc;
+// OBSOLETE    }
+// OBSOLETE       return;
+// OBSOLETE     }
+// OBSOLETE   if (after_prologue == 0)
+// OBSOLETE     after_prologue = current_pc;
+// OBSOLETE 
+// OBSOLETE   insn_debug ((" framesize %d, firstline %08x\n", framesize, after_prologue));
+// OBSOLETE   if (framelength)
+// OBSOLETE     *framelength = framesize;
+// OBSOLETE   if (pl_endptr)
+// OBSOLETE     *pl_endptr = after_prologue;
+// OBSOLETE }                          /*  decode_prologue */
+// OBSOLETE 
+// OBSOLETE /* Function: skip_prologue
+// OBSOLETE    Find end of function prologue */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE m32r_skip_prologue (CORE_ADDR pc)
+// OBSOLETE {
+// OBSOLETE   CORE_ADDR func_addr, func_end;
+// OBSOLETE   struct symtab_and_line sal;
+// OBSOLETE 
+// OBSOLETE   /* See what the symbol table says */
+// OBSOLETE 
+// OBSOLETE   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+// OBSOLETE     {
+// OBSOLETE       sal = find_pc_line (func_addr, 0);
+// OBSOLETE 
+// OBSOLETE       if (sal.line != 0 && sal.end <= func_end)
+// OBSOLETE    {
+// OBSOLETE 
+// OBSOLETE      insn_debug (("BP after prologue %08x\n", sal.end));
+// OBSOLETE      func_end = sal.end;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    /* Either there's no line info, or the line after the prologue is after
+// OBSOLETE       the end of the function.  In this case, there probably isn't a
+// OBSOLETE       prologue.  */
+// OBSOLETE    {
+// OBSOLETE      insn_debug (("No line info, line(%x) sal_end(%x) funcend(%x)\n",
+// OBSOLETE                   sal.line, sal.end, func_end));
+// OBSOLETE      func_end = min (func_end, func_addr + DEFAULT_SEARCH_LIMIT);
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     func_end = pc + DEFAULT_SEARCH_LIMIT;
+// OBSOLETE   decode_prologue (pc, func_end, &sal.end, 0, 0, 0);
+// OBSOLETE   return sal.end;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static unsigned long
+// OBSOLETE m32r_scan_prologue (struct frame_info *fi, struct frame_saved_regs *fsr)
+// OBSOLETE {
+// OBSOLETE   struct symtab_and_line sal;
+// OBSOLETE   CORE_ADDR prologue_start, prologue_end, current_pc;
+// OBSOLETE   unsigned long framesize = 0;
+// OBSOLETE 
+// OBSOLETE   /* this code essentially duplicates skip_prologue, 
+// OBSOLETE      but we need the start address below.  */
+// OBSOLETE 
+// OBSOLETE   if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end))
+// OBSOLETE     {
+// OBSOLETE       sal = find_pc_line (prologue_start, 0);
+// OBSOLETE 
+// OBSOLETE       if (sal.line == 0)   /* no line info, use current PC */
+// OBSOLETE    if (prologue_start == entry_point_address ())
+// OBSOLETE      return 0;
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       prologue_start = fi->pc;
+// OBSOLETE       prologue_end = prologue_start + 48;  /* We're in the boondocks: 
+// OBSOLETE                                               allow for 16 pushes, an add, 
+// OBSOLETE                                               and "mv fp,sp" */
+// OBSOLETE     }
+// OBSOLETE #if 0
+// OBSOLETE   prologue_end = min (prologue_end, fi->pc);
+// OBSOLETE #endif
+// OBSOLETE   insn_debug (("fipc(%08x) start(%08x) end(%08x)\n",
+// OBSOLETE           fi->pc, prologue_start, prologue_end));
+// OBSOLETE   prologue_end = min (prologue_end, prologue_start + DEFAULT_SEARCH_LIMIT);
+// OBSOLETE   decode_prologue (prologue_start, prologue_end, &prologue_end, &framesize,
+// OBSOLETE               fi, fsr);
+// OBSOLETE   return framesize;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: init_extra_frame_info
+// OBSOLETE    This function actually figures out the frame address for a given pc and
+// OBSOLETE    sp.  This is tricky on the m32r because we sometimes don't use an explicit
+// OBSOLETE    frame pointer, and the previous stack pointer isn't necessarily recorded
+// OBSOLETE    on the stack.  The only reliable way to get this info is to
+// OBSOLETE    examine the prologue.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE m32r_init_extra_frame_info (struct frame_info *fi)
+// OBSOLETE {
+// OBSOLETE   int reg;
+// OBSOLETE 
+// OBSOLETE   if (fi->next)
+// OBSOLETE     fi->pc = FRAME_SAVED_PC (fi->next);
+// OBSOLETE 
+// OBSOLETE   memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
+// OBSOLETE 
+// OBSOLETE   if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+// OBSOLETE     {
+// OBSOLETE       /* We need to setup fi->frame here because run_stack_dummy gets it wrong
+// OBSOLETE          by assuming it's always FP.  */
+// OBSOLETE       fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame,
+// OBSOLETE                                              SP_REGNUM);
+// OBSOLETE       fi->framesize = 0;
+// OBSOLETE       return;
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       fi->using_frame_pointer = 0;
+// OBSOLETE       fi->framesize = m32r_scan_prologue (fi, &fi->fsr);
+// OBSOLETE 
+// OBSOLETE       if (!fi->next)
+// OBSOLETE    if (fi->using_frame_pointer)
+// OBSOLETE      {
+// OBSOLETE        fi->frame = read_register (FP_REGNUM);
+// OBSOLETE      }
+// OBSOLETE    else
+// OBSOLETE      fi->frame = read_register (SP_REGNUM);
+// OBSOLETE       else
+// OBSOLETE    /* fi->next means this is not the innermost frame */ if (fi->using_frame_pointer)
+// OBSOLETE    /* we have an FP */
+// OBSOLETE    if (fi->next->fsr.regs[FP_REGNUM] != 0)         /* caller saved our FP */
+// OBSOLETE      fi->frame = read_memory_integer (fi->next->fsr.regs[FP_REGNUM], 4);
+// OBSOLETE       for (reg = 0; reg < NUM_REGS; reg++)
+// OBSOLETE    if (fi->fsr.regs[reg] != 0)
+// OBSOLETE      fi->fsr.regs[reg] = fi->frame + fi->framesize - fi->fsr.regs[reg];
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: m32r_virtual_frame_pointer
+// OBSOLETE    Return the register that the function uses for a frame pointer, 
+// OBSOLETE    plus any necessary offset to be applied to the register before
+// OBSOLETE    any frame pointer offsets.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE m32r_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
+// OBSOLETE {
+// OBSOLETE   struct frame_info *fi = deprecated_frame_xmalloc ();
+// OBSOLETE   struct cleanup *old_chain = make_cleanup (xfree, fi);
+// OBSOLETE 
+// OBSOLETE   /* Set up a dummy frame_info. */
+// OBSOLETE   fi->next = NULL;
+// OBSOLETE   fi->prev = NULL;
+// OBSOLETE   fi->frame = 0;
+// OBSOLETE   fi->pc = pc;
+// OBSOLETE 
+// OBSOLETE   /* Analyze the prolog and fill in the extra info.  */
+// OBSOLETE   m32r_init_extra_frame_info (fi);
+// OBSOLETE 
+// OBSOLETE   /* Results will tell us which type of frame it uses.  */
+// OBSOLETE   if (fi->using_frame_pointer)
+// OBSOLETE     {
+// OBSOLETE       *reg = FP_REGNUM;
+// OBSOLETE       *offset = 0;
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       *reg = SP_REGNUM;
+// OBSOLETE       *offset = 0;
+// OBSOLETE     }
+// OBSOLETE   do_cleanups (old_chain);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: find_callers_reg
+// OBSOLETE    Find REGNUM on the stack.  Otherwise, it's in an active register.  One thing
+// OBSOLETE    we might want to do here is to check REGNUM against the clobber mask, and
+// OBSOLETE    somehow flag it as invalid if it isn't saved on the stack somewhere.  This
+// OBSOLETE    would provide a graceful failure mode when trying to get the value of
+// OBSOLETE    caller-saves registers for an inner frame.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE m32r_find_callers_reg (struct frame_info *fi, int regnum)
+// OBSOLETE {
+// OBSOLETE   for (; fi; fi = fi->next)
+// OBSOLETE     if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+// OBSOLETE       return deprecated_read_register_dummy (fi->pc, fi->frame, regnum);
+// OBSOLETE     else if (fi->fsr.regs[regnum] != 0)
+// OBSOLETE       return read_memory_integer (fi->fsr.regs[regnum],
+// OBSOLETE                              REGISTER_RAW_SIZE (regnum));
+// OBSOLETE   return read_register (regnum);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: frame_chain Given a GDB frame, determine the address of
+// OBSOLETE    the calling function's frame.  This will be used to create a new
+// OBSOLETE    GDB frame struct, and then INIT_EXTRA_FRAME_INFO and
+// OBSOLETE    DEPRECATED_INIT_FRAME_PC will be called for the new frame.  For
+// OBSOLETE    m32r, we save the frame size when we initialize the frame_info.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE m32r_frame_chain (struct frame_info *fi)
+// OBSOLETE {
+// OBSOLETE   CORE_ADDR fn_start, callers_pc, fp;
+// OBSOLETE 
+// OBSOLETE   /* is this a dummy frame? */
+// OBSOLETE   if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+// OBSOLETE     return fi->frame;              /* dummy frame same as caller's frame */
+// OBSOLETE 
+// OBSOLETE   /* is caller-of-this a dummy frame? */
+// OBSOLETE   callers_pc = FRAME_SAVED_PC (fi);        /* find out who called us: */
+// OBSOLETE   fp = m32r_find_callers_reg (fi, FP_REGNUM);
+// OBSOLETE   if (DEPRECATED_PC_IN_CALL_DUMMY (callers_pc, fp, fp))
+// OBSOLETE     return fp;                     /* dummy frame's frame may bear no relation to ours */
+// OBSOLETE 
+// OBSOLETE   if (find_pc_partial_function (fi->pc, 0, &fn_start, 0))
+// OBSOLETE     if (fn_start == entry_point_address ())
+// OBSOLETE       return 0;                    /* in _start fn, don't chain further */
+// OBSOLETE   if (fi->framesize == 0)
+// OBSOLETE     {
+// OBSOLETE       printf_filtered ("cannot determine frame size @ %s , pc(%s)\n",
+// OBSOLETE                   paddr (fi->frame),
+// OBSOLETE                   paddr (fi->pc));
+// OBSOLETE       return 0;
+// OBSOLETE     }
+// OBSOLETE   insn_debug (("m32rx frame %08x\n", fi->frame + fi->framesize));
+// OBSOLETE   return fi->frame + fi->framesize;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: push_return_address (pc)
+// OBSOLETE    Set up the return address for the inferior function call.
+// OBSOLETE    Necessary for targets that don't actually execute a JSR/BSR instruction 
+// OBSOLETE    (ie. when using an empty CALL_DUMMY) */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE m32r_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
+// OBSOLETE {
+// OBSOLETE   write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ());
+// OBSOLETE   return sp;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* Function: pop_frame
+// OBSOLETE    Discard from the stack the innermost frame,
+// OBSOLETE    restoring all saved registers.  */
+// OBSOLETE 
+// OBSOLETE struct frame_info *
+// OBSOLETE m32r_pop_frame (struct frame_info *frame)
+// OBSOLETE {
+// OBSOLETE   int regnum;
+// OBSOLETE 
+// OBSOLETE   if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+// OBSOLETE     generic_pop_dummy_frame ();
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       for (regnum = 0; regnum < NUM_REGS; regnum++)
+// OBSOLETE    if (frame->fsr.regs[regnum] != 0)
+// OBSOLETE      write_register (regnum,
+// OBSOLETE                      read_memory_integer (frame->fsr.regs[regnum], 4));
+// OBSOLETE 
+// OBSOLETE       write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+// OBSOLETE       write_register (SP_REGNUM, read_register (FP_REGNUM));
+// OBSOLETE       if (read_register (PSW_REGNUM) & 0x80)
+// OBSOLETE    write_register (SPU_REGNUM, read_register (SP_REGNUM));
+// OBSOLETE       else
+// OBSOLETE    write_register (SPI_REGNUM, read_register (SP_REGNUM));
+// OBSOLETE     }
+// OBSOLETE   flush_cached_frames ();
+// OBSOLETE   return NULL;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: frame_saved_pc
+// OBSOLETE    Find the caller of this frame.  We do this by seeing if RP_REGNUM is saved
+// OBSOLETE    in the stack anywhere, otherwise we get it from the registers. */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE m32r_frame_saved_pc (struct frame_info *fi)
+// OBSOLETE {
+// OBSOLETE   if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+// OBSOLETE     return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
+// OBSOLETE   else
+// OBSOLETE     return m32r_find_callers_reg (fi, RP_REGNUM);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: push_arguments
+// OBSOLETE    Setup the function arguments for calling a function in the inferior.
+// OBSOLETE 
+// OBSOLETE    On the Mitsubishi M32R architecture, there are four registers (R0 to R3)
+// OBSOLETE    which are dedicated for passing function arguments.  Up to the first 
+// OBSOLETE    four arguments (depending on size) may go into these registers.
+// OBSOLETE    The rest go on the stack.
+// OBSOLETE 
+// OBSOLETE    Arguments that are smaller than 4 bytes will still take up a whole
+// OBSOLETE    register or a whole 32-bit word on the stack, and will be
+// OBSOLETE    right-justified in the register or the stack word.  This includes
+// OBSOLETE    chars, shorts, and small aggregate types.
+// OBSOLETE 
+// OBSOLETE    Arguments of 8 bytes size are split between two registers, if 
+// OBSOLETE    available.  If only one register is available, the argument will 
+// OBSOLETE    be split between the register and the stack.  Otherwise it is
+// OBSOLETE    passed entirely on the stack.  Aggregate types with sizes between
+// OBSOLETE    4 and 8 bytes are passed entirely on the stack, and are left-justified
+// OBSOLETE    within the double-word (as opposed to aggregates smaller than 4 bytes
+// OBSOLETE    which are right-justified).
+// OBSOLETE 
+// OBSOLETE    Aggregates of greater than 8 bytes are first copied onto the stack, 
+// OBSOLETE    and then a pointer to the copy is passed in the place of the normal
+// OBSOLETE    argument (either in a register if available, or on the stack).
+// OBSOLETE 
+// OBSOLETE    Functions that must return an aggregate type can return it in the 
+// OBSOLETE    normal return value registers (R0 and R1) if its size is 8 bytes or
+// OBSOLETE    less.  For larger return values, the caller must allocate space for 
+// OBSOLETE    the callee to copy the return value to.  A pointer to this space is
+// OBSOLETE    passed as an implicit first argument, always in R0. */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE m32r_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+// OBSOLETE                 unsigned char struct_return, CORE_ADDR struct_addr)
+// OBSOLETE {
+// OBSOLETE   int stack_offset, stack_alloc;
+// OBSOLETE   int argreg;
+// OBSOLETE   int argnum;
+// OBSOLETE   struct type *type;
+// OBSOLETE   CORE_ADDR regval;
+// OBSOLETE   char *val;
+// OBSOLETE   char valbuf[4];
+// OBSOLETE   int len;
+// OBSOLETE   int odd_sized_struct;
+// OBSOLETE 
+// OBSOLETE   /* first force sp to a 4-byte alignment */
+// OBSOLETE   sp = sp & ~3;
+// OBSOLETE 
+// OBSOLETE   argreg = ARG0_REGNUM;
+// OBSOLETE   /* The "struct return pointer" pseudo-argument goes in R0 */
+// OBSOLETE   if (struct_return)
+// OBSOLETE     write_register (argreg++, struct_addr);
+// OBSOLETE 
+// OBSOLETE   /* Now make sure there's space on the stack */
+// OBSOLETE   for (argnum = 0, stack_alloc = 0;
+// OBSOLETE        argnum < nargs; argnum++)
+// OBSOLETE     stack_alloc += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3);
+// OBSOLETE   sp -= stack_alloc;               /* make room on stack for args */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE   /* Now load as many as possible of the first arguments into
+// OBSOLETE      registers, and push the rest onto the stack.  There are 16 bytes
+// OBSOLETE      in four registers available.  Loop thru args from first to last.  */
+// OBSOLETE 
+// OBSOLETE   argreg = ARG0_REGNUM;
+// OBSOLETE   for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
+// OBSOLETE     {
+// OBSOLETE       type = VALUE_TYPE (args[argnum]);
+// OBSOLETE       len = TYPE_LENGTH (type);
+// OBSOLETE       memset (valbuf, 0, sizeof (valbuf));
+// OBSOLETE       if (len < 4)
+// OBSOLETE    {                       /* value gets right-justified in the register or stack word */
+// OBSOLETE      memcpy (valbuf + (4 - len),
+// OBSOLETE              (char *) VALUE_CONTENTS (args[argnum]), len);
+// OBSOLETE      val = valbuf;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    val = (char *) VALUE_CONTENTS (args[argnum]);
+// OBSOLETE 
+// OBSOLETE       if (len > 4 && (len & 3) != 0)
+// OBSOLETE    odd_sized_struct = 1;   /* such structs go entirely on stack */
+// OBSOLETE       else
+// OBSOLETE    odd_sized_struct = 0;
+// OBSOLETE       while (len > 0)
+// OBSOLETE    {
+// OBSOLETE      if (argreg > ARGLAST_REGNUM || odd_sized_struct)
+// OBSOLETE        {                   /* must go on the stack */
+// OBSOLETE          write_memory (sp + stack_offset, val, 4);
+// OBSOLETE          stack_offset += 4;
+// OBSOLETE        }
+// OBSOLETE      /* NOTE WELL!!!!!  This is not an "else if" clause!!!
+// OBSOLETE         That's because some *&^%$ things get passed on the stack
+// OBSOLETE         AND in the registers!   */
+// OBSOLETE      if (argreg <= ARGLAST_REGNUM)
+// OBSOLETE        {                   /* there's room in a register */
+// OBSOLETE          regval = extract_address (val, REGISTER_RAW_SIZE (argreg));
+// OBSOLETE          write_register (argreg++, regval);
+// OBSOLETE        }
+// OBSOLETE      /* Store the value 4 bytes at a time.  This means that things
+// OBSOLETE         larger than 4 bytes may go partly in registers and partly
+// OBSOLETE         on the stack.  */
+// OBSOLETE      len -= REGISTER_RAW_SIZE (argreg);
+// OBSOLETE      val += REGISTER_RAW_SIZE (argreg);
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE   return sp;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: fix_call_dummy 
+// OBSOLETE    If there is real CALL_DUMMY code (eg. on the stack), this function
+// OBSOLETE    has the responsability to insert the address of the actual code that
+// OBSOLETE    is the target of the target function call.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE m32r_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs,
+// OBSOLETE                 struct value **args, struct type *type, int gcc_p)
+// OBSOLETE {
+// OBSOLETE   /* ld24 r8, <(imm24) fun> */
+// OBSOLETE   *(unsigned long *) (dummy) = (fun & 0x00ffffff) | 0xe8000000;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* Function: m32r_write_sp
+// OBSOLETE    Because SP is really a read-only register that mirrors either SPU or SPI,
+// OBSOLETE    we must actually write one of those two as well, depending on PSW. */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE m32r_write_sp (CORE_ADDR val)
+// OBSOLETE {
+// OBSOLETE   unsigned long psw = read_register (PSW_REGNUM);
+// OBSOLETE 
+// OBSOLETE   if (psw & 0x80)          /* stack mode: user or interrupt */
+// OBSOLETE     write_register (SPU_REGNUM, val);
+// OBSOLETE   else
+// OBSOLETE     write_register (SPI_REGNUM, val);
+// OBSOLETE   write_register (SP_REGNUM, val);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE _initialize_m32r_tdep (void)
+// OBSOLETE {
+// OBSOLETE   tm_print_insn = print_insn_m32r;
+// OBSOLETE }
index 69c54d1..6af823e 100644 (file)
@@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "objfiles.h"
 #include "arch-utils.h"
 #include "regcache.h"
+#include "reggroups.h"
 
 #include "target.h"
 #include "opcode/m68hc11.h"
@@ -441,7 +442,7 @@ m68hc11_pop_frame (void)
   else
     {
       fp = get_frame_base (frame);
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
       /* Copy regs from where they were saved in the frame.  */
       for (regnum = 0; regnum < M68HC11_ALL_REGS; regnum++)
@@ -464,24 +465,27 @@ m68hc11_pop_frame (void)
 
 /* 68HC11 opcodes.  */
 #undef M6811_OP_PAGE2
-#define M6811_OP_PAGE2 (0x18)
-#define M6811_OP_LDX   (0xde)
-#define M6811_OP_PSHX  (0x3c)
-#define M6811_OP_STS   (0x9f)
-#define M6811_OP_TSX   (0x30)
-#define M6811_OP_XGDX  (0x8f)
-#define M6811_OP_ADDD  (0xc3)
-#define M6811_OP_TXS   (0x35)
-#define M6811_OP_DES   (0x34)
+#define M6811_OP_PAGE2   (0x18)
+#define M6811_OP_LDX     (0xde)
+#define M6811_OP_LDX_EXT (0xfe)
+#define M6811_OP_PSHX    (0x3c)
+#define M6811_OP_STS     (0x9f)
+#define M6811_OP_STS_EXT (0xbf)
+#define M6811_OP_TSX     (0x30)
+#define M6811_OP_XGDX    (0x8f)
+#define M6811_OP_ADDD    (0xc3)
+#define M6811_OP_TXS     (0x35)
+#define M6811_OP_DES     (0x34)
 
 /* 68HC12 opcodes.  */
-#define M6812_OP_PAGE2 (0x18)
-#define M6812_OP_MOVW  (0x01)
-#define M6812_PB_PSHW  (0xae)
-#define M6812_OP_STS   (0x7f)
-#define M6812_OP_LEAS  (0x1b)
-#define M6812_OP_PSHX  (0x34)
-#define M6812_OP_PSHY  (0x35)
+#define M6812_OP_PAGE2   (0x18)
+#define M6812_OP_MOVW    (0x01)
+#define M6812_PB_PSHW    (0xae)
+#define M6812_OP_STS     (0x5f)
+#define M6812_OP_STS_EXT (0x7f)
+#define M6812_OP_LEAS    (0x1b)
+#define M6812_OP_PSHX    (0x34)
+#define M6812_OP_PSHY    (0x35)
 
 /* Operand extraction.  */
 #define OP_DIRECT      (0x100) /* 8-byte direct addressing.  */
@@ -513,6 +517,10 @@ static struct insn_sequence m6811_prologue[] = {
                      M6811_OP_PSHX } },
   { P_SAVE_REG, 5, { M6811_OP_PAGE2, M6811_OP_LDX, OP_DIRECT,
                      M6811_OP_PAGE2, M6811_OP_PSHX } },
+  { P_SAVE_REG, 4, { M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
+                     M6811_OP_PSHX } },
+  { P_SAVE_REG, 6, { M6811_OP_PAGE2, M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
+                     M6811_OP_PAGE2, M6811_OP_PSHX } },
 
   /* Sequences to allocate local variables.  */
   { P_LOCAL_N,  7, { M6811_OP_TSX,
@@ -531,6 +539,7 @@ static struct insn_sequence m6811_prologue[] = {
 
   /* Initialize the frame pointer.  */
   { P_SET_FRAME, 2, { M6811_OP_STS, OP_DIRECT } },
+  { P_SET_FRAME, 3, { M6811_OP_STS_EXT, OP_IMM_HIGH, OP_IMM_LOW } },
   { P_LAST, 0, { 0 } }
 };
 
@@ -539,7 +548,8 @@ static struct insn_sequence m6811_prologue[] = {
 static struct insn_sequence m6812_prologue[] = {  
   { P_SAVE_REG,  5, { M6812_OP_PAGE2, M6812_OP_MOVW, M6812_PB_PSHW,
                       OP_IMM_HIGH, OP_IMM_LOW } },
-  { P_SET_FRAME, 3, { M6812_OP_STS, OP_IMM_HIGH, OP_IMM_LOW } },
+  { P_SET_FRAME, 2, { M6812_OP_STS, OP_DIRECT } },
+  { P_SET_FRAME, 3, { M6812_OP_STS_EXT, OP_IMM_HIGH, OP_IMM_LOW } },
   { P_LOCAL_N,   2, { M6812_OP_LEAS, OP_PBYTE } },
   { P_LOCAL_2,   1, { M6812_OP_PSHX } },
   { P_LOCAL_2,   1, { M6812_OP_PSHY } },
@@ -806,8 +816,8 @@ m68hc11_skip_prologue (CORE_ADDR pc)
 
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame.  */
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame.  */
 
 static CORE_ADDR
 m68hc11_frame_chain (struct frame_info *frame)
@@ -1205,6 +1215,66 @@ gdb_print_insn_m68hc11 (bfd_vma memaddr, disassemble_info *info)
     return print_insn_m68hc12 (memaddr, info);
 }
 
+\f
+
+/* 68HC11/68HC12 register groups.
+   Identify real hard registers and soft registers used by gcc.  */
+
+static struct reggroup *m68hc11_soft_reggroup;
+static struct reggroup *m68hc11_hard_reggroup;
+
+static void
+m68hc11_init_reggroups (void)
+{
+  m68hc11_hard_reggroup = reggroup_new ("hard", USER_REGGROUP);
+  m68hc11_soft_reggroup = reggroup_new ("soft", USER_REGGROUP);
+}
+
+static void
+m68hc11_add_reggroups (struct gdbarch *gdbarch)
+{
+  reggroup_add (gdbarch, m68hc11_hard_reggroup);
+  reggroup_add (gdbarch, m68hc11_soft_reggroup);
+  reggroup_add (gdbarch, general_reggroup);
+  reggroup_add (gdbarch, float_reggroup);
+  reggroup_add (gdbarch, all_reggroup);
+  reggroup_add (gdbarch, save_reggroup);
+  reggroup_add (gdbarch, restore_reggroup);
+  reggroup_add (gdbarch, vector_reggroup);
+  reggroup_add (gdbarch, system_reggroup);
+}
+
+static int
+m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+                             struct reggroup *group)
+{
+  /* We must save the real hard register as well as gcc
+     soft registers including the frame pointer.  */
+  if (group == save_reggroup || group == restore_reggroup)
+    {
+      return (regnum <= gdbarch_num_regs (gdbarch)
+              || ((regnum == SOFT_FP_REGNUM
+                   || regnum == SOFT_TMP_REGNUM
+                   || regnum == SOFT_ZS_REGNUM
+                   || regnum == SOFT_XY_REGNUM)
+                  && m68hc11_register_name (regnum)));
+    }
+
+  /* Group to identify gcc soft registers (d1..dN).  */
+  if (group == m68hc11_soft_reggroup)
+    {
+      return regnum >= SOFT_D1_REGNUM && m68hc11_register_name (regnum);
+    }
+
+  if (group == m68hc11_hard_reggroup)
+    {
+      return regnum == HARD_PC_REGNUM || regnum == HARD_SP_REGNUM
+        || regnum == HARD_X_REGNUM || regnum == HARD_D_REGNUM
+        || regnum == HARD_Y_REGNUM || regnum == HARD_CCR_REGNUM;
+    }
+  return default_register_reggroup_p (gdbarch, regnum, group);
+}
+
 static struct gdbarch *
 m68hc11_gdbarch_init (struct gdbarch_info info,
                       struct gdbarch_list *arches)
@@ -1283,16 +1353,16 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_int_bit (gdbarch, elf_flags & E_M68HC11_I32 ? 32 : 16);
   set_gdbarch_float_bit (gdbarch, 32);
   set_gdbarch_double_bit (gdbarch, elf_flags & E_M68HC11_F64 ? 64 : 32);
-  set_gdbarch_long_double_bit (gdbarch, elf_flags & E_M68HC11_F64 ? 64 : 32);
+  set_gdbarch_long_double_bit (gdbarch, 64);
   set_gdbarch_long_bit (gdbarch, 32);
   set_gdbarch_ptr_bit (gdbarch, 16);
   set_gdbarch_long_long_bit (gdbarch, 64);
 
   /* Set register info.  */
   set_gdbarch_fp0_regnum (gdbarch, -1);
-  set_gdbarch_max_register_raw_size (gdbarch, 2);
-  set_gdbarch_max_register_virtual_size (gdbarch, 2);
-  set_gdbarch_frame_init_saved_regs (gdbarch, m68hc11_frame_init_saved_regs);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 2);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 2);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68hc11_frame_init_saved_regs);
   set_gdbarch_frame_args_skip (gdbarch, 0);
 
   set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
@@ -1324,7 +1394,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address);
   set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack);
 
@@ -1348,7 +1417,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_deprecated_extract_struct_value_address
     (gdbarch, m68hc11_extract_struct_value_address);
   set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention);
-  set_gdbarch_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info);
   set_gdbarch_pop_frame (gdbarch, m68hc11_pop_frame);
   set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -1358,6 +1427,9 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_stack_align (gdbarch, m68hc11_stack_align);
   set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11);
 
+  m68hc11_add_reggroups (gdbarch);
+  set_gdbarch_register_reggroup_p (gdbarch, m68hc11_register_reggroup_p);
+
   /* Minsymbol frobbing.  */
   set_gdbarch_elf_make_msymbol_special (gdbarch,
                                         m68hc11_elf_make_msymbol_special);
@@ -1372,6 +1444,7 @@ _initialize_m68hc11_tdep (void)
 {
   register_gdbarch_init (bfd_arch_m68hc11, m68hc11_gdbarch_init);
   register_gdbarch_init (bfd_arch_m68hc12, m68hc11_gdbarch_init);
+  m68hc11_init_reggroups ();
 
   add_com ("regs", class_vars, show_regs, "Print all registers");
 } 
index 182cac6..6008a62 100644 (file)
@@ -1012,7 +1012,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_chain (gdbarch, m68k_frame_chain);
   set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc);
-  set_gdbarch_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs);
   set_gdbarch_frameless_function_invocation (gdbarch,
                                             m68k_frameless_function_invocation);
   /* OK to default this value to 'unknown'. */
@@ -1021,8 +1021,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size);
   set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 12);
-  set_gdbarch_max_register_virtual_size (gdbarch, 12);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 12);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 12);
   set_gdbarch_register_virtual_type (gdbarch, m68k_register_virtual_type);
   set_gdbarch_register_name (gdbarch, m68k_register_name);
   set_gdbarch_register_size (gdbarch, 4);
@@ -1050,7 +1050,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (call_dummy_words));
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
   set_gdbarch_fix_call_dummy (gdbarch, m68k_fix_call_dummy);
-  set_gdbarch_push_dummy_frame (gdbarch, m68k_push_dummy_frame);
+  set_gdbarch_deprecated_push_dummy_frame (gdbarch, m68k_push_dummy_frame);
   set_gdbarch_pop_frame (gdbarch, m68k_pop_frame);
 
   return gdbarch;
index 7da4ac4..559c521 100644 (file)
@@ -1,7 +1,8 @@
 /* Top level stuff for GDB, the GNU debugger.
-   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
-   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+
+   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -37,6 +38,7 @@
 #include "event-loop.h"
 #include "ui-out.h"
 
+#include "interps.h"
 #include "main.h"
 
 /* If nonzero, display time usage both at startup and for each command.  */
@@ -53,12 +55,11 @@ int display_space;
    processes UI events asynchronously. */
 int event_loop_p = 1;
 
-/* Has an interpreter been specified and if so, which. */
+/* The selected interpreter.  This will be used as a set command
+   variable, so it should always be malloc'ed - since
+   do_setshow_command will free it. */
 char *interpreter_p;
 
-/* Whether this is the command line version or not */
-int tui_version = 0;
-
 /* Whether xdb commands will be handled */
 int xdb_commands = 0;
 
@@ -93,10 +94,7 @@ extern char *external_editor_command;
 static int
 captured_command_loop (void *data)
 {
-  if (command_loop_hook == NULL)
-    command_loop ();
-  else
-    command_loop_hook ();
+  current_interp_command_loop ();
   /* FIXME: cagney/1999-11-05: A correct command_loop() implementaton
      would clean things up (restoring the cleanup chain) to the state
      they were just prior to the call.  Technically, this means that
@@ -167,11 +165,6 @@ captured_main (void *data)
 
   START_PROGRESS (argv[0], 0);
 
-#ifdef MPW
-  /* Do all Mac-specific setup. */
-  mac_init ();
-#endif /* MPW */
-
   /* This needs to happen before the first use of malloc.  */
   init_malloc (NULL);
 
@@ -232,18 +225,33 @@ captured_main (void *data)
 #endif
 #endif
 
+  /* There will always be an interpreter.  Either the one passed into
+     this captured main, or one specified by the user at start up, or
+     the console.  Initialize the interpreter to the one requested by 
+     the application.  */
+  interpreter_p = xstrdup (context->interpreter_p);
+
   /* Parse arguments and options.  */
   {
     int c;
     /* When var field is 0, use flag field to record the equivalent
        short option (or arbitrary numbers starting at 10 for those
        with no equivalent).  */
+    enum {
+      OPT_SE = 10,
+      OPT_CD,
+      OPT_ANNOTATE,
+      OPT_STATISTICS,
+      OPT_TUI,
+      OPT_NOWINDOWS,
+      OPT_WINDOWS
+    };
     static struct option long_options[] =
     {
       {"async", no_argument, &event_loop_p, 1},
       {"noasync", no_argument, &event_loop_p, 0},
 #if defined(TUI)
-      {"tui", no_argument, &tui_version, 1},
+      {"tui", no_argument, 0, OPT_TUI},
 #endif
       {"xdb", no_argument, &xdb_commands, 1},
       {"dbx", no_argument, &dbx_commands, 1},
@@ -265,9 +273,9 @@ captured_main (void *data)
       {"fullname", no_argument, 0, 'f'},
       {"f", no_argument, 0, 'f'},
 
-      {"annotate", required_argument, 0, 12},
+      {"annotate", required_argument, 0, OPT_ANNOTATE},
       {"help", no_argument, &print_help, 1},
-      {"se", required_argument, 0, 10},
+      {"se", required_argument, 0, OPT_SE},
       {"symbols", required_argument, 0, 's'},
       {"s", required_argument, 0, 's'},
       {"exec", required_argument, 0, 'e'},
@@ -289,15 +297,15 @@ captured_main (void *data)
       {"i", required_argument, 0, 'i'},
       {"directory", required_argument, 0, 'd'},
       {"d", required_argument, 0, 'd'},
-      {"cd", required_argument, 0, 11},
+      {"cd", required_argument, 0, OPT_CD},
       {"tty", required_argument, 0, 't'},
       {"baud", required_argument, 0, 'b'},
       {"b", required_argument, 0, 'b'},
-      {"nw", no_argument, &use_windows, 0},
-      {"nowindows", no_argument, &use_windows, 0},
-      {"w", no_argument, &use_windows, 1},
-      {"windows", no_argument, &use_windows, 1},
-      {"statistics", no_argument, 0, 13},
+      {"nw", no_argument, NULL, OPT_NOWINDOWS},
+      {"nowindows", no_argument, NULL, OPT_NOWINDOWS},
+      {"w", no_argument, NULL, OPT_WINDOWS},
+      {"windows", no_argument, NULL, OPT_WINDOWS},
+      {"statistics", no_argument, 0, OPT_STATISTICS},
       {"write", no_argument, &write_files, 1},
       {"args", no_argument, &set_args, 1},
       {0, no_argument, 0, 0}
@@ -321,22 +329,38 @@ captured_main (void *data)
          case 0:
            /* Long option that just sets a flag.  */
            break;
-         case 10:
+         case OPT_SE:
            symarg = optarg;
            execarg = optarg;
            break;
-         case 11:
+         case OPT_CD:
            cdarg = optarg;
            break;
-         case 12:
+         case OPT_ANNOTATE:
            /* FIXME: what if the syntax is wrong (e.g. not digits)?  */
            annotation_level = atoi (optarg);
            break;
-         case 13:
+         case OPT_STATISTICS:
            /* Enable the display of both time and space usage.  */
            display_time = 1;
            display_space = 1;
            break;
+         case OPT_TUI:
+           /* --tui is equivalent to -i=tui.  */
+           xfree (interpreter_p);
+           interpreter_p = xstrdup ("tui");
+           break;
+         case OPT_WINDOWS:
+           /* FIXME: cagney/2003-03-01: Not sure if this option is
+               actually useful, and if it is, what it should do.  */
+           use_windows = 1;
+           break;
+         case OPT_NOWINDOWS:
+           /* -nw is equivalent to -i=console.  */
+           xfree (interpreter_p);
+           interpreter_p = xstrdup (INTERP_CONSOLE);
+           use_windows = 0;
+           break;
          case 'f':
            annotation_level = 1;
 /* We have probably been invoked from emacs.  Disable window interface.  */
@@ -386,7 +410,8 @@ extern int gdbtk_test (char *);
            }
 #endif /* GDBTK */
          case 'i':
-           interpreter_p = optarg;
+           xfree (interpreter_p);
+           interpreter_p = xstrdup (optarg);
            break;
          case 'd':
            dirarg[ndir++] = optarg;
@@ -452,19 +477,8 @@ extern int gdbtk_test (char *);
     if (print_help || print_version)
       {
        use_windows = 0;
-#ifdef TUI
-       /* Disable the TUI as well.  */
-       tui_version = 0;
-#endif
       }
 
-#ifdef TUI
-    /* An explicit --tui flag overrides the default UI, which is the
-       window system.  */
-    if (tui_version)
-      use_windows = 0;
-#endif
-
     if (set_args)
       {
        /* The remaining options are the command-line options for the
@@ -514,7 +528,10 @@ extern int gdbtk_test (char *);
   gdb_init (argv[0]);
 
   /* Do these (and anything which might call wrap_here or *_filtered)
-     after initialize_all_files.  */
+     after initialize_all_files() but before the interpreter has been
+     installed.  Otherwize the help/version messages will be eaten by
+     the interpreter's output handler.  */
+
   if (print_version)
     {
       print_gdb_version (gdb_stdout);
@@ -530,7 +547,49 @@ extern int gdbtk_test (char *);
       exit (0);
     }
 
-  if (!quiet)
+  /* FIXME: cagney/2003-02-03: The big hack (part 1 of 2) that lets
+     GDB retain the old MI1 interpreter startup behavior.  Output the
+     copyright message before the interpreter is installed.  That way
+     it isn't encapsulated in MI output.  */
+  if (!quiet && strcmp (interpreter_p, INTERP_MI1) == 0)
+    {
+      /* Print all the junk at the top, with trailing "..." if we are about
+         to read a symbol file (possibly slowly).  */
+      print_gdb_version (gdb_stdout);
+      if (symarg)
+       printf_filtered ("..");
+      wrap_here ("");
+      gdb_flush (gdb_stdout);  /* Force to screen during slow operations */
+    }
+
+
+  /* Install the default UI.  All the interpreters should have had a
+     look at things by now.  Initialize the default interpreter. */
+
+  {
+    /* Find it.  */
+    struct interp *interp = interp_lookup (interpreter_p);
+    if (interp == NULL)
+      {
+        fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
+                            interpreter_p);
+        exit (1);
+      }
+    /* Install it.  */
+    if (!interp_set (interp))
+      {
+        fprintf_unfiltered (gdb_stderr,
+                           "Interpreter `%s' failed to initialize.\n",
+                            interpreter_p);
+        exit (1);
+      }
+  }
+
+  /* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets
+     GDB retain the old MI1 interpreter startup behavior.  Output the
+     copyright message after the interpreter is installed when it is
+     any sane interpreter.  */
+  if (!quiet && !current_interp_named_p (INTERP_MI1))
     {
       /* Print all the junk at the top, with trailing "..." if we are about
          to read a symbol file (possibly slowly).  */
@@ -590,7 +649,7 @@ extern int gdbtk_test (char *);
 
   if (execarg != NULL
       && symarg != NULL
-      && STREQ (execarg, symarg))
+      && strcmp (execarg, symarg) == 0)
     {
       /* The exec file and the symbol-file are the same.  If we can't
          open it, better only print one error message.
index 8ee189e..1c91d07 100644 (file)
@@ -27,6 +27,7 @@ struct captured_main_args
   int argc;
   char **argv;
   int use_windows;
+  const char *interpreter_p;
 };
 
 extern int gdb_main (struct captured_main_args *);
index 3595e18..f2dfa68 100644 (file)
@@ -494,7 +494,7 @@ maintenance_translate_address (char *arg, int from_tty)
 
   if (sym)
     printf_filtered ("%s+%s\n",
-                    SYMBOL_SOURCE_NAME (sym),
+                    SYMBOL_PRINT_NAME (sym),
                     paddr_u (address - SYMBOL_VALUE_ADDRESS (sym)));
   else if (sect)
     printf_filtered ("no symbol at %s:0x%s\n", sect->name, paddr (address));
@@ -645,6 +645,14 @@ static int maintenance_profile_p;
 
 #if defined (HAVE_MONSTARTUP) && defined (HAVE__MCLEANUP)
 
+#ifdef HAVE__ETEXT
+extern char _etext;
+#define TEXTEND &_etext
+#else
+extern char etext;
+#define TEXTEND &etext
+#endif
+
 static int profiling_state;
 
 static void
@@ -669,7 +677,6 @@ maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element *
       static int profiling_initialized;
 
       extern void monstartup (unsigned long, unsigned long);
-      extern char _etext;
       extern int main();
 
       if (!profiling_initialized)
@@ -680,7 +687,7 @@ maintenance_set_profile_cmd (char *args, int from_tty, struct cmd_list_element *
 
       /* "main" is now always the first function in the text segment, so use
         its address for monstartup.  */
-      monstartup ((unsigned long) &main, (unsigned long) &_etext);
+      monstartup ((unsigned long) &main, (unsigned long) TEXTEND);
     }
   else
     {
index 134f9dd..e5b6434 100644 (file)
@@ -643,8 +643,8 @@ mcore_analyze_prologue (struct frame_info *fi, CORE_ADDR pc, int skip_prologue)
 
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame. */
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame. */
 
 CORE_ADDR
 mcore_frame_chain (struct frame_info * fi)
@@ -1101,8 +1101,8 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* All registers are 32 bits */
   set_gdbarch_register_size (gdbarch, MCORE_REG_SIZE);
-  set_gdbarch_max_register_raw_size (gdbarch, MCORE_REG_SIZE);
-  set_gdbarch_max_register_virtual_size (gdbarch, MCORE_REG_SIZE);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, MCORE_REG_SIZE);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, MCORE_REG_SIZE);
   set_gdbarch_register_name (gdbarch, mcore_register_name);
   set_gdbarch_register_virtual_type (gdbarch, mcore_register_virtual_type);
   set_gdbarch_register_virtual_size (gdbarch, mcore_register_size);
@@ -1131,15 +1131,14 @@ mcore_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_breakpoint_from_pc (gdbarch, mcore_breakpoint_from_pc);
   set_gdbarch_push_return_address (gdbarch, mcore_push_return_address);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_arguments (gdbarch, mcore_push_arguments);
   set_gdbarch_call_dummy_length (gdbarch, 0);
 
   /* Frames:  */
 
-  set_gdbarch_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mcore_init_extra_frame_info);
   set_gdbarch_frame_chain (gdbarch, mcore_frame_chain);
-  set_gdbarch_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mcore_frame_init_saved_regs);
   set_gdbarch_frame_saved_pc (gdbarch, mcore_frame_saved_pc);
   set_gdbarch_deprecated_store_return_value (gdbarch, mcore_store_return_value);
   set_gdbarch_deprecated_extract_return_value (gdbarch, 
index 30e94c7..7c17d61 100644 (file)
@@ -53,6 +53,7 @@
 #include "complaints.h"
 #include "demangle.h"
 #include "gdb_assert.h"
+#include "block.h"
 
 /* These are needed if the tm.h file does not contain the necessary
    mips specific definitions.  */
@@ -669,7 +670,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
          /* It is a FORTRAN common block.  At least for SGI Fortran the
             address is not in the symbol; we need to fix it later in
             scan_file_globals.  */
-         int bucket = hashname (SYMBOL_NAME (s));
+         int bucket = hashname (DEPRECATED_SYMBOL_NAME (s));
          SYMBOL_VALUE_CHAIN (s) = global_sym_chain[bucket];
          global_sym_chain[bucket] = s;
        }
@@ -1101,7 +1102,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                            obstack_alloc (&current_objfile->symbol_obstack,
                                           sizeof (struct symbol)));
                memset (enum_sym, 0, sizeof (struct symbol));
-               SYMBOL_NAME (enum_sym) =
+               DEPRECATED_SYMBOL_NAME (enum_sym) =
                  obsavestring (f->name, strlen (f->name),
                                &current_objfile->symbol_obstack);
                SYMBOL_CLASS (enum_sym) = LOC_CONST;
@@ -1372,7 +1373,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                 for anything except pointers or functions.  */
            }
          else
-           TYPE_NAME (SYMBOL_TYPE (s)) = SYMBOL_NAME (s);
+           TYPE_NAME (SYMBOL_TYPE (s)) = DEPRECATED_SYMBOL_NAME (s);
        }
       break;
 
@@ -4458,10 +4459,10 @@ mylookup_symbol (char *name, register struct block *block,
   inc = name[0];
   ALL_BLOCK_SYMBOLS (block, i, sym)
     {
-      if (SYMBOL_NAME (sym)[0] == inc
+      if (DEPRECATED_SYMBOL_NAME (sym)[0] == inc
          && SYMBOL_NAMESPACE (sym) == namespace
          && SYMBOL_CLASS (sym) == class
-         && strcmp (SYMBOL_NAME (sym), name) == 0)
+         && strcmp (DEPRECATED_SYMBOL_NAME (sym), name) == 0)
        return sym;
     }
 
@@ -4488,7 +4489,7 @@ add_symbol (struct symbol *s, struct block *b)
       nsyms >= top_stack->maxsyms)
     {
       complaint (&symfile_complaints, "block containing %s overfilled",
-                SYMBOL_NAME (s));
+                DEPRECATED_SYMBOL_NAME (s));
       /* In this case shrink_block is actually grow_block, since
          BLOCK_NSYMS(b) is larger than its current size.  */
       origb = b;
@@ -4779,10 +4780,8 @@ new_symbol (char *name)
                                     sizeof (struct symbol)));
 
   memset (s, 0, sizeof (*s));
-  SYMBOL_NAME (s) = obsavestring (name, strlen (name),
-                                 &current_objfile->symbol_obstack);
   SYMBOL_LANGUAGE (s) = psymtab_language;
-  SYMBOL_INIT_DEMANGLED_NAME (s, &current_objfile->symbol_obstack);
+  SYMBOL_SET_NAMES (s, name, strlen (name), current_objfile);
   return s;
 }
 
@@ -4810,6 +4809,14 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
 {
   bfd *abfd = objfile->obfd;
   struct ecoff_debug_info *info;
+  struct cleanup *back_to;
+
+  /* FIXME: It's not clear whether we should be getting minimal symbol
+     information from .mdebug in an ELF file, or whether we will.
+     Re-initialize the minimal symbol reader in case we do.  */
+
+  init_minimal_symbol_collection ();
+  back_to = make_cleanup_discard_minimal_symbols ();
 
   info = ((struct ecoff_debug_info *)
          obstack_alloc (&objfile->psymbol_obstack,
@@ -4820,6 +4827,9 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
           bfd_errmsg (bfd_get_error ()));
 
   mdebug_build_psymtabs (objfile, swap, info);
+
+  install_minimal_symbols (objfile);
+  do_cleanups (back_to);
 }
 \f
 
index e25430e..a103802 100644 (file)
@@ -1,3 +1,67 @@
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * mi-main.c (get_register): Use register_type instead of
+       REGISTER_VIRTUAL_TYPE.
+
+2003-02-25  David Carlton  <carlton@math.stanford.edu>
+
+       * mi-cmd-stack.c: Replace all instances of SYMBOL_NAME with
+       DEPRECATED_SYMBOL_NAME.  Update copyright.
+
+2003-02-21  Daniel Jacobowitz  <drow@mvista.com>
+
+       * mi-cmd-stack.c (list_args_or_locals): Handle LOC_COMPUTED and
+       LOC_COMPUTED_ARG.
+
+2003-02-19  David Carlton  <carlton@math.stanford.edu>
+
+       * mi-cmd-stack.c: #include "block.h"
+
+2003-02-09  Andrew Cagney  <ac131313@redhat.com>
+
+       * mi-interp.c (mi_remove_notify_hooks): Convert function
+       definition to ISO C.
+
+2003-02-06  Andrew Cagney  <ac131313@redhat.com>
+
+       * mi-cmd-env.c: Include "gdb_stat.h" instead of <sys/stat.h>.
+
+2003-02-04  Jim Ingham <jingham@apple.com>
+           Keith Seitz  <keiths@redhat.com>
+            Elena Zannoni  <ezannoni@redhat.com>
+            Andrew Cagney  <ac131313@redhat.com>
+       
+       * mi-main.h: New file.
+       * mi-interp.c: New file.
+       * mi-main.c: Include "interps.h".
+       (mi_error_message): Make global.
+       (mi_input): Delete static function, moved to "mi-interp.c".
+       (mi_execute_command, mi_execute_command_wrapper): Ditto.
+       (mi_command_loop, mi1_command_loop, mi2_command_loop): Ditto.
+       (mi_load_progress): Make non-static.
+       (mi_error_last_message): New function.
+       (captured_mi_execute_command): If the interpreter changed, don't
+       print anything.
+       (mi_load_progress): Use current_interp_named_p.
+       (mi_init_ui): Delete function.
+       (_initialize_mi_main): Don't install the mi interpreter, handled
+       by "mi-interp.c".
+       (mi_exec_async_cli_cmd_continuation): Make static.
+       * mi-console.h (mi_console_file_new): Add `quote' parameter.
+       * mi-console.c (struct mi_console_file): Add `quote'.
+       (mi_console_file_new): Add `quote' parameter.  Initialize `quote'.
+       (mi_console_raw_packet): Only quote the output when `quote'.
+       * mi-cmds.h (mi_cmd_interpreter_exec): Declare.
+       (mi_error_message, mi_error_last_message): Declare.
+       (mi_execute_command): Declare.
+       * mi-cmds.c: Add `interpreter-exec' command.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       From Keith Seitz <keiths@redhat.com>:
+       * gdbmi.texinfo (GDB/MI Miscellaneous Commands): Document the
+       interpreter-exec command.
+
 2003-02-02  Andrew Cagney  <ac131313@redhat.com>
 
        From 2002-11-10 Jason Molenda (jason-cl@molenda.com):
 
 2002-07-29  Andrew Cagney  <ac131313@redhat.com>
 
-
        * mi-cmd-var.c: Include "gdb_string.h".
        * mi-cmd-disas.c: Ditto.
 
index 8326bca..da8b77c 100644 (file)
@@ -2543,6 +2543,33 @@ information when you start an interactive session.
 (@value{GDBP})
 @end smallexample
 
+@subheading The @code{-interpreter-exec} Command
+@findex -interpreter-exec
+
+@subheading Synopsis
+
+@smallexample
+-interpreter-exec @var{interpreter} @var{command}
+@end smallexample
+
+Execute the specified @var{command} in the given @var{interpreter}.
+
+@subheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{interpreter-exec}.
+
+@subheading Example
+
+@smallexample
+(@value{GDBP})
+-interpreter-exec console "break main"
+&"During symbol reading, couldn't parse type; debugger out of date?.\n"
+&"During symbol reading, bad structure-type format.\n"
+~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
+^done
+(@value{GDBP})
+@end smallexample
+
 @ignore
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 @node GDB/MI Kod Commands
index 8fc673f..55fcba1 100644 (file)
@@ -35,7 +35,7 @@
 #include "top.h"
 
 #include "gdb_string.h"
-#include <sys/stat.h>
+#include "gdb_stat.h"
 
 static void env_cli_command (const char *cli, char *args);
 static void env_mod_path (char *dirname, char **which_path);
index 34fb308..0a76291 100644 (file)
@@ -1,5 +1,5 @@
 /* MI Command Set - stack commands.
-   Copyright 2000, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions (a Red Hat company).
 
    This file is part of GDB.
@@ -26,6 +26,7 @@
 #include "mi-cmds.h"
 #include "ui-out.h"
 #include "symtab.h"
+#include "block.h"
 
 /* FIXME: these should go in some .h file but stack.c doesn't have a
    corresponding .h file. These wrappers will be obsolete anyway, once
@@ -252,6 +253,7 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
            case LOC_REGPARM_ADDR:      /* indirect register arg */
            case LOC_LOCAL_ARG: /* stack arg             */
            case LOC_BASEREG_ARG:       /* basereg arg           */
+           case LOC_COMPUTED_ARG:      /* arg with computed location */
              if (!locals)
                print_me = 1;
              break;
@@ -260,6 +262,7 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
            case LOC_BASEREG:   /* basereg local         */
            case LOC_STATIC:    /* static                */
            case LOC_REGISTER:  /* register              */
+           case LOC_COMPUTED:  /* computed location     */
              if (locals)
                print_me = 1;
              break;
@@ -270,13 +273,13 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
              if (values)
                cleanup_tuple = 
                  make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
-             ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
+             ui_out_field_string (uiout, "name", DEPRECATED_SYMBOL_NAME (sym));
 
              if (values)
                {
                  struct symbol *sym2;
                  if (!locals)
-                   sym2 = lookup_symbol (SYMBOL_NAME (sym),
+                   sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
                                          block, VAR_NAMESPACE,
                                          (int *) NULL,
                                          (struct symtab **) NULL);
index 699937d..5a0bf50 100644 (file)
@@ -1,5 +1,7 @@
-/* MI Command Set.
-   Copyright 2000, 2001 Free Software Foundation, Inc.
+/* MI Command Set for GDB, the GNU debugger.
+
+   Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Solutions (a Red Hat company).
 
    This file is part of GDB.
@@ -88,6 +90,7 @@ struct mi_cmd mi_cmds[] =
   {"gdb-show", "show %s", 0},
   {"gdb-source", 0, 0},
   {"gdb-version", "show version", 0},
+  {"interpreter-exec", 0, 0, mi_cmd_interpreter_exec},
   {"kod-info", 0, 0},
   {"kod-list", 0, 0},
   {"kod-list-object-types", 0, 0},
index f4fe64d..3eb6153 100644 (file)
@@ -1,5 +1,7 @@
-/* MI Command Set.
-   Copyright 2000 Free Software Foundation, Inc.
+/* MI Command Set for GDB, the GNU debugger.
+
+   Copyright 2000, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Solutions (a Red Hat company).
 
    This file is part of GDB.
@@ -79,6 +81,7 @@ extern mi_cmd_args_ftype mi_cmd_exec_step_instruction;
 extern mi_cmd_args_ftype mi_cmd_exec_until;
 extern mi_cmd_args_ftype mi_cmd_exec_interrupt;
 extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
+extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
 extern mi_cmd_argv_ftype mi_cmd_stack_info_depth;
 extern mi_cmd_argv_ftype mi_cmd_stack_list_args;
 extern mi_cmd_argv_ftype mi_cmd_stack_list_frames;
@@ -126,4 +129,8 @@ extern int mi_debug_p;
 /* Raw console output - FIXME: should this be a parameter? */
 extern struct ui_file *raw_stdout;
 
+extern char *mi_error_message;
+extern void mi_error_last_message (void);
+extern void mi_execute_command (char *cmd, int from_tty);
+
 #endif
index c1b6e9f..aca0086 100644 (file)
@@ -37,13 +37,14 @@ struct mi_console_file
     struct ui_file *raw;
     struct ui_file *buffer;
     const char *prefix;
+    char quote;
   };
 
 int mi_console_file_magic;
 
 struct ui_file *
 mi_console_file_new (struct ui_file *raw,
-                    const char *prefix)
+                    const char *prefix, char quote)
 {
   struct ui_file *ui_file = ui_file_new ();
   struct mi_console_file *mi_console = XMALLOC (struct mi_console_file);
@@ -51,6 +52,7 @@ mi_console_file_new (struct ui_file *raw,
   mi_console->raw = raw;
   mi_console->buffer = mem_fileopen ();
   mi_console->prefix = prefix;
+  mi_console->quote = quote;
   set_ui_file_fputs (ui_file, mi_console_file_fputs);
   set_ui_file_flush (ui_file, mi_console_file_flush);
   set_ui_file_data (ui_file, mi_console, mi_console_file_delete);
@@ -96,9 +98,17 @@ mi_console_raw_packet (void *data,
   if (length_buf > 0)
     {
       fputs_unfiltered (mi_console->prefix, mi_console->raw);
-      fputs_unfiltered ("\"", mi_console->raw);
-      fputstrn_unfiltered (buf, length_buf, '"', mi_console->raw);
-      fputs_unfiltered ("\"\n", mi_console->raw);
+      if (mi_console->quote)
+       {
+         fputs_unfiltered ("\"", mi_console->raw);
+         fputstrn_unfiltered (buf, length_buf, mi_console->quote, mi_console->raw);
+         fputs_unfiltered ("\"\n", mi_console->raw);
+       }
+      else
+       {
+         fputstrn_unfiltered (buf, length_buf, 0, mi_console->raw);
+         fputs_unfiltered ("\n", mi_console->raw);
+       }
       gdb_flush (mi_console->raw);
     }
 }
index 6bd03cb..bc6c008 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef MI_CONSOLE_H
 #define MI_CONSOLE_H
 
-extern struct ui_file *mi_console_file_new (struct ui_file *raw, const char *prefix);
+extern struct ui_file *mi_console_file_new (struct ui_file *raw,
+                                           const char *prefix,
+                                           char quote);
 
 #endif
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
new file mode 100644 (file)
index 0000000..87ed17f
--- /dev/null
@@ -0,0 +1,412 @@
+/* MI Interpreter Definitions and Commands for GDB, the GNU debugger.
+
+   Copyright 2002, 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "gdb_string.h"
+#include "interps.h"
+#include "event-top.h"
+#include "event-loop.h"
+#include "inferior.h"
+#include "ui-out.h"
+#include "top.h"
+
+#include "mi-main.h"
+#include "mi-cmds.h"
+#include "mi-out.h"
+#include "mi-console.h"
+
+struct mi_interp
+{
+  /* MI's output channels */
+  struct ui_file *out;
+  struct ui_file *err;
+  struct ui_file *log;
+  struct ui_file *targ;
+  struct ui_file *event_channel;
+
+  /* This is the interpreter for the mi... */
+  struct interp *mi2_interp;
+  struct interp *mi1_interp;
+  struct interp *mi_interp;
+};
+
+/* These are the interpreter setup, etc. functions for the MI interpreter */
+static void mi_execute_command_wrapper (char *cmd);
+static void mi_command_loop (int mi_version);
+static char *mi_input (char *);
+
+/* These are hooks that we put in place while doing interpreter_exec
+   so we can report interesting things that happened "behind the mi's
+   back" in this command */
+static int mi_interp_query_hook (const char *ctlstr, va_list ap);
+static char *mi_interp_read_one_line_hook (char *prompt, int repeat,
+                                          char *anno);
+
+static void mi2_command_loop (void);
+static void mi1_command_loop (void);
+
+static void mi_insert_notify_hooks (void);
+static void mi_remove_notify_hooks (void);
+
+static void *
+mi_interpreter_init (void)
+{
+  struct mi_interp *mi = XMALLOC (struct mi_interp);
+
+  /* Why is this a part of the mi architecture? */
+
+  mi_setup_architecture_data ();
+
+  /* HACK: We need to force stdout/stderr to point at the console.  This avoids
+     any potential side effects caused by legacy code that is still
+     using the TUI / fputs_unfiltered_hook.  So we set up output channels for
+     this now, and swap them in when we are run. */
+
+  raw_stdout = stdio_fileopen (stdout);
+
+  /* Create MI channels */
+  mi->out = mi_console_file_new (raw_stdout, "~", '"');
+  mi->err = mi_console_file_new (raw_stdout, "&", '"');
+  mi->log = mi->err;
+  mi->targ = mi_console_file_new (raw_stdout, "@", '"');
+  mi->event_channel = mi_console_file_new (raw_stdout, "=", 0);
+
+  return mi;
+}
+
+static int
+mi_interpreter_resume (void *data)
+{
+  struct mi_interp *mi = data;
+  /* As per hack note in mi_interpreter_init, swap in the output channels... */
+
+  gdb_setup_readline ();
+
+  if (event_loop_p)
+    {
+      /* These overwrite some of the initialization done in
+         _intialize_event_loop. */
+      call_readline = gdb_readline2;
+      input_handler = mi_execute_command_wrapper;
+      add_file_handler (input_fd, stdin_event_handler, 0);
+      async_command_editing_p = 0;
+      /* FIXME: This is a total hack for now.  PB's use of the MI implicitly
+         relies on a bug in the async support which allows asynchronous
+         commands to leak through the commmand loop.  The bug involves
+         (but is not limited to) the fact that sync_execution was
+         erroneously initialized to 0.  Duplicate by initializing it
+         thus here... */
+      sync_execution = 0;
+    }
+
+  gdb_stdout = mi->out;
+  /* Route error and log output through the MI */
+  gdb_stderr = mi->err;
+  gdb_stdlog = mi->log;
+  /* Route target output through the MI. */
+  gdb_stdtarg = mi->targ;
+
+  /* Replace all the hooks that we know about.  There really needs to
+     be a better way of doing this... */
+  clear_interpreter_hooks ();
+
+  show_load_progress = mi_load_progress;
+
+  /* If we're _the_ interpreter, take control. */
+  if (current_interp_named_p (INTERP_MI1))
+    command_loop_hook = mi1_command_loop;
+  else if (current_interp_named_p (INTERP_MI))
+    command_loop_hook = mi2_command_loop;
+  else
+    return 0;
+
+  return 1;
+}
+
+static int
+mi_interpreter_suspend (void *data)
+{
+  gdb_disable_readline ();
+  return 1;
+}
+
+static int
+mi_interpreter_exec (void *data, const char *command)
+{
+  char *tmp = alloca (strlen (command) + 1);
+  strcpy (tmp, command);
+  mi_execute_command_wrapper (tmp);
+  return 1;
+}
+
+/* Never display the default gdb prompt in mi case.  */
+static int
+mi_interpreter_prompt_p (void *data)
+{
+  return 0;
+}
+
+static void
+mi_interpreter_exec_continuation (struct continuation_arg *arg)
+{
+  bpstat_do_actions (&stop_bpstat);
+  if (!target_executing)
+    {
+      fputs_unfiltered ("*stopped", raw_stdout);
+      mi_out_put (uiout, raw_stdout);
+      fputs_unfiltered ("\n", raw_stdout);
+      fputs_unfiltered ("(gdb) \n", raw_stdout);
+      gdb_flush (raw_stdout);
+      do_exec_cleanups (ALL_CLEANUPS);
+    }
+  else if (target_can_async_p ())
+    {
+      add_continuation (mi_interpreter_exec_continuation, NULL);
+    }
+}
+
+enum mi_cmd_result
+mi_cmd_interpreter_exec (char *command, char **argv, int argc)
+{
+  struct interp *interp_to_use;
+  enum mi_cmd_result result = MI_CMD_DONE;
+  int i;
+  struct interp_procs *procs;
+
+  if (argc < 2)
+    {
+      xasprintf (&mi_error_message,
+                "mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command");
+      return MI_CMD_ERROR;
+    }
+
+  interp_to_use = interp_lookup (argv[0]);
+  if (interp_to_use == NULL)
+    {
+      xasprintf (&mi_error_message,
+                "mi_cmd_interpreter_exec: could not find interpreter \"%s\"",
+                argv[0]);
+      return MI_CMD_ERROR;
+    }
+
+  if (!interp_exec_p (interp_to_use))
+    {
+      xasprintf (&mi_error_message,
+                "mi_cmd_interpreter_exec: interpreter \"%s\" does not support command execution",
+                argv[0]);
+      return MI_CMD_ERROR;
+    }
+
+  /* Insert the MI out hooks, making sure to also call the interpreter's hooks
+     if it has any. */
+  /* KRS: We shouldn't need this... Events should be installed and they should
+     just ALWAYS fire something out down the MI channel... */
+  mi_insert_notify_hooks ();
+
+  /* Now run the code... */
+
+  for (i = 1; i < argc; i++)
+    {
+      char *buff = NULL;
+      /* Do this in a cleaner way...  We want to force execution to be
+         asynchronous for commands that run the target.  */
+      if (target_can_async_p () && (strcmp (argv[0], "console") == 0))
+       {
+         int len = strlen (argv[i]);
+         buff = xmalloc (len + 2);
+         memcpy (buff, argv[i], len);
+         buff[len] = '&';
+         buff[len + 1] = '\0';
+       }
+
+      /* We had to set sync_execution = 0 for the mi (well really for Project
+         Builder's use of the mi - particularly so interrupting would work.
+         But for console commands to work, we need to initialize it to 1 -
+         since that is what the cli expects - before running the command,
+         and then set it back to 0 when we are done. */
+      sync_execution = 1;
+      if (interp_exec (interp_to_use, argv[i]) < 0)
+       {
+         mi_error_last_message ();
+         result = MI_CMD_ERROR;
+         break;
+       }
+      xfree (buff);
+      do_exec_error_cleanups (ALL_CLEANUPS);
+      sync_execution = 0;
+    }
+
+  mi_remove_notify_hooks ();
+
+  /* Okay, now let's see if the command set the inferior going...
+     Tricky point - have to do this AFTER resetting the interpreter, since
+     changing the interpreter will clear out all the continuations for
+     that interpreter... */
+
+  if (target_can_async_p () && target_executing)
+    {
+      fputs_unfiltered ("^running\n", raw_stdout);
+      add_continuation (mi_interpreter_exec_continuation, NULL);
+    }
+
+  return result;
+}
+
+/*
+ * mi_insert_notify_hooks - This inserts a number of hooks that are meant to produce
+ * async-notify ("=") MI messages while running commands in another interpreter
+ * using mi_interpreter_exec.  The canonical use for this is to allow access to
+ * the gdb CLI interpreter from within the MI, while still producing MI style output
+ * when actions in the CLI command change gdb's state.
+*/
+
+static void
+mi_insert_notify_hooks (void)
+{
+  query_hook = mi_interp_query_hook;
+}
+
+static void
+mi_remove_notify_hooks (void)
+{
+  query_hook = NULL;
+}
+
+static int
+mi_interp_query_hook (const char *ctlstr, va_list ap)
+{
+  return 1;
+}
+
+static char *
+mi_interp_read_one_line_hook (char *prompt, int repeat, char *anno)
+{
+  static char buff[256];
+  printf_unfiltered ("=read-one-line,prompt=\"%s\"\n", prompt);
+  gdb_flush (gdb_stdout);
+  (void) fgets (buff, sizeof (buff), stdin);
+  buff[(strlen (buff) - 1)] = 0;
+  return buff;
+}
+
+static void
+output_control_change_notification (char *notification)
+{
+  printf_unfiltered ("^");
+  printf_unfiltered ("%s\n", notification);
+  gdb_flush (gdb_stdout);
+}
+
+static void
+mi_execute_command_wrapper (char *cmd)
+{
+  mi_execute_command (cmd, stdin == instream);
+}
+
+static void
+mi1_command_loop (void)
+{
+  mi_command_loop (1);
+}
+
+static void
+mi2_command_loop (void)
+{
+  mi_command_loop (2);
+}
+
+static void
+mi_command_loop (int mi_version)
+{
+#if 0
+  /* HACK: Force stdout/stderr to point at the console.  This avoids
+     any potential side effects caused by legacy code that is still
+     using the TUI / fputs_unfiltered_hook */
+  raw_stdout = stdio_fileopen (stdout);
+  /* Route normal output through the MIx */
+  gdb_stdout = mi_console_file_new (raw_stdout, "~", '"');
+  /* Route error and log output through the MI */
+  gdb_stderr = mi_console_file_new (raw_stdout, "&", '"');
+  gdb_stdlog = gdb_stderr;
+  /* Route target output through the MI. */
+  gdb_stdtarg = mi_console_file_new (raw_stdout, "@", '"');
+  /* HACK: Poke the ui_out table directly.  Should we be creating a
+     mi_out object wired up to the above gdb_stdout / gdb_stderr? */
+  uiout = mi_out_new (mi_version);
+  /* HACK: Override any other interpreter hooks.  We need to create a
+     real event table and pass in that. */
+  init_ui_hook = 0;
+  /* command_loop_hook = 0; */
+  print_frame_info_listing_hook = 0;
+  query_hook = 0;
+  warning_hook = 0;
+  create_breakpoint_hook = 0;
+  delete_breakpoint_hook = 0;
+  modify_breakpoint_hook = 0;
+  interactive_hook = 0;
+  registers_changed_hook = 0;
+  readline_begin_hook = 0;
+  readline_hook = 0;
+  readline_end_hook = 0;
+  register_changed_hook = 0;
+  memory_changed_hook = 0;
+  context_hook = 0;
+  target_wait_hook = 0;
+  call_command_hook = 0;
+  error_hook = 0;
+  error_begin_hook = 0;
+  show_load_progress = mi_load_progress;
+#endif
+  /* Turn off 8 bit strings in quoted output.  Any character with the
+     high bit set is printed using C's octal format. */
+  sevenbit_strings = 1;
+  /* Tell the world that we're alive */
+  fputs_unfiltered ("(gdb) \n", raw_stdout);
+  gdb_flush (raw_stdout);
+  if (!event_loop_p)
+    simplified_command_loop (mi_input, mi_execute_command);
+  else
+    start_event_loop ();
+}
+
+static char *
+mi_input (char *buf)
+{
+  return gdb_readline (NULL);
+}
+
+void
+_initialize_mi_interp (void)
+{
+  static const struct interp_procs procs =
+  {
+    mi_interpreter_init,       /* init_proc */
+    mi_interpreter_resume,     /* resume_proc */
+    mi_interpreter_suspend,    /* suspend_proc */
+    mi_interpreter_exec,       /* exec_proc */
+    mi_interpreter_prompt_p    /* prompt_proc_p */
+  };
+
+  /* Create MI1 interpreter */
+  interp_add (interp_new (INTERP_MI1, NULL, mi_out_new (1), &procs));
+
+  interp_add (interp_new (INTERP_MI, NULL, mi_out_new (3), &procs));
+}
index 96030b7..f08bd3f 100644 (file)
@@ -33,6 +33,7 @@
 #include "mi-console.h"
 #include "ui-out.h"
 #include "mi-out.h"
+#include "interps.h"
 #include "event-loop.h"
 #include "event-top.h"
 #include "gdbcore.h"           /* for write_memory() */
@@ -79,27 +80,29 @@ struct ui_file *raw_stdout;
 /* The token of the last asynchronous command */
 static char *last_async_command;
 static char *previous_async_command;
-static char *mi_error_message;
+char *mi_error_message;
 static char *old_regs;
 
 extern void _initialize_mi_main (void);
-static char *mi_input (char *);
-static void mi_execute_command (char *cmd, int from_tty);
 static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse);
 
 static void mi_execute_cli_command (const char *cli, char *args);
 static enum mi_cmd_result mi_execute_async_cli_command (char *mi, char *args, int from_tty);
-static void mi_execute_command_wrapper (char *cmd);
 
-void mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg);
+static void mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg);
 
 static int register_changed_p (int regnum);
 static int get_register (int regnum, int format);
-static void mi_load_progress (const char *section_name,
-                             unsigned long sent_so_far,
-                             unsigned long total_section,
-                             unsigned long total_sent,
-                             unsigned long grand_total);
+
+/* A helper function which will set mi_error_message to
+   error_last_message.  */
+void
+mi_error_last_message (void)
+{
+  char *s = error_last_message ();
+  xasprintf (&mi_error_message, s);
+  xfree (s);
+}
 
 /* Command implementations. FIXME: Is this libgdb? No.  This is the MI
    layer that calls libgdb.  Any operation used in the below should be
@@ -531,7 +534,8 @@ get_register (int regnum, int format)
 
   if (REGISTER_CONVERTIBLE (regnum))
     {
-      REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
+      REGISTER_CONVERT_TO_VIRTUAL (regnum,
+                                  register_type (current_gdbarch, regnum),
                                   raw_buffer, virtual_buffer);
     }
   else
@@ -556,7 +560,7 @@ get_register (int regnum, int format)
     }
   else
     {
-      val_print (REGISTER_VIRTUAL_TYPE (regnum), virtual_buffer, 0, 0,
+      val_print (register_type (current_gdbarch, regnum), virtual_buffer, 0, 0,
                 stb->stream, format, 1, 0, Val_pretty_default);
       ui_out_field_stream (uiout, "value", stb);
       ui_out_stream_delete (stb);
@@ -1098,7 +1102,12 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
 
       if (!target_can_async_p () || !target_executing)
        {
-         /* print the result if there were no errors */
+         /* print the result if there were no errors
+
+            Remember that on the way out of executing a command, you have
+            to directly use the mi_interp's uiout, since the command could 
+            have reset the interpreter, in which case the current uiout 
+            will most likely crash in the mi_out_* routines.  */
          if (args->rc == MI_CMD_DONE)
            {
              fputs_unfiltered (context->token, raw_stdout);
@@ -1146,15 +1155,21 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
       /* FIXME: If the command string has something that looks like 
          a format spec (e.g. %s) we will get a core dump */
       mi_execute_cli_command ("%s", context->command);
-      /* print the result */
-      /* FIXME: Check for errors here. */
-      fputs_unfiltered (context->token, raw_stdout);
-      fputs_unfiltered ("^done", raw_stdout);
-      mi_out_put (uiout, raw_stdout);
-      mi_out_rewind (uiout);
-      fputs_unfiltered ("\n", raw_stdout);
-      args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
-      args->rc = MI_CMD_DONE;
+
+      /* If we changed interpreters, DON'T print out anything. */
+      if (current_interp_named_p (INTERP_MI)
+         || current_interp_named_p (INTERP_MI1))
+       {
+         /* print the result */
+         /* FIXME: Check for errors here. */
+         fputs_unfiltered (context->token, raw_stdout);
+         fputs_unfiltered ("^done", raw_stdout);
+         mi_out_put (uiout, raw_stdout);
+         mi_out_rewind (uiout);
+         fputs_unfiltered ("\n", raw_stdout);
+         args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
+         args->rc = MI_CMD_DONE;
+       }
       break;
 
     }
@@ -1169,7 +1184,7 @@ mi_execute_command (char *cmd, int from_tty)
   struct mi_parse *command;
   struct captured_mi_execute_command_args args;
   struct ui_out *saved_uiout = uiout;
-  int result, rc;
+  int result;
 
   /* This is to handle EOF (^D). We just quit gdb. */
   /* FIXME: we should call some API function here. */
@@ -1277,12 +1292,6 @@ mi_cmd_execute (struct mi_parse *parse)
     }
 }
 
-static void
-mi_execute_command_wrapper (char *cmd)
-{
-  mi_execute_command (cmd, stdin == instream);
-}
-
 /* FIXME: This is just a hack so we can get some extra commands going.
    We don't want to channel things through the CLI, but call libgdb directly */
 /* Use only for synchronous commands */
@@ -1385,13 +1394,7 @@ mi_exec_async_cli_cmd_continuation (struct continuation_arg *arg)
   do_exec_cleanups (ALL_CLEANUPS);
 }
 
-static char *
-mi_input (char *buf)
-{
-  return gdb_readline (NULL);
-}
-
-static void
+void
 mi_load_progress (const char *section_name,
                  unsigned long sent_so_far,
                  unsigned long total_section,
@@ -1403,7 +1406,8 @@ mi_load_progress (const char *section_name,
   static char *previous_sect_name = NULL;
   int new_section;
 
-  if (!interpreter_p || strncmp (interpreter_p, "mi", 2) != 0)
+  if (!current_interp_named_p (INTERP_MI)
+      && !current_interp_named_p (INTERP_MI1))
     return;
 
   update_threshold.tv_sec = 0;
@@ -1462,131 +1466,17 @@ mi_load_progress (const char *section_name,
     }
 }
 
-static void
-mi_command_loop (int mi_version)
-{
-  if (mi_version <= 1)
-    {
-      /* HACK: Force stdout/stderr to point at the console.  This avoids
-         any potential side effects caused by legacy code that is still
-         using the TUI / fputs_unfiltered_hook */
-      raw_stdout = stdio_fileopen (stdout);
-      /* Route normal output through the MIx */
-      gdb_stdout = mi_console_file_new (raw_stdout, "~");
-    }
-
-  /* Route error and log output through the MI */
-  gdb_stderr = mi_console_file_new (raw_stdout, "&");
-  gdb_stdlog = gdb_stderr;
-  /* Route target output through the MI. */
-  gdb_stdtarg = mi_console_file_new (raw_stdout, "@");
-
-  /* HACK: Poke the ui_out table directly.  Should we be creating a
-     mi_out object wired up to the above gdb_stdout / gdb_stderr? */
-  uiout = mi_out_new (mi_version);
-
-  /* HACK: Override any other interpreter hooks.  We need to create a
-     real event table and pass in that. */
-  init_ui_hook = 0;
-  /* command_loop_hook = 0; */
-  print_frame_info_listing_hook = 0;
-  query_hook = 0;
-  warning_hook = 0;
-  create_breakpoint_hook = 0;
-  delete_breakpoint_hook = 0;
-  modify_breakpoint_hook = 0;
-  interactive_hook = 0;
-  registers_changed_hook = 0;
-  readline_begin_hook = 0;
-  readline_hook = 0;
-  readline_end_hook = 0;
-  register_changed_hook = 0;
-  memory_changed_hook = 0;
-  context_hook = 0;
-  target_wait_hook = 0;
-  call_command_hook = 0;
-  error_hook = 0;
-  error_begin_hook = 0;
-  show_load_progress = mi_load_progress;
-
-  /* Turn off 8 bit strings in quoted output.  Any character with the
-     high bit set is printed using C's octal format. */
-  sevenbit_strings = 1;
-
-  /* Tell the world that we're alive */
-  fputs_unfiltered ("(gdb) \n", raw_stdout);
-  gdb_flush (raw_stdout);
-
-  if (!event_loop_p)
-    simplified_command_loop (mi_input, mi_execute_command);
-  else
-    start_event_loop ();
-}
-
-static void
-mi1_command_loop (void)
-{
-  mi_command_loop (1);
-}
-
-static void
-mi2_command_loop (void)
-{
-  mi_command_loop (2);
-}
-
-static void
-setup_architecture_data (void)
+void
+mi_setup_architecture_data (void)
 {
   /* don't trust REGISTER_BYTES to be zero. */
   old_regs = xmalloc (REGISTER_BYTES + 1);
   memset (old_regs, 0, REGISTER_BYTES + 1);
 }
 
-static void
-mi_init_ui (char *arg0)
-{
-  if (strlen (interpreter_p) <= 2 ||
-      interpreter_p[2] > '1')
-    {
-      /* HACK: Force stdout/stderr to point at the console.  This avoids
-         any potential side effects caused by legacy code that is still
-         using the TUI / fputs_unfiltered_hook */
-      raw_stdout = stdio_fileopen (stdout);
-      /* Route normal output through the MIx */
-      gdb_stdout = mi_console_file_new (raw_stdout, "~");
-    }
-}
-
 void
 _initialize_mi_main (void)
 {
-  if (interpreter_p == NULL)
-    return;
-
-  /* If we're _the_ interpreter, take control. */
-  if (strcmp (interpreter_p, "mi") == 0)
-    command_loop_hook = mi2_command_loop;
-  else if (strcmp (interpreter_p, "mi1") == 0)
-    command_loop_hook = mi1_command_loop;
-  else if (strcmp (interpreter_p, "mi2") == 0)
-    command_loop_hook = mi2_command_loop;
-  else
-    return;
-
-  init_ui_hook = mi_init_ui;
-  setup_architecture_data ();
   register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
-  register_gdbarch_swap (NULL, 0, setup_architecture_data);
-  if (event_loop_p)
-    {
-      /* These overwrite some of the initialization done in
-        _intialize_event_loop. */
-      call_readline = gdb_readline2;
-      input_handler = mi_execute_command_wrapper;
-      add_file_handler (input_fd, stdin_event_handler, 0);
-      async_command_editing_p = 0;
-    }
-  /* FIXME: Should we notify main that we are here as a possible
-     interpreter? */
+  register_gdbarch_swap (NULL, 0, mi_setup_architecture_data);
 }
similarity index 65%
rename from gdb/config/powerpc/tm-ppc-sim.h
rename to gdb/mi/mi-main.h
index 9fa1186..8e504c6 100644 (file)
@@ -1,5 +1,6 @@
-/* Macro definitions for Power PC running embedded ABI under the simulator.
-   Copyright 1995 Free Software Foundation, Inc.
+/* MI Internal Functions for GDB, the GNU debugger.
+
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef TM_PPC_SIM_H
-#define TM_PPC_SIM_H
+#ifndef MI_MAIN_H
+#define MI_MAIN_H
+
+extern void mi_setup_architecture_data (void);
 
-#include "powerpc/tm-ppc-eabi.h"
+extern void mi_load_progress (const char *section_name,
+                             unsigned long sent_so_far,
+                             unsigned long total_section,
+                             unsigned long total_sent,
+                             unsigned long grand_total);
+#endif
 
-#endif /* TM_PPC_SIM_H */
index 9823c87..e3f649e 100644 (file)
@@ -113,7 +113,7 @@ add_minsym_to_hash_table (struct minimal_symbol *sym,
 {
   if (sym->hash_next == NULL)
     {
-      unsigned int hash = msymbol_hash (SYMBOL_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE;
+      unsigned int hash = msymbol_hash (DEPRECATED_SYMBOL_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE;
       sym->hash_next = table[hash];
       table[hash] = sym;
     }
@@ -188,7 +188,7 @@ lookup_minimal_symbol (register const char *name, const char *sfile,
 
             while (msymbol != NULL && found_symbol == NULL)
                {
-                if (SYMBOL_MATCHES_NAME (msymbol, name))
+                if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name))
                    {
                     switch (MSYMBOL_TYPE (msymbol))
                       {
@@ -288,7 +288,7 @@ lookup_minimal_symbol_text (register const char *name, const char *sfile,
               msymbol != NULL && found_symbol == NULL;
               msymbol = msymbol->hash_next)
            {
-             if (SYMBOL_MATCHES_NAME (msymbol, name) &&
+             if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name) &&
                  (MSYMBOL_TYPE (msymbol) == mst_text ||
                   MSYMBOL_TYPE (msymbol) == mst_file_text))
                {
@@ -364,7 +364,7 @@ lookup_minimal_symbol_solib_trampoline (register const char *name,
               msymbol != NULL && found_symbol == NULL;
               msymbol = msymbol->hash_next)
            {
-             if (SYMBOL_MATCHES_NAME (msymbol, name) &&
+             if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name) &&
                  MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
                return msymbol;
            }
@@ -411,8 +411,9 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, asection *section)
          "null symbol".  If there are no real symbols, then there is no
          minimal symbol table at all. */
 
-      if ((msymbol = objfile->msymbols) != NULL)
+      if (objfile->minimal_symbol_count > 0)
        {
+          msymbol = objfile->msymbols;
          lo = 0;
          hi = objfile->minimal_symbol_count - 1;
 
@@ -611,9 +612,10 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address,
       msym_bunch = new;
     }
   msymbol = &msym_bunch->contents[msym_bunch_index];
-  SYMBOL_NAME (msymbol) = obsavestring ((char *) name, strlen (name),
-                                       &objfile->symbol_obstack);
   SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown);
+  SYMBOL_LANGUAGE (msymbol) = language_auto;
+  SYMBOL_SET_NAMES (msymbol, (char *)name, strlen (name), objfile);
+
   SYMBOL_VALUE_ADDRESS (msymbol) = address;
   SYMBOL_SECTION (msymbol) = section;
   SYMBOL_BFD_SECTION (msymbol) = bfd_section;
@@ -657,8 +659,8 @@ compare_minimal_symbols (const void *fn1p, const void *fn2p)
   else
     /* addrs are equal: sort by name */
     {
-      char *name1 = SYMBOL_NAME (fn1);
-      char *name2 = SYMBOL_NAME (fn2);
+      char *name1 = DEPRECATED_SYMBOL_NAME (fn1);
+      char *name2 = DEPRECATED_SYMBOL_NAME (fn2);
 
       if (name1 && name2)      /* both have names */
        return strcmp (name1, name2);
@@ -750,7 +752,7 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount,
        {
          if (SYMBOL_VALUE_ADDRESS (copyfrom) ==
              SYMBOL_VALUE_ADDRESS ((copyfrom + 1)) &&
-             (STREQ (SYMBOL_NAME (copyfrom), SYMBOL_NAME ((copyfrom + 1)))))
+             (STREQ (DEPRECATED_SYMBOL_NAME (copyfrom), DEPRECATED_SYMBOL_NAME ((copyfrom + 1)))))
            {
              if (MSYMBOL_TYPE ((copyfrom + 1)) == mst_unknown)
                {
@@ -865,10 +867,9 @@ install_minimal_symbols (struct objfile *objfile)
          for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++)
            {
              msymbols[mcount] = bunch->contents[bindex];
-             SYMBOL_LANGUAGE (&msymbols[mcount]) = language_auto;
-             if (SYMBOL_NAME (&msymbols[mcount])[0] == leading_char)
+             if (DEPRECATED_SYMBOL_NAME (&msymbols[mcount])[0] == leading_char)
                {
-                 SYMBOL_NAME (&msymbols[mcount])++;
+                 DEPRECATED_SYMBOL_NAME (&msymbols[mcount])++;
                }
            }
          msym_bunch_index = BUNCH_SIZE;
@@ -897,7 +898,7 @@ install_minimal_symbols (struct objfile *objfile)
          symbol count does *not* include this null symbol, which is why it
          is indexed by mcount and not mcount-1. */
 
-      SYMBOL_NAME (&msymbols[mcount]) = NULL;
+      DEPRECATED_SYMBOL_NAME (&msymbols[mcount]) = NULL;
       SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0;
       MSYMBOL_INFO (&msymbols[mcount]) = NULL;
       MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown;
@@ -917,7 +918,7 @@ install_minimal_symbols (struct objfile *objfile)
 
        for (i = 0; i < mcount; i++)
          {
-           const char *name = SYMBOL_NAME (&objfile->msymbols[i]);
+           const char *name = DEPRECATED_SYMBOL_NAME (&objfile->msymbols[i]);
            if (name[0] == '_' && name[1] == 'Z')
              {
                switch_to_cp_abi ("gnu-v3");
@@ -925,11 +926,6 @@ install_minimal_symbols (struct objfile *objfile)
              }
          }
       }
-      
-      /* Now walk through all the minimal symbols, selecting the newly added
-         ones and attempting to cache their C++ demangled names. */
-      for (; mcount-- > 0; msymbols++)
-       SYMBOL_INIT_DEMANGLED_NAME (msymbols, &objfile->symbol_obstack);
 
       /* Now build the hash tables; we can't do this incrementally
          at an earlier point since we weren't finished with the obstack
@@ -985,7 +981,7 @@ find_solib_trampoline_target (CORE_ADDR pc)
       ALL_MSYMBOLS (objfile, msymbol)
       {
        if (MSYMBOL_TYPE (msymbol) == mst_text
-           && STREQ (SYMBOL_NAME (msymbol), SYMBOL_NAME (tsymbol)))
+           && STREQ (DEPRECATED_SYMBOL_NAME (msymbol), DEPRECATED_SYMBOL_NAME (tsymbol)))
          return SYMBOL_VALUE_ADDRESS (msymbol);
       }
     }
index 5898e57..7ade6a2 100644 (file)
@@ -40,6 +40,7 @@
 #include "regcache.h"
 #include "osabi.h"
 #include "mips-tdep.h"
+#include "block.h"
 
 #include "opcode/mips.h"
 #include "elf/mips.h"
@@ -1589,20 +1590,28 @@ read_next_frame_reg (struct frame_info *fi, int regno)
   int realnum;
   enum lval_type lval;
   void *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
-  frame_register_unwind (fi, regno, &optimized, &lval, &addr, &realnum,
-                        raw_buffer);
-  /* FIXME: cagney/2002-09-13: This is just soooo bad.  The MIPS
-     should have a pseudo register range that correspons to the ABI's,
-     rather than the ISA's, view of registers.  These registers would
-     then implicitly describe their size and hence could be used
-     without the below munging.  */
-  if (lval == lval_memory)
+
+  if (fi == NULL)
     {
-      if (regno < 32)
+      regcache_cooked_read (current_regcache, regno, raw_buffer);
+    }
+  else
+    {
+      frame_register_unwind (fi, regno, &optimized, &lval, &addr, &realnum,
+                            raw_buffer);
+      /* FIXME: cagney/2002-09-13: This is just soooo bad.  The MIPS
+        should have a pseudo register range that correspons to the ABI's,
+        rather than the ISA's, view of registers.  These registers would
+        then implicitly describe their size and hence could be used
+        without the below munging.  */
+      if (lval == lval_memory)
        {
-         /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
-            saved. */
-         return read_memory_integer (addr, MIPS_SAVED_REGSIZE);
+         if (regno < 32)
+           {
+             /* Only MIPS_SAVED_REGSIZE bytes of GP registers are
+                saved. */
+             return read_memory_integer (addr, MIPS_SAVED_REGSIZE);
+           }
        }
     }
 
@@ -2473,11 +2482,16 @@ mips_init_extra_frame_info (int fromleaf, struct frame_info *fci)
   if (get_frame_type (fci) == DUMMY_FRAME)
     return;
 
-  /* Use proc_desc calculated in frame_chain */
+  /* Use proc_desc calculated in frame_chain.  When there is no
+     next frame, i.e, get_next_frame (fci) == NULL, we call
+     find_proc_desc () to calculate it, passing an explicit
+     NULL as the frame parameter.  */
   proc_desc =
     get_next_frame (fci)
     ? cached_proc_desc
-    : find_proc_desc (get_frame_pc (fci), get_next_frame (fci), 1);
+    : find_proc_desc (get_frame_pc (fci),
+                      NULL /* i.e, get_next_frame (fci) */,
+                     1);
 
   frame_extra_info_zalloc (fci, sizeof (struct frame_extra_info));
 
@@ -3832,7 +3846,7 @@ mips_pop_frame (void)
 
   write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
   if (get_frame_saved_regs (frame) == NULL)
-    FRAME_INIT_SAVED_REGS (frame);
+    DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
   for (regnum = 0; regnum < NUM_REGS; regnum++)
     if (regnum != SP_REGNUM && regnum != PC_REGNUM
        && get_frame_saved_regs (frame)[regnum])
@@ -5481,7 +5495,6 @@ mips_get_saved_register (char *raw_buffer,
   CORE_ADDR addrx;
   enum lval_type lvalx;
   int optimizedx;
-  int realnum;
 
   if (!target_has_registers)
     error ("No registers.");
@@ -5493,8 +5506,8 @@ mips_get_saved_register (char *raw_buffer,
     lvalp = &lvalx;
   if (optimizedp == NULL)
     optimizedp = &optimizedx;
-  frame_register_unwind (get_next_frame (frame), regnum, optimizedp, lvalp,
-                        addrp, &realnum, raw_buffer);
+  generic_unwind_get_saved_register (raw_buffer, optimizedp, addrp, frame,
+                                     regnum, lvalp);
   /* FIXME: cagney/2002-09-13: This is just so bad.  The MIPS should
      have a pseudo register range that correspons to the ABI's, rather
      than the ISA's, view of registers.  These registers would then
@@ -5740,8 +5753,8 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_double_bit (gdbarch, 64);
   set_gdbarch_long_double_bit (gdbarch, 64);
   set_gdbarch_register_raw_size (gdbarch, mips_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 8);
-  set_gdbarch_max_register_virtual_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
   tdep->found_abi = found_abi;
   tdep->mips_abi = mips_abi;
 
@@ -5969,8 +5982,8 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum);
 
   /* Initialize a frame */
-  set_gdbarch_init_extra_frame_info (gdbarch, mips_init_extra_frame_info);
-  set_gdbarch_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mips_init_extra_frame_info);
 
   /* MIPS version of CALL_DUMMY */
 
@@ -5978,7 +5991,6 @@ mips_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
   set_gdbarch_call_dummy_address (gdbarch, mips_call_dummy_address);
   set_gdbarch_push_return_address (gdbarch, mips_push_return_address);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_pop_frame (gdbarch, mips_pop_frame);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
@@ -6053,6 +6065,38 @@ mips_abi_update (char *ignore_args, int from_tty,
   gdbarch_update_p (info);
 }
 
+/* Print out which MIPS ABI is in use.  */
+
+static void
+show_mips_abi (char *ignore_args, int from_tty)
+{
+  if (gdbarch_bfd_arch_info (current_gdbarch)->arch != bfd_arch_mips)
+    printf_filtered (
+      "The MIPS ABI is unknown because the current architecture is not MIPS.\n");
+  else
+    {
+      enum mips_abi global_abi = global_mips_abi ();
+      enum mips_abi actual_abi = mips_abi (current_gdbarch);
+      const char *actual_abi_str = mips_abi_strings[actual_abi];
+
+      if (global_abi == MIPS_ABI_UNKNOWN)
+       printf_filtered ("The MIPS ABI is set automatically (currently \"%s\").\n",
+                        actual_abi_str);
+      else if (global_abi == actual_abi)
+       printf_filtered (
+         "The MIPS ABI is assumed to be \"%s\" (due to user setting).\n",
+         actual_abi_str);
+      else
+       {
+         /* Probably shouldn't happen...  */
+         printf_filtered (
+           "The (auto detected) MIPS ABI \"%s\" is in use even though the user setting was \"%s\".\n",
+           actual_abi_str,
+           mips_abi_strings[global_abi]);
+       }
+    }
+}
+
 static void
 mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
 {
@@ -6500,8 +6544,9 @@ This option can be set to one of:\n\
      "  eabi32\n"
      "  eabi64",
      &setmipscmdlist);
-  add_show_from_set (c, &showmipscmdlist);
   set_cmd_sfunc (c, mips_abi_update);
+  add_cmd ("abi", class_obscure, show_mips_abi,
+           "Show ABI in use by MIPS target", &showmipscmdlist);
 
   /* Let the user turn off floating point and set the fence post for
      heuristic_proc_start.  */
index 1f869f4..293eaed 100644 (file)
@@ -1,6 +1,6 @@
 /* Read a symbol table in MIPS' format (Third-Eye).
    Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1998, 1999, 2000, 2001
+   1998, 1999, 2000, 2001, 2003
    Free Software Foundation, Inc.
    Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU.  Major work
    by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support.
@@ -118,7 +118,7 @@ mipscoff_symfile_read (struct objfile *objfile, int mainline)
       struct minimal_symbol *m;
 
       m = lookup_minimal_symbol_by_pc (objfile->ei.entry_point);
-      if (m && SYMBOL_NAME (m + 1))
+      if (m && DEPRECATED_SYMBOL_NAME (m + 1))
        {
          objfile->ei.entry_file_lowpc = SYMBOL_VALUE_ADDRESS (m);
          objfile->ei.entry_file_highpc = SYMBOL_VALUE_ADDRESS (m + 1);
index c75bd58..a484f02 100644 (file)
-/* Target-dependent code for the Matsushita MN10200 for GDB, the GNU debugger.
-
-   Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software
-   Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include "defs.h"
-#include "frame.h"
-#include "inferior.h"
-#include "target.h"
-#include "value.h"
-#include "bfd.h"
-#include "gdb_string.h"
-#include "gdbcore.h"
-#include "symfile.h"
-#include "regcache.h"
-
-
-/* Should call_function allocate stack space for a struct return?  */
-int
-mn10200_use_struct_convention (int gcc_p, struct type *type)
-{
-  return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
-}
-/* *INDENT-OFF* */
-/* The main purpose of this file is dealing with prologues to extract
-   information about stack frames and saved registers.
-
-   For reference here's how prologues look on the mn10200:
-
-     With frame pointer:
-       mov fp,a0
-       mov sp,fp
-       add <size>,sp
-       Register saves for d2, d3, a1, a2 as needed.  Saves start
-       at fp - <size> + <outgoing_args_size> and work towards higher
-       addresses.  Note that the saves are actually done off the stack
-       pointer in the prologue!  This makes for smaller code and easier
-       prologue scanning as the displacement fields will unlikely
-        be more than 8 bits!
-
-     Without frame pointer:
-        add <size>,sp
-       Register saves for d2, d3, a1, a2 as needed.  Saves start
-       at sp + <outgoing_args_size> and work towards higher addresses.
-
-     Out of line prologue:
-       add <local size>,sp  -- optional
-       jsr __prologue
-       add <outgoing_size>,sp -- optional
-
-   The stack pointer remains constant throughout the life of most
-   functions.  As a result the compiler will usually omit the
-   frame pointer, so we must handle frame pointerless functions.  */
-
-/* Analyze the prologue to determine where registers are saved,
-   the end of the prologue, etc etc.  Return the end of the prologue
-   scanned.
-
-   We store into FI (if non-null) several tidbits of information:
-
-    * stack_size -- size of this stack frame.  Note that if we stop in
-    certain parts of the prologue/epilogue we may claim the size of the
-    current frame is zero.  This happens when the current frame has
-    not been allocated yet or has already been deallocated.
-
-    * fsr -- Addresses of registers saved in the stack by this frame.
-
-    * status -- A (relatively) generic status indicator.  It's a bitmask
-    with the following bits: 
-
-      MY_FRAME_IN_SP: The base of the current frame is actually in
-      the stack pointer.  This can happen for frame pointerless
-      functions, or cases where we're stopped in the prologue/epilogue
-      itself.  For these cases mn10200_analyze_prologue will need up
-      update fi->frame before returning or analyzing the register
-      save instructions.
-
-      MY_FRAME_IN_FP: The base of the current frame is in the
-      frame pointer register ($a2).
-
-      CALLER_A2_IN_A0: $a2 from the caller's frame is temporarily
-      in $a0.  This can happen if we're stopped in the prologue.
-
-      NO_MORE_FRAMES: Set this if the current frame is "start" or
-      if the first instruction looks like mov <imm>,sp.  This tells
-      frame chain to not bother trying to unwind past this frame.  */
-/* *INDENT-ON* */
-
-
-
-
-#define MY_FRAME_IN_SP 0x1
-#define MY_FRAME_IN_FP 0x2
-#define CALLER_A2_IN_A0 0x4
-#define NO_MORE_FRAMES 0x8
-
-static CORE_ADDR
-mn10200_analyze_prologue (struct frame_info *fi, CORE_ADDR pc)
-{
-  CORE_ADDR func_addr, func_end, addr, stop;
-  CORE_ADDR stack_size = 0;
-  unsigned char buf[4];
-  int status;
-  char *name;
-  int out_of_line_prologue = 0;
-
-  /* Use the PC in the frame if it's provided to look up the
-     start of this function.  */
-  pc = (fi ? get_frame_pc (fi) : pc);
-
-  /* Find the start of this function.  */
-  status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
-
-  /* Do nothing if we couldn't find the start of this function or if we're
-     stopped at the first instruction in the prologue.  */
-  if (status == 0)
-    return pc;
-
-  /* If we're in start, then give up.  */
-  if (strcmp (name, "start") == 0)
-    {
-      if (fi)
-       fi->status = NO_MORE_FRAMES;
-      return pc;
-    }
-
-  /* At the start of a function our frame is in the stack pointer.  */
-  if (fi)
-    fi->status = MY_FRAME_IN_SP;
-
-  /* If we're physically on an RTS instruction, then our frame has already
-     been deallocated.
-
-     fi->frame is bogus, we need to fix it.  */
-  if (fi && get_frame_pc (fi) + 1 == func_end)
-    {
-      status = target_read_memory (get_frame_pc (fi), buf, 1);
-      if (status != 0)
-       {
-         if (get_next_frame (fi) == NULL)
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return get_frame_pc (fi);
-       }
-
-      if (buf[0] == 0xfe)
-       {
-         if (get_next_frame (fi) == NULL)
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return get_frame_pc (fi);
-       }
-    }
-
-  /* Similarly if we're stopped on the first insn of a prologue as our
-     frame hasn't been allocated yet.  */
-  if (fi && get_frame_pc (fi) == func_addr)
-    {
-      if (get_next_frame (fi) == NULL)
-       deprecated_update_frame_base_hack (fi, read_sp ());
-      return get_frame_pc (fi);
-    }
-
-  /* Figure out where to stop scanning.  */
-  stop = fi ? get_frame_pc (fi) : func_end;
-
-  /* Don't walk off the end of the function.  */
-  stop = stop > func_end ? func_end : stop;
-
-  /* Start scanning on the first instruction of this function.  */
-  addr = func_addr;
-
-  status = target_read_memory (addr, buf, 2);
-  if (status != 0)
-    {
-      if (fi && get_next_frame (fi) == NULL && fi->status & MY_FRAME_IN_SP)
-       deprecated_update_frame_base_hack (fi, read_sp ());
-      return addr;
-    }
-
-  /* First see if this insn sets the stack pointer; if so, it's something
-     we won't understand, so quit now.   */
-  if (buf[0] == 0xdf
-      || (buf[0] == 0xf4 && buf[1] == 0x77))
-    {
-      if (fi)
-       fi->status = NO_MORE_FRAMES;
-      return addr;
-    }
-
-  /* Now see if we have a frame pointer.
-
-     Search for mov a2,a0 (0xf278)
-     then       mov a3,a2 (0xf27e).  */
-
-  if (buf[0] == 0xf2 && buf[1] == 0x78)
-    {
-      /* Our caller's $a2 will be found in $a0 now.  Note it for
-         our callers.  */
-      if (fi)
-       fi->status |= CALLER_A2_IN_A0;
-      addr += 2;
-      if (addr >= stop)
-       {
-         /* We still haven't allocated our local stack.  Handle this
-            as if we stopped on the first or last insn of a function.   */
-         if (fi && get_next_frame (fi) == NULL)
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-
-      status = target_read_memory (addr, buf, 2);
-      if (status != 0)
-       {
-         if (fi && get_next_frame (fi) == NULL)
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-      if (buf[0] == 0xf2 && buf[1] == 0x7e)
-       {
-         addr += 2;
-
-         /* Our frame pointer is valid now.  */
-         if (fi)
-           {
-             fi->status |= MY_FRAME_IN_FP;
-             fi->status &= ~MY_FRAME_IN_SP;
-           }
-         if (addr >= stop)
-           return addr;
-       }
-      else
-       {
-         if (fi && get_next_frame (fi) == NULL)
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-    }
-
-  /* Next we should allocate the local frame.
-
-     Search for add imm8,a3 (0xd3XX)
-     or add imm16,a3 (0xf70bXXXX)
-     or add imm24,a3 (0xf467XXXXXX).
-
-     If none of the above was found, then this prologue has
-     no stack, and therefore can't have any register saves,
-     so quit now.  */
-  status = target_read_memory (addr, buf, 2);
-  if (status != 0)
-    {
-      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-       deprecated_update_frame_base_hack (fi, read_sp ());
-      return addr;
-    }
-  if (buf[0] == 0xd3)
-    {
-      stack_size = extract_signed_integer (&buf[1], 1);
-      if (fi)
-       fi->stack_size = stack_size;
-      addr += 2;
-      if (addr >= stop)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
-         return addr;
-       }
-    }
-  else if (buf[0] == 0xf7 && buf[1] == 0x0b)
-    {
-      status = target_read_memory (addr + 2, buf, 2);
-      if (status != 0)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-      stack_size = extract_signed_integer (buf, 2);
-      if (fi)
-       fi->stack_size = stack_size;
-      addr += 4;
-      if (addr >= stop)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
-         return addr;
-       }
-    }
-  else if (buf[0] == 0xf4 && buf[1] == 0x67)
-    {
-      status = target_read_memory (addr + 2, buf, 3);
-      if (status != 0)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-      stack_size = extract_signed_integer (buf, 3);
-      if (fi)
-       fi->stack_size = stack_size;
-      addr += 5;
-      if (addr >= stop)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
-         return addr;
-       }
-    }
-
-  /* Now see if we have a call to __prologue for an out of line
-     prologue.  */
-  status = target_read_memory (addr, buf, 2);
-  if (status != 0)
-    return addr;
-
-  /* First check for 16bit pc-relative call to __prologue.  */
-  if (buf[0] == 0xfd)
-    {
-      CORE_ADDR temp;
-      status = target_read_memory (addr + 1, buf, 2);
-      if (status != 0)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-
-      /* Get the PC this instruction will branch to.  */
-      temp = (extract_signed_integer (buf, 2) + addr + 3) & 0xffffff;
-
-      /* Get the name of the function at the target address.  */
-      status = find_pc_partial_function (temp, &name, NULL, NULL);
-      if (status == 0)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-
-      /* Note if it is an out of line prologue.  */
-      out_of_line_prologue = (strcmp (name, "__prologue") == 0);
-
-      /* This sucks up 3 bytes of instruction space.  */
-      if (out_of_line_prologue)
-       addr += 3;
-
-      if (addr >= stop)
-       {
-         if (fi && get_next_frame (fi) == NULL)
-           {
-             fi->stack_size -= 16;
-             deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
-           }
-         return addr;
-       }
-    }
-  /* Now check for the 24bit pc-relative call to __prologue.  */
-  else if (buf[0] == 0xf4 && buf[1] == 0xe1)
-    {
-      CORE_ADDR temp;
-      status = target_read_memory (addr + 2, buf, 3);
-      if (status != 0)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-
-      /* Get the PC this instruction will branch to.  */
-      temp = (extract_signed_integer (buf, 3) + addr + 5) & 0xffffff;
-
-      /* Get the name of the function at the target address.  */
-      status = find_pc_partial_function (temp, &name, NULL, NULL);
-      if (status == 0)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           deprecated_update_frame_base_hack (fi, read_sp ());
-         return addr;
-       }
-
-      /* Note if it is an out of line prologue.  */
-      out_of_line_prologue = (strcmp (name, "__prologue") == 0);
-
-      /* This sucks up 5 bytes of instruction space.  */
-      if (out_of_line_prologue)
-       addr += 5;
-
-      if (addr >= stop)
-       {
-         if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
-           {
-             fi->stack_size -= 16;
-             deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
-           }
-         return addr;
-       }
-    }
-
-  /* Now actually handle the out of line prologue.  */
-  if (out_of_line_prologue)
-    {
-      int outgoing_args_size = 0;
-
-      /* First adjust the stack size for this function.  The out of
-         line prologue saves 4 registers (16bytes of data).  */
-      if (fi)
-       fi->stack_size -= 16;
-
-      /* Update fi->frame if necessary.  */
-      if (fi && get_next_frame (fi) == NULL)
-       deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
-
-      /* After the out of line prologue, there may be another
-         stack adjustment for the outgoing arguments.
-
-         Search for add imm8,a3 (0xd3XX)
-         or     add imm16,a3 (0xf70bXXXX)
-         or     add imm24,a3 (0xf467XXXXXX).  */
-
-      status = target_read_memory (addr, buf, 2);
-      if (status != 0)
-       {
-         if (fi)
-           {
-             fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
-             fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
-             fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
-             fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
-           }
-         return addr;
-       }
-
-      if (buf[0] == 0xd3)
-       {
-         outgoing_args_size = extract_signed_integer (&buf[1], 1);
-         addr += 2;
-       }
-      else if (buf[0] == 0xf7 && buf[1] == 0x0b)
-       {
-         status = target_read_memory (addr + 2, buf, 2);
-         if (status != 0)
-           {
-             if (fi)
-               {
-                 fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
-                 fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
-                 fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
-                 fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
-               }
-             return addr;
-           }
-         outgoing_args_size = extract_signed_integer (buf, 2);
-         addr += 4;
-       }
-      else if (buf[0] == 0xf4 && buf[1] == 0x67)
-       {
-         status = target_read_memory (addr + 2, buf, 3);
-         if (status != 0)
-           {
-             if (fi && get_next_frame (fi) == NULL)
-               {
-                 fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
-                 fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
-                 fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
-                 fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
-               }
-             return addr;
-           }
-         outgoing_args_size = extract_signed_integer (buf, 3);
-         addr += 5;
-       }
-      else
-       outgoing_args_size = 0;
-
-      /* Now that we know the size of the outgoing arguments, fix
-         fi->frame again if this is the innermost frame.  */
-      if (fi && get_next_frame (fi) == NULL)
-       deprecated_update_frame_base_hack (fi, get_frame_base (fi) - outgoing_args_size);
-
-      /* Note the register save information and update the stack
-         size for this frame too.  */
-      if (fi)
-       {
-         fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
-         fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
-         fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
-         fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
-         fi->stack_size += outgoing_args_size;
-       }
-      /* There can be no more prologue insns, so return now.  */
-      return addr;
-    }
-
-  /* At this point fi->frame needs to be correct.
-
-     If MY_FRAME_IN_SP is set and we're the innermost frame, then we
-     need to fix fi->frame so that backtracing, find_frame_saved_regs,
-     etc work correctly.  */
-  if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP) != 0)
-    deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
-
-  /* And last we have the register saves.  These are relatively
-     simple because they're physically done off the stack pointer,
-     and thus the number of different instructions we need to
-     check is greatly reduced because we know the displacements
-     will be small.
-
-     Search for movx d2,(X,a3) (0xf55eXX)
-     then       movx d3,(X,a3) (0xf55fXX)
-     then       mov  a1,(X,a3) (0x5dXX)    No frame pointer case
-     then       mov  a2,(X,a3) (0x5eXX)    No frame pointer case
-     or  mov  a0,(X,a3) (0x5cXX)           Frame pointer case.  */
-
-  status = target_read_memory (addr, buf, 2);
-  if (status != 0)
-    return addr;
-  if (buf[0] == 0xf5 && buf[1] == 0x5e)
-    {
-      if (fi)
-       {
-         status = target_read_memory (addr + 2, buf, 1);
-         if (status != 0)
-           return addr;
-         fi->fsr.regs[2] = (get_frame_base (fi) + stack_size
-                            + extract_signed_integer (buf, 1));
-       }
-      addr += 3;
-      if (addr >= stop)
-       return addr;
-      status = target_read_memory (addr, buf, 2);
-      if (status != 0)
-       return addr;
-    }
-  if (buf[0] == 0xf5 && buf[1] == 0x5f)
-    {
-      if (fi)
-       {
-         status = target_read_memory (addr + 2, buf, 1);
-         if (status != 0)
-           return addr;
-         fi->fsr.regs[3] = (get_frame_base (fi) + stack_size
-                            + extract_signed_integer (buf, 1));
-       }
-      addr += 3;
-      if (addr >= stop)
-       return addr;
-      status = target_read_memory (addr, buf, 2);
-      if (status != 0)
-       return addr;
-    }
-  if (buf[0] == 0x5d)
-    {
-      if (fi)
-       {
-         status = target_read_memory (addr + 1, buf, 1);
-         if (status != 0)
-           return addr;
-         fi->fsr.regs[5] = (get_frame_base (fi) + stack_size
-                            + extract_signed_integer (buf, 1));
-       }
-      addr += 2;
-      if (addr >= stop)
-       return addr;
-      status = target_read_memory (addr, buf, 2);
-      if (status != 0)
-       return addr;
-    }
-  if (buf[0] == 0x5e || buf[0] == 0x5c)
-    {
-      if (fi)
-       {
-         status = target_read_memory (addr + 1, buf, 1);
-         if (status != 0)
-           return addr;
-         fi->fsr.regs[6] = (get_frame_base (fi) + stack_size
-                            + extract_signed_integer (buf, 1));
-         fi->status &= ~CALLER_A2_IN_A0;
-       }
-      addr += 2;
-      if (addr >= stop)
-       return addr;
-      return addr;
-    }
-  return addr;
-}
-
-/* Function: frame_chain
-   Figure out and return the caller's frame pointer given current
-   frame_info struct.
-
-   We don't handle dummy frames yet but we would probably just return the
-   stack pointer that was in use at the time the function call was made?  */
-
-CORE_ADDR
-mn10200_frame_chain (struct frame_info *fi)
-{
-  struct frame_info *dummy_frame = deprecated_frame_xmalloc ();
-  struct cleanup *old_chain = make_cleanup (xfree, dummy_frame);
-  CORE_ADDR ret;
-
-  /* Walk through the prologue to determine the stack size,
-     location of saved registers, end of the prologue, etc.  */
-  if (fi->status == 0)
-    mn10200_analyze_prologue (fi, (CORE_ADDR) 0);
-
-  /* Quit now if mn10200_analyze_prologue set NO_MORE_FRAMES.  */
-  if (fi->status & NO_MORE_FRAMES)
-    return 0;
-
-  /* Now that we've analyzed our prologue, determine the frame
-     pointer for our caller.
-
-     If our caller has a frame pointer, then we need to
-     find the entry value of $a2 to our function.
-
-     If CALLER_A2_IN_A0, then the chain is in $a0.
-
-     If fsr.regs[6] is nonzero, then it's at the memory
-     location pointed to by fsr.regs[6].
-
-     Else it's still in $a2.
-
-     If our caller does not have a frame pointer, then his
-     frame base is fi->frame + -caller's stack size + 4.  */
-
-  /* The easiest way to get that info is to analyze our caller's frame.
-
-     So we set up a dummy frame and call mn10200_analyze_prologue to
-     find stuff for us.  */
-  deprecated_update_frame_pc_hack (dummy_frame, FRAME_SAVED_PC (fi));
-  deprecated_update_frame_base_hack (dummy_frame, get_frame_base (fi));
-  memset (dummy_frame->fsr.regs, '\000', sizeof dummy_frame->fsr.regs);
-  dummy_frame->status = 0;
-  dummy_frame->stack_size = 0;
-  mn10200_analyze_prologue (dummy_frame, 0);
-
-  if (dummy_frame->status & MY_FRAME_IN_FP)
-    {
-      /* Our caller has a frame pointer.  So find the frame in $a2, $a0,
-         or in the stack.  */
-      if (fi->fsr.regs[6])
-       ret = (read_memory_integer (fi->fsr.regs[FP_REGNUM], REGISTER_SIZE)
-              & 0xffffff);
-      else if (fi->status & CALLER_A2_IN_A0)
-       ret = read_register (4);
-      else
-       ret = read_register (FP_REGNUM);
-    }
-  else
-    {
-      /* Our caller does not have a frame pointer.  So his frame starts
-         at the base of our frame (fi->frame) + <his size> + 4 (saved pc).  */
-      ret = get_frame_base (fi) + -dummy_frame->stack_size + 4;
-    }
-  do_cleanups (old_chain);
-  return ret;
-}
-
-/* Function: skip_prologue
-   Return the address of the first inst past the prologue of the function.  */
-
-CORE_ADDR
-mn10200_skip_prologue (CORE_ADDR pc)
-{
-  /* We used to check the debug symbols, but that can lose if
-     we have a null prologue.  */
-  return mn10200_analyze_prologue (NULL, pc);
-}
-
-/* Function: pop_frame
-   This routine gets called when either the user uses the `return'
-   command, or the call dummy breakpoint gets hit.  */
-
-void
-mn10200_pop_frame (struct frame_info *frame)
-{
-  int regnum;
-
-  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
-                                  get_frame_base (frame),
-                                  get_frame_base (frame)))
-    generic_pop_dummy_frame ();
-  else
-    {
-      write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
-
-      /* Restore any saved registers.  */
-      for (regnum = 0; regnum < NUM_REGS; regnum++)
-       if (frame->fsr.regs[regnum] != 0)
-         {
-           ULONGEST value;
-
-           value = read_memory_unsigned_integer (frame->fsr.regs[regnum],
-                                               REGISTER_RAW_SIZE (regnum));
-           write_register (regnum, value);
-         }
-
-      /* Actually cut back the stack.  */
-      write_register (SP_REGNUM, get_frame_base (frame));
-
-      /* Don't we need to set the PC?!?  XXX FIXME.  */
-    }
-
-  /* Throw away any cached frame information.  */
-  flush_cached_frames ();
-}
-
-/* Function: push_arguments
-   Setup arguments for a call to the target.  Arguments go in
-   order on the stack.  */
-
-CORE_ADDR
-mn10200_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
-                       unsigned char struct_return, CORE_ADDR struct_addr)
-{
-  int argnum = 0;
-  int len = 0;
-  int stack_offset = 0;
-  int regsused = struct_return ? 1 : 0;
-
-  /* This should be a nop, but align the stack just in case something
-     went wrong.  Stacks are two byte aligned on the mn10200.  */
-  sp &= ~1;
-
-  /* Now make space on the stack for the args.
-
-     XXX This doesn't appear to handle pass-by-invisible reference
-     arguments.  */
-  for (argnum = 0; argnum < nargs; argnum++)
-    {
-      int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 1) & ~1;
-
-      /* If we've used all argument registers, then this argument is
-         pushed.  */
-      if (regsused >= 2 || arg_length > 4)
-       {
-         regsused = 2;
-         len += arg_length;
-       }
-      /* We know we've got some arg register space left.  If this argument
-         will fit entirely in regs, then put it there.  */
-      else if (arg_length <= 2
-              || TYPE_CODE (VALUE_TYPE (args[argnum])) == TYPE_CODE_PTR)
-       {
-         regsused++;
-       }
-      else if (regsused == 0)
-       {
-         regsused = 2;
-       }
-      else
-       {
-         regsused = 2;
-         len += arg_length;
-       }
-    }
-
-  /* Allocate stack space.  */
-  sp -= len;
-
-  regsused = struct_return ? 1 : 0;
-  /* Push all arguments onto the stack. */
-  for (argnum = 0; argnum < nargs; argnum++)
-    {
-      int len;
-      char *val;
-
-      /* XXX Check this.  What about UNIONS?  */
-      if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
-         && TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
-       {
-         /* XXX Wrong, we want a pointer to this argument.  */
-         len = TYPE_LENGTH (VALUE_TYPE (*args));
-         val = (char *) VALUE_CONTENTS (*args);
-       }
-      else
-       {
-         len = TYPE_LENGTH (VALUE_TYPE (*args));
-         val = (char *) VALUE_CONTENTS (*args);
-       }
-
-      if (regsused < 2
-         && (len <= 2
-             || TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_PTR))
-       {
-         write_register (regsused, extract_unsigned_integer (val, 4));
-         regsused++;
-       }
-      else if (regsused == 0 && len == 4)
-       {
-         write_register (regsused, extract_unsigned_integer (val, 2));
-         write_register (regsused + 1, extract_unsigned_integer (val + 2, 2));
-         regsused = 2;
-       }
-      else
-       {
-         regsused = 2;
-         while (len > 0)
-           {
-             write_memory (sp + stack_offset, val, 2);
-
-             len -= 2;
-             val += 2;
-             stack_offset += 2;
-           }
-       }
-      args++;
-    }
-
-  return sp;
-}
-
-/* Function: push_return_address (pc)
-   Set up the return address for the inferior function call.
-   Needed for targets where we don't actually execute a JSR/BSR instruction */
-
-CORE_ADDR
-mn10200_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  unsigned char buf[4];
-
-  store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ());
-  write_memory (sp - 4, buf, 4);
-  return sp - 4;
-}
-
-/* Function: store_struct_return (addr,sp)
-   Store the structure value return address for an inferior function
-   call.  */
-
-CORE_ADDR
-mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
-  /* The structure return address is passed as the first argument.  */
-  write_register (0, addr);
-  return sp;
-}
-
-/* Function: frame_saved_pc 
-   Find the caller of this frame.  We do this by seeing if RP_REGNUM
-   is saved in the stack anywhere, otherwise we get it from the
-   registers.  If the inner frame is a dummy frame, return its PC
-   instead of RP, because that's where "caller" of the dummy-frame
-   will be found.  */
-
-CORE_ADDR
-mn10200_frame_saved_pc (struct frame_info *fi)
-{
-  /* The saved PC will always be at the base of the current frame.  */
-  return (read_memory_integer (get_frame_base (fi), REGISTER_SIZE) & 0xffffff);
-}
-
-/* Function: init_extra_frame_info
-   Setup the frame's frame pointer, pc, and frame addresses for saved
-   registers.  Most of the work is done in mn10200_analyze_prologue().
-
-   Note that when we are called for the last frame (currently active frame),
-   that get_frame_pc (fi) and fi->frame will already be setup.  However, fi->frame will
-   be valid only if this routine uses FP.  For previous frames, fi-frame will
-   always be correct.  mn10200_analyze_prologue will fix fi->frame if
-   it's not valid.
-
-   We can be called with the PC in the call dummy under two circumstances.
-   First, during normal backtracing, second, while figuring out the frame
-   pointer just prior to calling the target function (see run_stack_dummy).  */
-
-void
-mn10200_init_extra_frame_info (struct frame_info *fi)
-{
-  if (get_next_frame (fi))
-    deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
-
-  memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
-  fi->status = 0;
-  fi->stack_size = 0;
-
-  mn10200_analyze_prologue (fi, 0);
-}
-
-void
-_initialize_mn10200_tdep (void)
-{
-  tm_print_insn = print_insn_mn10200;
-}
+// OBSOLETE /* Target-dependent code for the Matsushita MN10200 for GDB, the GNU debugger.
+// OBSOLETE 
+// OBSOLETE    Copyright 1997, 1998, 1999, 2000, 2001, 2003 Free Software
+// OBSOLETE    Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "frame.h"
+// OBSOLETE #include "inferior.h"
+// OBSOLETE #include "target.h"
+// OBSOLETE #include "value.h"
+// OBSOLETE #include "bfd.h"
+// OBSOLETE #include "gdb_string.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "symfile.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE /* Should call_function allocate stack space for a struct return?  */
+// OBSOLETE int
+// OBSOLETE mn10200_use_struct_convention (int gcc_p, struct type *type)
+// OBSOLETE {
+// OBSOLETE   return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
+// OBSOLETE }
+// OBSOLETE /* *INDENT-OFF* */
+// OBSOLETE /* The main purpose of this file is dealing with prologues to extract
+// OBSOLETE    information about stack frames and saved registers.
+// OBSOLETE 
+// OBSOLETE    For reference here's how prologues look on the mn10200:
+// OBSOLETE 
+// OBSOLETE      With frame pointer:
+// OBSOLETE    mov fp,a0
+// OBSOLETE    mov sp,fp
+// OBSOLETE    add <size>,sp
+// OBSOLETE    Register saves for d2, d3, a1, a2 as needed.  Saves start
+// OBSOLETE    at fp - <size> + <outgoing_args_size> and work towards higher
+// OBSOLETE    addresses.  Note that the saves are actually done off the stack
+// OBSOLETE    pointer in the prologue!  This makes for smaller code and easier
+// OBSOLETE    prologue scanning as the displacement fields will unlikely
+// OBSOLETE         be more than 8 bits!
+// OBSOLETE 
+// OBSOLETE      Without frame pointer:
+// OBSOLETE         add <size>,sp
+// OBSOLETE    Register saves for d2, d3, a1, a2 as needed.  Saves start
+// OBSOLETE    at sp + <outgoing_args_size> and work towards higher addresses.
+// OBSOLETE 
+// OBSOLETE      Out of line prologue:
+// OBSOLETE    add <local size>,sp  -- optional
+// OBSOLETE    jsr __prologue
+// OBSOLETE    add <outgoing_size>,sp -- optional
+// OBSOLETE 
+// OBSOLETE    The stack pointer remains constant throughout the life of most
+// OBSOLETE    functions.  As a result the compiler will usually omit the
+// OBSOLETE    frame pointer, so we must handle frame pointerless functions.  */
+// OBSOLETE 
+// OBSOLETE /* Analyze the prologue to determine where registers are saved,
+// OBSOLETE    the end of the prologue, etc etc.  Return the end of the prologue
+// OBSOLETE    scanned.
+// OBSOLETE 
+// OBSOLETE    We store into FI (if non-null) several tidbits of information:
+// OBSOLETE 
+// OBSOLETE     * stack_size -- size of this stack frame.  Note that if we stop in
+// OBSOLETE     certain parts of the prologue/epilogue we may claim the size of the
+// OBSOLETE     current frame is zero.  This happens when the current frame has
+// OBSOLETE     not been allocated yet or has already been deallocated.
+// OBSOLETE 
+// OBSOLETE     * fsr -- Addresses of registers saved in the stack by this frame.
+// OBSOLETE 
+// OBSOLETE     * status -- A (relatively) generic status indicator.  It's a bitmask
+// OBSOLETE     with the following bits: 
+// OBSOLETE 
+// OBSOLETE       MY_FRAME_IN_SP: The base of the current frame is actually in
+// OBSOLETE       the stack pointer.  This can happen for frame pointerless
+// OBSOLETE       functions, or cases where we're stopped in the prologue/epilogue
+// OBSOLETE       itself.  For these cases mn10200_analyze_prologue will need up
+// OBSOLETE       update fi->frame before returning or analyzing the register
+// OBSOLETE       save instructions.
+// OBSOLETE 
+// OBSOLETE       MY_FRAME_IN_FP: The base of the current frame is in the
+// OBSOLETE       frame pointer register ($a2).
+// OBSOLETE 
+// OBSOLETE       CALLER_A2_IN_A0: $a2 from the caller's frame is temporarily
+// OBSOLETE       in $a0.  This can happen if we're stopped in the prologue.
+// OBSOLETE 
+// OBSOLETE       NO_MORE_FRAMES: Set this if the current frame is "start" or
+// OBSOLETE       if the first instruction looks like mov <imm>,sp.  This tells
+// OBSOLETE       frame chain to not bother trying to unwind past this frame.  */
+// OBSOLETE /* *INDENT-ON* */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE #define MY_FRAME_IN_SP 0x1
+// OBSOLETE #define MY_FRAME_IN_FP 0x2
+// OBSOLETE #define CALLER_A2_IN_A0 0x4
+// OBSOLETE #define NO_MORE_FRAMES 0x8
+// OBSOLETE 
+// OBSOLETE static CORE_ADDR
+// OBSOLETE mn10200_analyze_prologue (struct frame_info *fi, CORE_ADDR pc)
+// OBSOLETE {
+// OBSOLETE   CORE_ADDR func_addr, func_end, addr, stop;
+// OBSOLETE   CORE_ADDR stack_size = 0;
+// OBSOLETE   unsigned char buf[4];
+// OBSOLETE   int status;
+// OBSOLETE   char *name;
+// OBSOLETE   int out_of_line_prologue = 0;
+// OBSOLETE 
+// OBSOLETE   /* Use the PC in the frame if it's provided to look up the
+// OBSOLETE      start of this function.  */
+// OBSOLETE   pc = (fi ? get_frame_pc (fi) : pc);
+// OBSOLETE 
+// OBSOLETE   /* Find the start of this function.  */
+// OBSOLETE   status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
+// OBSOLETE 
+// OBSOLETE   /* Do nothing if we couldn't find the start of this function or if we're
+// OBSOLETE      stopped at the first instruction in the prologue.  */
+// OBSOLETE   if (status == 0)
+// OBSOLETE     return pc;
+// OBSOLETE 
+// OBSOLETE   /* If we're in start, then give up.  */
+// OBSOLETE   if (strcmp (name, "start") == 0)
+// OBSOLETE     {
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->status = NO_MORE_FRAMES;
+// OBSOLETE       return pc;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* At the start of a function our frame is in the stack pointer.  */
+// OBSOLETE   if (fi)
+// OBSOLETE     fi->status = MY_FRAME_IN_SP;
+// OBSOLETE 
+// OBSOLETE   /* If we're physically on an RTS instruction, then our frame has already
+// OBSOLETE      been deallocated.
+// OBSOLETE 
+// OBSOLETE      fi->frame is bogus, we need to fix it.  */
+// OBSOLETE   if (fi && get_frame_pc (fi) + 1 == func_end)
+// OBSOLETE     {
+// OBSOLETE       status = target_read_memory (get_frame_pc (fi), buf, 1);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (get_next_frame (fi) == NULL)
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return get_frame_pc (fi);
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       if (buf[0] == 0xfe)
+// OBSOLETE    {
+// OBSOLETE      if (get_next_frame (fi) == NULL)
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return get_frame_pc (fi);
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Similarly if we're stopped on the first insn of a prologue as our
+// OBSOLETE      frame hasn't been allocated yet.  */
+// OBSOLETE   if (fi && get_frame_pc (fi) == func_addr)
+// OBSOLETE     {
+// OBSOLETE       if (get_next_frame (fi) == NULL)
+// OBSOLETE    deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE       return get_frame_pc (fi);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Figure out where to stop scanning.  */
+// OBSOLETE   stop = fi ? get_frame_pc (fi) : func_end;
+// OBSOLETE 
+// OBSOLETE   /* Don't walk off the end of the function.  */
+// OBSOLETE   stop = stop > func_end ? func_end : stop;
+// OBSOLETE 
+// OBSOLETE   /* Start scanning on the first instruction of this function.  */
+// OBSOLETE   addr = func_addr;
+// OBSOLETE 
+// OBSOLETE   status = target_read_memory (addr, buf, 2);
+// OBSOLETE   if (status != 0)
+// OBSOLETE     {
+// OBSOLETE       if (fi && get_next_frame (fi) == NULL && fi->status & MY_FRAME_IN_SP)
+// OBSOLETE    deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE       return addr;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* First see if this insn sets the stack pointer; if so, it's something
+// OBSOLETE      we won't understand, so quit now.   */
+// OBSOLETE   if (buf[0] == 0xdf
+// OBSOLETE       || (buf[0] == 0xf4 && buf[1] == 0x77))
+// OBSOLETE     {
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->status = NO_MORE_FRAMES;
+// OBSOLETE       return addr;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Now see if we have a frame pointer.
+// OBSOLETE 
+// OBSOLETE      Search for mov a2,a0 (0xf278)
+// OBSOLETE      then       mov a3,a2 (0xf27e).  */
+// OBSOLETE 
+// OBSOLETE   if (buf[0] == 0xf2 && buf[1] == 0x78)
+// OBSOLETE     {
+// OBSOLETE       /* Our caller's $a2 will be found in $a0 now.  Note it for
+// OBSOLETE          our callers.  */
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->status |= CALLER_A2_IN_A0;
+// OBSOLETE       addr += 2;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    {
+// OBSOLETE      /* We still haven't allocated our local stack.  Handle this
+// OBSOLETE         as if we stopped on the first or last insn of a function.   */
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       status = target_read_memory (addr, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE       if (buf[0] == 0xf2 && buf[1] == 0x7e)
+// OBSOLETE    {
+// OBSOLETE      addr += 2;
+// OBSOLETE 
+// OBSOLETE      /* Our frame pointer is valid now.  */
+// OBSOLETE      if (fi)
+// OBSOLETE        {
+// OBSOLETE          fi->status |= MY_FRAME_IN_FP;
+// OBSOLETE          fi->status &= ~MY_FRAME_IN_SP;
+// OBSOLETE        }
+// OBSOLETE      if (addr >= stop)
+// OBSOLETE        return addr;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Next we should allocate the local frame.
+// OBSOLETE 
+// OBSOLETE      Search for add imm8,a3 (0xd3XX)
+// OBSOLETE      or add imm16,a3 (0xf70bXXXX)
+// OBSOLETE      or add imm24,a3 (0xf467XXXXXX).
+// OBSOLETE 
+// OBSOLETE      If none of the above was found, then this prologue has
+// OBSOLETE      no stack, and therefore can't have any register saves,
+// OBSOLETE      so quit now.  */
+// OBSOLETE   status = target_read_memory (addr, buf, 2);
+// OBSOLETE   if (status != 0)
+// OBSOLETE     {
+// OBSOLETE       if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE    deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE       return addr;
+// OBSOLETE     }
+// OBSOLETE   if (buf[0] == 0xd3)
+// OBSOLETE     {
+// OBSOLETE       stack_size = extract_signed_integer (&buf[1], 1);
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->stack_size = stack_size;
+// OBSOLETE       addr += 2;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE   else if (buf[0] == 0xf7 && buf[1] == 0x0b)
+// OBSOLETE     {
+// OBSOLETE       status = target_read_memory (addr + 2, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE       stack_size = extract_signed_integer (buf, 2);
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->stack_size = stack_size;
+// OBSOLETE       addr += 4;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE   else if (buf[0] == 0xf4 && buf[1] == 0x67)
+// OBSOLETE     {
+// OBSOLETE       status = target_read_memory (addr + 2, buf, 3);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE       stack_size = extract_signed_integer (buf, 3);
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->stack_size = stack_size;
+// OBSOLETE       addr += 5;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Now see if we have a call to __prologue for an out of line
+// OBSOLETE      prologue.  */
+// OBSOLETE   status = target_read_memory (addr, buf, 2);
+// OBSOLETE   if (status != 0)
+// OBSOLETE     return addr;
+// OBSOLETE 
+// OBSOLETE   /* First check for 16bit pc-relative call to __prologue.  */
+// OBSOLETE   if (buf[0] == 0xfd)
+// OBSOLETE     {
+// OBSOLETE       CORE_ADDR temp;
+// OBSOLETE       status = target_read_memory (addr + 1, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* Get the PC this instruction will branch to.  */
+// OBSOLETE       temp = (extract_signed_integer (buf, 2) + addr + 3) & 0xffffff;
+// OBSOLETE 
+// OBSOLETE       /* Get the name of the function at the target address.  */
+// OBSOLETE       status = find_pc_partial_function (temp, &name, NULL, NULL);
+// OBSOLETE       if (status == 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* Note if it is an out of line prologue.  */
+// OBSOLETE       out_of_line_prologue = (strcmp (name, "__prologue") == 0);
+// OBSOLETE 
+// OBSOLETE       /* This sucks up 3 bytes of instruction space.  */
+// OBSOLETE       if (out_of_line_prologue)
+// OBSOLETE    addr += 3;
+// OBSOLETE 
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE        {
+// OBSOLETE          fi->stack_size -= 16;
+// OBSOLETE          deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
+// OBSOLETE        }
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE   /* Now check for the 24bit pc-relative call to __prologue.  */
+// OBSOLETE   else if (buf[0] == 0xf4 && buf[1] == 0xe1)
+// OBSOLETE     {
+// OBSOLETE       CORE_ADDR temp;
+// OBSOLETE       status = target_read_memory (addr + 2, buf, 3);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* Get the PC this instruction will branch to.  */
+// OBSOLETE       temp = (extract_signed_integer (buf, 3) + addr + 5) & 0xffffff;
+// OBSOLETE 
+// OBSOLETE       /* Get the name of the function at the target address.  */
+// OBSOLETE       status = find_pc_partial_function (temp, &name, NULL, NULL);
+// OBSOLETE       if (status == 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        deprecated_update_frame_base_hack (fi, read_sp ());
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* Note if it is an out of line prologue.  */
+// OBSOLETE       out_of_line_prologue = (strcmp (name, "__prologue") == 0);
+// OBSOLETE 
+// OBSOLETE       /* This sucks up 5 bytes of instruction space.  */
+// OBSOLETE       if (out_of_line_prologue)
+// OBSOLETE    addr += 5;
+// OBSOLETE 
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    {
+// OBSOLETE      if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP))
+// OBSOLETE        {
+// OBSOLETE          fi->stack_size -= 16;
+// OBSOLETE          deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
+// OBSOLETE        }
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Now actually handle the out of line prologue.  */
+// OBSOLETE   if (out_of_line_prologue)
+// OBSOLETE     {
+// OBSOLETE       int outgoing_args_size = 0;
+// OBSOLETE 
+// OBSOLETE       /* First adjust the stack size for this function.  The out of
+// OBSOLETE          line prologue saves 4 registers (16bytes of data).  */
+// OBSOLETE       if (fi)
+// OBSOLETE    fi->stack_size -= 16;
+// OBSOLETE 
+// OBSOLETE       /* Update fi->frame if necessary.  */
+// OBSOLETE       if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE    deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
+// OBSOLETE 
+// OBSOLETE       /* After the out of line prologue, there may be another
+// OBSOLETE          stack adjustment for the outgoing arguments.
+// OBSOLETE 
+// OBSOLETE          Search for add imm8,a3 (0xd3XX)
+// OBSOLETE          or     add imm16,a3 (0xf70bXXXX)
+// OBSOLETE          or     add imm24,a3 (0xf467XXXXXX).  */
+// OBSOLETE 
+// OBSOLETE       status = target_read_memory (addr, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    {
+// OBSOLETE      if (fi)
+// OBSOLETE        {
+// OBSOLETE          fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
+// OBSOLETE          fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
+// OBSOLETE          fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
+// OBSOLETE          fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
+// OBSOLETE        }
+// OBSOLETE      return addr;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       if (buf[0] == 0xd3)
+// OBSOLETE    {
+// OBSOLETE      outgoing_args_size = extract_signed_integer (&buf[1], 1);
+// OBSOLETE      addr += 2;
+// OBSOLETE    }
+// OBSOLETE       else if (buf[0] == 0xf7 && buf[1] == 0x0b)
+// OBSOLETE    {
+// OBSOLETE      status = target_read_memory (addr + 2, buf, 2);
+// OBSOLETE      if (status != 0)
+// OBSOLETE        {
+// OBSOLETE          if (fi)
+// OBSOLETE            {
+// OBSOLETE              fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
+// OBSOLETE              fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
+// OBSOLETE              fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
+// OBSOLETE              fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
+// OBSOLETE            }
+// OBSOLETE          return addr;
+// OBSOLETE        }
+// OBSOLETE      outgoing_args_size = extract_signed_integer (buf, 2);
+// OBSOLETE      addr += 4;
+// OBSOLETE    }
+// OBSOLETE       else if (buf[0] == 0xf4 && buf[1] == 0x67)
+// OBSOLETE    {
+// OBSOLETE      status = target_read_memory (addr + 2, buf, 3);
+// OBSOLETE      if (status != 0)
+// OBSOLETE        {
+// OBSOLETE          if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE            {
+// OBSOLETE              fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
+// OBSOLETE              fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
+// OBSOLETE              fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
+// OBSOLETE              fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
+// OBSOLETE            }
+// OBSOLETE          return addr;
+// OBSOLETE        }
+// OBSOLETE      outgoing_args_size = extract_signed_integer (buf, 3);
+// OBSOLETE      addr += 5;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    outgoing_args_size = 0;
+// OBSOLETE 
+// OBSOLETE       /* Now that we know the size of the outgoing arguments, fix
+// OBSOLETE          fi->frame again if this is the innermost frame.  */
+// OBSOLETE       if (fi && get_next_frame (fi) == NULL)
+// OBSOLETE    deprecated_update_frame_base_hack (fi, get_frame_base (fi) - outgoing_args_size);
+// OBSOLETE 
+// OBSOLETE       /* Note the register save information and update the stack
+// OBSOLETE          size for this frame too.  */
+// OBSOLETE       if (fi)
+// OBSOLETE    {
+// OBSOLETE      fi->fsr.regs[2] = get_frame_base (fi) + fi->stack_size + 4;
+// OBSOLETE      fi->fsr.regs[3] = get_frame_base (fi) + fi->stack_size + 8;
+// OBSOLETE      fi->fsr.regs[5] = get_frame_base (fi) + fi->stack_size + 12;
+// OBSOLETE      fi->fsr.regs[6] = get_frame_base (fi) + fi->stack_size + 16;
+// OBSOLETE      fi->stack_size += outgoing_args_size;
+// OBSOLETE    }
+// OBSOLETE       /* There can be no more prologue insns, so return now.  */
+// OBSOLETE       return addr;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* At this point fi->frame needs to be correct.
+// OBSOLETE 
+// OBSOLETE      If MY_FRAME_IN_SP is set and we're the innermost frame, then we
+// OBSOLETE      need to fix fi->frame so that backtracing, find_frame_saved_regs,
+// OBSOLETE      etc work correctly.  */
+// OBSOLETE   if (fi && get_next_frame (fi) == NULL && (fi->status & MY_FRAME_IN_SP) != 0)
+// OBSOLETE     deprecated_update_frame_base_hack (fi, read_sp () - fi->stack_size);
+// OBSOLETE 
+// OBSOLETE   /* And last we have the register saves.  These are relatively
+// OBSOLETE      simple because they're physically done off the stack pointer,
+// OBSOLETE      and thus the number of different instructions we need to
+// OBSOLETE      check is greatly reduced because we know the displacements
+// OBSOLETE      will be small.
+// OBSOLETE 
+// OBSOLETE      Search for movx d2,(X,a3) (0xf55eXX)
+// OBSOLETE      then       movx d3,(X,a3) (0xf55fXX)
+// OBSOLETE      then       mov  a1,(X,a3) (0x5dXX)    No frame pointer case
+// OBSOLETE      then       mov  a2,(X,a3) (0x5eXX)    No frame pointer case
+// OBSOLETE      or  mov  a0,(X,a3) (0x5cXX)           Frame pointer case.  */
+// OBSOLETE 
+// OBSOLETE   status = target_read_memory (addr, buf, 2);
+// OBSOLETE   if (status != 0)
+// OBSOLETE     return addr;
+// OBSOLETE   if (buf[0] == 0xf5 && buf[1] == 0x5e)
+// OBSOLETE     {
+// OBSOLETE       if (fi)
+// OBSOLETE    {
+// OBSOLETE      status = target_read_memory (addr + 2, buf, 1);
+// OBSOLETE      if (status != 0)
+// OBSOLETE        return addr;
+// OBSOLETE      fi->fsr.regs[2] = (get_frame_base (fi) + stack_size
+// OBSOLETE                         + extract_signed_integer (buf, 1));
+// OBSOLETE    }
+// OBSOLETE       addr += 3;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    return addr;
+// OBSOLETE       status = target_read_memory (addr, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    return addr;
+// OBSOLETE     }
+// OBSOLETE   if (buf[0] == 0xf5 && buf[1] == 0x5f)
+// OBSOLETE     {
+// OBSOLETE       if (fi)
+// OBSOLETE    {
+// OBSOLETE      status = target_read_memory (addr + 2, buf, 1);
+// OBSOLETE      if (status != 0)
+// OBSOLETE        return addr;
+// OBSOLETE      fi->fsr.regs[3] = (get_frame_base (fi) + stack_size
+// OBSOLETE                         + extract_signed_integer (buf, 1));
+// OBSOLETE    }
+// OBSOLETE       addr += 3;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    return addr;
+// OBSOLETE       status = target_read_memory (addr, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    return addr;
+// OBSOLETE     }
+// OBSOLETE   if (buf[0] == 0x5d)
+// OBSOLETE     {
+// OBSOLETE       if (fi)
+// OBSOLETE    {
+// OBSOLETE      status = target_read_memory (addr + 1, buf, 1);
+// OBSOLETE      if (status != 0)
+// OBSOLETE        return addr;
+// OBSOLETE      fi->fsr.regs[5] = (get_frame_base (fi) + stack_size
+// OBSOLETE                         + extract_signed_integer (buf, 1));
+// OBSOLETE    }
+// OBSOLETE       addr += 2;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    return addr;
+// OBSOLETE       status = target_read_memory (addr, buf, 2);
+// OBSOLETE       if (status != 0)
+// OBSOLETE    return addr;
+// OBSOLETE     }
+// OBSOLETE   if (buf[0] == 0x5e || buf[0] == 0x5c)
+// OBSOLETE     {
+// OBSOLETE       if (fi)
+// OBSOLETE    {
+// OBSOLETE      status = target_read_memory (addr + 1, buf, 1);
+// OBSOLETE      if (status != 0)
+// OBSOLETE        return addr;
+// OBSOLETE      fi->fsr.regs[6] = (get_frame_base (fi) + stack_size
+// OBSOLETE                         + extract_signed_integer (buf, 1));
+// OBSOLETE      fi->status &= ~CALLER_A2_IN_A0;
+// OBSOLETE    }
+// OBSOLETE       addr += 2;
+// OBSOLETE       if (addr >= stop)
+// OBSOLETE    return addr;
+// OBSOLETE       return addr;
+// OBSOLETE     }
+// OBSOLETE   return addr;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: frame_chain
+// OBSOLETE    Figure out and return the caller's frame pointer given current
+// OBSOLETE    frame_info struct.
+// OBSOLETE 
+// OBSOLETE    We don't handle dummy frames yet but we would probably just return the
+// OBSOLETE    stack pointer that was in use at the time the function call was made?  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE mn10200_frame_chain (struct frame_info *fi)
+// OBSOLETE {
+// OBSOLETE   struct frame_info *dummy_frame = deprecated_frame_xmalloc ();
+// OBSOLETE   struct cleanup *old_chain = make_cleanup (xfree, dummy_frame);
+// OBSOLETE   CORE_ADDR ret;
+// OBSOLETE 
+// OBSOLETE   /* Walk through the prologue to determine the stack size,
+// OBSOLETE      location of saved registers, end of the prologue, etc.  */
+// OBSOLETE   if (fi->status == 0)
+// OBSOLETE     mn10200_analyze_prologue (fi, (CORE_ADDR) 0);
+// OBSOLETE 
+// OBSOLETE   /* Quit now if mn10200_analyze_prologue set NO_MORE_FRAMES.  */
+// OBSOLETE   if (fi->status & NO_MORE_FRAMES)
+// OBSOLETE     return 0;
+// OBSOLETE 
+// OBSOLETE   /* Now that we've analyzed our prologue, determine the frame
+// OBSOLETE      pointer for our caller.
+// OBSOLETE 
+// OBSOLETE      If our caller has a frame pointer, then we need to
+// OBSOLETE      find the entry value of $a2 to our function.
+// OBSOLETE 
+// OBSOLETE      If CALLER_A2_IN_A0, then the chain is in $a0.
+// OBSOLETE 
+// OBSOLETE      If fsr.regs[6] is nonzero, then it's at the memory
+// OBSOLETE      location pointed to by fsr.regs[6].
+// OBSOLETE 
+// OBSOLETE      Else it's still in $a2.
+// OBSOLETE 
+// OBSOLETE      If our caller does not have a frame pointer, then his
+// OBSOLETE      frame base is fi->frame + -caller's stack size + 4.  */
+// OBSOLETE 
+// OBSOLETE   /* The easiest way to get that info is to analyze our caller's frame.
+// OBSOLETE 
+// OBSOLETE      So we set up a dummy frame and call mn10200_analyze_prologue to
+// OBSOLETE      find stuff for us.  */
+// OBSOLETE   deprecated_update_frame_pc_hack (dummy_frame, FRAME_SAVED_PC (fi));
+// OBSOLETE   deprecated_update_frame_base_hack (dummy_frame, get_frame_base (fi));
+// OBSOLETE   memset (dummy_frame->fsr.regs, '\000', sizeof dummy_frame->fsr.regs);
+// OBSOLETE   dummy_frame->status = 0;
+// OBSOLETE   dummy_frame->stack_size = 0;
+// OBSOLETE   mn10200_analyze_prologue (dummy_frame, 0);
+// OBSOLETE 
+// OBSOLETE   if (dummy_frame->status & MY_FRAME_IN_FP)
+// OBSOLETE     {
+// OBSOLETE       /* Our caller has a frame pointer.  So find the frame in $a2, $a0,
+// OBSOLETE          or in the stack.  */
+// OBSOLETE       if (fi->fsr.regs[6])
+// OBSOLETE    ret = (read_memory_integer (fi->fsr.regs[FP_REGNUM], REGISTER_SIZE)
+// OBSOLETE           & 0xffffff);
+// OBSOLETE       else if (fi->status & CALLER_A2_IN_A0)
+// OBSOLETE    ret = read_register (4);
+// OBSOLETE       else
+// OBSOLETE    ret = read_register (FP_REGNUM);
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       /* Our caller does not have a frame pointer.  So his frame starts
+// OBSOLETE          at the base of our frame (fi->frame) + <his size> + 4 (saved pc).  */
+// OBSOLETE       ret = get_frame_base (fi) + -dummy_frame->stack_size + 4;
+// OBSOLETE     }
+// OBSOLETE   do_cleanups (old_chain);
+// OBSOLETE   return ret;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: skip_prologue
+// OBSOLETE    Return the address of the first inst past the prologue of the function.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE mn10200_skip_prologue (CORE_ADDR pc)
+// OBSOLETE {
+// OBSOLETE   /* We used to check the debug symbols, but that can lose if
+// OBSOLETE      we have a null prologue.  */
+// OBSOLETE   return mn10200_analyze_prologue (NULL, pc);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: pop_frame
+// OBSOLETE    This routine gets called when either the user uses the `return'
+// OBSOLETE    command, or the call dummy breakpoint gets hit.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE mn10200_pop_frame (struct frame_info *frame)
+// OBSOLETE {
+// OBSOLETE   int regnum;
+// OBSOLETE 
+// OBSOLETE   if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
+// OBSOLETE                               get_frame_base (frame),
+// OBSOLETE                               get_frame_base (frame)))
+// OBSOLETE     generic_pop_dummy_frame ();
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+// OBSOLETE 
+// OBSOLETE       /* Restore any saved registers.  */
+// OBSOLETE       for (regnum = 0; regnum < NUM_REGS; regnum++)
+// OBSOLETE    if (frame->fsr.regs[regnum] != 0)
+// OBSOLETE      {
+// OBSOLETE        ULONGEST value;
+// OBSOLETE 
+// OBSOLETE        value = read_memory_unsigned_integer (frame->fsr.regs[regnum],
+// OBSOLETE                                            REGISTER_RAW_SIZE (regnum));
+// OBSOLETE        write_register (regnum, value);
+// OBSOLETE      }
+// OBSOLETE 
+// OBSOLETE       /* Actually cut back the stack.  */
+// OBSOLETE       write_register (SP_REGNUM, get_frame_base (frame));
+// OBSOLETE 
+// OBSOLETE       /* Don't we need to set the PC?!?  XXX FIXME.  */
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Throw away any cached frame information.  */
+// OBSOLETE   flush_cached_frames ();
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: push_arguments
+// OBSOLETE    Setup arguments for a call to the target.  Arguments go in
+// OBSOLETE    order on the stack.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE mn10200_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
+// OBSOLETE                    unsigned char struct_return, CORE_ADDR struct_addr)
+// OBSOLETE {
+// OBSOLETE   int argnum = 0;
+// OBSOLETE   int len = 0;
+// OBSOLETE   int stack_offset = 0;
+// OBSOLETE   int regsused = struct_return ? 1 : 0;
+// OBSOLETE 
+// OBSOLETE   /* This should be a nop, but align the stack just in case something
+// OBSOLETE      went wrong.  Stacks are two byte aligned on the mn10200.  */
+// OBSOLETE   sp &= ~1;
+// OBSOLETE 
+// OBSOLETE   /* Now make space on the stack for the args.
+// OBSOLETE 
+// OBSOLETE      XXX This doesn't appear to handle pass-by-invisible reference
+// OBSOLETE      arguments.  */
+// OBSOLETE   for (argnum = 0; argnum < nargs; argnum++)
+// OBSOLETE     {
+// OBSOLETE       int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 1) & ~1;
+// OBSOLETE 
+// OBSOLETE       /* If we've used all argument registers, then this argument is
+// OBSOLETE          pushed.  */
+// OBSOLETE       if (regsused >= 2 || arg_length > 4)
+// OBSOLETE    {
+// OBSOLETE      regsused = 2;
+// OBSOLETE      len += arg_length;
+// OBSOLETE    }
+// OBSOLETE       /* We know we've got some arg register space left.  If this argument
+// OBSOLETE          will fit entirely in regs, then put it there.  */
+// OBSOLETE       else if (arg_length <= 2
+// OBSOLETE           || TYPE_CODE (VALUE_TYPE (args[argnum])) == TYPE_CODE_PTR)
+// OBSOLETE    {
+// OBSOLETE      regsused++;
+// OBSOLETE    }
+// OBSOLETE       else if (regsused == 0)
+// OBSOLETE    {
+// OBSOLETE      regsused = 2;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      regsused = 2;
+// OBSOLETE      len += arg_length;
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* Allocate stack space.  */
+// OBSOLETE   sp -= len;
+// OBSOLETE 
+// OBSOLETE   regsused = struct_return ? 1 : 0;
+// OBSOLETE   /* Push all arguments onto the stack. */
+// OBSOLETE   for (argnum = 0; argnum < nargs; argnum++)
+// OBSOLETE     {
+// OBSOLETE       int len;
+// OBSOLETE       char *val;
+// OBSOLETE 
+// OBSOLETE       /* XXX Check this.  What about UNIONS?  */
+// OBSOLETE       if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
+// OBSOLETE      && TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
+// OBSOLETE    {
+// OBSOLETE      /* XXX Wrong, we want a pointer to this argument.  */
+// OBSOLETE      len = TYPE_LENGTH (VALUE_TYPE (*args));
+// OBSOLETE      val = (char *) VALUE_CONTENTS (*args);
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      len = TYPE_LENGTH (VALUE_TYPE (*args));
+// OBSOLETE      val = (char *) VALUE_CONTENTS (*args);
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       if (regsused < 2
+// OBSOLETE      && (len <= 2
+// OBSOLETE          || TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_PTR))
+// OBSOLETE    {
+// OBSOLETE      write_register (regsused, extract_unsigned_integer (val, 4));
+// OBSOLETE      regsused++;
+// OBSOLETE    }
+// OBSOLETE       else if (regsused == 0 && len == 4)
+// OBSOLETE    {
+// OBSOLETE      write_register (regsused, extract_unsigned_integer (val, 2));
+// OBSOLETE      write_register (regsused + 1, extract_unsigned_integer (val + 2, 2));
+// OBSOLETE      regsused = 2;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      regsused = 2;
+// OBSOLETE      while (len > 0)
+// OBSOLETE        {
+// OBSOLETE          write_memory (sp + stack_offset, val, 2);
+// OBSOLETE 
+// OBSOLETE          len -= 2;
+// OBSOLETE          val += 2;
+// OBSOLETE          stack_offset += 2;
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE       args++;
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   return sp;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: push_return_address (pc)
+// OBSOLETE    Set up the return address for the inferior function call.
+// OBSOLETE    Needed for targets where we don't actually execute a JSR/BSR instruction */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE mn10200_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
+// OBSOLETE {
+// OBSOLETE   unsigned char buf[4];
+// OBSOLETE 
+// OBSOLETE   store_unsigned_integer (buf, 4, CALL_DUMMY_ADDRESS ());
+// OBSOLETE   write_memory (sp - 4, buf, 4);
+// OBSOLETE   return sp - 4;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: store_struct_return (addr,sp)
+// OBSOLETE    Store the structure value return address for an inferior function
+// OBSOLETE    call.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE mn10200_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+// OBSOLETE {
+// OBSOLETE   /* The structure return address is passed as the first argument.  */
+// OBSOLETE   write_register (0, addr);
+// OBSOLETE   return sp;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: frame_saved_pc 
+// OBSOLETE    Find the caller of this frame.  We do this by seeing if RP_REGNUM
+// OBSOLETE    is saved in the stack anywhere, otherwise we get it from the
+// OBSOLETE    registers.  If the inner frame is a dummy frame, return its PC
+// OBSOLETE    instead of RP, because that's where "caller" of the dummy-frame
+// OBSOLETE    will be found.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE mn10200_frame_saved_pc (struct frame_info *fi)
+// OBSOLETE {
+// OBSOLETE   /* The saved PC will always be at the base of the current frame.  */
+// OBSOLETE   return (read_memory_integer (get_frame_base (fi), REGISTER_SIZE) & 0xffffff);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Function: init_extra_frame_info
+// OBSOLETE    Setup the frame's frame pointer, pc, and frame addresses for saved
+// OBSOLETE    registers.  Most of the work is done in mn10200_analyze_prologue().
+// OBSOLETE 
+// OBSOLETE    Note that when we are called for the last frame (currently active frame),
+// OBSOLETE    that get_frame_pc (fi) and fi->frame will already be setup.  However, fi->frame will
+// OBSOLETE    be valid only if this routine uses FP.  For previous frames, fi-frame will
+// OBSOLETE    always be correct.  mn10200_analyze_prologue will fix fi->frame if
+// OBSOLETE    it's not valid.
+// OBSOLETE 
+// OBSOLETE    We can be called with the PC in the call dummy under two circumstances.
+// OBSOLETE    First, during normal backtracing, second, while figuring out the frame
+// OBSOLETE    pointer just prior to calling the target function (see run_stack_dummy).  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE mn10200_init_extra_frame_info (struct frame_info *fi)
+// OBSOLETE {
+// OBSOLETE   if (get_next_frame (fi))
+// OBSOLETE     deprecated_update_frame_pc_hack (fi, FRAME_SAVED_PC (get_next_frame (fi)));
+// OBSOLETE 
+// OBSOLETE   memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
+// OBSOLETE   fi->status = 0;
+// OBSOLETE   fi->stack_size = 0;
+// OBSOLETE 
+// OBSOLETE   mn10200_analyze_prologue (fi, 0);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE _initialize_mn10200_tdep (void)
+// OBSOLETE {
+// OBSOLETE   tm_print_insn = print_insn_mn10200;
+// OBSOLETE }
index a3dd012..bcd96ad 100644 (file)
@@ -1146,10 +1146,10 @@ mn10300_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_register_size (gdbarch, 4);
   set_gdbarch_register_bytes (gdbarch, 
                               num_regs * gdbarch_register_size (gdbarch));
-  set_gdbarch_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
   set_gdbarch_register_raw_size (gdbarch, mn10300_register_raw_size);
   set_gdbarch_register_byte (gdbarch, mn10300_register_byte);
-  set_gdbarch_max_register_virtual_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_register_virtual_size (gdbarch, mn10300_register_virtual_size);
   set_gdbarch_register_virtual_type (gdbarch, mn10300_register_virtual_type);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum);
@@ -1167,9 +1167,9 @@ mn10300_gdbarch_init (struct gdbarch_info info,
   /* Stack unwinding.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_saved_pc_after_call (gdbarch, mn10300_saved_pc_after_call);
-  set_gdbarch_init_extra_frame_info (gdbarch, mn10300_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mn10300_init_extra_frame_info);
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_noop);
-  set_gdbarch_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs);
   set_gdbarch_frame_chain (gdbarch, mn10300_frame_chain);
   set_gdbarch_frame_saved_pc (gdbarch, mn10300_frame_saved_pc);
   set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value);
@@ -1197,7 +1197,6 @@ mn10300_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_arguments (gdbarch, mn10300_push_arguments);
   set_gdbarch_reg_struct_has_addr (gdbarch, mn10300_reg_struct_has_addr);
   set_gdbarch_push_return_address (gdbarch, mn10300_push_return_address);
index 8f14500..f58ed2a 100644 (file)
@@ -569,12 +569,14 @@ monitor_expect (char *string, char *buf, int buflen)
                return 0;
            }
        }
-      else if ((c == '\021' || c == '\023') &&
-              (STREQ (targ_ops->to_shortname, "m32r")
-               || STREQ (targ_ops->to_shortname, "mon2000")))
-       {                       /* m32r monitor emits random DC1/DC3 chars */
-         continue;
-       }
+#if 0
+      // OBSOLETE       else if ((c == '\021' || c == '\023') &&
+      // OBSOLETE             (STREQ (targ_ops->to_shortname, "m32r")
+      // OBSOLETE              || STREQ (targ_ops->to_shortname, "mon2000")))
+      // OBSOLETE      {                       /* m32r monitor emits random DC1/DC3 chars */
+      // OBSOLETE        continue;
+      // OBSOLETE      }
+#endif
       else
        {
          /* We got a character that doesn't match the string.  We need to
index eaa9dde..10af4c5 100644 (file)
@@ -27,6 +27,7 @@
 #include "objfiles.h"
 #include "buildsym.h"
 #include "stabsread.h"
+#include "block.h"
 
 extern void _initialize_nlmread (void);
 
@@ -190,6 +191,12 @@ nlm_symfile_read (struct objfile *objfile, int mainline)
 
   nlm_symtab_read (abfd, offset, objfile);
 
+  /* Install any minimal symbols that have been collected as the current
+     minimal symbols for this objfile. */
+
+  install_minimal_symbols (objfile);
+  do_cleanups (back_to);
+
   stabsect_build_psymtabs (objfile, mainline, ".stab",
                           ".stabstr", ".text");
 
@@ -204,13 +211,6 @@ nlm_symfile_read (struct objfile *objfile, int mainline)
 
   /* FIXME:  We could locate and read the optional native debugging format
      here and add the symbols to the minimal symbol table. */
-
-  /* Install any minimal symbols that have been collected as the current
-     minimal symbols for this objfile. */
-
-  install_minimal_symbols (objfile);
-
-  do_cleanups (back_to);
 }
 
 
index fe5ebdf..36ccadc 100644 (file)
@@ -429,7 +429,7 @@ ns32k_pop_frame (void)
   int regnum;
 
   fp = get_frame_base (frame);
-  FRAME_INIT_SAVED_REGS (frame);
+  DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
   for (regnum = 0; regnum < 8; regnum++)
     if (get_frame_saved_regs (frame)[regnum])
@@ -558,9 +558,9 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_register_size (gdbarch, NS32K_REGISTER_SIZE);
   set_gdbarch_register_raw_size (gdbarch, ns32k_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, NS32K_MAX_REGISTER_RAW_SIZE);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, NS32K_MAX_REGISTER_RAW_SIZE);
   set_gdbarch_register_virtual_size (gdbarch, ns32k_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch,
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch,
                                          NS32K_MAX_REGISTER_VIRTUAL_SIZE);
   set_gdbarch_register_virtual_type (gdbarch, ns32k_register_virtual_type);
 
@@ -578,7 +578,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address);
   set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs);
 
   set_gdbarch_frame_args_skip (gdbarch, 8);
 
@@ -592,7 +592,7 @@ ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
                                             ns32k_extract_struct_value_address);
 
   /* Call dummy info */
-  set_gdbarch_push_dummy_frame (gdbarch, ns32k_push_dummy_frame);
+  set_gdbarch_deprecated_push_dummy_frame (gdbarch, ns32k_push_dummy_frame);
   set_gdbarch_pop_frame (gdbarch, ns32k_pop_frame);
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_call_dummy_p (gdbarch, 1);
index 1a7c5f0..8e52fc0 100644 (file)
@@ -52,6 +52,7 @@
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols.  */
 #include "top.h"
 #include "completer.h" /* For skip_quoted().  */
+#include "block.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
    etc), as well as gratuitiously global symbol names, so we can have
index 00a57dd..255781e 100644 (file)
@@ -1,6 +1,6 @@
 /* Objective-C language support routines for GDB, the GNU debugger.
 
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Apple Computer, Inc.
    Written by Michael Snyder.
@@ -41,6 +41,7 @@
 #include "frame.h"
 #include "gdb_regex.h"
 #include "regcache.h"
+#include "block.h"
 
 #include <ctype.h>
 
@@ -798,8 +799,8 @@ compare_selectors (const void *a, const void *b)
 {
   char *aname, *bname;
 
-  aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a);
-  bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b);
+  aname = SYMBOL_PRINT_NAME (*(struct symbol **) a);
+  bname = SYMBOL_PRINT_NAME (*(struct symbol **) b);
   if (aname == NULL || bname == NULL)
     error ("internal: compare_selectors(1)");
 
@@ -867,7 +868,7 @@ selectors_info (char *regexp, int from_tty)
       QUIT;
       name = SYMBOL_DEMANGLED_NAME (msymbol);
       if (name == NULL)
-       name = SYMBOL_NAME (msymbol);
+       name = DEPRECATED_SYMBOL_NAME (msymbol);
       if (name &&
         (name[0] == '-' || name[0] == '+') &&
          name[1] == '[')               /* Got a method name.  */
@@ -900,7 +901,7 @@ selectors_info (char *regexp, int from_tty)
          QUIT;
          name = SYMBOL_DEMANGLED_NAME (msymbol);
          if (name == NULL)
-           name = SYMBOL_NAME (msymbol);
+           name = DEPRECATED_SYMBOL_NAME (msymbol);
          if (name &&
             (name[0] == '-' || name[0] == '+') &&
              name[1] == '[')           /* Got a method name.  */
@@ -926,7 +927,7 @@ selectors_info (char *regexp, int from_tty)
          QUIT;
          name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]);
          if (name == NULL)
-           name = SYMBOL_NAME (sym_arr[ix]);
+           name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]);
          name = strchr (name, ' ') + 1;
          if (p[0] && specialcmp(name, p) == 0)
            continue;           /* Seen this one already (not unique).  */
@@ -956,8 +957,8 @@ compare_classes (const void *a, const void *b)
 {
   char *aname, *bname;
 
-  aname = SYMBOL_SOURCE_NAME (*(struct symbol **) a);
-  bname = SYMBOL_SOURCE_NAME (*(struct symbol **) b);
+  aname = SYMBOL_PRINT_NAME (*(struct symbol **) a);
+  bname = SYMBOL_PRINT_NAME (*(struct symbol **) b);
   if (aname == NULL || bname == NULL)
     error ("internal: compare_classes(1)");
 
@@ -1010,7 +1011,7 @@ classes_info (char *regexp, int from_tty)
       QUIT;
       name = SYMBOL_DEMANGLED_NAME (msymbol);
       if (name == NULL)
-       name = SYMBOL_NAME (msymbol);
+       name = DEPRECATED_SYMBOL_NAME (msymbol);
       if (name &&
         (name[0] == '-' || name[0] == '+') &&
          name[1] == '[')                       /* Got a method name.  */
@@ -1036,7 +1037,7 @@ classes_info (char *regexp, int from_tty)
          QUIT;
          name = SYMBOL_DEMANGLED_NAME (msymbol);
          if (name == NULL)
-           name = SYMBOL_NAME (msymbol);
+           name = DEPRECATED_SYMBOL_NAME (msymbol);
          if (name &&
             (name[0] == '-' || name[0] == '+') &&
              name[1] == '[')                   /* Got a method name.  */
@@ -1055,7 +1056,7 @@ classes_info (char *regexp, int from_tty)
          QUIT;
          name = SYMBOL_DEMANGLED_NAME (sym_arr[ix]);
          if (name == NULL)
-           name = SYMBOL_NAME (sym_arr[ix]);
+           name = DEPRECATED_SYMBOL_NAME (sym_arr[ix]);
          name += 2;
          if (p[0] && specialcmp(name, p) == 0)
            continue;   /* Seen this one already (not unique).  */
@@ -1272,7 +1273,7 @@ parse_method (char *method, char *type, char **class,
   return s2;
 }
 
-void
+static void
 find_methods (struct symtab *symtab, char type, 
              const char *class, const char *category, 
              const char *selector, struct symbol **syms, 
@@ -1318,7 +1319,7 @@ find_methods (struct symtab *symtab, char type,
 
       symname = SYMBOL_DEMANGLED_NAME (msymbol);
       if (symname == NULL)
-       symname = SYMBOL_NAME (msymbol);
+       symname = DEPRECATED_SYMBOL_NAME (msymbol);
       if (symname == NULL)
        continue;
 
@@ -1357,7 +1358,7 @@ find_methods (struct symtab *symtab, char type,
           const char *newsymname = SYMBOL_DEMANGLED_NAME (sym);
          
           if (newsymname == NULL)
-            newsymname = SYMBOL_NAME (sym);
+            newsymname = DEPRECATED_SYMBOL_NAME (sym);
           if (strcmp (symname, newsymname) == 0)
             {
               /* Found a high-level method sym: swap it into the
index 58f1884..8506818 100644 (file)
@@ -20,6 +20,7 @@
    Boston, MA 02111-1307, USA.  */
 
 struct value;
+struct block;
 
 extern int objc_parse (void);          /* Defined in c-exp.y */
 
@@ -45,11 +46,6 @@ extern char *parse_method (char *method, char *type,
                           char **class, char **category, 
                           char **selector);
 
-extern void find_methods (struct symtab *symtab, char type, 
-                         const char *class, const char *category, 
-                         const char *selector, struct symbol **syms, 
-                         unsigned int *nsym, unsigned int *ndebug);
-
 extern char *find_imps (struct symtab *symtab, struct block *block,
                        char *method, struct symbol **syms, 
                        unsigned int *nsym, unsigned int *ndebug);
index d62b28f..32a57fa 100644 (file)
@@ -1,7 +1,7 @@
 /* GDB routines for manipulating objfiles.
 
    Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002 Free Software Foundation, Inc.
+   2001, 2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
 #include <fcntl.h>
 #include "gdb_obstack.h"
 #include "gdb_string.h"
+#include "hashtab.h"
 
 #include "breakpoint.h"
+#include "block.h"
 
 /* Prototypes for local functions */
 
@@ -149,6 +151,15 @@ build_objfile_section_table (struct objfile *objfile)
    OBJF_SHARED are simply copied through to the new objfile flags
    member. */
 
+/* NOTE: carlton/2003-02-04: This function is called with args NULL, 0
+   by jv-lang.c, to create an artificial objfile used to hold
+   information about dynamically-loaded Java classes.  Unfortunately,
+   that branch of this function doesn't get tested very frequently, so
+   it's prone to breakage.  (E.g. at one time the name was set to NULL
+   in that situation, which broke a loop over all names in the dynamic
+   library loader.)  If you change this function, please try to leave
+   things in a consistent state even if abfd is NULL.  */
+
 struct objfile *
 allocate_objfile (bfd *abfd, int flags)
 {
@@ -191,6 +202,11 @@ allocate_objfile (bfd *abfd, int flags)
              objfile->md = md;
              objfile->mmfd = fd;
              /* Update pointers to functions to *our* copies */
+             if (objfile->demangled_names_hash)
+               htab_set_functions_ex
+                 (objfile->demangled_names_hash, htab_hash_string,
+                  (int (*) (const void *, const void *)) streq, NULL,
+                  objfile->md, xmcalloc, xmfree);
              obstack_chunkfun (&objfile->psymbol_cache.cache, xmmalloc);
              obstack_freefun (&objfile->psymbol_cache.cache, xmfree);
              obstack_chunkfun (&objfile->macro_cache.cache, xmmalloc);
@@ -281,6 +297,8 @@ allocate_objfile (bfd *abfd, int flags)
       obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
                                  xfree);
       flags &= ~OBJF_MAPPED;
+
+      terminate_minimal_symbol_table (objfile);
     }
 
   /* Update the per-objfile information that comes from the bfd, ensuring
@@ -305,6 +323,10 @@ allocate_objfile (bfd *abfd, int flags)
                 objfile->name, bfd_errmsg (bfd_get_error ()));
        }
     }
+  else
+    {
+      objfile->name = "<<anonymous objfile>>";
+    }
 
   /* Initialize the section indexes for this objfile, so that we can
      later detect if they are used w/o being properly assigned to. */
@@ -333,6 +355,33 @@ allocate_objfile (bfd *abfd, int flags)
   return (objfile);
 }
 
+
+/* Create the terminating entry of OBJFILE's minimal symbol table.
+   If OBJFILE->msymbols is zero, allocate a single entry from
+   OBJFILE->symbol_obstack; otherwise, just initialize
+   OBJFILE->msymbols[OBJFILE->minimal_symbol_count].  */
+void
+terminate_minimal_symbol_table (struct objfile *objfile)
+{
+  if (! objfile->msymbols)
+    objfile->msymbols = ((struct minimal_symbol *)
+                         obstack_alloc (&objfile->symbol_obstack,
+                                        sizeof (objfile->msymbols[0])));
+
+  {
+    struct minimal_symbol *m
+      = &objfile->msymbols[objfile->minimal_symbol_count];
+
+    memset (m, 0, sizeof (*m));
+    DEPRECATED_SYMBOL_NAME (m) = NULL;
+    SYMBOL_VALUE_ADDRESS (m) = 0;
+    MSYMBOL_INFO (m) = NULL;
+    MSYMBOL_TYPE (m) = mst_unknown;
+    SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
+  }
+}
+
+
 /* Put one object file before a specified on in the global list.
    This can be used to make sure an object file is destroyed before
    another when using ALL_OBJFILES_SAFE to free all objfiles. */
@@ -522,6 +571,8 @@ free_objfile (struct objfile *objfile)
       /* Free the obstacks for non-reusable objfiles */
       bcache_xfree (objfile->psymbol_cache);
       bcache_xfree (objfile->macro_cache);
+      if (objfile->demangled_names_hash)
+       htab_delete (objfile->demangled_names_hash);
       obstack_free (&objfile->psymbol_obstack, 0);
       obstack_free (&objfile->symbol_obstack, 0);
       obstack_free (&objfile->type_obstack, 0);
@@ -632,7 +683,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
 
              else if (SYMBOL_CLASS (sym) == LOC_CONST
                       && SYMBOL_NAMESPACE (sym) == LABEL_NAMESPACE
-                      && strcmp (SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0)
+                      && strcmp (DEPRECATED_SYMBOL_NAME (sym), MIPS_EFI_SYMBOL_NAME) == 0)
                ecoff_relocate_efi (sym, ANOFFSET (delta,
                                                   s->block_line_section));
 #endif
@@ -810,7 +861,7 @@ have_minimal_symbols (void)
 
   ALL_OBJFILES (ofp)
   {
-    if (ofp->msymbols != NULL)
+    if (ofp->minimal_symbol_count > 0)
       {
        return 1;
       }
index 587e71c..e710263 100644 (file)
@@ -1,7 +1,7 @@
 /* Definitions for symbol file management in GDB.
 
    Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002 Free Software Foundation, Inc.
+   2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,6 +27,7 @@
 #include "symfile.h"           /* For struct psymbol_allocation_list */
 
 struct bcache;
+struct htab;
 
 /* This structure maintains information on a per-objfile basis about the
    "entry point" of the objfile, and the scope within which the entry point
@@ -286,6 +287,13 @@ struct objfile
     struct bcache *psymbol_cache;      /* Byte cache for partial syms */
     struct bcache *macro_cache;          /* Byte cache for macros */
 
+    /* Hash table for mapping symbol names to demangled names.  Each
+       entry in the hash table is actually two consecutive strings,
+       both null-terminated; the first one is a mangled or linkage
+       name, and the second is the demangled name or just a zero byte
+       if the name doesn't demangle.  */
+    struct htab *demangled_names_hash;
+
     /* Vectors of all partial symbols read in from file.  The actual data
        is stored in the psymbol_obstack. */
 
@@ -515,6 +523,8 @@ extern struct objfile *allocate_objfile (bfd *, int);
 
 extern int build_objfile_section_table (struct objfile *);
 
+extern void terminate_minimal_symbol_table (struct objfile *objfile);
+
 extern void put_objfile_before (struct objfile *, struct objfile *);
 
 extern void objfile_to_front (struct objfile *);
@@ -577,7 +587,7 @@ extern int is_in_import_list (char *, struct objfile *);
 /* Traverse all minimal symbols in one objfile.  */
 
 #define        ALL_OBJFILE_MSYMBOLS(objfile, m) \
-    for ((m) = (objfile) -> msymbols; SYMBOL_NAME(m) != NULL; (m)++)
+    for ((m) = (objfile) -> msymbols; DEPRECATED_SYMBOL_NAME(m) != NULL; (m)++)
 
 /* Traverse all symtabs in all objfiles.  */
 
@@ -595,8 +605,7 @@ extern int is_in_import_list (char *, struct objfile *);
 
 #define        ALL_MSYMBOLS(objfile, m) \
   ALL_OBJFILES (objfile)        \
-    if ((objfile)->msymbols)    \
-      ALL_OBJFILE_MSYMBOLS (objfile, m)
+    ALL_OBJFILE_MSYMBOLS (objfile, m)
 
 #define ALL_OBJFILE_OSECTIONS(objfile, osect)  \
   for (osect = objfile->sections; osect < objfile->sections_end; osect++)
diff --git a/gdb/observer.c b/gdb/observer.c
new file mode 100644 (file)
index 0000000..92ec48e
--- /dev/null
@@ -0,0 +1,192 @@
+/* GDB Notifications to Observers.
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* An observer is an entity who is interested in being notified when GDB
+   reaches certain states, or certain events occur in GDB. The entity being
+   observed is called the Subject. To receive notifications, the observer
+   attaches a callback to the subject. One subject can have several
+   observers.
+
+   This file implements an internal generic low-level event notification
+   mechanism based on the Observer paradigm described in the book "Design
+   Patterns".  This generic event notification mechansim is then re-used
+   to implement the exported high-level notification management routines
+   for all possible notifications.
+
+   The current implementation of the generic observer provides support
+   for contextual data. This contextual data is given to the subject
+   when attaching the callback. In return, the subject will provide
+   this contextual data back to the observer as a parameter of the
+   callback.
+
+   FIXME: The current support for the contextual data is only partial,
+   as it lacks a mechanism that would deallocate this data when the
+   callback is detached. This is not a problem so far, as this contextual
+   data is only used internally to hold a function pointer. Later on,
+   if a certain observer needs to provide support for user-level
+   contextual data, then the generic notification mechanism will need
+   need to be enhanced to allow the observer to provide a routine to
+   deallocate the data when attaching the callback.
+
+   This file is currently maintained by hand, but the long term plan
+   if the number of different notifications starts growing is to create
+   a new script (observer.sh) that would generate this file, and the
+   associated documentation.  */
+
+#include "defs.h"
+#include "observer.h"
+
+/* The internal generic observer.  */
+
+typedef void (generic_observer_notification_ftype) (const void *data,
+                                                   const void *args);
+
+struct observer
+{
+  generic_observer_notification_ftype *notify;
+  /* No memory management needed for the following field for now.  */
+  void *data;
+};
+
+/* A list of observers, maintained by the subject.  A subject is
+   actually represented by its list of observers.  */
+
+struct observer_list
+{
+  struct observer_list *next;
+  struct observer *observer;
+};
+
+/* Allocate a struct observer_list, intended to be used as a node
+   in the list of observers maintained by a subject.  */
+
+static struct observer_list *
+xalloc_observer_list_node (void)
+{
+  struct observer_list *node = XMALLOC (struct observer_list);
+  node->observer = XMALLOC (struct observer);
+  return node;
+}
+
+/* The opposite of xalloc_observer_list_node, frees the memory for
+   the given node.  */
+
+static void
+xfree_observer_list_node (struct observer_list *node)
+{
+  xfree (node->observer);
+  xfree (node);
+}
+
+/* Attach the callback NOTIFY to a SUBJECT.  The DATA is also stored,
+   in order for the subject to provide it back to the observer during
+   a notification.  */
+
+static struct observer *
+generic_observer_attach (struct observer_list **subject,
+                        generic_observer_notification_ftype * notify,
+                        void *data)
+{
+  struct observer_list *observer_list = xalloc_observer_list_node ();
+
+  observer_list->next = *subject;
+  observer_list->observer->notify = notify;
+  observer_list->observer->data = data;
+  *subject = observer_list;
+
+  return observer_list->observer;
+}
+
+/* Remove the given OBSERVER from the SUBJECT.  Once detached, OBSERVER
+   should no longer be used, as it is no longer valid.  */
+
+static void
+generic_observer_detach (struct observer_list **subject,
+                        const struct observer *observer)
+{
+  struct observer_list *previous_node = NULL;
+  struct observer_list *current_node = *subject;
+
+  while (current_node != NULL)
+    {
+      if (current_node->observer == observer)
+       {
+         if (previous_node != NULL)
+           previous_node->next = current_node->next;
+         else
+           *subject = current_node->next;
+         xfree_observer_list_node (current_node);
+         return;
+       }
+      previous_node = current_node;
+      current_node = current_node->next;
+    }
+
+  /* We should never reach this point.  However, this should not be
+     a very serious error, so simply report a warning to the user.  */
+  warning ("Failed to detach observer");
+}
+
+/* Send a notification to all the observers of SUBJECT.  ARGS is passed to
+   all observers as an argument to the notification callback.  */
+
+static void
+generic_observer_notify (struct observer_list *subject, const void *args)
+{
+  struct observer_list *current_node = subject;
+
+  while (current_node != NULL)
+    {
+      (*current_node->observer->notify) (current_node->observer->data, args);
+      current_node = current_node->next;
+    }
+}
+
+/* normal_stop notifications.  */
+
+static struct observer_list *normal_stop_subject = NULL;
+
+static void
+observer_normal_stop_notification_stub (const void *data,
+                                       const void *unused_args)
+{
+  observer_normal_stop_ftype *notify = (observer_normal_stop_ftype *) data;
+  (*notify) ();
+}
+
+struct observer *
+observer_attach_normal_stop (observer_normal_stop_ftype *f)
+{
+  return generic_observer_attach (&normal_stop_subject,
+                                 &observer_normal_stop_notification_stub,
+                                 (void *) f);
+}
+
+void
+observer_detach_normal_stop (struct observer *observer)
+{
+  generic_observer_detach (&normal_stop_subject, observer);
+}
+
+void
+observer_notify_normal_stop (void)
+{
+  generic_observer_notify (normal_stop_subject, NULL);
+}
similarity index 62%
rename from gdb/config/m68k/xm-apollo68b.h
rename to gdb/observer.h
index d77509d..8b9a6db 100644 (file)
@@ -1,5 +1,5 @@
-/* Macro definitions for an Apollo m68k in BSD mode
-   Copyright 1992, 2001 Free Software Foundation, Inc.
+/* GDB Notifications to Observers.
+   Copyright 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define ALIGN_STACK_ON_STARTUP
+#ifndef OBSERVER_H
+#define OBSERVER_H
+
+struct observer;
+
+/* normal_stop notifications.  */
+
+typedef void (observer_normal_stop_ftype) (void);
+
+extern struct observer *
+  observer_attach_normal_stop (observer_normal_stop_ftype *f);
+extern void observer_detach_normal_stop (struct observer *observer);
+extern void observer_notify_normal_stop (void);
+
+#endif /* OBSERVER_H */
index 5b4531a..ab49f9a 100644 (file)
@@ -72,6 +72,7 @@ static const char * const gdb_osabi_names[] =
   "ARM EABI v1",
   "ARM EABI v2",
   "ARM APCS",
+  "QNX Neutrino",
 
   "<invalid>"
 };
index b4d4739..896a06b 100644 (file)
@@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "bfd.h" /* Required by objfiles.h.  */
 #include "symfile.h" /* Required by objfiles.h.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "block.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
index a99d4e9..1f41422 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing Pascal values for GDB, the GNU debugger.
-   Copyright 2000, 2001
+   Copyright 2000, 2001, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -213,7 +213,7 @@ pascal_val_print (struct type *type, char *valaddr, int embedded_offset,
                  && (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
                {
                  fputs_filtered (" <", stream);
-                 fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
+                 fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
                  fputs_filtered (">", stream);
                }
              if (vt_address && vtblprint)
@@ -226,7 +226,7 @@ pascal_val_print (struct type *type, char *valaddr, int embedded_offset,
                  int is_this_fld;
 
                  if (msymbol != NULL)
-                   wsym = lookup_symbol (SYMBOL_NAME (msymbol), block,
+                   wsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol), block,
                                          VAR_NAMESPACE, &is_this_fld, &s);
 
                  if (wsym)
@@ -647,7 +647,7 @@ pascal_object_print_class_method (char *valaddr, struct type *type,
          check_stub_method_group (domain, i);
          for (j = 0; j < len2; j++)
            {
-             if (STREQ (SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j)))
+             if (STREQ (DEPRECATED_SYMBOL_NAME (sym), TYPE_FN_FIELD_PHYSNAME (f, j)))
                goto common;
            }
        }
index 45a9597..d4a6a05 100644 (file)
@@ -48,6 +48,7 @@
                                   with "gdbarch.h" when appropriate.  */
 #include "doublest.h"
 #include "gdb_assert.h"
+#include "block.h"
 
 \f
 /* Symbols which architectures can redefine.  */
index e675384..f03f537 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "doublest.h"
 
+struct block;
+
 extern struct expression *expout;
 extern int expout_size;
 extern int expout_ptr;
index 8e5c4f7..4561e4d 100644 (file)
@@ -1,6 +1,7 @@
 /* PPC GNU/Linux native support.
-   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002
-   Free Software Foundation, Inc.
+
+   Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002,
+   2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -31,7 +32,7 @@
 #include <signal.h>
 #include <sys/user.h>
 #include <sys/ioctl.h>
-#include <sys/wait.h>
+#include "gdb_wait.h"
 #include <fcntl.h>
 #include <sys/procfs.h>
 #include <sys/ptrace.h>
index c118cf4..f02581b 100644 (file)
 #include "solib-svr4.h"
 #include "ppc-tdep.h"
 
-/* The following two instructions are used in the signal trampoline
-   code on GNU/Linux PPC.  */
-#define INSTR_LI_R0_0x7777     0x38007777
-#define INSTR_SC               0x44000002
+/* The following instructions are used in the signal trampoline code
+   on GNU/Linux PPC. The kernel used to use magic syscalls 0x6666 and
+   0x7777 but now uses the sigreturn syscalls.  We check for both.  */
+#define INSTR_LI_R0_0x6666             0x38006666
+#define INSTR_LI_R0_0x7777             0x38007777
+#define INSTR_LI_R0_NR_sigreturn       0x38000077
+#define INSTR_LI_R0_NR_rt_sigreturn    0x380000AC
+
+#define INSTR_SC                       0x44000002
 
 /* Since the *-tdep.c files are platform independent (i.e, they may be
    used to build cross platform debuggers), we can't include system
@@ -183,6 +188,21 @@ ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
   return (pc == handler || pc == handler + 4);
 }
 
+static inline int
+insn_is_sigreturn (unsigned long pcinsn)
+{
+  switch(pcinsn)
+    {
+    case INSTR_LI_R0_0x6666:
+    case INSTR_LI_R0_0x7777:
+    case INSTR_LI_R0_NR_sigreturn:
+    case INSTR_LI_R0_NR_rt_sigreturn:
+      return 1;
+    default:
+      return 0;
+    }
+}
+
 /*
  * The signal handler trampoline is on the stack and consists of exactly
  * two instructions.  The easiest and most accurate way of determining
@@ -202,11 +222,11 @@ ppc_linux_at_sigtramp_return_path (CORE_ADDR pc)
   pcinsn = extract_unsigned_integer (buf + 4, 4);
 
   return (
-          (pcinsn == INSTR_LI_R0_0x7777
+          (insn_is_sigreturn (pcinsn)
            && extract_unsigned_integer (buf + 8, 4) == INSTR_SC)
           ||
           (pcinsn == INSTR_SC
-           && extract_unsigned_integer (buf, 4) == INSTR_LI_R0_0x7777));
+           && insn_is_sigreturn (extract_unsigned_integer (buf, 4))));
 }
 
 CORE_ADDR
@@ -712,9 +732,9 @@ ppc_linux_init_abi (struct gdbarch_info info,
       set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain);
       set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
 
-      set_gdbarch_frame_init_saved_regs (gdbarch,
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
                                          ppc_linux_frame_init_saved_regs);
-      set_gdbarch_init_extra_frame_info (gdbarch,
+      set_gdbarch_deprecated_init_extra_frame_info (gdbarch,
                                          ppc_linux_init_extra_frame_info);
 
       set_gdbarch_memory_remove_breakpoint (gdbarch,
index 05b5e71..c7b0ffb 100644 (file)
@@ -1,7 +1,7 @@
 /* Print values for GNU debugger GDB.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -41,6 +41,7 @@
 #include "completer.h"         /* for completion functions */
 #include "ui-out.h"
 #include "gdb_assert.h"
+#include "block.h"
 
 extern int asm_demangle;       /* Whether to demangle syms in asm printouts */
 extern int addressprint;       /* Whether to print hex addresses in HLL " */
@@ -639,10 +640,10 @@ build_address_symbolic (CORE_ADDR addr,  /* IN */
   if (symbol)
     {
       name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol));
-      if (do_demangle)
-       name_temp = SYMBOL_SOURCE_NAME (symbol);
+      if (do_demangle || asm_demangle)
+       name_temp = SYMBOL_PRINT_NAME (symbol);
       else
-       name_temp = SYMBOL_LINKAGE_NAME (symbol);
+       name_temp = DEPRECATED_SYMBOL_NAME (symbol);
     }
 
   if (msymbol != NULL)
@@ -654,10 +655,10 @@ build_address_symbolic (CORE_ADDR addr,  /* IN */
          symbol = 0;
          symtab = 0;
          name_location = SYMBOL_VALUE_ADDRESS (msymbol);
-         if (do_demangle)
-           name_temp = SYMBOL_SOURCE_NAME (msymbol);
+         if (do_demangle || asm_demangle)
+           name_temp = SYMBOL_PRINT_NAME (msymbol);
          else
-           name_temp = SYMBOL_LINKAGE_NAME (msymbol);
+           name_temp = DEPRECATED_SYMBOL_NAME (msymbol);
        }
     }
   if (symbol == NULL && msymbol == NULL)
@@ -1043,10 +1044,10 @@ sym_info (char *arg, int from_tty)
        offset = sect_addr - SYMBOL_VALUE_ADDRESS (msymbol);
        if (offset)
          printf_filtered ("%s + %u in ",
-                          SYMBOL_SOURCE_NAME (msymbol), offset);
+                          SYMBOL_PRINT_NAME (msymbol), offset);
        else
          printf_filtered ("%s in ",
-                          SYMBOL_SOURCE_NAME (msymbol));
+                          SYMBOL_PRINT_NAME (msymbol));
        if (pc_in_unmapped_range (addr, sect))
          printf_filtered ("load address range of ");
        if (section_is_overlay (sect))
@@ -1121,7 +1122,7 @@ address_info (char *exp, int from_tty)
     }
 
   printf_filtered ("Symbol \"");
-  fprintf_symbol_filtered (gdb_stdout, SYMBOL_NAME (sym),
+  fprintf_symbol_filtered (gdb_stdout, DEPRECATED_SYMBOL_NAME (sym),
                           current_language->la_language, DMGL_ANSI);
   printf_filtered ("\" is ");
   val = SYMBOL_VALUE (sym);
@@ -1148,6 +1149,11 @@ address_info (char *exp, int from_tty)
        }
       break;
 
+    case LOC_COMPUTED:
+    case LOC_COMPUTED_ARG:
+      (SYMBOL_LOCATION_FUNCS (sym)->describe_location) (sym, gdb_stdout);
+      break;
+
     case LOC_REGISTER:
       printf_filtered ("a variable in register %s", REGISTER_NAME (val));
       break;
@@ -1234,7 +1240,7 @@ address_info (char *exp, int from_tty)
       {
        struct minimal_symbol *msym;
 
-       msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, NULL);
+       msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, NULL);
        if (msym == NULL)
          printf_filtered ("unresolved");
        else
@@ -1363,7 +1369,9 @@ display_command (char *exp, int from_tty)
   int display_it = 1;
 
 #if defined(TUI)
-  if (tui_version && *exp == '$')
+  /* NOTE: cagney/2003-02-13 The `tui_active' was previously
+     `tui_version'.  */
+  if (tui_active && *exp == '$')
     display_it = (tui_set_layout (exp) == TUI_FAILURE);
 #endif
 
@@ -1811,6 +1819,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
            case LOC_REGPARM_ADDR:
            case LOC_LOCAL_ARG:
            case LOC_BASEREG_ARG:
+           case LOC_COMPUTED_ARG:
              break;
 
            /* Other types of symbols we just skip over.  */
@@ -1831,11 +1840,11 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
             Null parameter names occur on the RS/6000, for traceback tables.
             FIXME, should we even print them?  */
 
-         if (*SYMBOL_NAME (sym))
+         if (*DEPRECATED_SYMBOL_NAME (sym))
            {
              struct symbol *nsym;
              nsym = lookup_symbol
-               (SYMBOL_NAME (sym),
+               (DEPRECATED_SYMBOL_NAME (sym),
                 b, VAR_NAMESPACE, (int *) NULL, (struct symtab **) NULL);
              if (SYMBOL_CLASS (nsym) == LOC_REGISTER)
                {
@@ -1879,7 +1888,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
          annotate_arg_begin ();
 
          list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
-         fprintf_symbol_filtered (stb->stream, SYMBOL_SOURCE_NAME (sym),
+         fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (sym),
                                   SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
          ui_out_field_stream (uiout, "name", stb);
          annotate_arg_name_end ();
index 3e8b198..2d4fe81 100644 (file)
@@ -1,5 +1,7 @@
 /* Machine independent support for SVR4 /proc (process file system) for GDB.
-   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+
+   Copyright 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
 
@@ -43,7 +45,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <sys/user.h>  /* for struct user */
 #endif
 #include <fcntl.h>     /* for O_RDWR etc. */
-#include <sys/wait.h>
+#include "gdb_wait.h"
 
 #include "proc-utils.h"
 
index bf488a6..2f14c5d 100644 (file)
@@ -1,5 +1,8 @@
 /* Machine independent support for SVR4 /proc (process file system) for GDB.
-   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+   Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+   Inc.
+
    Written by Michael Snyder at Cygnus Solutions.
    Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
 
@@ -39,9 +42,11 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <sys/syscall.h>
 #endif
 #include <sys/errno.h>
-#include <sys/wait.h>
+#include "gdb_wait.h"
 #include <signal.h>
 #include <ctype.h>
+#include "gdb_assert.h"
+#include "inflow.h"
 
 /* 
  * PROCFS.C
@@ -4605,8 +4610,6 @@ procfs_can_run (void)
 static void
 procfs_stop (void)
 {
-  extern pid_t inferior_process_group;
-
   kill (-inferior_process_group, SIGINT);
 }
 
index 334a1fc..3d17669 100644 (file)
@@ -154,7 +154,7 @@ static int wait_for_debug_message(int *rcode, int *debugID,
 
   unpack_message(BUFFERDATA((*packet)->pk_buffer), "%w%w%w%w%w", &reason, debugID,
                  OSinfo1, OSinfo2, status);
-  if (reason&0xffffff == ADP_HADPUnrecognised)
+  if ((reason&0xffffff) == ADP_HADPUnrecognised)
     return RDIError_UnimplementedMessage;
   if (reason != (unsigned ) *rcode) {
     if((reason&0xffffff) == ADP_HADPUnrecognised)
@@ -1842,7 +1842,7 @@ int angel_RDI_info(unsigned type, ARMword *arg1, ARMword *arg2) {
     len +=msgbuild(BUFFERDATA(packet->pk_buffer)+20, "%b%b%b%b%b", cpnum,
                    cpd->regdesc[cpnum].rmin, cpd->regdesc[cpnum].rmax,
                    cpd->regdesc[cpnum].nbytes, cpd->regdesc[cpnum].access);
-    if (cpd->regdesc[cpnum].access&0x3 == 0x3){
+    if ((cpd->regdesc[cpnum].access&0x3) == 0x3){
       len += msgbuild(BUFFERDATA(packet->pk_buffer)+25, "%b%b%b%b%b",
                       cpd->regdesc[cpnum].accessinst.cprt.read_b0,
                       cpd->regdesc[cpnum].accessinst.cprt.read_b1,
index 1bbdb61..3f2be7b 100644 (file)
@@ -172,13 +172,20 @@ init_regcache_descr (struct gdbarch *gdbarch)
                                  struct type *);
   for (i = 0; i < descr->nr_cooked_registers; i++)
     {
-      descr->register_type[i] = REGISTER_VIRTUAL_TYPE (i);
+      if (gdbarch_register_type_p (gdbarch))
+       {
+         gdb_assert (!REGISTER_VIRTUAL_TYPE_P ()); /* OK */
+         descr->register_type[i] = gdbarch_register_type (gdbarch, i);
+       }
+      else
+       descr->register_type[i] = REGISTER_VIRTUAL_TYPE (i); /* OK */
     }
 
   /* If an old style architecture, fill in the remainder of the
      register cache descriptor using the register macros.  */
   if (!gdbarch_pseudo_register_read_p (gdbarch)
-      && !gdbarch_pseudo_register_write_p (gdbarch))
+      && !gdbarch_pseudo_register_write_p (gdbarch)
+      && !gdbarch_register_type_p (gdbarch))
     {
       descr->legacy_p = 1;
       init_legacy_regcache_descr (gdbarch, descr);
@@ -285,6 +292,36 @@ max_register_size (struct gdbarch *gdbarch)
   return descr->max_register_size;
 }
 
+int
+legacy_max_register_raw_size (void)
+{
+  if (DEPRECATED_MAX_REGISTER_RAW_SIZE_P ())
+    return DEPRECATED_MAX_REGISTER_RAW_SIZE;
+  else
+    return max_register_size (current_gdbarch);
+}
+
+int
+legacy_max_register_virtual_size (void)
+{
+  if (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P ())
+    return DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE;
+  else
+    return max_register_size (current_gdbarch);
+}
+
+int
+register_size (struct gdbarch *gdbarch, int regnum)
+{
+  struct regcache_descr *descr = regcache_descr (gdbarch);
+  int size;
+  gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
+  size = descr->sizeof_register[regnum];
+  gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
+  gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
+  return size;
+}
+
 /* The register cache for storing raw register values.  */
 
 struct regcache
index 8dfd2e9..ee10505 100644 (file)
@@ -129,6 +129,32 @@ extern struct type *register_type (struct gdbarch *gdbarch, int regnum);
 extern int max_register_size (struct gdbarch *gdbarch);
 
 
+/* Return the size of register REGNUM.  All registers should have only
+   one size.
+
+   FIXME: cagney/2003-02-28:
+
+   Unfortunatly, thanks to some legacy architectures, this doesn't
+   hold.  A register's cooked (nee virtual) and raw size can differ
+   (see MIPS).  Such architectures should be using different register
+   numbers for the different sized views of identical registers.
+
+   Anyway, the up-shot is that, until that mess is fixed, core code
+   can end up being very confused - should the RAW or VIRTUAL size be
+   used?  As a rule of thumb, use REGISTER_VIRTUAL_SIZE in cooked
+   code, but with the comment:
+
+   OK: REGISTER_VIRTUAL_SIZE
+
+   or just
+
+   OK
+
+   appended to the end of the line.  */
+   
+extern int register_size (struct gdbarch *gdbarch, int regnum);
+
+
 /* Save/restore a register cache.  The registers saved/restored is
    determined by the save_reggroup and restore_reggroup (although you
    can't restore a register that wasn't saved as well :-).  You can
index efacde3..49c7fb9 100644 (file)
@@ -1,7 +1,7 @@
 /* Remote debugging interface for Hitachi E7000 ICE, for GDB
 
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002 Free Software Foundation, Inc.
+   2002, 2003 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support. 
 
@@ -1812,7 +1812,7 @@ e7000_drain_command (char *args, int fromtty)
   puts_e7000debug ("end\r");
   putchar_e7000 (CTRLC);
 
-  while ((c = readchar (1) != -1))
+  while ((c = readchar (1)) != -1)
     {
       if (quit_flag)
        {
index cc21649..f934bd4 100644 (file)
@@ -814,46 +814,13 @@ gdbsim_mourn_inferior (void)
 static int
 gdbsim_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
-#ifdef SIM_HAS_BREAKPOINTS
-  SIM_RC retcode;
-
-  retcode = sim_set_breakpoint (gdbsim_desc, addr);
-
-  switch (retcode)
-    {
-    case SIM_RC_OK:
-      return 0;
-    case SIM_RC_INSUFFICIENT_RESOURCES:
-      return ENOMEM;
-    default:
-      return EIO;
-    }
-#else
   return memory_insert_breakpoint (addr, contents_cache);
-#endif
 }
 
 static int
 gdbsim_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
-#ifdef SIM_HAS_BREAKPOINTS
-  SIM_RC retcode;
-
-  retcode = sim_clear_breakpoint (gdbsim_desc, addr);
-
-  switch (retcode)
-    {
-    case SIM_RC_OK:
-    case SIM_RC_UNKNOWN_BREAKPOINT:
-      return 0;
-    case SIM_RC_INSUFFICIENT_RESOURCES:
-      return ENOMEM;
-    default:
-      return EIO;
-    }
-#else
   return memory_remove_breakpoint (addr, contents_cache);
-#endif
 }
 
 /* Pass the command argument through to the simulator verbatim.  The
index d47dad7..5edea01 100644 (file)
@@ -4839,8 +4839,8 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type)
 }
 
 
-int remote_hw_watchpoint_limit = 0;
-int remote_hw_breakpoint_limit = 0;
+int remote_hw_watchpoint_limit = -1;
+int remote_hw_breakpoint_limit = -1;
 
 int
 remote_check_watch_resources (int type, int cnt, int ot)
@@ -4849,6 +4849,8 @@ remote_check_watch_resources (int type, int cnt, int ot)
     {
       if (remote_hw_breakpoint_limit == 0)
        return 0;
+      else if (remote_hw_breakpoint_limit < 0)
+       return 1;
       else if (cnt <= remote_hw_breakpoint_limit)
        return 1;
     }
@@ -4856,6 +4858,8 @@ remote_check_watch_resources (int type, int cnt, int ot)
     {
       if (remote_hw_watchpoint_limit == 0)
        return 0;
+      else if (remote_hw_watchpoint_limit < 0)
+       return 1;
       else if (ot)
        return -1;
       else if (cnt <= remote_hw_watchpoint_limit)
@@ -6144,6 +6148,19 @@ terminating `#' character and checksum.",
           "Show the maximum number of bytes per memory-read packet.\n",
           &remote_show_cmdlist);
 
+  add_setshow_cmd ("hardware-watchpoint-limit", no_class,
+                  var_zinteger, &remote_hw_watchpoint_limit, "\
+Set the maximum number of target hardware watchpoints.\n\
+Specify a negative limit for unlimited.", "\
+Show the maximum number of target hardware watchpoints.\n",
+                  NULL, NULL, &remote_set_cmdlist, &remote_show_cmdlist);
+  add_setshow_cmd ("hardware-breakpoint-limit", no_class,
+                  var_zinteger, &remote_hw_breakpoint_limit, "\
+Set the maximum number of target hardware breakpoints.\n\
+Specify a negative limit for unlimited.", "\
+Show the maximum number of target hardware breakpoints.\n",
+                  NULL, NULL, &remote_set_cmdlist, &remote_show_cmdlist);
+
   add_show_from_set
     (add_set_cmd ("remoteaddresssize", class_obscure,
                  var_integer, (char *) &remote_address_size,
index a3a8d3d..ac33578 100644 (file)
@@ -47,6 +47,8 @@
 #include "solib-svr4.h"
 #include "ppc-tdep.h"
 
+#include "gdb_assert.h"
+
 /* If the kernel has to deliver a signal, it pushes a sigcontext
    structure on the stack and then calls the signal handler, passing
    the address of the sigcontext in an argument register. Usually
@@ -1442,7 +1444,7 @@ rs6000_skip_trampoline_code (CORE_ADDR pc)
 
   /* Check for bigtoc fixup code.  */
   msymbol = lookup_minimal_symbol_by_pc (pc);
-  if (msymbol && rs6000_in_solib_return_trampoline (pc, SYMBOL_NAME (msymbol)))
+  if (msymbol && rs6000_in_solib_return_trampoline (pc, DEPRECATED_SYMBOL_NAME (msymbol)))
     {
       /* Double-check that the third instruction from PC is relative "b".  */
       op = read_memory_integer (pc + 8, 4);
@@ -2271,7 +2273,7 @@ rs6000_convert_from_func_ptr_addr (CORE_ADDR addr)
   /*  0 */ P(r0), P(r1), P(r2), P(r3), P(r4), P(r5), P(r6), P(r7),  \
   /*  8 */ P(r8), P(r9), P(r10),P(r11),P(r12),P(r13),P(r14),P(r15), \
   /* 16 */ P(r16),P(r17),P(r18),P(r19),P(r20),P(r21),P(r22),P(r23), \
-  /* 24 */ P(r24),P(r25),P(r26),P(r27),P(r28),P(r29),P(r30),P(r31), \
+  /* 24 */ P(r24),P(r25),P(r26),P(r27),P(r28),P(r29),P(r30),P(r31)
 
 /* IBM POWER (pre-PowerPC) architecture, user-level view.  We only cover
    user-level SPR's.  */
@@ -2450,6 +2452,9 @@ static const struct reg registers_e500[] =
   PPC_UISA_NOFP_SPRS,
   /* 7...38 */
   PPC_EV_REGS,
+  R8(acc), R(spefscr),
+  /* NOTE: Add new registers here the end of the raw register
+     list and just before the first pseudo register.  */
   /* 39...70 */
   PPC_GPRS_PSEUDO_REGS
 };
@@ -2801,8 +2806,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        tdep->ppc_ev31_regnum = -1;
        break;
       case bfd_mach_ppc_e500:
-        tdep->ppc_gp0_regnum = 39;
-        tdep->ppc_gplast_regnum = 70;
+        tdep->ppc_gp0_regnum = 41;
+        tdep->ppc_gplast_regnum = tdep->ppc_gp0_regnum + 32 - 1;
         tdep->ppc_toc_regnum = -1;
         tdep->ppc_ps_regnum = 1;
         tdep->ppc_cr_regnum = 2;
@@ -2812,8 +2817,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        tdep->ppc_ev0_regnum = 7;
        tdep->ppc_ev31_regnum = 38;
         set_gdbarch_pc_regnum (gdbarch, 0);
-        set_gdbarch_sp_regnum (gdbarch, 40);
-        set_gdbarch_fp_regnum (gdbarch, 40);
+        set_gdbarch_sp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1);
+        set_gdbarch_fp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1);
         set_gdbarch_dwarf2_reg_to_regnum (gdbarch, e500_dwarf2_reg_to_regnum);
         set_gdbarch_pseudo_register_read (gdbarch, e500_pseudo_register_read);
         set_gdbarch_pseudo_register_write (gdbarch, e500_pseudo_register_write);
@@ -2828,6 +2833,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
        break;
       }   
 
+  /* Sanity check on registers.  */
+  gdb_assert (strcmp (tdep->regs[tdep->ppc_gp0_regnum].name, "r0") == 0);
+
   /* Set lr_frame_offset.  */
   if (wordsize == 8)
     tdep->lr_frame_offset = 16;
@@ -2863,9 +2871,9 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, off);
   set_gdbarch_register_byte (gdbarch, rs6000_register_byte);
   set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, 16);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16);
   set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 16);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16);
   set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type);
 
   set_gdbarch_ptr_bit (gdbarch, wordsize * TARGET_CHAR_BIT);
@@ -2887,7 +2895,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
   set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
   set_gdbarch_frame_align (gdbarch, rs6000_frame_align);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
@@ -2933,8 +2940,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain);
   set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
-  set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
 
   if (!sysv_abi)
     {
index c313532..9ad34c8 100644 (file)
@@ -1748,6 +1748,37 @@ s390_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
   return sp;
 }
 
+static int
+s390_address_class_type_flags (int byte_size, int dwarf2_addr_class)
+{
+  if (byte_size == 4)
+    return TYPE_FLAG_ADDRESS_CLASS_1;
+  else
+    return 0;
+}
+
+static const char *
+s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
+{
+  if (type_flags & TYPE_FLAG_ADDRESS_CLASS_1)
+    return "mode32";
+  else
+    return NULL;
+}
+
+int
+s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name,
+                                      int *type_flags_ptr)
+{
+  if (strcmp (name, "mode32") == 0)
+    {
+      *type_flags_ptr = TYPE_FLAG_ADDRESS_CLASS_1;
+      return 1;
+    }
+  else
+    return 0;
+}
+
 struct gdbarch *
 s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1778,7 +1809,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_args_skip (gdbarch, 0);
   set_gdbarch_frame_args_address (gdbarch, s390_frame_args_address);
   set_gdbarch_frame_chain (gdbarch, s390_frame_chain);
-  set_gdbarch_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, s390_frame_init_saved_regs);
   set_gdbarch_frame_locals_address (gdbarch, s390_frame_args_address);
   /* We can't do this */
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
@@ -1795,11 +1826,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Offset from address of function to start of its code.
      Zero on most machines.  */
   set_gdbarch_function_start_offset (gdbarch, 0);
-  set_gdbarch_max_register_raw_size (gdbarch, 8);
-  set_gdbarch_max_register_virtual_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
   set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc);
   set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue);
-  set_gdbarch_init_extra_frame_info (gdbarch, s390_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, s390_init_extra_frame_info);
   set_gdbarch_deprecated_init_frame_pc_first (gdbarch, s390_init_frame_pc_first);
   set_gdbarch_read_fp (gdbarch, s390_read_fp);
   /* This function that tells us whether the function invocation represented
@@ -1835,7 +1866,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
   set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_arguments (gdbarch, s390_push_arguments);
   set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
@@ -1869,6 +1899,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_long_long_bit (gdbarch, 64);
       set_gdbarch_ptr_bit (gdbarch, 64);
       set_gdbarch_register_bytes (gdbarch, S390X_REGISTER_BYTES);
+      set_gdbarch_address_class_type_flags (gdbarch,
+                                            s390_address_class_type_flags);
+      set_gdbarch_address_class_type_flags_to_name (gdbarch,
+                                                    s390_address_class_type_flags_to_name);
+      set_gdbarch_address_class_name_to_type_flags (gdbarch,
+                                                    s390_address_class_name_to_type_flags);
       break;
     }
 
index 1f044d0..91f3f62 100644 (file)
@@ -157,6 +157,28 @@ sh_sh3e_register_name (int reg_nr)
 }
 
 static const char *
+sh_sh2e_register_name (int reg_nr)
+{
+  static char *register_names[] =
+  {
+    "r0",   "r1",   "r2",   "r3",   "r4",   "r5",   "r6",   "r7",
+    "r8",   "r9",   "r10",  "r11",  "r12",  "r13",  "r14",  "r15",
+    "pc",   "pr",   "gbr",  "vbr",  "mach", "macl", "sr",
+    "fpul", "fpscr",
+    "fr0",  "fr1",  "fr2",  "fr3",  "fr4",  "fr5",  "fr6",  "fr7",
+    "fr8",  "fr9",  "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+    "",  "",
+    "", "", "", "", "", "", "", "",
+    "", "", "", "", "", "", "", "",
+  };
+  if (reg_nr < 0)
+    return NULL;
+  if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
+    return NULL;
+  return register_names[reg_nr];
+}
+
+static const char *
 sh_sh_dsp_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -921,8 +943,8 @@ gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info)
 
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct, and
-   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
-   called for the new frame.
+   then DEPRECATED_INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC
+   will be called for the new frame.
 
    For us, the frame address is its stack pointer value, so we look up
    the function prologue to determine the caller's sp value, and return it.  */
@@ -1007,7 +1029,7 @@ sh_find_callers_reg (struct frame_info *fi, int regnum)
                                             get_frame_base (fi), regnum);
     else
       {
-       FRAME_INIT_SAVED_REGS (fi);
+       DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
        if (!get_frame_pc (fi))
          return 0;
        if (get_frame_saved_regs (fi)[regnum] != 0)
@@ -1031,7 +1053,7 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum)
                                             get_frame_base (fi), pr_regnum);
     else
       {
-       FRAME_INIT_SAVED_REGS (fi);
+       DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
        if (!get_frame_pc (fi))
          return 0;
 
@@ -1754,7 +1776,7 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi)
     }
   else
     {
-      FRAME_INIT_SAVED_REGS (fi);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
       get_frame_extra_info (fi)->return_pc = 
        sh_find_callers_reg (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM);
     }
@@ -1785,7 +1807,7 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
     }
   else
     {
-      FRAME_INIT_SAVED_REGS (fi);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
       get_frame_extra_info (fi)->return_pc =
        sh64_get_saved_pr (fi, gdbarch_tdep (current_gdbarch)->PR_REGNUM);
     }
@@ -1842,7 +1864,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
          return;
        }
 
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
       if (get_frame_saved_regs (frame) != NULL
          && get_frame_saved_regs (frame)[regnum] != 0)
        {
@@ -1931,7 +1953,7 @@ sh_pop_frame (void)
   else
     {
       fp = get_frame_base (frame);
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
       /* Copy regs from where they were saved in the frame */
       for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
@@ -1963,7 +1985,7 @@ sh64_pop_frame (void)
   else
     {
       fp = get_frame_base (frame);
-      FRAME_INIT_SAVED_REGS (frame);
+      DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
 
       /* Copy regs from where they were saved in the frame */
       for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
@@ -2625,6 +2647,62 @@ sh3_show_regs (void)
 
 
 static void
+sh2e_show_regs (void)
+{
+  printf_filtered ("PC=%s SR=%08lx PR=%08lx MACH=%08lx MACHL=%08lx\n",
+                  paddr (read_register (PC_REGNUM)),
+                  (long) read_register (SR_REGNUM),
+                  (long) read_register (PR_REGNUM),
+                  (long) read_register (MACH_REGNUM),
+                  (long) read_register (MACL_REGNUM));
+
+  printf_filtered ("GBR=%08lx VBR=%08lx",
+                  (long) read_register (GBR_REGNUM),
+                  (long) read_register (VBR_REGNUM));
+  printf_filtered (" FPUL=%08lx FPSCR=%08lx",
+                  (long) read_register (gdbarch_tdep (current_gdbarch)->FPUL_REGNUM),
+                   (long) read_register (gdbarch_tdep (current_gdbarch)->FPSCR_REGNUM));
+
+  printf_filtered ("\nR0-R7  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+                  (long) read_register (0),
+                  (long) read_register (1),
+                  (long) read_register (2),
+                  (long) read_register (3),
+                  (long) read_register (4),
+                  (long) read_register (5),
+                  (long) read_register (6),
+                  (long) read_register (7));
+  printf_filtered ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+                  (long) read_register (8),
+                  (long) read_register (9),
+                  (long) read_register (10),
+                  (long) read_register (11),
+                  (long) read_register (12),
+                  (long) read_register (13),
+                  (long) read_register (14),
+                  (long) read_register (15));
+
+  printf_filtered (("FP0-FP7  %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
+                  (long) read_register (FP0_REGNUM + 0),
+                  (long) read_register (FP0_REGNUM + 1),
+                  (long) read_register (FP0_REGNUM + 2),
+                  (long) read_register (FP0_REGNUM + 3),
+                  (long) read_register (FP0_REGNUM + 4),
+                  (long) read_register (FP0_REGNUM + 5),
+                  (long) read_register (FP0_REGNUM + 6),
+                  (long) read_register (FP0_REGNUM + 7));
+  printf_filtered (("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"),
+                  (long) read_register (FP0_REGNUM + 8),
+                  (long) read_register (FP0_REGNUM + 9),
+                  (long) read_register (FP0_REGNUM + 10),
+                  (long) read_register (FP0_REGNUM + 11),
+                  (long) read_register (FP0_REGNUM + 12),
+                  (long) read_register (FP0_REGNUM + 13),
+                  (long) read_register (FP0_REGNUM + 14),
+                  (long) read_register (FP0_REGNUM + 15));
+}
+
+static void
 sh3e_show_regs (void)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
@@ -4281,8 +4359,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_fp0_regnum (gdbarch, -1);
   set_gdbarch_num_pseudo_regs (gdbarch, 0);
-  set_gdbarch_max_register_raw_size (gdbarch, 4);
-  set_gdbarch_max_register_virtual_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_num_regs (gdbarch, SH_DEFAULT_NUM_REGS);
@@ -4295,7 +4373,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
   set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
   set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
-  set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
   set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
   set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return);
@@ -4314,7 +4392,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh_generic_show_regs;
       sh_store_return_value = sh_default_store_return_value;
       sh_register_virtual_type = sh_default_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
@@ -4324,17 +4402,31 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh_generic_show_regs;
       sh_store_return_value = sh_default_store_return_value;
       sh_register_virtual_type = sh_default_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
       break;      
+    case bfd_mach_sh2e:
+      sh_register_name = sh_sh2e_register_name;
+      sh_show_regs = sh2e_show_regs;
+      sh_store_return_value = sh3e_sh4_store_return_value;
+      sh_register_virtual_type = sh_sh3e_register_virtual_type;
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
+      set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      set_gdbarch_fp0_regnum (gdbarch, 25);
+      tdep->FPUL_REGNUM = 23;
+      tdep->FPSCR_REGNUM = 24;
+      tdep->FP_LAST_REGNUM = 40;
+      break;
     case bfd_mach_sh_dsp:
       sh_register_name = sh_sh_dsp_register_name;
       sh_show_regs = sh_dsp_show_regs;
       sh_store_return_value = sh_default_store_return_value;
       sh_register_virtual_type = sh_default_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
@@ -4359,7 +4451,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh3_show_regs;
       sh_store_return_value = sh_default_store_return_value;
       sh_register_virtual_type = sh_default_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
@@ -4371,7 +4463,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh3e_show_regs;
       sh_store_return_value = sh3e_sh4_store_return_value;
       sh_register_virtual_type = sh_sh3e_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
@@ -4388,7 +4480,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh3_dsp_show_regs;
       sh_store_return_value = sh_default_store_return_value;
       sh_register_virtual_type = sh_default_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
@@ -4414,15 +4506,15 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh4_show_regs;
       sh_store_return_value = sh3e_sh4_store_return_value;
       sh_register_virtual_type = sh_sh4_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
       set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
       set_gdbarch_fp0_regnum (gdbarch, 25);
       set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_sh4_register_byte);
       set_gdbarch_num_pseudo_regs (gdbarch, 12);
-      set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
-      set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
+      set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4 * 4);
+      set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4 * 4);
       set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
       set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
       tdep->FPUL_REGNUM = 23;
@@ -4509,19 +4601,19 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte);
       /* This seems awfully wrong!*/
-      /*set_gdbarch_max_register_raw_size (gdbarch, 8);*/
+      /*set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);*/
       /* should include the size of the pseudo regs. */
-      set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
+      set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4 * 4);
       /* Or should that go in the virtual_size? */
-      /*set_gdbarch_max_register_virtual_size (gdbarch, 8);*/
-      set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
+      /*set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);*/
+      set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4 * 4);
       set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
       set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
 
       set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info);
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
       set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc);
-      set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
+      set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
       set_gdbarch_frame_chain (gdbarch, sh64_frame_chain);
       set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register);
       set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value);
@@ -4538,7 +4630,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_show_regs = sh_generic_show_regs;
       sh_store_return_value = sh_default_store_return_value;
       sh_register_virtual_type = sh_default_register_virtual_type;
-      set_gdbarch_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
+      set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh_nofp_frame_init_saved_regs);
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
@@ -4572,7 +4664,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
 
   set_gdbarch_deprecated_store_return_value (gdbarch, sh_store_return_value);
index 13b9580..1d379e9 100644 (file)
@@ -1,5 +1,5 @@
 /* Low level interface for debugging Solaris threads for GDB, the GNU debugger.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -55,7 +55,7 @@
 #include "target.h"
 #include "inferior.h"
 #include <fcntl.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
 #include <dlfcn.h>
 #include "gdbcmd.h"
 #include "gdbcore.h"
@@ -1476,7 +1476,7 @@ info_cb (const td_thrhandle_t *th, void *s)
          struct minimal_symbol *msym;
          msym = lookup_minimal_symbol_by_pc (ti.ti_startfunc);
          if (msym)
-           printf_filtered ("   startfunc: %s\n", SYMBOL_NAME (msym));
+           printf_filtered ("   startfunc: %s\n", DEPRECATED_SYMBOL_NAME (msym));
          else
            printf_filtered ("   startfunc: 0x%s\n", paddr (ti.ti_startfunc));
        }
@@ -1487,7 +1487,7 @@ info_cb (const td_thrhandle_t *th, void *s)
          struct minimal_symbol *msym;
          msym = lookup_minimal_symbol_by_pc (ti.ti_pc);
          if (msym)
-           printf_filtered (" - Sleep func: %s\n", SYMBOL_NAME (msym));
+           printf_filtered (" - Sleep func: %s\n", DEPRECATED_SYMBOL_NAME (msym));
          else
            printf_filtered (" - Sleep func: 0x%s\n", paddr (ti.ti_startfunc));
        }
index ae11567..25682e0 100644 (file)
@@ -184,6 +184,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
                                  xmalloc, xfree);
       rt_common_objfile->minimal_symbol_count = 0;
       rt_common_objfile->msymbols = NULL;
+      terminate_minimal_symbol_table (rt_common_objfile);
     }
 
   init_minimal_symbol_collection ();
index a49614b..289b84f 100644 (file)
@@ -160,6 +160,11 @@ solib_open (char *in_pathname, char **found_pathname)
                         1, lbasename (in_pathname), O_RDONLY, 0,
                         &temp_pathname);
 
+  /* If not found, try to use target supplied solib search method */
+  if (found_file < 0 && TARGET_SO_FIND_AND_OPEN_SOLIB != NULL)
+    found_file = TARGET_SO_FIND_AND_OPEN_SOLIB
+                 (in_pathname, O_RDONLY, &temp_pathname);
+
   /* If not found, next search the inferior's $PATH environment variable. */
   if (found_file < 0 && solib_search_path != NULL)
     found_file = openp (get_in_environ (inferior_environ, "PATH"),
@@ -844,6 +849,13 @@ no_shared_libraries (char *ignored, int from_tty)
   do_clear_solib (NULL);
 }
 
+static void
+reload_shared_libraries (char *ignored, int from_tty)
+{
+  no_shared_libraries (NULL, from_tty);
+  solib_add (NULL, from_tty, NULL, auto_solib_add);
+}
+
 void
 _initialize_solib (void)
 {
@@ -873,6 +885,7 @@ inferior.  Otherwise, symbols must be loaded manually, using `sharedlibrary'.",
 For other (relative) files, you can add values using `set solib-search-path'.",
                   &setlist);
   add_show_from_set (c, &showlist);
+  set_cmd_cfunc (c, reload_shared_libraries);
   set_cmd_completer (c, filename_completer);
 
   /* Set the default value of "solib-absolute-prefix" from the sysroot, if
@@ -885,5 +898,6 @@ For other (relative) files, you can add values using `set solib-search-path'.",
 This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.",
                   &setlist);
   add_show_from_set (c, &showlist);
+  set_cmd_cfunc (c, reload_shared_libraries);
   set_cmd_completer (c, filename_completer);
 }
index dd1100c..8e5c432 100644 (file)
@@ -99,6 +99,12 @@ struct target_so_ops
     /* Determine if PC lies in the dynamic symbol resolution code of
        the run time loader */
     int (*in_dynsym_resolve_code) (CORE_ADDR pc);
+
+    /* Extra hook for finding and opening a solib.  Convenience function
+       for remote debuggers finding host libs */
+    int (*find_and_open_solib) (char *soname,
+        unsigned o_flags, char **temp_pathname);
+    
   };
 
 void free_so (struct so_list *so);
@@ -122,5 +128,7 @@ extern struct target_so_ops *current_target_so_ops;
   (current_target_so_ops->open_symbol_file_object)
 #define TARGET_SO_IN_DYNSYM_RESOLVE_CODE \
   (current_target_so_ops->in_dynsym_resolve_code)
+#define TARGET_SO_FIND_AND_OPEN_SOLIB \
+  (current_target_so_ops->find_and_open_solib)
 
 #endif
index 6ba95a6..85d4f0a 100644 (file)
@@ -353,6 +353,14 @@ som_symfile_read (struct objfile *objfile, int mainline)
 
   som_symtab_read (abfd, objfile, objfile->section_offsets);
 
+  /* Install any minimal symbols that have been collected as the current
+     minimal symbols for this objfile. 
+     Further symbol-reading is done incrementally, file-by-file,
+     in a step known as "psymtab-to-symtab" expansion. hp-symtab-read.c
+     contains the code to do the actual DNTT scanning and symtab building. */
+  install_minimal_symbols (objfile);
+  do_cleanups (back_to);
+
   /* Now read information from the stabs debug sections.
      This is a no-op for SOM.
      Perhaps it is intended for some kind of mixed STABS/SOM
@@ -366,16 +374,8 @@ som_symfile_read (struct objfile *objfile, int mainline)
      together with a scan of the GNTT. See hp-psymtab-read.c. */
   hpread_build_psymtabs (objfile, mainline);
 
-  /* Install any minimal symbols that have been collected as the current
-     minimal symbols for this objfile. 
-     Further symbol-reading is done incrementally, file-by-file,
-     in a step known as "psymtab-to-symtab" expansion. hp-symtab-read.c
-     contains the code to do the actual DNTT scanning and symtab building. */
-  install_minimal_symbols (objfile);
-
   /* Force hppa-tdep.c to re-read the unwind descriptors.  */
   objfile->obj_private = NULL;
-  do_cleanups (back_to);
 }
 
 /* Initialize anything that needs initializing when a completely new symbol
index c66946b..08d3e1c 100644 (file)
@@ -938,7 +938,7 @@ som_solib_create_inferior_hook (void)
     struct minimal_symbol *msymbol2;
 
     /* What a crock.  */
-    msymbol2 = lookup_minimal_symbol_solib_trampoline (SYMBOL_NAME (msymbol),
+    msymbol2 = lookup_minimal_symbol_solib_trampoline (DEPRECATED_SYMBOL_NAME (msymbol),
                                                       NULL, objfile);
     /* Found a symbol with the right name.  */
     if (msymbol2)
index 5970b5a..b634f6c 100644 (file)
@@ -1,7 +1,7 @@
 /* Functions specific to running gdb native on a SPARC running SunOS4.
-   Copyright 1989, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002
-   Free Software Foundation, Inc.
+
+   Copyright 1989, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000,
+   2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -31,7 +31,7 @@
 #endif
 #include <signal.h>
 #include <sys/ptrace.h>
-#include <sys/wait.h>
+#include "gdb_wait.h"
 #ifdef __linux__
 #include <asm/reg.h>
 #else
index 3fe4dfc..b22474a 100644 (file)
@@ -431,8 +431,20 @@ sparc_frame_chain (struct frame_info *frame)
 {
   /* Value that will cause FRAME_CHAIN_VALID to not worry about the chain
      value.  If it really is zero, we detect it later in
-     sparc_init_prev_frame.  */
-  return (CORE_ADDR) 1;
+     sparc_init_prev_frame.
+     
+     Note:  kevinb/2003-02-18:  The constant 1 used to be returned
+     here, but, after some recent changes to frame_chain_valid(),
+     this value is no longer suitable for causing frame_chain_valid()
+     to "not worry about the chain value."  The constant ~0 (i.e,
+     0xfff...) causes the failing test in frame_chain_valid() to
+     succeed thus preserving the "not worry" property.  I had considered
+     using something like ``get_frame_base (frame) + 1''.  However, I think
+     a constant value is better, because when debugging this problem,
+     I knew that something funny was going on as soon as I saw the
+     constant 1 being used as the frame chain elsewhere in GDB.  */
+
+  return ~ (CORE_ADDR) 0;
 }
 
 CORE_ADDR
@@ -3133,22 +3145,22 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_fp_regnum (gdbarch, SPARC_FP_REGNUM);
   set_gdbarch_fp0_regnum (gdbarch, SPARC_FP0_REGNUM);
   set_gdbarch_frame_chain (gdbarch, sparc_frame_chain);
-  set_gdbarch_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sparc_frame_init_saved_regs);
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_frame_saved_pc (gdbarch, sparc_frame_saved_pc);
   set_gdbarch_frameless_function_invocation (gdbarch, 
                                             frameless_look_for_prologue);
   set_gdbarch_get_saved_register (gdbarch, sparc_get_saved_register);
-  set_gdbarch_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
   set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-  set_gdbarch_max_register_raw_size (gdbarch, 8);
-  set_gdbarch_max_register_virtual_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, 8);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8);
   set_gdbarch_pop_frame (gdbarch, sparc_pop_frame);
   set_gdbarch_push_return_address (gdbarch, sparc_push_return_address);
-  set_gdbarch_push_dummy_frame (gdbarch, sparc_push_dummy_frame);
+  set_gdbarch_deprecated_push_dummy_frame (gdbarch, sparc_push_dummy_frame);
   set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
   set_gdbarch_register_convert_to_raw (gdbarch, sparc_convert_to_raw);
   set_gdbarch_register_convert_to_virtual (gdbarch, 
index b873be6..cf7a21b 100644 (file)
@@ -420,7 +420,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
              memset (sym, 0, sizeof (struct symbol));
              SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
              SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
-             SYMBOL_NAME (sym) =
+             DEPRECATED_SYMBOL_NAME (sym) =
                obsavestring (name, pp - name, &objfile->symbol_obstack);
              pp += 2;
              if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
@@ -940,13 +940,13 @@ read_type_number (register char **pp, register int *typenums)
 // OBSOLETE    /* Get symbol typs name and validate 
 // OBSOLETE       eg: p = "A;;__ct__1AFv foo__1AFv ;;;" */
 // OBSOLETE    sname = get_substring (&p, ';');
-// OBSOLETE    if (!sname || strcmp (sname, SYMBOL_NAME (sym)))
+// OBSOLETE    if (!sname || strcmp (sname, DEPRECATED_SYMBOL_NAME (sym)))
 // OBSOLETE      error ("Internal error: base symbol type name does not match\n");
 
 // OBSOLETE    /* Find symbol's internal gdb reference using demangled_name.
 // OBSOLETE       This is the real sym that we want; 
 // OBSOLETE       sym was a temp hack to make debugger happy */
-// OBSOLETE    ref_sym = lookup_symbol (SYMBOL_NAME (sym), 0, STRUCT_NAMESPACE, 0, 0);
+// OBSOLETE    ref_sym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), 0, STRUCT_NAMESPACE, 0, 0);
 // OBSOLETE    type = SYMBOL_TYPE (ref_sym);
 
 
@@ -1073,7 +1073,7 @@ resolve_symbol_reference (struct objfile *objfile, struct symbol *sym, char *p)
      will correctly print the name.
      Don't add_symbol_to_list so that lookup_symbol won't find it.
      nope... needed for fixups. */
-  SYMBOL_NAME (sym) = SYMBOL_NAME (ref_sym);
+  DEPRECATED_SYMBOL_NAME (sym) = DEPRECATED_SYMBOL_NAME (ref_sym);
 
   /* Done!  */
   return 1;
@@ -1277,16 +1277,16 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       switch (string[1])
        {
        case 't':
-         SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"),
+         DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"),
                                            &objfile->symbol_obstack);
          break;
 
        case 'v':               /* $vtbl_ptr_type */
-         /* Was: SYMBOL_NAME (sym) = "vptr"; */
+         /* Was: DEPRECATED_SYMBOL_NAME (sym) = "vptr"; */
          goto normal;
 
        case 'e':
-         SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"),
+         DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"),
                                            &objfile->symbol_obstack);
          break;
 
@@ -1324,28 +1324,18 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
        return NULL;
 
       /* S..P contains the name of the symbol.  We need to store
-         the correct name into SYMBOL_NAME.  */
+         the correct name into DEPRECATED_SYMBOL_NAME.  */
       nlen = p - s;
       if (refnum >= 0)
        {
          if (nlen > 0)
-           {
-             SYMBOL_NAME (sym) = (char *)
-               obstack_alloc (&objfile->symbol_obstack, nlen);
-             strncpy (SYMBOL_NAME (sym), s, nlen);
-             SYMBOL_NAME (sym)[nlen] = '\0';
-             SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
-           }
+           SYMBOL_SET_NAMES (sym, s, nlen, objfile);
          else
-           /* FIXME! Want SYMBOL_NAME (sym) = 0;
+           /* FIXME! Want DEPRECATED_SYMBOL_NAME (sym) = 0;
               Get error if leave name 0.  So give it something. */
            {
              nlen = p - string;
-             SYMBOL_NAME (sym) = (char *)
-               obstack_alloc (&objfile->symbol_obstack, nlen);
-             strncpy (SYMBOL_NAME (sym), string, nlen);
-             SYMBOL_NAME (sym)[nlen] = '\0';
-             SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
+             SYMBOL_SET_NAMES (sym, string, nlen, objfile);
            }
        }
       /* Advance STRING beyond the reference id.  */
@@ -1355,29 +1345,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
     {
     normal:
       SYMBOL_LANGUAGE (sym) = current_subfile->language;
-      SYMBOL_NAME (sym) = (char *)
-       obstack_alloc (&objfile->symbol_obstack, ((p - string) + 1));
-      /* Open-coded memcpy--saves function call time.  */
-      /* FIXME:  Does it really?  Try replacing with simple strcpy and
-         try it on an executable with a large symbol table. */
-      /* FIXME: considering that gcc can open code memcpy anyway, I
-         doubt it.  xoxorich. */
-      {
-       register char *p1 = string;
-       register char *p2 = SYMBOL_NAME (sym);
-       while (p1 != p)
-         {
-           *p2++ = *p1++;
-         }
-       *p2++ = '\0';
-      }
-
-      /* If this symbol is from a C++ compilation, then attempt to cache the
-         demangled form for future reference.  This is a typical time versus
-         space tradeoff, that was decided in favor of time because it sped up
-         C++ symbol lookups by a factor of about 20. */
-
-      SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
+      SYMBOL_SET_NAMES (sym, string, p - string, objfile);
     }
   p++;
 
@@ -1608,9 +1576,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
          Symbol references don't have valid names and wont't match up with
          minimal symbols when the global_sym_chain is relocated.
          We'll fixup symbol references when we fixup the defining symbol.  */
-      if (SYMBOL_NAME (sym) && SYMBOL_NAME (sym)[0] != '#')
+      if (DEPRECATED_SYMBOL_NAME (sym) && DEPRECATED_SYMBOL_NAME (sym)[0] != '#')
        {
-         i = hashname (SYMBOL_NAME (sym));
+         i = hashname (DEPRECATED_SYMBOL_NAME (sym));
          SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i];
          global_sym_chain[i] = sym;
        }
@@ -1754,7 +1722,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
        {
          reg_value_complaint (SYMBOL_VALUE (sym),
                               NUM_REGS + NUM_PSEUDO_REGS,
-                              SYMBOL_SOURCE_NAME (sym));
+                              SYMBOL_PRINT_NAME (sym));
          SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -1770,7 +1738,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
        {
          reg_value_complaint (SYMBOL_VALUE (sym),
                               NUM_REGS + NUM_PSEUDO_REGS,
-                              SYMBOL_SOURCE_NAME (sym));
+                              SYMBOL_PRINT_NAME (sym));
          SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -1810,7 +1778,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
              prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
              if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG
                   || SYMBOL_CLASS (prev_sym) == LOC_ARG)
-                 && STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME (sym)))
+                 && STREQ (DEPRECATED_SYMBOL_NAME (prev_sym), DEPRECATED_SYMBOL_NAME (sym)))
                {
                  SYMBOL_CLASS (prev_sym) = LOC_REGPARM;
                  /* Use the type from the LOC_REGISTER; that is the type
@@ -1833,13 +1801,13 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_VALUE_ADDRESS (sym) = valu;
 #ifdef STATIC_TRANSFORM_NAME
-      if (IS_STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym)))
+      if (IS_STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym)))
        {
          struct minimal_symbol *msym;
-         msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile);
+         msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile);
          if (msym != NULL)
            {
-             SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym));
+             DEPRECATED_SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym));
              SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
            }
        }
@@ -1884,7 +1852,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
          extern const char vtbl_ptr_name[];
 
          if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
-              && strcmp (SYMBOL_NAME (sym), vtbl_ptr_name))
+              && strcmp (DEPRECATED_SYMBOL_NAME (sym), vtbl_ptr_name))
              || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
            {
              /* If we are giving a name to a type such as "pointer to
@@ -1924,11 +1892,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
              /* Pascal accepts names for pointer types. */
              if (current_subfile->language == language_pascal)
                {
-                 TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
+                 TYPE_NAME (SYMBOL_TYPE (sym)) = DEPRECATED_SYMBOL_NAME (sym);
                }
            }
          else
-           TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
+           TYPE_NAME (SYMBOL_TYPE (sym)) = DEPRECATED_SYMBOL_NAME (sym);
        }
 
       add_symbol_to_list (sym, &file_symbols);
@@ -1963,7 +1931,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
       if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
        TYPE_TAG_NAME (SYMBOL_TYPE (sym))
-         = obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));
+         = obconcat (&objfile->type_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym));
       add_symbol_to_list (sym, &file_symbols);
 
       if (synonym)
@@ -1977,7 +1945,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
          SYMBOL_NAMESPACE (typedef_sym) = VAR_NAMESPACE;
          if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
            TYPE_NAME (SYMBOL_TYPE (sym))
-             = obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));
+             = obconcat (&objfile->type_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym));
          add_symbol_to_list (typedef_sym, &file_symbols);
        }
       break;
@@ -1988,13 +1956,13 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_VALUE_ADDRESS (sym) = valu;
 #ifdef STATIC_TRANSFORM_NAME
-      if (IS_STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym)))
+      if (IS_STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym)))
        {
          struct minimal_symbol *msym;
-         msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile);
+         msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, objfile);
          if (msym != NULL)
            {
-             SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym));
+             DEPRECATED_SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (DEPRECATED_SYMBOL_NAME (sym));
              SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
            }
        }
@@ -2021,7 +1989,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
        {
          reg_value_complaint (SYMBOL_VALUE (sym),
                               NUM_REGS + NUM_PSEUDO_REGS,
-                              SYMBOL_SOURCE_NAME (sym));
+                              SYMBOL_PRINT_NAME (sym));
          SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -2427,7 +2395,7 @@ again:
              if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
                  && SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
                  && (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
-                 && STREQ (SYMBOL_NAME (sym), type_name))
+                 && STREQ (DEPRECATED_SYMBOL_NAME (sym), type_name))
                {
                  obstack_free (&objfile->type_obstack, type_name);
                  type = SYMBOL_TYPE (sym);
@@ -4529,7 +4497,7 @@ read_enum_type (register char **pp, register struct type *type,
       sym = (struct symbol *)
        obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
-      SYMBOL_NAME (sym) = name;
+      DEPRECATED_SYMBOL_NAME (sym) = name;
       SYMBOL_LANGUAGE (sym) = current_subfile->language;
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -4571,7 +4539,7 @@ read_enum_type (register char **pp, register struct type *type,
        {
          struct symbol *xsym = syms->symbol[j];
          SYMBOL_TYPE (xsym) = type;
-         TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+         TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
          TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
          TYPE_FIELD_BITSIZE (type, n) = 0;
        }
@@ -5104,7 +5072,7 @@ common_block_end (struct objfile *objfile)
     obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
   /* Note: common_block_name already saved on symbol_obstack */
-  SYMBOL_NAME (sym) = common_block_name;
+  DEPRECATED_SYMBOL_NAME (sym) = common_block_name;
   SYMBOL_CLASS (sym) = LOC_BLOCK;
 
   /* Now we copy all the symbols which have been defined since the BCOMM.  */
@@ -5131,7 +5099,7 @@ common_block_end (struct objfile *objfile)
   /* Should we be putting local_symbols back to what it was?
      Does it matter?  */
 
-  i = hashname (SYMBOL_NAME (sym));
+  i = hashname (DEPRECATED_SYMBOL_NAME (sym));
   SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i];
   global_sym_chain[i] = sym;
   common_block_name = NULL;
@@ -5222,7 +5190,7 @@ cleanup_undefined_types (void)
                            && SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
                            && (TYPE_CODE (SYMBOL_TYPE (sym)) ==
                                TYPE_CODE (*type))
-                           && STREQ (SYMBOL_NAME (sym), typename))
+                           && STREQ (DEPRECATED_SYMBOL_NAME (sym), typename))
                           replace_type (*type, SYMBOL_TYPE (sym));
                      }
                  }
@@ -5278,7 +5246,7 @@ scan_file_globals (struct objfile *objfile)
        return;
 
       for (msymbol = resolve_objfile->msymbols;
-          msymbol && SYMBOL_NAME (msymbol) != NULL;
+          msymbol && DEPRECATED_SYMBOL_NAME (msymbol) != NULL;
           msymbol++)
        {
          QUIT;
@@ -5299,12 +5267,12 @@ scan_file_globals (struct objfile *objfile)
          /* Get the hash index and check all the symbols
             under that hash index. */
 
-         hash = hashname (SYMBOL_NAME (msymbol));
+         hash = hashname (DEPRECATED_SYMBOL_NAME (msymbol));
 
          for (sym = global_sym_chain[hash]; sym;)
            {
-             if (SYMBOL_NAME (msymbol)[0] == SYMBOL_NAME (sym)[0] &&
-                 STREQ (SYMBOL_NAME (msymbol) + 1, SYMBOL_NAME (sym) + 1))
+             if (DEPRECATED_SYMBOL_NAME (msymbol)[0] == DEPRECATED_SYMBOL_NAME (sym)[0] &&
+                 STREQ (DEPRECATED_SYMBOL_NAME (msymbol) + 1, DEPRECATED_SYMBOL_NAME (sym) + 1))
                {
 
                  struct alias_list *aliases;
@@ -5396,7 +5364,7 @@ scan_file_globals (struct objfile *objfile)
          else
            complaint (&symfile_complaints,
                       "%s: common block `%s' from global_sym_chain unresolved",
-                      objfile->name, SYMBOL_NAME (prev));
+                      objfile->name, DEPRECATED_SYMBOL_NAME (prev));
        }
     }
   memset (global_sym_chain, 0, sizeof (global_sym_chain));
index 6b242b2..3eab979 100644 (file)
@@ -39,6 +39,7 @@
 #include "inferior.h"
 #include "annotate.h"
 #include "ui-out.h"
+#include "block.h"
 
 /* Prototypes for exported functions. */
 
@@ -355,12 +356,12 @@ print_frame (struct frame_info *fi,
          /* We also don't know anything about the function besides
             its address and name.  */
          func = 0;
-         funname = SYMBOL_NAME (msymbol);
+         funname = DEPRECATED_SYMBOL_NAME (msymbol);
          funlang = SYMBOL_LANGUAGE (msymbol);
        }
       else
        {
-         /* I'd like to use SYMBOL_SOURCE_NAME() here, to display the
+         /* I'd like to use SYMBOL_PRINT_NAME() here, to display the
             demangled name that we already have stored in the symbol
             table, but we stored a version with DMGL_PARAMS turned
             on, and here we don't want to display parameters. So call
@@ -372,7 +373,7 @@ print_frame (struct frame_info *fi,
             here, while we still have our hands on the function
             symbol.) */
          char *demangled;
-         funname = SYMBOL_NAME (func);
+         funname = DEPRECATED_SYMBOL_NAME (func);
          funlang = SYMBOL_LANGUAGE (func);
          if (funlang == language_cplus)
            {
@@ -381,7 +382,7 @@ print_frame (struct frame_info *fi,
                /* If the demangler fails, try the demangled name from
                   the symbol table. This'll have parameters, but
                   that's preferable to diplaying a mangled name. */
-               funname = SYMBOL_SOURCE_NAME (func);
+               funname = SYMBOL_PRINT_NAME (func);
            }
        }
     }
@@ -390,7 +391,7 @@ print_frame (struct frame_info *fi,
       struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (frame_address_in_block (fi));
       if (msymbol != NULL)
        {
-         funname = SYMBOL_NAME (msymbol);
+         funname = DEPRECATED_SYMBOL_NAME (msymbol);
          funlang = SYMBOL_LANGUAGE (msymbol);
        }
     }
@@ -638,7 +639,7 @@ frame_info (char *addr_exp, int from_tty)
   s = find_pc_symtab (get_frame_pc (fi));
   if (func)
     {
-      /* I'd like to use SYMBOL_SOURCE_NAME() here, to display
+      /* I'd like to use SYMBOL_PRINT_NAME() here, to display
        * the demangled name that we already have stored in
        * the symbol table, but we stored a version with
        * DMGL_PARAMS turned on, and here we don't want
@@ -652,7 +653,7 @@ frame_info (char *addr_exp, int from_tty)
        * have our hands on the function symbol.)
        */
       char *demangled;
-      funname = SYMBOL_NAME (func);
+      funname = DEPRECATED_SYMBOL_NAME (func);
       funlang = SYMBOL_LANGUAGE (func);
       if (funlang == language_cplus)
        {
@@ -662,7 +663,7 @@ frame_info (char *addr_exp, int from_tty)
           * but that's preferable to diplaying a mangled name.
           */
          if (demangled == NULL)
-           funname = SYMBOL_SOURCE_NAME (func);
+           funname = SYMBOL_PRINT_NAME (func);
        }
     }
   else
@@ -670,7 +671,7 @@ frame_info (char *addr_exp, int from_tty)
       register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (get_frame_pc (fi));
       if (msymbol != NULL)
        {
-         funname = SYMBOL_NAME (msymbol);
+         funname = DEPRECATED_SYMBOL_NAME (msymbol);
          funlang = SYMBOL_LANGUAGE (msymbol);
        }
     }
@@ -781,9 +782,9 @@ frame_info (char *addr_exp, int from_tty)
       }
   }
 
-  if (FRAME_INIT_SAVED_REGS_P ()
+  if (DEPRECATED_FRAME_INIT_SAVED_REGS_P ()
       && get_frame_saved_regs (fi) == NULL)
-    FRAME_INIT_SAVED_REGS (fi);
+    DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
   /* Print as much information as possible on the location of all the
      registers.  */
   {
@@ -1082,10 +1083,11 @@ print_block_frame_locals (struct block *b, register struct frame_info *fi,
        case LOC_REGISTER:
        case LOC_STATIC:
        case LOC_BASEREG:
+       case LOC_COMPUTED:
          values_printed = 1;
          for (j = 0; j < num_tabs; j++)
            fputs_filtered ("\t", stream);
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
          fputs_filtered (" = ", stream);
          print_variable_value (sym, fi, stream);
          fprintf_filtered (stream, "\n");
@@ -1111,7 +1113,7 @@ print_block_frame_labels (struct block *b, int *have_default,
 
   ALL_BLOCK_SYMBOLS (b, i, sym)
     {
-      if (STREQ (SYMBOL_NAME (sym), "default"))
+      if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
        {
          if (*have_default)
            continue;
@@ -1122,7 +1124,7 @@ print_block_frame_labels (struct block *b, int *have_default,
          struct symtab_and_line sal;
          sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
          values_printed = 1;
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
          if (addressprint)
            {
              fprintf_filtered (stream, " ");
@@ -1308,8 +1310,9 @@ print_frame_arg_vars (register struct frame_info *fi,
        case LOC_REGPARM:
        case LOC_REGPARM_ADDR:
        case LOC_BASEREG_ARG:
+       case LOC_COMPUTED_ARG:
          values_printed = 1;
-         fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+         fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
          fputs_filtered (" = ", stream);
 
          /* We have to look up the symbol because arguments can have
@@ -1323,7 +1326,7 @@ print_frame_arg_vars (register struct frame_info *fi,
             float).  There are also LOC_ARG/LOC_REGISTER pairs which
             are not combined in symbol-reading.  */
 
-         sym2 = lookup_symbol (SYMBOL_NAME (sym),
+         sym2 = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym),
                   b, VAR_NAMESPACE, (int *) NULL, (struct symtab **) NULL);
          print_variable_value (sym2, fi, stream);
          fprintf_filtered (stream, "\n");
@@ -1621,7 +1624,7 @@ return_command (char *retval_exp, int from_tty)
     {
       if (thisfun != 0)
        {
-         if (!query ("Make %s return now? ", SYMBOL_SOURCE_NAME (thisfun)))
+         if (!query ("Make %s return now? ", SYMBOL_PRINT_NAME (thisfun)))
            {
              error ("Not confirmed.");
              /* NOTREACHED */
index c83c025..8380b27 100644 (file)
 #include "gdb_obstack.h"
 #include "completer.h"
 #include "bcache.h"
+#include "hashtab.h"
 #include <readline/readline.h>
 #include "gdb_assert.h"
+#include "block.h"
 
 #include <sys/types.h>
 #include <fcntl.h>
@@ -208,55 +210,20 @@ compare_symbols (const void *s1p, const void *s2p)
 
   s1 = (struct symbol **) s1p;
   s2 = (struct symbol **) s2p;
-  return (strcmp (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2)));
+  return (strcmp (SYMBOL_NATURAL_NAME (*s1), SYMBOL_NATURAL_NAME (*s2)));
 }
 
-/*
-
-   LOCAL FUNCTION
-
-   compare_psymbols -- compare two partial symbols by name
-
-   DESCRIPTION
-
-   Given pointers to pointers to two partial symbol table entries,
-   compare them by name and return -N, 0, or +N (ala strcmp).
-   Typically used by sorting routines like qsort().
-
-   NOTES
-
-   Does direct compare of first two characters before punting
-   and passing to strcmp for longer compares.  Note that the
-   original version had a bug whereby two null strings or two
-   identically named one character strings would return the
-   comparison of memory following the null byte.
-
- */
+/* This compares two partial symbols by names, using strcmp_iw_ordered
+   for the comparison.  */
 
 static int
 compare_psymbols (const void *s1p, const void *s2p)
 {
-  register struct partial_symbol **s1, **s2;
-  register char *st1, *st2;
-
-  s1 = (struct partial_symbol **) s1p;
-  s2 = (struct partial_symbol **) s2p;
-  st1 = SYMBOL_SOURCE_NAME (*s1);
-  st2 = SYMBOL_SOURCE_NAME (*s2);
+  struct partial_symbol *const *s1 = s1p;
+  struct partial_symbol *const *s2 = s2p;
 
-
-  if ((st1[0] - st2[0]) || !st1[0])
-    {
-      return (st1[0] - st2[0]);
-    }
-  else if ((st1[1] - st2[1]) || !st1[1])
-    {
-      return (st1[1] - st2[1]);
-    }
-  else
-    {
-      return (strcmp (st1, st2));
-    }
+  return strcmp_iw_ordered (SYMBOL_NATURAL_NAME (*s1),
+                           SYMBOL_NATURAL_NAME (*s2));
 }
 
 void
@@ -1983,6 +1950,11 @@ reread_symbols (void)
              objfile->psymbol_cache = bcache_xmalloc ();
              bcache_xfree (objfile->macro_cache);
              objfile->macro_cache = bcache_xmalloc ();
+             if (objfile->demangled_names_hash != NULL)
+               {
+                 htab_delete (objfile->demangled_names_hash);
+                 objfile->demangled_names_hash = NULL;
+               }
              obstack_free (&objfile->psymbol_obstack, 0);
              obstack_free (&objfile->symbol_obstack, 0);
              obstack_free (&objfile->type_obstack, 0);
@@ -2019,6 +1991,7 @@ reread_symbols (void)
                  error ("Can't find the file sections in `%s': %s",
                         objfile->name, bfd_errmsg (bfd_get_error ()));
                }
+              terminate_minimal_symbol_table (objfile);
 
              /* We use the same section offsets as from last time.  I'm not
                 sure whether that is always correct for shared libraries.  */
@@ -2683,7 +2656,6 @@ add_psymbol_to_list (char *name, int namelength, namespace_enum namespace,
   /* Create local copy of the partial symbol */
   memcpy (buf, name, namelength);
   buf[namelength] = '\0';
-  SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache);
   /* val and coreaddr are mutually exclusive, one of them *will* be zero */
   if (val != 0)
     {
@@ -2697,7 +2669,8 @@ add_psymbol_to_list (char *name, int namelength, namespace_enum namespace,
   SYMBOL_LANGUAGE (&psymbol) = language;
   PSYMBOL_NAMESPACE (&psymbol) = namespace;
   PSYMBOL_CLASS (&psymbol) = class;
-  SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language);
+
+  SYMBOL_SET_NAMES (&psymbol, buf, namelength, objfile);
 
   /* Stash the partial symbol away in the cache */
   psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache);
@@ -2735,7 +2708,7 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name,
 
   memcpy (buf, name, namelength);
   buf[namelength] = '\0';
-  SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache);
+  DEPRECATED_SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache);
 
   buf = alloca (dem_namelength + 1);
   memcpy (buf, dem_name, dem_namelength);
@@ -3705,5 +3678,4 @@ Usage: set extension-language .foo bar",
         &setlist));
   add_show_from_set (c, &showlist);
   set_cmd_completer (c, filename_completer);
-
 }
index 2671463..17bcb4c 100644 (file)
@@ -28,6 +28,7 @@
 /* Opaque declarations.  */
 
 struct obstack;
+struct block;
 
 /* Partial symbols are stored in the psymbol_cache and pointers to them
    are kept in a dynamically grown array that is obtained from malloc and
index fb52754..79caf5a 100644 (file)
@@ -1,7 +1,7 @@
 /* Sequent Symmetry host interface, for GDB when running under Unix.
-   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999, 2000,
-   2001
-   Free Software Foundation, Inc.
+
+   Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1999,
+   2000, 2001, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -34,7 +34,7 @@
 #define _INKERNEL
 #include <signal.h>
 #undef _INKERNEL
-#include <sys/wait.h>
+#include "gdb_wait.h"
 #include <sys/param.h>
 #include <sys/user.h>
 #include <sys/proc.h>
index 995372d..f6e78eb 100644 (file)
@@ -1,8 +1,8 @@
 /* Do various things to symbol tables (other than lookup), for GDB.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2002 Free Software Foundation,
-   Inc.
+   1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -32,6 +32,7 @@
 #include "gdb_obstack.h"
 #include "language.h"
 #include "bcache.h"
+#include "block.h"
 
 #include "gdb_string.h"
 #include <readline/readline.h>
@@ -97,7 +98,7 @@ free_symtab_block (struct objfile *objfile, struct block *b)
       for (sym = BLOCK_BUCKET (b, i); sym; sym = next_sym)
        {
          next_sym = sym->hash_next;
-         xmfree (objfile->md, SYMBOL_NAME (sym));
+         xmfree (objfile->md, DEPRECATED_SYMBOL_NAME (sym));
          xmfree (objfile->md, sym);
        }
     }
@@ -179,6 +180,9 @@ void
 print_objfile_statistics (void)
 {
   struct objfile *objfile;
+  struct symtab *s;
+  struct partial_symtab *ps;
+  int i, linetables, blockvectors;
 
   immediate_quit++;
   ALL_OBJFILES (objfile)
@@ -199,6 +203,28 @@ print_objfile_statistics (void)
     if (OBJSTAT (objfile, n_types) > 0)
       printf_filtered ("  Number of \"types\" defined: %d\n",
                       OBJSTAT (objfile, n_types));
+    i = 0;
+    ALL_OBJFILE_PSYMTABS (objfile, ps)
+      {
+        if (ps->readin == 0)
+          i++;
+      }
+    printf_filtered ("  Number of psym tables (not yet expanded): %d\n", i);
+    i = linetables = blockvectors = 0;
+    ALL_OBJFILE_SYMTABS (objfile, s)
+      {
+        i++;
+        if (s->linetable != NULL)
+          linetables++;
+        if (s->primary == 1)
+          blockvectors++;
+      }
+    printf_filtered ("  Number of symbol tables: %d\n", i);
+    printf_filtered ("  Number of symbol tables with line tables: %d\n", 
+                     linetables);
+    printf_filtered ("  Number of symbol tables with blockvectors: %d\n", 
+                     blockvectors);
+    
     if (OBJSTAT (objfile, sz_strtab) > 0)
       printf_filtered ("  Space used by a.out string tables: %d\n",
                       OBJSTAT (objfile, sz_strtab));
@@ -286,7 +312,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
       return;
     }
   for (index = 0, msymbol = objfile->msymbols;
-       SYMBOL_NAME (msymbol) != NULL; msymbol++, index++)
+       DEPRECATED_SYMBOL_NAME (msymbol) != NULL; msymbol++, index++)
     {
       switch (msymbol->type)
        {
@@ -323,7 +349,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
        }
       fprintf_filtered (outfile, "[%2d] %c ", index, ms_type);
       print_address_numeric (SYMBOL_VALUE_ADDRESS (msymbol), 1, outfile);
-      fprintf_filtered (outfile, " %s", SYMBOL_NAME (msymbol));
+      fprintf_filtered (outfile, " %s", DEPRECATED_SYMBOL_NAME (msymbol));
       if (SYMBOL_BFD_SECTION (msymbol))
        fprintf_filtered (outfile, " section %s",
                          bfd_section_name (objfile->obfd,
@@ -479,7 +505,7 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab,
          print_address_numeric (BLOCK_END (b), 1, outfile);
          if (BLOCK_FUNCTION (b))
            {
-             fprintf_filtered (outfile, ", function %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
+             fprintf_filtered (outfile, ", function %s", DEPRECATED_SYMBOL_NAME (BLOCK_FUNCTION (b)));
              if (SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL)
                {
                  fprintf_filtered (outfile, ", %s",
@@ -574,7 +600,7 @@ print_symbol (void *args)
   print_spaces (depth, outfile);
   if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
     {
-      fprintf_filtered (outfile, "label %s at ", SYMBOL_SOURCE_NAME (symbol));
+      fprintf_filtered (outfile, "label %s at ", SYMBOL_PRINT_NAME (symbol));
       print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), 1, outfile);
       if (SYMBOL_BFD_SECTION (symbol))
        fprintf_filtered (outfile, " section %s\n",
@@ -597,7 +623,7 @@ print_symbol (void *args)
                          ? "enum"
                     : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT
                        ? "struct" : "union")),
-                           SYMBOL_NAME (symbol));
+                           DEPRECATED_SYMBOL_NAME (symbol));
          LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
        }
       fprintf_filtered (outfile, ";\n");
@@ -609,14 +635,14 @@ print_symbol (void *args)
       if (SYMBOL_TYPE (symbol))
        {
          /* Print details of types, except for enums where it's clutter.  */
-         LA_PRINT_TYPE (SYMBOL_TYPE (symbol), SYMBOL_SOURCE_NAME (symbol),
+         LA_PRINT_TYPE (SYMBOL_TYPE (symbol), SYMBOL_PRINT_NAME (symbol),
                         outfile,
                         TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM,
                         depth);
          fprintf_filtered (outfile, "; ");
        }
       else
-       fprintf_filtered (outfile, "%s ", SYMBOL_SOURCE_NAME (symbol));
+       fprintf_filtered (outfile, "%s ", SYMBOL_PRINT_NAME (symbol));
 
       switch (SYMBOL_CLASS (symbol))
        {
@@ -726,6 +752,11 @@ print_symbol (void *args)
                               SYMBOL_BFD_SECTION (symbol)));
          break;
 
+       case LOC_COMPUTED:
+       case LOC_COMPUTED_ARG:
+         fprintf_filtered (outfile, "computed at runtime");
+         break;
+
        case LOC_UNRESOLVED:
          fprintf_filtered (outfile, "unresolved");
          break;
@@ -800,7 +831,7 @@ print_partial_symbols (struct partial_symbol **p, int count, char *what,
   fprintf_filtered (outfile, "  %s partial symbols:\n", what);
   while (count-- > 0)
     {
-      fprintf_filtered (outfile, "    `%s'", SYMBOL_NAME (*p));
+      fprintf_filtered (outfile, "    `%s'", DEPRECATED_SYMBOL_NAME (*p));
       if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
        {
          fprintf_filtered (outfile, "  `%s'", SYMBOL_DEMANGLED_NAME (*p));
@@ -877,6 +908,10 @@ print_partial_symbols (struct partial_symbol **p, int count, char *what,
        case LOC_OPTIMIZED_OUT:
          fputs_filtered ("optimized out", outfile);
          break;
+       case LOC_COMPUTED:
+       case LOC_COMPUTED_ARG:
+         fputs_filtered ("computed at runtime", outfile);
+         break;
        default:
          fputs_filtered ("<invalid location>", outfile);
          break;
@@ -975,12 +1010,12 @@ maintenance_check_symtabs (char *ignore, int from_tty)
     length = ps->n_static_syms;
     while (length--)
       {
-       sym = lookup_block_symbol (b, SYMBOL_NAME (*psym),
+       sym = lookup_block_symbol (b, DEPRECATED_SYMBOL_NAME (*psym),
                                   NULL, SYMBOL_NAMESPACE (*psym));
        if (!sym)
          {
            printf_filtered ("Static symbol `");
-           puts_filtered (SYMBOL_NAME (*psym));
+           puts_filtered (DEPRECATED_SYMBOL_NAME (*psym));
            printf_filtered ("' only found in ");
            puts_filtered (ps->filename);
            printf_filtered (" psymtab\n");
@@ -992,12 +1027,12 @@ maintenance_check_symtabs (char *ignore, int from_tty)
     length = ps->n_global_syms;
     while (length--)
       {
-       sym = lookup_block_symbol (b, SYMBOL_NAME (*psym),
+       sym = lookup_block_symbol (b, DEPRECATED_SYMBOL_NAME (*psym),
                                   NULL, SYMBOL_NAMESPACE (*psym));
        if (!sym)
          {
            printf_filtered ("Global symbol `");
-           puts_filtered (SYMBOL_NAME (*psym));
+           puts_filtered (DEPRECATED_SYMBOL_NAME (*psym));
            printf_filtered ("' only found in ");
            puts_filtered (ps->filename);
            printf_filtered (" psymtab\n");
index 9d8bdc0..9ecbd54 100644 (file)
 #include "source.h"
 #include "filenames.h"         /* for FILENAME_CMP */
 
+#include "hashtab.h"
+
 #include "gdb_obstack.h"
+#include "block.h"
 
 #include <sys/types.h>
 #include <fcntl.h>
@@ -410,14 +413,11 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol,
 {
   gsymbol->language = language;
   if (gsymbol->language == language_cplus
-      || gsymbol->language == language_java)
+      || gsymbol->language == language_java
+      || gsymbol->language == language_objc)
     {
       gsymbol->language_specific.cplus_specific.demangled_name = NULL;
     }
-  else if (gsymbol->language == language_objc)
-    {
-      gsymbol->language_specific.objc_specific.demangled_name = NULL;
-    }
   else
     {
       memset (&gsymbol->language_specific, 0,
@@ -425,22 +425,35 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol,
     }
 }
 
-/* Initialize a symbol's mangled name.  */
+/* Functions to initialize a symbol's mangled name.  */
+
+/* Create the hash table used for demangled names.  Each hash entry is
+   a pair of strings; one for the mangled name and one for the demangled
+   name.  The entry is hashed via just the mangled name.  */
+
+static void
+create_demangled_names_hash (struct objfile *objfile)
+{
+  /* Choose 256 as the starting size of the hash table, somewhat arbitrarily.
+     The hash table code will round this up to the next prime number. 
+     Choosing a much larger table size wastes memory, and saves only about
+     1% in symbol reading.  */
+
+  objfile->demangled_names_hash = htab_create_alloc_ex
+    (256, htab_hash_string, (int (*) (const void *, const void *)) streq,
+     NULL, objfile->md, xmcalloc, xmfree);
+}
 
-/* Try to initialize the demangled name for a symbol, based on the
+/* Try to determine the demangled name for a symbol, based on the
    language of that symbol.  If the language is set to language_auto,
    it will attempt to find any demangling algorithm that works and
-   then set the language appropriately.  If no demangling of any kind
-   is found, the language is set back to language_unknown, so we can
-   avoid doing this work again the next time we encounter the symbol.
-   Any required space to store the name is obtained from the specified
-   obstack. */
+   then set the language appropriately.  The returned name is allocated
+   by the demangler and should be xfree'd.  */
 
-void
-symbol_init_demangled_name (struct general_symbol_info *gsymbol,
-                            struct obstack *obstack)
+static char *
+symbol_find_demangled_name (struct general_symbol_info *gsymbol,
+                           const char *mangled)
 {
-  char *mangled = gsymbol->name;
   char *demangled = NULL;
 
   if (gsymbol->language == language_unknown)
@@ -449,35 +462,135 @@ symbol_init_demangled_name (struct general_symbol_info *gsymbol,
       || gsymbol->language == language_auto)
     {
       demangled =
-        cplus_demangle (gsymbol->name, DMGL_PARAMS | DMGL_ANSI);
+        cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
       if (demangled != NULL)
-        {
-          gsymbol->language = language_cplus;
-          gsymbol->language_specific.cplus_specific.demangled_name =
-            obsavestring (demangled, strlen (demangled), obstack);
-          xfree (demangled);
-        }
-      else
-        {
-          gsymbol->language_specific.cplus_specific.demangled_name = NULL;
-        }
+       {
+         gsymbol->language = language_cplus;
+         return demangled;
+       }
     }
   if (gsymbol->language == language_java)
     {
       demangled =
-        cplus_demangle (gsymbol->name,
+        cplus_demangle (mangled,
                         DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA);
       if (demangled != NULL)
-        {
-          gsymbol->language = language_java;
-          gsymbol->language_specific.cplus_specific.demangled_name =
-            obsavestring (demangled, strlen (demangled), obstack);
-          xfree (demangled);
-        }
+       {
+         gsymbol->language = language_java;
+         return demangled;
+       }
+    }
+  return NULL;
+}
+
+/* Set both the mangled and demangled (if any) names for GSYMBOL based on
+   NAME and LEN.  The hash table corresponding to OBJFILE is used, and the
+   memory comes from that objfile's symbol_obstack.  NAME is copied, so the
+   pointer can be discarded after calling this function.  */
+
+void
+symbol_set_names (struct general_symbol_info *gsymbol,
+                 const char *name, int len, struct objfile *objfile)
+{
+  char **slot;
+  const char *tmpname;
+
+  if (objfile->demangled_names_hash == NULL)
+    create_demangled_names_hash (objfile);
+
+  /* The stabs reader generally provides names that are not NULL-terminated;
+     most of the other readers don't do this, so we can just use the given
+     copy.  */
+  if (name[len] != 0)
+    {
+      char *alloc_name = alloca (len + 1);
+      memcpy (alloc_name, name, len);
+      alloc_name[len] = 0;
+      tmpname = alloc_name;
+    }
+  else
+    tmpname = name;
+
+  slot = (char **) htab_find_slot (objfile->demangled_names_hash, tmpname, INSERT);
+
+  /* If this name is not in the hash table, add it.  */
+  if (*slot == NULL)
+    {
+      char *demangled_name = symbol_find_demangled_name (gsymbol, tmpname);
+      int demangled_len = demangled_name ? strlen (demangled_name) : 0;
+
+      /* If there is a demangled name, place it right after the mangled name.
+        Otherwise, just place a second zero byte after the end of the mangled
+        name.  */
+      *slot = obstack_alloc (&objfile->symbol_obstack,
+                            len + demangled_len + 2);
+      memcpy (*slot, tmpname, len + 1);
+      if (demangled_name)
+       {
+         memcpy (*slot + len + 1, demangled_name, demangled_len + 1);
+         xfree (demangled_name);
+       }
       else
-        {
-          gsymbol->language_specific.cplus_specific.demangled_name = NULL;
-        }
+       (*slot)[len + 1] = 0;
+    }
+
+  gsymbol->name = *slot;
+  if ((*slot)[len + 1])
+    gsymbol->language_specific.cplus_specific.demangled_name
+      = &(*slot)[len + 1];
+  else
+    gsymbol->language_specific.cplus_specific.demangled_name = NULL;
+}
+
+/* Initialize the demangled name of GSYMBOL if possible.  Any required space
+   to store the name is obtained from the specified obstack.  The function
+   symbol_set_names, above, should be used instead where possible for more
+   efficient memory usage.  */
+
+void
+symbol_init_demangled_name (struct general_symbol_info *gsymbol,
+                            struct obstack *obstack)
+{
+  char *mangled = gsymbol->name;
+  char *demangled = NULL;
+
+  demangled = symbol_find_demangled_name (gsymbol, mangled);
+  if (gsymbol->language == language_cplus
+      || gsymbol->language == language_java)
+    {
+      if (demangled)
+       {
+         gsymbol->language_specific.cplus_specific.demangled_name
+           = obsavestring (demangled, strlen (demangled), obstack);
+         xfree (demangled);
+       }
+      else
+       gsymbol->language_specific.cplus_specific.demangled_name = NULL;
+    }
+  else
+    {
+      /* Unknown language; just clean up quietly.  */
+      if (demangled)
+       xfree (demangled);
+    }
+}
+
+/* Return the source code name of a symbol.  In languages where
+   demangling is necessary, this is the demangled name.  */
+
+char *
+symbol_natural_name (const struct general_symbol_info *gsymbol)
+{
+  if ((gsymbol->language == language_cplus
+       || gsymbol->language == language_java
+       || gsymbol->language == language_objc)
+      && (gsymbol->language_specific.cplus_specific.demangled_name != NULL))
+    {
+      return gsymbol->language_specific.cplus_specific.demangled_name;
+    }
+  else
+    {
+      return gsymbol->name;
     }
 }
 
@@ -487,12 +600,10 @@ char *
 symbol_demangled_name (struct general_symbol_info *gsymbol)
 {
   if (gsymbol->language == language_cplus
-      || gsymbol->language == language_java)
+      || gsymbol->language == language_java
+      || gsymbol->language == language_objc)
     return gsymbol->language_specific.cplus_specific.demangled_name;
 
-  else if (gsymbol->language == language_objc)
-    return gsymbol->language_specific.objc_specific.demangled_name;
-
   else 
     return NULL;
 }
@@ -1181,7 +1292,7 @@ lookup_symbol_aux_minsyms (const char *name,
              bv = BLOCKVECTOR (s);
              block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
 
-             /* This call used to pass `SYMBOL_NAME (msymbol)' as the
+             /* This call used to pass `DEPRECATED_SYMBOL_NAME (msymbol)' as the
                 `name' argument to lookup_block_symbol.  But the name
                 of a minimal symbol is always mangled, so that seems
                 to be clearly the wrong thing to pass as the
@@ -1242,11 +1353,11 @@ lookup_symbol_aux_minsyms (const char *name,
            }
          else if (MSYMBOL_TYPE (msymbol) != mst_text
                   && MSYMBOL_TYPE (msymbol) != mst_file_text
-                  && !STREQ (name, SYMBOL_NAME (msymbol)))
+                  && !STREQ (name, DEPRECATED_SYMBOL_NAME (msymbol)))
            {
              /* This is a mangled variable, look it up by its
                 mangled name.  */
-             return lookup_symbol_aux (SYMBOL_NAME (msymbol), mangled_name,
+             return lookup_symbol_aux (DEPRECATED_SYMBOL_NAME (msymbol), mangled_name,
                                        NULL, namespace, is_a_field_of_this,
                                        symtab);
            }
@@ -1282,9 +1393,10 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
       do_linear_search = 0;
 
       /* Binary search.  This search is guaranteed to end with center
-         pointing at the earliest partial symbol with the correct
-         name.  At that point *all* partial symbols with that name
-         will be checked against the correct namespace. */
+         pointing at the earliest partial symbol whose name might be
+         correct.  At that point *all* partial symbols with an
+         appropriate name will be checked against the correct
+         namespace.  */
 
       bottom = start;
       top = start + length - 1;
@@ -1299,7 +1411,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
            {
              do_linear_search = 1;
            }
-         if (strcmp (SYMBOL_SOURCE_NAME (*center), name) >= 0)
+         if (strcmp_iw_ordered (SYMBOL_NATURAL_NAME (*center), name) >= 0)
            {
              top = center;
            }
@@ -1311,10 +1423,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
       if (!(top == bottom))
        internal_error (__FILE__, __LINE__, "failed internal consistency check");
 
-      /* djb - 2000-06-03 - Use SYMBOL_MATCHES_NAME, not a strcmp, so
-        we don't have to force a linear search on C++. Probably holds true
-        for JAVA as well, no way to check.*/
-      while (top <= real_top && SYMBOL_MATCHES_NAME (*top,name))
+      while (top <= real_top && SYMBOL_MATCHES_NATURAL_NAME (*top,name))
        {
          if (SYMBOL_NAMESPACE (*top) == namespace)
            {
@@ -1333,7 +1442,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
        {
          if (namespace == SYMBOL_NAMESPACE (*psym))
            {
-             if (SYMBOL_MATCHES_NAME (*psym, name))
+             if (SYMBOL_MATCHES_NATURAL_NAME (*psym, name))
                {
                  return (*psym);
                }
@@ -1510,8 +1619,8 @@ lookup_block_symbol (register const struct block *block, const char *name,
        {
          if (SYMBOL_NAMESPACE (sym) == namespace 
              && (mangled_name
-                 ? strcmp (SYMBOL_NAME (sym), mangled_name) == 0
-                 : SYMBOL_MATCHES_NAME (sym, name)))
+                 ? strcmp (DEPRECATED_SYMBOL_NAME (sym), mangled_name) == 0
+                 : SYMBOL_MATCHES_NATURAL_NAME (sym, name)))
            return sym;
        }
       return NULL;
@@ -1545,15 +1654,15 @@ lookup_block_symbol (register const struct block *block, const char *name,
            {
              do_linear_search = 1;
            }
-         if (SYMBOL_SOURCE_NAME (sym)[0] < name[0])
+         if (SYMBOL_NATURAL_NAME (sym)[0] < name[0])
            {
              bot = inc;
            }
-         else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
+         else if (SYMBOL_NATURAL_NAME (sym)[0] > name[0])
            {
              top = inc;
            }
-         else if (strcmp (SYMBOL_SOURCE_NAME (sym), name) < 0)
+         else if (strcmp (SYMBOL_NATURAL_NAME (sym), name) < 0)
            {
              bot = inc;
            }
@@ -1580,12 +1689,12 @@ lookup_block_symbol (register const struct block *block, const char *name,
          sym = BLOCK_SYM (block, bot);
          if (SYMBOL_NAMESPACE (sym) == namespace
              && (mangled_name
-                 ? strcmp (SYMBOL_NAME (sym), mangled_name) == 0
-                 : SYMBOL_MATCHES_NAME (sym, name)))
+                 ? strcmp (DEPRECATED_SYMBOL_NAME (sym), mangled_name) == 0
+                 : SYMBOL_MATCHES_NATURAL_NAME (sym, name)))
            {
              return sym;
            }
-          if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
+          if (SYMBOL_PRINT_NAME (sym)[0] > name[0])
             {
               break;
             }
@@ -1615,8 +1724,8 @@ lookup_block_symbol (register const struct block *block, const char *name,
          sym = BLOCK_SYM (block, bot);
          if (SYMBOL_NAMESPACE (sym) == namespace
              && (mangled_name
-                 ? strcmp (SYMBOL_NAME (sym), mangled_name) == 0
-                 : SYMBOL_MATCHES_NAME (sym, name)))
+                 ? strcmp (DEPRECATED_SYMBOL_NAME (sym), mangled_name) == 0
+                 : SYMBOL_MATCHES_NATURAL_NAME (sym, name)))
            {
              /* If SYM has aliases, then use any alias that is active
                 at the current PC.  If no alias is active at the current
@@ -1647,7 +1756,8 @@ lookup_block_symbol (register const struct block *block, const char *name,
                  SYMBOL_CLASS (sym) != LOC_REF_ARG &&
                  SYMBOL_CLASS (sym) != LOC_REGPARM &&
                  SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR &&
-                 SYMBOL_CLASS (sym) != LOC_BASEREG_ARG)
+                 SYMBOL_CLASS (sym) != LOC_BASEREG_ARG &&
+                 SYMBOL_CLASS (sym) != LOC_COMPUTED_ARG)
                {
                  break;
                }
@@ -1690,18 +1800,6 @@ find_active_alias (struct symbol *sym, CORE_ADDR addr)
 }
 \f
 
-/* Return the symbol for the function which contains a specified
-   lexical block, described by a struct block BL.  */
-
-struct symbol *
-block_function (struct block *bl)
-{
-  while (BLOCK_FUNCTION (bl) == 0 && BLOCK_SUPERBLOCK (bl) != 0)
-    bl = BLOCK_SUPERBLOCK (bl);
-
-  return BLOCK_FUNCTION (bl);
-}
-
 /* Find the symtab associated with PC and SECTION.  Look through the
    psymtabs and read in another symtab if necessary. */
 
@@ -1930,7 +2028,7 @@ find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent)
   if (msymbol != NULL)
     if (MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
       {
-       mfunsym = lookup_minimal_symbol_text (SYMBOL_NAME (msymbol), NULL, NULL);
+       mfunsym = lookup_minimal_symbol_text (DEPRECATED_SYMBOL_NAME (msymbol), NULL, NULL);
        if (mfunsym == NULL)
          /* I eliminated this warning since it is coming out
           * in the following situation:
@@ -1941,12 +2039,12 @@ find_pc_sect_line (CORE_ADDR pc, struct sec *section, int notcurrent)
           * so of course we can't find the real func/line info,
           * but the "break" still works, and the warning is annoying.
           * So I commented out the warning. RT */
-         /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */ ;
+         /* warning ("In stub for %s; unable to find real function/line info", DEPRECATED_SYMBOL_NAME (msymbol)) */ ;
        /* fall through */
        else if (SYMBOL_VALUE (mfunsym) == SYMBOL_VALUE (msymbol))
          /* Avoid infinite recursion */
          /* See above comment about why warning is commented out */
-         /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */ ;
+         /* warning ("In stub for %s; unable to find real function/line info", DEPRECATED_SYMBOL_NAME (msymbol)) */ ;
        /* fall through */
        else
          return find_pc_line (SYMBOL_VALUE (mfunsym), 0);
@@ -2652,8 +2750,8 @@ compare_search_syms (const void *sa, const void *sb)
   struct symbol_search **sym_a = (struct symbol_search **) sa;
   struct symbol_search **sym_b = (struct symbol_search **) sb;
 
-  return strcmp (SYMBOL_SOURCE_NAME ((*sym_a)->symbol),
-                SYMBOL_SOURCE_NAME ((*sym_b)->symbol));
+  return strcmp (SYMBOL_PRINT_NAME ((*sym_a)->symbol),
+                SYMBOL_PRINT_NAME ((*sym_b)->symbol));
 }
 
 /* Sort the ``nfound'' symbols in the list after prevtail.  Leave
@@ -2830,7 +2928,8 @@ search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[],
            /* If it would match (logic taken from loop below)
               load the file and go on to the next one */
            if (file_matches (ps->filename, files, nfiles)
-               && ((regexp == NULL || SYMBOL_MATCHES_REGEXP (*psym))
+               && ((regexp == NULL
+                    || re_exec (SYMBOL_NATURAL_NAME (*psym)) != 0)
                    && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (*psym) != LOC_TYPEDEF
                         && SYMBOL_CLASS (*psym) != LOC_BLOCK)
                        || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK)
@@ -2867,35 +2966,23 @@ search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[],
            MSYMBOL_TYPE (msymbol) == ourtype3 ||
            MSYMBOL_TYPE (msymbol) == ourtype4)
          {
-           if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
+           if (regexp == NULL
+               || re_exec (SYMBOL_NATURAL_NAME (msymbol)) != 0)
              {
                if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))
                  {
-                   if (kind == FUNCTIONS_NAMESPACE)
-                     {
-                       found_misc = 1;
-                     }
-                   else
-                     {
-                       struct symbol *sym;
-
-                       if (SYMBOL_DEMANGLED_NAME (msymbol) != NULL)
-                         sym
-                           = lookup_symbol_aux_minsyms (SYMBOL_DEMANGLED_NAME
-                                                        (msymbol),
-                                                        SYMBOL_NAME (msymbol),
-                                                        VAR_NAMESPACE,
-                                                        NULL, NULL);
-                       else
-                         sym
-                           = lookup_symbol_aux_minsyms (SYMBOL_NAME (msymbol),
-                                                        NULL,
-                                                        VAR_NAMESPACE,
-                                                        NULL, NULL);
-
-                       if (sym == NULL)
-                         found_misc = 1;
-                     }
+                   /* FIXME: carlton/2003-02-04: Given that the
+                      semantics of lookup_symbol keeps on changing
+                      slightly, it would be a nice idea if we had a
+                      function lookup_symbol_minsym that found the
+                      symbol associated to a given minimal symbol (if
+                      any).  */
+                   if (kind == FUNCTIONS_NAMESPACE
+                       || lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol),
+                                         (struct block *) NULL,
+                                         VAR_NAMESPACE,
+                                       0, (struct symtab **) NULL) == NULL)
+                     found_misc = 1;
                  }
              }
          }
@@ -2920,7 +3007,8 @@ search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[],
            {
              QUIT;
              if (file_matches (s->filename, files, nfiles)
-                 && ((regexp == NULL || SYMBOL_MATCHES_REGEXP (sym))
+                 && ((regexp == NULL
+                      || re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
                      && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (sym) != LOC_TYPEDEF
                           && SYMBOL_CLASS (sym) != LOC_BLOCK
                           && SYMBOL_CLASS (sym) != LOC_CONST)
@@ -2974,14 +3062,15 @@ search_symbols (char *regexp, namespace_enum kind, int nfiles, char *files[],
            MSYMBOL_TYPE (msymbol) == ourtype3 ||
            MSYMBOL_TYPE (msymbol) == ourtype4)
          {
-           if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
+           if (regexp == NULL
+               || re_exec (SYMBOL_NATURAL_NAME (msymbol)) != 0)
              {
                /* Functions:  Look up by address. */
                if (kind != FUNCTIONS_NAMESPACE ||
                    (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol))))
                  {
                    /* Variables/Absolutes:  Look up by name */
-                   if (lookup_symbol (SYMBOL_NAME (msymbol),
+                   if (lookup_symbol (DEPRECATED_SYMBOL_NAME (msymbol),
                                       (struct block *) NULL, VAR_NAMESPACE,
                                       0, (struct symtab **) NULL) == NULL)
                      {
@@ -3041,7 +3130,7 @@ print_symbol_info (namespace_enum kind, struct symtab *s, struct symbol *sym,
     {
       type_print (SYMBOL_TYPE (sym),
                  (SYMBOL_CLASS (sym) == LOC_TYPEDEF
-                  ? "" : SYMBOL_SOURCE_NAME (sym)),
+                  ? "" : SYMBOL_PRINT_NAME (sym)),
                  gdb_stdout, 0);
 
       printf_filtered (";\n");
@@ -3064,7 +3153,7 @@ print_msymbol_info (struct minimal_symbol *msymbol)
     tmp = local_hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol),
                                   "016l");
   printf_filtered ("%s  %s\n",
-                  tmp, SYMBOL_SOURCE_NAME (msymbol));
+                  tmp, SYMBOL_PRINT_NAME (msymbol));
 }
 
 /* This is the guts of the commands "info functions", "info types", and
@@ -3162,11 +3251,11 @@ rbreak_command (char *regexp, int from_tty)
       if (p->msymbol == NULL)
        {
          char *string = (char *) alloca (strlen (p->symtab->filename)
-                                         + strlen (SYMBOL_NAME (p->symbol))
+                                         + strlen (DEPRECATED_SYMBOL_NAME (p->symbol))
                                          + 4);
          strcpy (string, p->symtab->filename);
          strcat (string, ":'");
-         strcat (string, SYMBOL_NAME (p->symbol));
+         strcat (string, DEPRECATED_SYMBOL_NAME (p->symbol));
          strcat (string, "'");
          break_command (string, from_tty);
          print_symbol_info (FUNCTIONS_NAMESPACE,
@@ -3177,9 +3266,9 @@ rbreak_command (char *regexp, int from_tty)
        }
       else
        {
-         break_command (SYMBOL_NAME (p->msymbol), from_tty);
+         break_command (DEPRECATED_SYMBOL_NAME (p->msymbol), from_tty);
          printf_filtered ("<function, no debug info> %s;\n",
-                          SYMBOL_SOURCE_NAME (p->msymbol));
+                          SYMBOL_PRINT_NAME (p->msymbol));
        }
     }
 
@@ -3187,19 +3276,6 @@ rbreak_command (char *regexp, int from_tty)
 }
 \f
 
-/* Return Nonzero if block a is lexically nested within block b,
-   or if a and b have the same pc range.
-   Return zero otherwise. */
-int
-contained_in (struct block *a, struct block *b)
-{
-  if (!a || !b)
-    return 0;
-  return BLOCK_START (a) >= BLOCK_START (b)
-    && BLOCK_END (a) <= BLOCK_END (b);
-}
-\f
-
 /* Helper routine for make_symbol_completion_list.  */
 
 static int return_val_size;
@@ -3216,7 +3292,7 @@ static char **return_val;
        (SYMBOL_DEMANGLED_NAME (symbol), (sym_text), (len), (text), (word)); \
     else \
       completion_list_add_name \
-       (SYMBOL_NAME (symbol), (sym_text), (len), (text), (word)); \
+       (DEPRECATED_SYMBOL_NAME (symbol), (sym_text), (len), (text), (word)); \
   } while (0)
 
 /*  Test to see if the symbol specified by SYMNAME (which is already
@@ -3872,7 +3948,7 @@ overload_list_add_symbol (struct symbol *sym, char *oload_name)
 
   /* skip any symbols that we've already considered. */
   for (i = 0; i < sym_return_val_index; ++i)
-    if (!strcmp (SYMBOL_NAME (sym), SYMBOL_NAME (sym_return_val[i])))
+    if (!strcmp (DEPRECATED_SYMBOL_NAME (sym), DEPRECATED_SYMBOL_NAME (sym_return_val[i])))
       return;
 
   /* Get the demangled name without parameters */
@@ -3939,8 +4015,8 @@ make_symbol_overload_list (struct symbol *fsym)
   sym_return_val = (struct symbol **) xmalloc ((sym_return_val_size + 1) * sizeof (struct symbol *));
   sym_return_val[0] = NULL;
 
-  /* Look through the partial symtabs for all symbols which begin
-     by matching OLOAD_NAME.  Make sure we read that symbol table in. */
+  /* Read in all partial symtabs containing a partial symbol named
+     OLOAD_NAME.  */
 
   ALL_PSYMTABS (objfile, ps)
   {
@@ -3951,26 +4027,9 @@ make_symbol_overload_list (struct symbol *fsym)
     if (ps->readin)
       continue;
 
-    for (psym = objfile->global_psymbols.list + ps->globals_offset;
-        psym < (objfile->global_psymbols.list + ps->globals_offset
-                + ps->n_global_syms);
-        psym++)
-      {
-       /* If interrupted, then quit. */
-       QUIT;
-        /* This will cause the symbol table to be read if it has not yet been */
-        s = PSYMTAB_TO_SYMTAB (ps);
-      }
-
-    for (psym = objfile->static_psymbols.list + ps->statics_offset;
-        psym < (objfile->static_psymbols.list + ps->statics_offset
-                + ps->n_static_syms);
-        psym++)
-      {
-       QUIT;
-        /* This will cause the symbol table to be read if it has not yet been */
-        s = PSYMTAB_TO_SYMTAB (ps);
-      }
+    if ((lookup_partial_symbol (ps, oload_name, 1, VAR_NAMESPACE) != NULL)
+       || (lookup_partial_symbol (ps, oload_name, 0, VAR_NAMESPACE) != NULL))
+      PSYMTAB_TO_SYMTAB (ps);
   }
 
   /* Search upwards from currently selected frame (so that we can
index 8d851a2..79705fe 100644 (file)
 #define SYMTAB_H 1
 
 /* Opaque declarations.  */
+
 struct obstack;
+struct objfile;
+struct block;
+struct blockvector;
+struct axs_value;
+struct agent_expr;
 
 /* Don't do this; it means that if some .o's are compiled with GNU C
    and some are not (easy to do accidentally the way we configure
@@ -48,9 +54,11 @@ struct obstack;
 
 struct general_symbol_info
 {
-  /* Name of the symbol.  This is a required field.  Storage for the name is
-     allocated on the psymbol_obstack or symbol_obstack for the associated
-     objfile. */
+  /* Name of the symbol.  This is a required field.  Storage for the
+     name is allocated on the psymbol_obstack or symbol_obstack for
+     the associated objfile.  For languages like C++ that make a
+     distinction between the mangled name and demangled name, this is
+     the mangled name.  */
 
   char *name;
 
@@ -84,17 +92,12 @@ struct general_symbol_info
 
   union
   {
-    struct cplus_specific      /* For C++ */
-      /*  and Java */
+    struct cplus_specific
     {
+      /* This is in fact used for C++, Java, and Objective C.  */
       char *demangled_name;
     }
     cplus_specific;
-    struct objc_specific
-    {
-      char *demangled_name;
-    }
-    objc_specific;
   }
   language_specific;
 
@@ -128,7 +131,7 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
    functions, unless the callers are changed to pass in the ginfo
    field only, instead of the SYMBOL parameter.  */
 
-#define SYMBOL_NAME(symbol)            (symbol)->ginfo.name
+#define DEPRECATED_SYMBOL_NAME(symbol) (symbol)->ginfo.name
 #define SYMBOL_VALUE(symbol)           (symbol)->ginfo.value.ivalue
 #define SYMBOL_VALUE_ADDRESS(symbol)   (symbol)->ginfo.value.address
 #define SYMBOL_VALUE_BYTES(symbol)     (symbol)->ginfo.value.bytes
@@ -149,39 +152,63 @@ extern void symbol_init_language_specific (struct general_symbol_info *symbol,
                                           enum language language);
 
 #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
-  (symbol_init_demangled_name (&symbol->ginfo, (obstack)))
+  (symbol_init_demangled_name (&(symbol)->ginfo, (obstack)))
 extern void symbol_init_demangled_name (struct general_symbol_info *symbol,
                                        struct obstack *obstack);
 
+#define SYMBOL_SET_NAMES(symbol,name,len,objfile) \
+  symbol_set_names (&(symbol)->ginfo, name, len, objfile)
+extern void symbol_set_names (struct general_symbol_info *symbol,
+                             const char *name, int len,
+                             struct objfile *objfile);
+
+/* Now come lots of name accessor macros.  Short version as to when to
+   use which: Use SYMBOL_NATURAL_NAME to refer to the name of the
+   symbol in the original source code.  Use SYMBOL_LINKAGE_NAME if you
+   want to know what the linker thinks the symbol's name is.  Use
+   SYMBOL_PRINT_NAME for output.  Use SYMBOL_DEMANGLED_NAME if you
+   specifically need to know whether SYMBOL_NATURAL_NAME and
+   SYMBOL_LINKAGE_NAME are different.  Don't use
+   DEPRECATED_SYMBOL_NAME at all: instances of that macro should be
+   replaced by SYMBOL_NATURAL_NAME, SYMBOL_LINKAGE_NAME, or perhaps
+   SYMBOL_PRINT_NAME.  */
+
+/* Return SYMBOL's "natural" name, i.e. the name that it was called in
+   the original source code.  In languages like C++ where symbols may
+   be mangled for ease of manipulation by the linker, this is the
+   demangled name.  */
+
+#define SYMBOL_NATURAL_NAME(symbol) \
+  (symbol_natural_name (&(symbol)->ginfo))
+extern char *symbol_natural_name (const struct general_symbol_info *symbol);
+
+/* Return SYMBOL's name from the point of view of the linker.  In
+   languages like C++ where symbols may be mangled for ease of
+   manipulation by the linker, this is the mangled name; otherwise,
+   it's the same as SYMBOL_NATURAL_NAME.  This is currently identical
+   to DEPRECATED_SYMBOL_NAME, but please use SYMBOL_LINKAGE_NAME when
+   appropriate: it conveys the additional semantic information that
+   you really have thought about the issue and decided that you mean
+   SYMBOL_LINKAGE_NAME instead of SYMBOL_NATURAL_NAME.  */
+
+#define SYMBOL_LINKAGE_NAME(symbol)    (symbol)->ginfo.name
+
 /* Return the demangled name for a symbol based on the language for
    that symbol.  If no demangled name exists, return NULL. */
 #define SYMBOL_DEMANGLED_NAME(symbol) \
   (symbol_demangled_name (&(symbol)->ginfo))
 extern char *symbol_demangled_name (struct general_symbol_info *symbol);
 
-#define SYMBOL_OBJC_DEMANGLED_NAME(symbol)                             \
-   (symbol)->ginfo.language_specific.objc_specific.demangled_name
+/* Macro that returns a version of the name of a symbol that is
+   suitable for output.  In C++ this is the "demangled" form of the
+   name if demangle is on and the "mangled" form of the name if
+   demangle is off.  In other languages this is just the symbol name.
+   The result should never be NULL.  Don't use this for internal
+   purposes (e.g. storing in a hashtable): it's only suitable for
+   output.  */
 
-/* Macro that returns the "natural source name" of a symbol.  In C++ this is
-   the "demangled" form of the name if demangle is on and the "mangled" form
-   of the name if demangle is off.  In other languages this is just the
-   symbol name.  The result should never be NULL. */
-
-#define SYMBOL_SOURCE_NAME(symbol)                                     \
-  (demangle && SYMBOL_DEMANGLED_NAME (symbol) != NULL                  \
-   ? SYMBOL_DEMANGLED_NAME (symbol)                                    \
-   : SYMBOL_NAME (symbol))
-
-/* Macro that returns the "natural assembly name" of a symbol.  In C++ this is
-   the "mangled" form of the name if demangle is off, or if demangle is on and
-   asm_demangle is off.  Otherwise if asm_demangle is on it is the "demangled"
-   form.  In other languages this is just the symbol name.  The result should
-   never be NULL. */
-
-#define SYMBOL_LINKAGE_NAME(symbol)                                    \
-  (demangle && asm_demangle && SYMBOL_DEMANGLED_NAME (symbol) != NULL  \
-   ? SYMBOL_DEMANGLED_NAME (symbol)                                    \
-   : SYMBOL_NAME (symbol))
+#define SYMBOL_PRINT_NAME(symbol)                                      \
+  (demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol))
 
 /* Macro that tests a symbol for a match against a specified name string.
    First test the unencoded name, then looks for and test a C++ encoded
@@ -190,20 +217,23 @@ extern char *symbol_demangled_name (struct general_symbol_info *symbol);
    "foo :: bar (int, long)".
    Evaluates to zero if the match fails, or nonzero if it succeeds. */
 
-#define SYMBOL_MATCHES_NAME(symbol, name)                              \
-  (STREQ (SYMBOL_NAME (symbol), (name))                                        \
+/* FIXME: carlton/2003-02-27: This is an unholy mixture of linkage
+   names and natural names.  If you want to test the linkage names
+   with strcmp, do that.  If you want to test the natural names with
+   strcmp_iw, use SYMBOL_MATCHES_NATURAL_NAME.  */
+
+#define DEPRECATED_SYMBOL_MATCHES_NAME(symbol, name)                   \
+  (STREQ (DEPRECATED_SYMBOL_NAME (symbol), (name))                     \
    || (SYMBOL_DEMANGLED_NAME (symbol) != NULL                          \
        && strcmp_iw (SYMBOL_DEMANGLED_NAME (symbol), (name)) == 0))
 
-/* Macro that tests a symbol for an re-match against the last compiled regular
-   expression.  First test the unencoded name, then look for and test a C++
-   encoded name if it exists.
-   Evaluates to zero if the match fails, or nonzero if it succeeds. */
+/* Macro that tests a symbol for a match against a specified name
+   string.  It tests against SYMBOL_NATURAL_NAME, and it ignores
+   whitespace and trailing parentheses.  (See strcmp_iw for details
+   about its behavior.)  */
 
-#define SYMBOL_MATCHES_REGEXP(symbol)                                  \
-  (re_exec (SYMBOL_NAME (symbol)) != 0                                 \
-   || (SYMBOL_DEMANGLED_NAME (symbol) != NULL                          \
-       && re_exec (SYMBOL_DEMANGLED_NAME (symbol)) != 0))
+#define SYMBOL_MATCHES_NATURAL_NAME(symbol, name)                      \
+  (strcmp_iw (SYMBOL_NATURAL_NAME (symbol), (name)) == 0)
 
 /* Define a simple structure used to hold some very basic information about
    all defined global symbols (text, data, bss, abs, etc).  The only required
@@ -291,148 +321,7 @@ struct minimal_symbol
 
 #define MSYMBOL_INFO(msymbol)          (msymbol)->info
 #define MSYMBOL_TYPE(msymbol)          (msymbol)->type
-\f
-
-
-/* All of the name-scope contours of the program
-   are represented by `struct block' objects.
-   All of these objects are pointed to by the blockvector.
-
-   Each block represents one name scope.
-   Each lexical context has its own block.
-
-   The blockvector begins with some special blocks.
-   The GLOBAL_BLOCK contains all the symbols defined in this compilation
-   whose scope is the entire program linked together.
-   The STATIC_BLOCK contains all the symbols whose scope is the
-   entire compilation excluding other separate compilations.
-   Blocks starting with the FIRST_LOCAL_BLOCK are not special.
-
-   Each block records a range of core addresses for the code that
-   is in the scope of the block.  The STATIC_BLOCK and GLOBAL_BLOCK
-   give, for the range of code, the entire range of code produced
-   by the compilation that the symbol segment belongs to.
-
-   The blocks appear in the blockvector
-   in order of increasing starting-address,
-   and, within that, in order of decreasing ending-address.
-
-   This implies that within the body of one function
-   the blocks appear in the order of a depth-first tree walk.  */
-
-struct blockvector
-{
-  /* Number of blocks in the list.  */
-  int nblocks;
-  /* The blocks themselves.  */
-  struct block *block[1];
-};
-
-#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
-#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
-
-/* Special block numbers */
-
-#define GLOBAL_BLOCK           0
-#define        STATIC_BLOCK            1
-#define        FIRST_LOCAL_BLOCK       2
-
-struct block
-{
-
-  /* Addresses in the executable code that are in this block.  */
-
-  CORE_ADDR startaddr;
-  CORE_ADDR endaddr;
-
-  /* The symbol that names this block, if the block is the body of a
-     function; otherwise, zero.  */
-
-  struct symbol *function;
-
-  /* The `struct block' for the containing block, or 0 if none.
-
-     The superblock of a top-level local block (i.e. a function in the
-     case of C) is the STATIC_BLOCK.  The superblock of the
-     STATIC_BLOCK is the GLOBAL_BLOCK.  */
-
-  struct block *superblock;
-
-  /* Version of GCC used to compile the function corresponding
-     to this block, or 0 if not compiled with GCC.  When possible,
-     GCC should be compatible with the native compiler, or if that
-     is not feasible, the differences should be fixed during symbol
-     reading.  As of 16 Apr 93, this flag is never used to distinguish
-     between gcc2 and the native compiler.
-
-     If there is no function corresponding to this block, this meaning
-     of this flag is undefined.  */
-
-  unsigned char gcc_compile_flag;
 
-  /* The symbols for this block are either in a simple linear list or
-     in a simple hashtable.  Blocks which correspond to a function
-     (which have a list of symbols corresponding to arguments) use
-     a linear list, as do some older symbol readers (currently only
-     mdebugread and dstread).  Other blocks are hashed.
-
-     The hashtable uses the same hash function as the minsym hashtables,
-     found in minsyms.c:minsym_hash_iw.  Symbols are hashed based on
-     their demangled name if appropriate, and on their name otherwise.
-     The hash function ignores space, and stops at the beginning of the
-     argument list if any.
-
-     The table is laid out in NSYMS/5 buckets and symbols are chained via
-     their hash_next field.  */
-
-  /* If this is really a hashtable of the symbols, this flag is 1.  */
-
-  unsigned char hashtable;
-
-  /* Number of local symbols.  */
-
-  int nsyms;
-
-  /* The symbols.  If some of them are arguments, then they must be
-     in the order in which we would like to print them.  */
-
-  struct symbol *sym[1];
-};
-
-#define BLOCK_START(bl)                (bl)->startaddr
-#define BLOCK_END(bl)          (bl)->endaddr
-#define BLOCK_FUNCTION(bl)     (bl)->function
-#define BLOCK_SUPERBLOCK(bl)   (bl)->superblock
-#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
-#define BLOCK_HASHTABLE(bl)    (bl)->hashtable
-
-/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only.  */
-#define BLOCK_NSYMS(bl)                (bl)->nsyms
-#define BLOCK_SYM(bl, n)       (bl)->sym[n]
-
-/* For blocks with a hashtable, but these are valid for non-hashed blocks as
-   well - each symbol will appear to be one bucket by itself.  */
-#define BLOCK_BUCKETS(bl)      (bl)->nsyms
-#define BLOCK_BUCKET(bl, n)    (bl)->sym[n]
-
-/* Macro used to set the size of a hashtable for N symbols.  */
-#define BLOCK_HASHTABLE_SIZE(n)        ((n)/5 + 1)
-
-/* Macro to loop through all symbols in a block BL, in no particular order.
-   i counts which bucket we are in, and sym points to the current symbol.  */
-
-#define ALL_BLOCK_SYMBOLS(bl, i, sym)                          \
-       for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++)        \
-         for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym);         \
-              (sym) = (sym)->hash_next)
-
-/* Nonzero if symbols of block BL should be sorted alphabetically.
-   Don't sort a block which corresponds to a function.  If we did the
-   sorting would have to preserve the order of the symbols for the
-   arguments.  Also don't sort any block that we chose to hash.  */
-
-#define BLOCK_SHOULD_SORT(bl) (! BLOCK_HASHTABLE (bl) \
-                              && BLOCK_FUNCTION (bl) == NULL)
 \f
 
 /* Represent one symbol name; a variable, constant, function or typedef.  */
@@ -621,7 +510,58 @@ enum address_class
    * with a level of indirection.
    */
 
-  LOC_INDIRECT
+  LOC_INDIRECT,
+
+  /* The variable's address is computed by a set of location
+     functions (see "struct location_funcs" below).  */
+  LOC_COMPUTED,
+
+  /* Same as LOC_COMPUTED, but for function arguments.  */
+  LOC_COMPUTED_ARG
+};
+
+/* A structure of function pointers describing the location of a
+   variable, structure member, or structure base class.
+
+   These functions' BATON arguments are generic data pointers, holding
+   whatever data the functions need --- the code which provides this
+   structure also provides the actual contents of the baton, and
+   decides its form.  However, there may be other rules about where
+   the baton data must be allocated; whoever is pointing to this
+   `struct location_funcs' object will know the rules.  For example,
+   when a symbol S's location is LOC_COMPUTED, then
+   SYMBOL_LOCATION_FUNCS(S) is pointing to a location_funcs structure,
+   and SYMBOL_LOCATION_BATON(S) is the baton, which must be allocated
+   on the same obstack as the symbol itself.  */
+
+struct location_funcs
+{
+
+  /* Return the value of the variable SYMBOL, relative to the stack
+     frame FRAME.  If the variable has been optimized out, return
+     zero.
+
+     Iff `read_needs_frame (SYMBOL)' is zero, then FRAME may be zero.  */
+
+  struct value *(*read_variable) (struct symbol * symbol,
+                                 struct frame_info * frame);
+
+  /* Return non-zero if we need a frame to find the value of the SYMBOL.  */
+  int (*read_needs_frame) (struct symbol * symbol);
+
+  /* Write to STREAM a natural-language description of the location of
+     SYMBOL.  */
+  int (*describe_location) (struct symbol * symbol, struct ui_file * stream);
+
+  /* Tracepoint support.  Append bytecodes to the tracepoint agent
+     expression AX that push the address of the object SYMBOL.  Set
+     VALUE appropriately.  Note --- for objects in registers, this
+     needn't emit any code; as long as it sets VALUE properly, then
+     the caller will generate the right code in the process of
+     treating this as an lvalue or rvalue.  */
+
+  void (*tracepoint_var_ref) (struct symbol * symbol, struct agent_expr * ax,
+                             struct axs_value * value);
 };
 
 /* Linked list of symbol's live ranges. */
@@ -683,6 +623,21 @@ struct symbol
        variable declared with the `__thread' storage class), we may
        need to know which object file it's in.  */
     struct objfile *objfile;
+
+    /* For a LOC_COMPUTED or LOC_COMPUTED_ARG symbol, this is the
+       baton and location_funcs structure to find its location.  For a
+       LOC_BLOCK symbol for a function in a compilation unit compiled
+       with DWARF 2 information, this is information used internally
+       by the DWARF 2 code --- specifically, the location expression
+       for the frame base for this function.  */
+    /* FIXME drow/2003-02-21: For the LOC_BLOCK case, it might be better
+       to add a magic symbol to the block containing this information,
+       or to have a generic debug info annotation slot for symbols.  */
+    struct
+    {
+      void *baton;
+      struct location_funcs *funcs;
+    } loc;
   }
   aux_value;
 
@@ -707,6 +662,8 @@ struct symbol
 #define SYMBOL_OBJFILE(symbol)          (symbol)->aux_value.objfile
 #define SYMBOL_ALIASES(symbol)         (symbol)->aliases
 #define SYMBOL_RANGES(symbol)          (symbol)->ranges
+#define SYMBOL_LOCATION_BATON(symbol)   (symbol)->aux_value.loc.baton
+#define SYMBOL_LOCATION_FUNCS(symbol)   (symbol)->aux_value.loc.funcs
 \f
 /* A partial_symbol records the name, namespace, and address class of
    symbols whose types we have not parsed yet.  For functions, it also
@@ -1058,10 +1015,6 @@ extern struct type *lookup_union (char *, struct block *);
 
 extern struct type *lookup_enum (char *, struct block *);
 
-/* lookup the function corresponding to the block */
-
-extern struct symbol *block_function (struct block *);
-
 /* from blockframe.c: */
 
 /* lookup the function symbol corresponding to the address */
@@ -1116,8 +1069,6 @@ extern struct partial_symbol *find_pc_sect_psymbol (struct partial_symtab *,
 
 extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
 
-extern int contained_in (struct block *, struct block *);
-
 extern void reread_symbols (void);
 
 extern struct type *lookup_transparent_type (const char *);
@@ -1321,13 +1272,6 @@ extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *);
 extern struct symtab_and_line find_function_start_sal (struct symbol *sym,
                                                       int);
 
-/* blockframe.c */
-
-extern struct blockvector *blockvector_for_pc (CORE_ADDR, int *);
-
-extern struct blockvector *blockvector_for_pc_sect (CORE_ADDR, asection *,
-                                                   int *, struct symtab *);
-
 /* symfile.c */
 
 extern void clear_symtab_users (void);
index 683561f..4de246c 100644 (file)
@@ -573,6 +573,7 @@ update_current_target (void)
       INHERIT (to_remove_watchpoint, t);
       INHERIT (to_stopped_data_address, t);
       INHERIT (to_stopped_by_watchpoint, t);
+      INHERIT (to_have_continuable_watchpoint, t);
       INHERIT (to_region_size_ok_for_hw_watchpoint, t);
       INHERIT (to_terminal_init, t);
       INHERIT (to_terminal_inferior, t);
index 80e6538..f081bd3 100644 (file)
@@ -256,6 +256,7 @@ struct target_ops
     int (*to_remove_watchpoint) (CORE_ADDR, int, int);
     int (*to_insert_watchpoint) (CORE_ADDR, int, int);
     int (*to_stopped_by_watchpoint) (void);
+    int to_have_continuable_watchpoint;
     CORE_ADDR (*to_stopped_data_address) (void);
     int (*to_region_size_ok_for_hw_watchpoint) (int);
     void (*to_terminal_init) (void);
@@ -963,6 +964,13 @@ extern void (*target_new_objfile_hook) (struct objfile *);
    (*current_target.to_stopped_by_watchpoint) ()
 #endif
 
+/* Non-zero if we have continuable watchpoints  */
+
+#ifndef HAVE_CONTINUABLE_WATCHPOINT
+#define HAVE_CONTINUABLE_WATCHPOINT \
+   (current_target.to_have_continuable_watchpoint)
+#endif
+
 /* HP-UX supplies these operations, which respectively disable and enable
    the memory page-protections that are used to implement hardware watchpoints
    on that platform.  See wait_for_inferior's use of these.  */
index 82f3843..14b54f4 100644 (file)
@@ -1,3 +1,161 @@
+2003-03-03  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/classes.exp (test_enums): KFAIL "ptype obj_with_enum"
+       with respect to PR c++/57.
+       KFAIL "print (ClassWithEnum::PrivEnum) 42" with respect to PR
+       c++/826.
+       Create "print ('ClassWithEnum::PrivEnum') 42"; KFAIL it with
+       respect to PR c++/57.
+
+2003-03-03  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/templates.exp (do_tests): Convert the KFAILs with
+       respect to PR c++/33 into FAILs.
+
+2003-03-03  Michael Chastain  <mec@shout.net>
+
+       * configure.in: Update copyright years.
+
+2003-03-03  Michael Chastain  <mec@shout.net>
+
+       * Makefile.in: Update copyright years.
+
+2003-02-28  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/classes.exp (test_ptype_class_objects): Accept it if we
+       print class instead of struct and/or superfluous protection
+       specifiers, as long as the resulting output is equivalent to the
+       source code.
+       Delete FIXME from end of messages on tests that don't need
+       fixing.
+
+2003-02-28  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/templates.exp (do_tests): Allow const in the two
+       Foo<volatile char *>::foo tests.
+
+2003-02-27  Michael Snyder  <msnyder@redhat.com>
+
+       * gdb.base/restore.c (main): Return zero, so exit code 
+       will be consistant.
+
+2003-02-26  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/templates.exp (do_tests): KFAIL the "print Foo<volatile
+       char *>::foo" test with respect to PR c++/33.  Create a new test
+       which is identical to that one except that it doesn't put the
+       space between the "char" and the "*"; KFAIL it, too.
+
+2003-02-26  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/templates.exp (do_tests): Convert XFAILs about printing
+       template types into either PASSes or KFAILs (corresponding to PR
+       c++/57).  Tweak indentation.  Update copyright.
+
+2003-02-23  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * lib/gdb.exp: Don't execute C++ tests on m6811/m6812 targets.
+
+2003-02-13  Michael Chastain  <mec@shout.net>
+
+       * gdb.base/exprs.exp: Remove i960 remnants.
+       * gdb.base/funcargs.exp: Likewise.
+       * gdb.base/list.exp: Likewise.
+       * gdb.base/ptype.exp: Likewise.
+
+2003-02-14  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/virtfunc.exp (test_virtual_calls): Change 'print
+       pEe->D::vg()" from XFAIL to KFAIL.
+
+2003-02-13  Jason Molenda  (jmolenda@apple.com)
+
+       * gdb.base/maint.exp: Update maint print statistics regexp to include
+       new entries.
+
+2003-02-13  Michael Chastain  <mec@shout.net>
+
+       * gdb.c++/inherit.exp: Remove call to get_debug_format.
+
+2003-02-12  Michael Chastain  <mec@shout.net>
+
+       * gdb.c++/classes.exp: Remove setup_xfail_format for DWARF 1.
+       * gdb.c++/inherit.exp: Likewise.
+       * gdb.c++/cplusfuncs.exp: Remove suppression logic for DWARF 1.
+       * gdb.c++/templates.exp: Likewise.
+       * gdb.c++/virtfunc.exp: Likewise.
+
+2003-02-06  Jason Molenda  (jason-cl@molenda.com)
+
+       * gdb.mi/mi-syn-frame.c (subroutine): Add a comment explaining
+       why the code is written that way.
+
+2003-02-05  Michael Chastain  <mec@shout.net>
+
+       * gdb.base/dump.exp: Add missing copyright line.
+
+2003-02-05  Jason Molenda  (jason-cl@molenda.com)
+
+       * gdb.mi/mi-syn-frame.c (subroutine): Add an extra statement
+       at the beginning so the breakpoint doesn't get set on the loop.
+
+2003-02-05  Michael Chastain  <mec@shout.net>
+
+       * gdb.c++/local.exp: Relax the test for PR gdb/825 to accept
+       output for configurations with gcc 2.95.3.
+
+2003-02-05  Keith Seitz  <keiths@redhat.com>
+           Andrew Cagney  <ac131313@redhat.com>
+
+       * gdb.mi/mi-cli.exp: New file.
+       
+2003-02-04  Michael Chastain  <mec@shout.net>
+
+       * gdb.c++/anon-union.exp: Do not call gdb_suppress_entire_file.
+       Call perror and then continue.
+
+2003-02-03  Michael Chastain  <mec@shout.net>
+
+       * gdb.c++/pr-1023.cc: New file.
+       * gdb.c++/pr-1023.exp: New file.
+
+2003-02-05  Jim Blandy  <jimb@redhat.com>
+
+       * gdb.c++/local.exp: Don't expect Local to be in scope in main;
+       it's local to foobar.  Check for it there, and check that it's not
+       present in main.
+       * gdb.c++/local.cc (marker2): New function.
+       (foobar): Call marker1.
+       (main): Call marker2 instead of marker1.
+
+2003-02-04  Andrew Cagney  <ac131313@redhat.com>
+
+       * gdb.disasm/mn10200.exp: Obsolete file.
+       * gdb.trace/Makefile.in (clean mostlyclean): Remove mn10200.
+       * gdb.disasm/Makefile.in (clean mostlyclean): Remove mn10200.
+       * gdb.base/watchpoint.exp: Mark the mn10200 xfails as obsolete.
+
+2003-02-04  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/overload.exp: Test intToChar(1).
+       * gdb.c++/overload.cc (intToChar): New.
+       (main): Call intToChar.
+
+2003-02-03  David Carlton  <carlton@math.stanford.edu>
+
+       * gdb.c++/ovldbreak.exp (continue_to_bp_overloaded): Add
+       'might_kfail' arg.
+       KFAIL some of the continue_to_bp_overloaded calls, according to
+       PR c++/1025.
+
+2003-02-01  Michael Chastain  <mec@shout.net>
+
+       * gdb.base/advance.c (marker1): New marker function.
+       * gdb.base/advance.exp: When the 'advance' command lands on the
+       return breakpoint, it can legitimately stop on either the
+       current line or the next line.  Accommodate both outcomes.
+       * gdb.base/until.exp: Likewise.
+
 2003-02-02  Andrew Cagney  <ac131313@redhat.com>
 
        2002-11-10 Jason Molenda (jason-cl@molenda.com):
 
 2003-01-29  Michael Snyder  <msnyder@redhat.com>
 
+       * gdb.base/maint.exp: Allow for leading underscore in symbol.
+       * gdb.base/display.exp: Allow for leading underscore in symbol.
        * gdb.base/args.exp: Skip if target does not support args passing.
 
 2003-01-22  Daniel Jacobowitz  <drow@mvista.com>
index 29079d4..c0ba9ab 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for regression testing the GNU debugger.
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003
 # Free Software Foundation, Inc.
 
 # This file is part of GDB.
index 70bbee2..8ba930f 100644 (file)
@@ -1,7 +1,7 @@
 #                                                       -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-# Copyright (C) 2002
+# Copyright 2002, 2003
 # Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
index 2ae3cc5..8066dee 100644 (file)
@@ -29,6 +29,10 @@ int func3 ()
   x = 4;
 }
 
+void marker1 ()
+{
+}
+
 int
 main ()
 {
@@ -38,6 +42,7 @@ main ()
   b = 3;    /* advance this location */
     
   func (c); /* stop here after leaving current frame */
+  marker1 (); /* stop here after leaving current frame */
   func3 (); /* break here */
   result = bar (b + foo (c));
   return 0; /* advance malformed */
index aea5a6d..e5061d8 100644 (file)
@@ -63,8 +63,12 @@ gdb_test "advance func" \
 # Verify that "advance <funcname>" when funcname is NOT called by the current
 # frame, stops at the end of the current frame.
 #
+# gdb can legitimately stop on either the current line or the next line,
+# depending on whether the machine instruction for 'call' on the current
+# line has more instructions after it or not.
+#
 gdb_test "advance func3" \
-       "in main.*func \\(c\\).*stop here after leaving current frame..."\
+       "(in main|).*(func \\(c\\)|marker1 \\(\\)).*stop here after leaving current frame..."\
        "advance function not called by current frame"
 
 # break at main again
index 826fdfb..5885307 100644 (file)
@@ -1,3 +1,4 @@
+# Copyright 2002 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
index 49df15a..f6ce719 100644 (file)
@@ -1,5 +1,5 @@
-#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2001
-#   Free Software Foundation, Inc.
+#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000,
+#   2001, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -98,13 +98,7 @@ test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[
 test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char < 127" "\\$\[0-9\]* = $false"  "print unsigned char <"
 test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char > 127" "\\$\[0-9\]* = $false"  "print unsigned char >"
 # make char a minus
-# FIXME:  gdb mishandles the cast (unsigned char) on the i960, so I've
-# set up an expected failure for this case.
-setup_xfail "i960-*-*" 1821
 test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false"  "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = $true" "print unsigned char == (~0)"
-# FIXME:  gdb mishandles the cast (unsigned char) on the i960, so I've
-# set up an expected failure for this case.
-setup_xfail "i960-*-*" 1821
 test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = $false"  "print v_unsigned_char != ~0" "\\$\[0-9\]* = $true" "print unsigned char != (~0)"
 test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false"  "print v_unsigned_char < 127" "\\$\[0-9\]* = $false"  "print unsigned char < (~0)"
 test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true"  "print v_unsigned_char > 127" "\\$\[0-9\]* = $true"  "print unsigned char > (~0)"
index 2ed154a..38949f1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
+# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -177,7 +177,6 @@ proc float_and_integral_args {} {
 
     # Run; should stop at call2a and print actual arguments.
 
-    setup_xfail "i960-*-*" 1813
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
     # The debug info. for "f" is not correct. It's a known bug.
     if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
@@ -680,9 +679,6 @@ $gdb_prompt $" {
 
     # Continue; should stop at call6k and print actual arguments.
     # Print backtrace.
-    # This fails on i960-*-vxworks because gdb gets confused by
-    # breakpoints on adjacent instructions.
-    setup_xfail "i960-*-vxworks" 1786
     gdb_continue call6k
 
     if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
@@ -742,7 +738,6 @@ proc shuffle_round_robin {} {
         timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
     }
 
-    setup_xfail "i960-*-*" 1813
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
     # The debug info. for "f" is not correct. It's a known bug.
     if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
index 881e0e6..dee9152 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2002
+# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -405,8 +405,6 @@ proc test_list_filename_and_function {} {
        timeout { fail "list list0.c:main (timeout)" }
     }
 
-    # The i960 is a second case
-
     # Not sure what the point of having this function be unused is.
     # AIX is legitimately removing it.
     setup_xfail "rs6000-*-aix*"
@@ -465,8 +463,6 @@ proc test_list_filename_and_function {} {
        timeout { fail "list list1.c:bar (timeout)" }
     }
 
-    # The i960 is a second case
-
     # Not sure what the point of having this function be unused is.
     # AIX is legitimately removing it.
     setup_xfail "rs6000-*-aix*"
index 69fecad..d828650 100644 (file)
@@ -180,7 +180,7 @@ gdb_expect  {
 
 send_gdb "maint print statistics\n"
 gdb_expect  {
-        -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\
+        -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\
                         { pass "maint print statistics" }
         -re ".*$gdb_prompt $"       { fail "maint print statistics" }
         timeout         { fail "(timeout) maint print statistics" }
index 8ef738e..6e33d85 100644 (file)
@@ -172,7 +172,6 @@ gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumera
 # acts like whatis for basic types.  If it is thought to be necessary to
 # test both whatis and ptype for all the types, the tests should be
 # merged into whatis.exp, or else maintenance will be a royal pain -kingdon
-#setup_xfail "i960-*-*" 1821
 #setup_xfail "mips-idt-*" "mips-sgi-*"
 #send "ptype v_char\n"
 #gdb_expect {
@@ -277,7 +276,6 @@ gdb_test "ptype v_int" "type = int.*" "ptype int"
 #
 # test ptype command with arrays
 #
-#setup_xfail "i960-*-*" 1821
 #setup_xfail "mips-idt-*" "mips-sgi-*"
 #send "ptype v_char_array\n"
 #gdb_expect {
@@ -380,7 +378,6 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
 ##
 ## test ptype command with pointers
 ##
-#setup_xfail "i960-*-*" 1821
 #setup_xfail "mips-idt-*" "mips-sgi-*"
 #send "ptype v_char_pointer\n"
 #gdb_expect {
index e05d68c..a8282ee 100644 (file)
@@ -257,4 +257,5 @@ int main ()
 #endif
   driver ();
   printf("exiting\n");
+  return 0;
 }
index 8159332..f646c6d 100644 (file)
@@ -76,6 +76,6 @@ delete_breakpoints
 # stop at main, the caller, where we put the 'guard' breakpoint.
 #
 gdb_test "until marker3" \
-       "$hex in main.*argc.*argv.*envp.*at.*${srcfile}:82.*marker2 \\(43\\)." \
+       "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:(82.*marker2 \\(43\\)|83.*marker3 \\(.stack., .trace.\\))." \
        "until func, not called by current frame"
 
index e150d55..f10955f 100644 (file)
@@ -394,7 +394,7 @@ proc test_stepping {} {
        clear_xfail "sparc-*-*"
        clear_xfail "hppa*-*-*bsd*"
        # It works with the generic inferior function calling code too.
-       clear_xfail "mn10200*-*-*"
+       # OBSOLETE clear_xfail "mn10200*-*-*"
        clear_xfail "mn10300*-*-*"
        # The following architectures define CALL_DUMMY_HAS_COMPLETED.
        clear_xfail "hppa*-*-*hpux*"
index 9b86b5d..0d5c777 100644 (file)
@@ -1,5 +1,5 @@
 # Tests for anonymous union support.
-# Copyright 1998, 1999 Free Software Foundation, Inc.
+# Copyright 1998, 1999, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -40,7 +40,8 @@ set srcfile ${testfile}.cc
 set binfile ${objdir}/${subdir}/${testfile}
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+     perror "Testcase compile failed" 0
+     continue
 }
 
 # Start with a fresh gdb
index dbdea5d..3f398ac 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ proc test_ptype_class_objects {} {
 
     # Note that struct members are public by default, so we don't print
     # "public:" for the public members of structs.
-    # Accept it as an expected failure if gdb just fails to distinguish between
+    # Accept it if gdb just fails to distinguish between
     # class and struct, and everything else is OK.
 
     send_gdb "ptype struct default_public_struct\n"
@@ -64,8 +64,7 @@ proc test_ptype_class_objects {} {
            pass "ptype struct default_public_struct"
        }
        -re "type = class default_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
-           fail "ptype struct default_public_struct"
+           pass "ptype struct default_public_struct"
        }
        -re ".*$gdb_prompt $" { fail "ptype struct default_public_struct" }
        timeout { fail "ptype struct default_public_struct (timeout)" ; return }
@@ -73,7 +72,7 @@ proc test_ptype_class_objects {} {
 
     # Note that struct members are public by default, so we don't print
     # "public:" for the public members of structs.
-    # Accept it as an expected failure if gdb just fails to distinguish between
+    # Accept it if gdb just fails to distinguish between
     # class and struct, and everything else is OK.
 
     send_gdb "ptype struct explicit_public_struct\n"
@@ -82,78 +81,70 @@ proc test_ptype_class_objects {} {
            pass "ptype struct explicit_public_struct"
        }
        -re "type = class explicit_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
-           fail "ptype struct explicit_public_struct"
+           pass "ptype struct explicit_public_struct"
        }
        -re ".*$gdb_prompt $" { fail "ptype struct explicit_public_struct" }
        timeout { fail "ptype struct explicit_public_struct (timeout)" ; return }
     }
 
-    # Accept it as an expected failure if gdb just fails to distinguish between
+    # Accept it if gdb just fails to distinguish between
     # class and struct, and everything else is OK.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype struct protected_struct\n"
     gdb_expect {
        -re "type = struct protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
-           pass "ptype struct protected_struct (FIXME)"
+           pass "ptype struct protected_struct"
        }
        -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
-           fail "ptype struct protected_struct (FIXME)"
+           pass "ptype struct protected_struct"
        }
        -re ".*$gdb_prompt $" { fail "ptype struct protected_struct" }
        timeout { fail "ptype struct protected_struct (timeout)" ; return }
     }
 
-    # Accept it as an expected failure if gdb just fails to distinguish between
+    # Accept it if gdb just fails to distinguish between
     # class and struct, and everything else is OK.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype struct private_struct\n"
     gdb_expect {
        -re "type = struct private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
-           pass "ptype struct private_struct (FIXME)"
+           pass "ptype struct private_struct"
        }
        -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { 
-           setup_xfail "*-*-*"
-           fail "ptype struct private_struct (FIXME)"
+           pass "ptype struct private_struct"
        }
        -re ".*$gdb_prompt $" { fail "ptype struct private_struct" }
        timeout { fail "ptype struct private_struct (timeout)" ; return }
     }
 
-    # Accept it as an expected failure if gdb just fails to distinguish between
+    # Accept it if gdb just fails to distinguish between
     # class and struct, and everything else is OK.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype struct mixed_protection_struct\n"
     gdb_expect {
        -re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" {
-           pass "ptype struct mixed_protection_struct (FIXME)"
+           pass "ptype struct mixed_protection_struct"
        }
         -re "type = struct mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" {
             pass "ptype struct mixed_protection_struct (extra public)"
         }
        -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
-           fail "ptype struct mixed_protection_struct (FIXME)"
+           pass "ptype struct mixed_protection_struct"
        }
        -re ".*$gdb_prompt $" { fail "ptype struct mixed_protection_struct" }
        timeout { fail "ptype struct mixed_protection_struct (timeout)" ; return }
     }
 
-    # Accept it as an expected failure if gdb just fails to distinguish between
+    # Accept it if gdb just fails to distinguish between
     # class and struct, and everything else is OK.
 
     send_gdb "ptype class public_class\n"
     gdb_expect {
        -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           pass "ptype class public_class (FIXME)"
+           pass "ptype class public_class"
        }
        -re "type = struct public_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
-           fail "ptype class public_class (FIXME)"
+           pass "ptype class public_class"
        }
        -re ".*$gdb_prompt $" { fail "ptype class public_class" }
        timeout { fail "ptype class public_class (timeout)" ; return }
@@ -165,27 +156,24 @@ proc test_ptype_class_objects {} {
            pass "ptype class protected_class"
        }
        -re "type = struct protected_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
            fail "ptype class protected_class"
        }
        -re ".*$gdb_prompt $" { fail "ptype class protected_class" }
        timeout { fail "ptype class protected_class (timeout)" ; return }
     }
 
-    # Accept it as an expected failure if gdb just emits a superflous "private:"
+    # Accept it if gdb just emits a superflous "private:"
     # attribute, since classes default to private and for consistency with
     # structs (where we don't print the "public:" attribute) we don't print
     # the "private:" attribute.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class default_private_class\n"
     gdb_expect {
        -re "type = class default_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           pass "ptype class default_private_class (FIXME)"
+           pass "ptype class default_private_class"
        }
        -re "type = class default_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
-           fail "ptype class default_private_class (FIXME)"
+           pass "ptype class default_private_class"
        }
        -re ".*$gdb_prompt $" { fail "ptype class default_private_class" }
        timeout { fail "ptype class default_private_class (timeout)" ; return }
@@ -197,10 +185,9 @@ proc test_ptype_class_objects {} {
            pass "ptype class explicit_private_class"
        }
         -re "type = class explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-            pass "ptype class explicit_private_class (OK for HP aCC)"
+            pass "ptype class explicit_private_class"
         }
        -re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
            fail "ptype class explicit_private_class"
        }
        -re ".*$gdb_prompt $" { fail "ptype class explicit_private_class" }
@@ -213,7 +200,6 @@ proc test_ptype_class_objects {} {
            pass "ptype class mixed_protection_class"
        }
        -re "type = struct mixed_protection_class \{${ws}int a;${ws}int b;${ws}int c;${ws}int d;${ws}int e;${ws}int f;${ws}int g;${ws}int h;${ws}int i;$nl.*\}$nl$gdb_prompt $" {
-           setup_xfail "*-*-*"
            fail "ptype class mixed_protection_class"
        }
        -re ".*$gdb_prompt $" { fail "ptype class mixed_protection_class" }
@@ -236,7 +222,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class B\n"
     gdb_expect {
        -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -254,7 +239,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class C\n"
     gdb_expect {
        -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -272,7 +256,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class D\n"
     gdb_expect {
        -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -290,7 +273,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class E\n"
     gdb_expect {
        -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;${ws}E & operator=\\(E const ?&\\);${ws}E\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -354,7 +336,6 @@ proc test_ptype_class_objects {} {
     # The format of a g++ virtual base pointer.
     set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vB\n"
     gdb_expect {
        -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}vB & operator=\\(vB const ?&\\);${ws}vB\\((vB const|const vB) ?&\\);${ws}vB\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -384,7 +365,6 @@ proc test_ptype_class_objects {} {
     # for now, but with a FIXME.  At some future point, gdb should use a
     # portable representation for the virtual table constructs.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vC\n"
     gdb_expect {
        -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}vC & operator=\\(vC const ?&\\);${ws}vC\\((vC const|const vC) ?&\\);${ws}vC\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -414,7 +394,6 @@ proc test_ptype_class_objects {} {
     # for now, but with a FIXME.  At some future point, gdb should use a
     # portable representation for the virtual table constructs.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vD\n"
     gdb_expect {
        -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}vD & operator=\\(vD const ?&\\);${ws}vD\\((vD const|const vD) ?&\\);${ws}vD\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -444,7 +423,6 @@ proc test_ptype_class_objects {} {
     # for now, but with a FIXME.  At some future point, gdb should use a
     # portable representation for the virtual table constructs.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vE\n"
     gdb_expect {
        -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}vE & operator=\\(vE const ?&\\);${ws}vE\\((vE const|const vE) ?&\\);${ws}vE\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
@@ -470,7 +448,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class Base1\n"
     gdb_expect {
        -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 & operator=\\(Base1 const ?&\\);${ws}Base1\\(((Base1 const)|(const Base1)) ?&\\);${ws}Base1\\(int\\);${ws}\}$nl$gdb_prompt $" {
@@ -491,7 +468,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class Foo\n"
     gdb_expect {
         -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;\r\n${ws}Foo\\(int, int\\);${ws}int operator!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" {
@@ -512,7 +488,6 @@ proc test_ptype_class_objects {} {
        }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class Bar\n"
     gdb_expect {
        -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar & operator=\\(Bar const ?&\\);${ws}Bar\\((Bar const|const Bar) ?&\\);${ws}Bar\\(int, int, int\\);${ws}\}$nl$gdb_prompt $" {
@@ -682,23 +657,45 @@ proc test_enums {} {
     }
 
     # ptype on the object
-    # g++ is putting out the wrong debug info.  This works with aCC
-    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
     send_gdb "ptype obj_with_enum\n"
     gdb_expect {
        -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" }
+       -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)PrivEnum priv_enum;\r\n\[ \t\]*int x;.*\\}\r\n$gdb_prompt $"
+       {
+           # NOTE: carlton/2003-02-28: One could certainly argue that
+           # this output is acceptable: PrivEnum is a member of
+           # ClassWithEnum, so there's no need to explicitly qualify
+           # its name with "ClassWithEnum::".  The truth, though, is
+           # that GDB is simply forgetting that PrivEnum is a member
+           # of ClassWithEnum, so we do that output for a bad reason
+           # instead of a good reason.  Under stabs, we probably
+           # can't get this right; under DWARF-2, we can.
+           kfail "gdb/57" "ptype obj_with_enum"
+       }
        -re "$gdb_prompt $"                     { fail "ptype obj_with_enum" }
        timeout                             { fail "(timeout) ptype obj_with_enum" }
     }
 
-    # g++ is putting out the wrong debug info.  This works with aCC
-    if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
+    # We'll do this test twice, because of a parser bug: see
+    # PR gdb/826.
+
     send_gdb "print (ClassWithEnum::PrivEnum) 42\n"
     gdb_expect {
        -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" }
+       -re "A parse error in expression, near `42'.\r\n$gdb_prompt $"
+       { kfail "gdb/826" "print (ClassWithEnum::PrivEnum) 42" }
        -re "$gdb_prompt $"                     { fail "print (ClassWithEnum::PrivEnum) 42" }
        timeout                             { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" }
     }
+
+    send_gdb "print ('ClassWithEnum::PrivEnum') 42\n"
+    gdb_expect {
+       -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print ('ClassWithEnum::PrivEnum') 42" }
+       -re "No symbol \"ClassWithEnum::PrivEnum\" in current context.\r\n$gdb_prompt $"
+       { kfail "gdb/57" "print ('ClassWithEnum::PrivEnum') 42" }
+       -re "$gdb_prompt $"                     { fail "print ('ClassWithEnum::PrivEnum') 42" }
+       timeout                             { fail "(timeout) print ('ClassWithEnum::PrivEnum') 42" }
+    }
 }
 
 #
@@ -737,7 +734,6 @@ proc test_pointers_to_class_members {} {
     }
     clear_xfail "*-*-*"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)"
 }
 
@@ -822,11 +818,9 @@ proc test_static_members {} {
        "print cnsi without static members"
 
     gdb_test "set print static-members on" ""
-    setup_xfail_format "DWARF 1"
     gdb_test "print csi" \
        "{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>}}" \
        "print csi with static members"
-    setup_xfail_format "DWARF 1"
     gdb_test "print cnsi" \
        "{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \
        "print cnsi with static members"
@@ -856,12 +850,7 @@ proc do_tests {} {
     send_gdb "set width 0\n"
     gdb_expect -re "$gdb_prompt $"
 
-    # Get the debug format for the compiled test case.
-
-    if [ runto_main ] then {
-       get_debug_format
-    }
-
+    runto_main
     test_ptype_class_objects
 
     if [ runto 'inheritance2' ] then {
index 6f92817..0a5e1b3 100644 (file)
@@ -552,18 +552,7 @@ proc do_tests {} {
     send_gdb "set width 0\n"
     gdb_expect -re "$gdb_prompt $"
 
-    # Get the debug format for the compiled test case.  If that
-    # format is DWARF 1 then just skip all the tests since none of
-    # them will pass.
-
-    if [ runto_main] then {
-       get_debug_format
-       if [ setup_xfail_format "DWARF 1" ] then {
-           fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
-           return
-       }
-       clear_xfail "*-*-*"
-    }
+    runto_main
 
     probe_demangler
     test_paddr_overloaded_functions
index 66c2a52..86c1f83 100644 (file)
@@ -79,7 +79,6 @@ proc test_print_si_members {} {
 
     # Print members of g_B using nonambiguous compact form.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_B.a" ".* = 3" "print g_B.a"
 
     gdb_test "print g_B.b" ".* = 5" "print g_B.b"
@@ -98,7 +97,6 @@ proc test_print_si_members {} {
 
     # Print members of g_C using nonambiguous compact form.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_C.a" ".* = 7" "print g_C.a"
 
     gdb_test "print g_C.c" ".* = 9" "print g_C.c"
@@ -163,32 +161,26 @@ proc test_ptype_si {} {
 
     # Print class B as a type.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B"
 
     # Print class B as an explicit class.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B"
 
     # Print type of an object of type B.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B"
 
     # Print class C as a type.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C"
 
     # Print class C as an explicit class.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C"
 
     # Print type of an object of type g_C.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C"
 
     # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
@@ -243,12 +235,10 @@ proc test_print_si_classes {} {
 
     # Print all members of g_B.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B"
 
     # Print all members of g_C.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"
 }
 
@@ -266,9 +256,7 @@ proc test_print_anon_union {} {
     global ws
     global nl
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member"
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_anon_union\n"
     gdb_expect {
        -re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" {
@@ -284,7 +272,6 @@ proc test_print_anon_union {} {
            fail "print variableof type anonymous union (timeout)"
        }
     }
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype g_anon_union\n"
     gdb_expect {
        -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" {
@@ -393,10 +380,8 @@ proc test_print_mi_members {} {
 
     gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x"
 
     gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d"
@@ -447,10 +432,8 @@ proc test_print_mi_members {} {
 
     gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x"
 
     gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d"
@@ -469,22 +452,16 @@ proc test_print_mi_members {} {
 proc test_ptype_mi {} {
     global nl
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E"
 }
 
@@ -495,12 +472,10 @@ proc test_ptype_mi {} {
 proc test_print_mi_classes {} {
     # Print all members of g_D.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_D" ".* = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D"
 
     # Print all members of g_E.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_E" ".* = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E"
 }
 
@@ -527,7 +502,6 @@ proc test_print_svi_members {} {
 
     # Print all members of g_vB.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_vB.vA::va\n"
     gdb_expect {
        -re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" }
@@ -541,7 +515,6 @@ proc test_print_svi_members {} {
        timeout { fail "print g_vB.vA::va (timeout)" ; return }
     }
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx"
 
     gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb"
@@ -550,7 +523,6 @@ proc test_print_svi_members {} {
 
     # Print members of g_vB using compact form.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vB.va" ".* = 3" "print g_vB.va"
 
     gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb"
@@ -559,10 +531,8 @@ proc test_print_svi_members {} {
 
     # Print all members of g_vC.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx"
 
     gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc"
@@ -571,7 +541,6 @@ proc test_print_svi_members {} {
 
     # Print members of g_vC using compact form.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vC.va" ".* = 7" "print g_vC.va"
 
     gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc"
@@ -631,7 +600,6 @@ proc test_ptype_vi {} {
        timeout { fail "ptype g_vA (timeout)" ; return }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype vB\n"
     gdb_expect {
        -re "ptype vB${nl}type = class vB : public virtual vA \{$nl  private:${ws}vA \\*${vbptr}vA;$nl  public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
@@ -644,7 +612,6 @@ proc test_ptype_vi {} {
        timeout { fail "ptype vB (timeout)" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vB\n"
     gdb_expect {
        -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
@@ -657,7 +624,6 @@ proc test_ptype_vi {} {
        timeout { fail "ptype class vB (timeout)" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype g_vB\n"
     gdb_expect {
        -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
@@ -670,7 +636,6 @@ proc test_ptype_vi {} {
        timeout { fail "ptype g_vB (timeout)" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype vC\n"
     gdb_expect {
        -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
@@ -683,7 +648,6 @@ proc test_ptype_vi {} {
        timeout { fail "ptype vC (timeout)" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vC\n"
     gdb_expect {
        -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
@@ -696,7 +660,6 @@ proc test_ptype_vi {} {
        timeout { fail "ptype class vC (timeout)" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype g_vC\n"
     gdb_expect {
        -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
@@ -727,7 +690,6 @@ proc test_print_svi_classes {} {
 
     # Print all members of g_vB.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_vB\n"
     gdb_expect {
        -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" {
@@ -754,7 +716,6 @@ proc test_print_svi_classes {} {
 
     # Print all members of g_vC.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_vC\n"
     gdb_expect {
        -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" {
@@ -785,7 +746,6 @@ proc test_print_mvi_members {} {
 
     # Print all members of g_vD.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_vD.vA::va\n"
     gdb_expect {
        -re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" }
@@ -799,19 +759,14 @@ proc test_print_mvi_members {} {
        timeout { fail "print g_vD.vA::va (timeout)" ; return }
     }
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx"
 
     gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd"
@@ -820,25 +775,18 @@ proc test_print_mvi_members {} {
 
     # Print all members of g_vE.
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx"
 
-    setup_xfail_format "DWARF 1"
     gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd"
 
     gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx"
@@ -858,7 +806,6 @@ proc test_ptype_mvi {} {
     global nl
     global vbptr
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype vD\n"
     gdb_expect {
        -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
@@ -871,7 +818,6 @@ proc test_ptype_mvi {} {
        timeout { fail "(timeout) ptype vD" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vD\n"
     gdb_expect {
        -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
@@ -884,7 +830,6 @@ proc test_ptype_mvi {} {
        timeout { fail "(timeout) ptype class vD" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype g_vD\n"
     gdb_expect {
        -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
@@ -897,7 +842,6 @@ proc test_ptype_mvi {} {
        timeout { fail "(timeout) ptype g_vD" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype vE\n"
     gdb_expect {
        -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
@@ -910,7 +854,6 @@ proc test_ptype_mvi {} {
        timeout { fail "(timeout) ptype vE" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype class vE\n"
     gdb_expect {
        -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
@@ -923,7 +866,6 @@ proc test_ptype_mvi {} {
        timeout { fail "(timeout) ptype class vE" }
     }
 
-    setup_xfail_format "DWARF 1"
     send_gdb "ptype g_vE\n"
     gdb_expect {
        -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
@@ -950,7 +892,6 @@ proc test_print_mvi_classes {} {
 
     # Print all members of g_vD.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_vD\n"
     gdb_expect {
        -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" {
@@ -977,7 +918,6 @@ proc test_print_mvi_classes {} {
 
     # Print all members of g_vE.
 
-    setup_xfail_format "DWARF 1"
     send_gdb "print g_vE\n"
     gdb_expect {
        -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" {
@@ -1022,8 +962,6 @@ proc do_tests {} {
 
     if { ![ runto_main] } {
        gdb_suppress_tests;
-    } else {
-       get_debug_format
     }
 
     test_ptype_si
index 5bfc44a..85fd6e1 100644 (file)
@@ -4,6 +4,9 @@ void marker1 (void)
 { 
 }
 
+void marker2 (void)
+{
+}
   
 int foobar (int x)
 {
@@ -20,6 +23,8 @@ int foobar (int x)
   static Local l1;
   char  c;
 
+  marker1 ();
+
   l.loc1 = 23;
 
   c = l.loc_foo('x');
@@ -56,6 +61,6 @@ int main()
 
    il.ilc = 'b';
    il.ip = &c;
-   marker1();
+   marker2();
  }
 }
index 971567d..21ceb7a 100644 (file)
@@ -67,7 +67,7 @@ if ![runto 'marker1'] then {
     continue
 }
 
-gdb_test "up" ".*main.*" "up from marker1"
+gdb_test "up" ".*foobar.*" "up from marker1"
 
 # Local classes in g++ get names like "main.1::InnerLocal", just like local
 # static variables.  Some targets use "___" instead of ".".
@@ -102,8 +102,7 @@ send_gdb "ptype Local\n"
 gdb_expect {
   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
-    # setup_kfail "gdb/483"
-    fail "ptype Local (gdb/483)"
+    kfail "gdb/483" "ptype Local"
   }
   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
   -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { xpass "ptype Local (old aCC)" }
@@ -111,6 +110,36 @@ gdb_expect {
   timeout             { fail "(timeout) ptype Local" }
 }
 
+gdb_test "break marker2"
+gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2.*" \
+    "continuing to marker2"
+
+gdb_test "up" ".*main.*" "up from marker2"
+
+# Make sure that `Local' isn't in scope here; it's local to foobar.
+# setup_kfail "gdb/825"
+send_gdb "ptype Local\n"
+set eol "\[\t \]*\[\r\n\]+\[\t \]*"
+gdb_expect {
+    -re "No symbol \"Local\" in current context.*${gdb_prompt} $" {
+        pass "Local out of scope"
+    }
+    -re "ptype Local${eol}type = class Local {${eol}  public:${eol}    int loc1;${eol}.*${eol}    char loc_foo\\(char\\);${eol}}${eol}${gdb_prompt} " {
+        # GCC emits STABS debugging information in a way that doesn't
+        # properly preserve the scoping of local classes.  I think
+        # we'd need to start using Sun's extensions to stabs to get
+        # this right.
+        kfail gdb/825 "Local out of scope"
+    }
+    -re ".*${gdb_prompt} $" {
+        fail "Local out of scope"
+    }
+    timeout {
+        fail "Local out of scope (timeout)"
+    }
+}
+        
+
 # DTS CLLbs14316 and CLLbs17058
 # coulter - I added a clause for HP's aCC compiler.  We print out the type
 #   as xx instead of const unsigned char, but we still have an expected failure
index 97083c5..2f46715 100644 (file)
@@ -45,6 +45,11 @@ int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
 
 };
 
+int intToChar (char c)
+{
+  return 297;
+}
+
 void marker1()
 {}
 
@@ -72,6 +77,8 @@ int main ()
        breakpoint();
     #endif
 
+    // Verify that intToChar should work:
+    intToChar(1);
 
     marker1();
     return 0; 
index 7bfae10..227b055 100644 (file)
@@ -378,3 +378,5 @@ gdb_test "list foo::overloadfnarg(int, int (*)(int))" \
 gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \
    "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
    "list overloaded function with function ptr args - quotes around argument"
+
+gdb_test "print intToChar(1)" ".\[0-9\]* = 297"
index 9852cb5..043243d 100644 (file)
@@ -312,7 +312,11 @@ gdb_test "info break" \
 
 # Run through each breakpoint.
 
-proc continue_to_bp_overloaded {bpnumber argtype actuals} {
+# NOTE: carlton/2003-02-03: I'm seeing failures on some of the tests,
+# with the wrong arg being printed out.  Michael Chastain sees
+# failures at times, too, albeit fewer than I do.
+
+proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} {
     global gdb_prompt hex decimal srcfile 
 
     send_gdb "continue\n"
@@ -320,6 +324,13 @@ proc continue_to_bp_overloaded {bpnumber argtype actuals} {
        -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
            pass "continue to bp overloaded : ${argtype}"
        }
+       -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
+           if $might_kfail {
+               kfail "gdb/1025" "continue to bp overloaded : ${argtype}"
+           } else {
+               fail "continue to bp overloaded : ${argtype}"
+           }
+       }
         -re ".*$gdb_prompt $" {
            fail "continue to bp overloaded : ${argtype}" 
        }
@@ -329,18 +340,18 @@ proc continue_to_bp_overloaded {bpnumber argtype actuals} {
     }
 }
 
-continue_to_bp_overloaded 25 "(void|)" ""
-continue_to_bp_overloaded 24 "char" "arg=2 \\'\\\\002\\'"
-continue_to_bp_overloaded 23 "signed char" "arg=3 \\'\\\\003\\'"
-continue_to_bp_overloaded 22 "unsigned char" "arg=4 \\'\\\\004\\'"
-continue_to_bp_overloaded 21 "short" "arg=5"
-continue_to_bp_overloaded 20 "unsigned short" "arg=6"
-continue_to_bp_overloaded 19 "int" "arg=7"
-continue_to_bp_overloaded 18 "(unsigned|unsigned int)" "arg=8"
-continue_to_bp_overloaded 17 "long" "arg=9"
-continue_to_bp_overloaded 16 "unsigned long" "arg=10"
-continue_to_bp_overloaded 15 "float" "arg=100"
-continue_to_bp_overloaded 14 "double" "arg=200"
+continue_to_bp_overloaded 25 "(void|)" ""
+continue_to_bp_overloaded 24 "char" "arg=2 \\'\\\\002\\'"
+continue_to_bp_overloaded 23 "signed char" "arg=3 \\'\\\\003\\'"
+continue_to_bp_overloaded 22 "unsigned char" "arg=4 \\'\\\\004\\'"
+continue_to_bp_overloaded 21 "short" "arg=5"
+continue_to_bp_overloaded 20 "unsigned short" "arg=6"
+continue_to_bp_overloaded 19 "int" "arg=7"
+continue_to_bp_overloaded 18 "(unsigned|unsigned int)" "arg=8"
+continue_to_bp_overloaded 17 "long" "arg=9"
+continue_to_bp_overloaded 16 "unsigned long" "arg=10"
+continue_to_bp_overloaded 15 "float" "arg=100"
+continue_to_bp_overloaded 1 14 "double" "arg=200"
 
 
 
diff --git a/gdb/testsuite/gdb.c++/pr-1023.cc b/gdb/testsuite/gdb.c++/pr-1023.cc
new file mode 100644 (file)
index 0000000..7583084
--- /dev/null
@@ -0,0 +1,20 @@
+class myClass
+{
+  public:
+    myClass() {};
+    ~myClass() {};
+    void performUnblocking( short int cell_index );
+    void performBlocking( int cell_index );
+};
+
+void myClass::performUnblocking( short int cell_index ) {}
+
+void myClass::performBlocking( int cell_index ) {}
+
+int main ()
+{
+  myClass mc;
+  mc.performBlocking (0);
+  mc.performUnblocking (0);
+}
+
diff --git a/gdb/testsuite/gdb.c++/pr-1023.exp b/gdb/testsuite/gdb.c++/pr-1023.exp
new file mode 100644 (file)
index 0000000..c8c9802
--- /dev/null
@@ -0,0 +1,79 @@
+# Copyright 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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.  
+
+# Tests for PR gdb/1023.
+# 2003-02-03  Michael Chastain <mec@shout.net>
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel then {
+        strace $tracelevel
+        }
+
+if { [skip_cplus_tests] } { continue }
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "pr-1023"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile} "c++"] {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    perror "couldn't run to breakpoint"
+    continue
+}
+
+send_gdb "break myClass::performBlocking\n"
+gdb_expect {
+    -re "Breakpoint $decimal at $hex: file .*$srcfile, line 12.*$gdb_prompt $" {
+       pass "break myClass::performBlocking"
+    }
+    -re "the class myClass does not have any method named performBlocking.*$gdb_prompt $" {
+       # fails with gcc 2.95.3 -gstabs+, native i686-pc-linux-gnu
+       # -- chastain 2003-02-03
+       kfail "gdb/1023" "break myClass::performBlocking"
+    }
+    -re ".*$gdb_prompt $" {
+       fail "break myClass::performBlocking"
+    }
+    timeout {
+       fail "break myClass::performBlocking (timeout)"
+    }
+}
+
+gdb_test \
+  "break myClass::performUnblocking" \
+  "Breakpoint $decimal at $hex: file .*$srcfile, line 10.*"
+
+gdb_exit
+return 0
index a6d35fc..7ef1c1d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002
+# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -192,18 +192,7 @@ proc do_tests {} {
        return
     }
 
-    # Get the debug format for the compiled test case.  If that
-    # format is DWARF 1 then just skip all the tests since none of
-    # them will pass.
-
-    if [ runto_main] then {
-       get_debug_format
-       if [ setup_xfail_format "DWARF 1" ] then {
-           fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
-           return
-       }
-       clear_xfail "*-*-*"
-    }
+    runto_main
 
     test_ptype_of_templates
     test_template_breakpoints
@@ -253,17 +242,30 @@ gdb_expect {
 
 # Template Foo<T>
 
-setup_xfail hppa64-*-* CLLbs16092
-# g++ can't do the template instantiation in debug info trick, so we
-# fail this because it's not a real type.
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
+# Neither stabs nor DWARF-2 contains type information about templates
+# (as opposed to instantiations of templates), so in those
+# circumstances we expect GDB to not find a symbol.  HP has a debug
+# format that contains more info, though, so it's also correct to
+# print out template info.  (This affects several subsequent tests as
+# well.)
+
+# NOTE: carlton/2003-02-26: However, because of a bug in the way GDB
+# handles nested types, we don't get this right in the DWARF-2 case.
+
 send_gdb "ptype Foo\n"   
 gdb_expect {   
-   -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
-   -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
-   -re "$gdb_prompt $"                     { fail "ptype Foo" }
-   timeout                             { fail "(timeout) ptype Foo" }
+    -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
+    -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
+    -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+       kfail "gdb/57" "ptype Foo" }
+    -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+       pass "ptype Foo" }
+    -re "$gdb_prompt $"                     { fail "ptype Foo" }
+    timeout                             { fail "(timeout) ptype Foo" }
 }
+#    -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo(int, int);\r\n\\}\r\n$gdb_prompt $"
 
 # ptype Foo<int>
 
@@ -294,24 +296,48 @@ gdb_expect {
 
 # print a function from Foo<volatile char *>
 
+# This test is sensitive to whitespace matching, so we'll do it twice,
+# varying the spacing, because of PR gdb/33.
+
 send_gdb "print Foo<volatile char *>::foo\n"   
 gdb_expect {   
-   -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char \\*> \\*, int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
-   -re "$gdb_prompt $"                     { fail "print Foo<volatile char *>::foo" }
-   timeout                             { fail "(timeout) print Foo<volatile char *>::foo" }
+    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
+    -re "No symbol \"Foo<volatile char \\*>\" in current context.\r\n$gdb_prompt $"
+    {
+       # This used to be a kfail gdb/33, but it shouldn't occur any more now.
+       fail "print Foo<volatile char *>::foo"
+    }
+    -re "$gdb_prompt $"                     { fail "print Foo<volatile char *>::foo" }
+    timeout                             { fail "(timeout) print Foo<volatile char *>::foo" }
+}
+
+send_gdb "print Foo<volatile char*>::foo\n"   
+gdb_expect {   
+    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char*>::foo" }
+    -re "No symbol \"Foo<volatile char\\*>\" in current context.\r\n$gdb_prompt $"
+    {
+       # This used to be a kfail gdb/33, but it shouldn't occur any more now.
+       fail "print Foo<volatile char *>::foo"
+    }
+    -re "$gdb_prompt $"                     { fail "print Foo<volatile char*>::foo" }
+    timeout                             { fail "(timeout) print Foo<volatile char*>::foo" }
 }
 
 # Template Bar<T, int>
 
-setup_xfail hppa64-*-* CLLbs16092
 # same as Foo for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Bar\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
-   -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
-   -re "$gdb_prompt $"                     { fail "ptype Bar" }
-   timeout                             { fail "(timeout) ptype Bar" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
+    -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
+    -re "ptype Bar\r\ntype = class Bar<int,33> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+       kfail "gdb/57" "ptype Bar" }
+    -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+       pass "ptype Bar" }
+    -re "$gdb_prompt $"                     { fail "ptype Bar" }
+    timeout                             { fail "(timeout) ptype Bar" }
 }
 
 
@@ -335,15 +361,19 @@ gdb_expect {
 
 # Template Baz<T, char>
 
-setup_xfail hppa64-*-* CLLbs16092
 # Same as Foo, for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Baz\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
-   -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
-   -re "$gdb_prompt $"                     { fail "ptype Baz" }
-   timeout                             { fail "(timeout) ptype Baz" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
+    -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
+    -re "type = class Baz<int,'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+       kfail "gdb/57" "ptype Baz" }
+    -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+       pass "ptype Baz" }
+    -re "$gdb_prompt $"                     { fail "ptype Baz" }
+    timeout                             { fail "(timeout) ptype Baz" }
 }
 
 
@@ -367,13 +397,18 @@ gdb_expect {
 
 # Template Qux<T, int (*f)(int) >
 # Same as Foo for g++
-if {!$hp_aCC_compiler} {setup_xfail *-*-*}
 send_gdb "ptype Qux\n"   
 gdb_expect {   
-   -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
-   -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
-   -re "$gdb_prompt $"                     { fail "ptype Qux" }
-   timeout                             { fail "(timeout) ptype Qux" }
+    -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
+    -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
+    -re "type = class Qux<char,&string> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+       kfail "gdb/57" "ptype Qux" }
+    -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+       pass "ptype Qux" }
+    -re "$gdb_prompt $"                     { fail "ptype Qux" }
+    timeout                             { fail "(timeout) ptype Qux" }
 }
 
 # pt Qux<int,&string>
@@ -398,15 +433,19 @@ gdb_expect {
 
 # Template Spec<T1, T2>
 
-setup_xfail hppa64-*-* CLLbs16092
 # Same as Foo for g++
-if {!$hp_aCC_compiler} { setup_xfail *-*-* }
 send_gdb "ptype Spec\n"   
 gdb_expect {   
-   -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
-   -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
-   -re "$gdb_prompt $"                     { fail "ptype Spec" }
-   timeout                             { fail "(timeout) ptype Spec" }
+    -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
+    -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
+    -re "type = class Spec<int,char> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $"
+    { # GCC 3.1, DWARF-2 output.
+       kfail "gdb/57" "ptype Spec" }
+    -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $"
+    { # GCC 2.95.3, stabs+ output.
+       pass "ptype Spec" }
+    -re "$gdb_prompt $"                     { fail "ptype Spec" }
+    timeout                             { fail "(timeout) ptype Spec" }
 }
 
 # pt Spec<char,0>
index 2741cf6..dbd575c 100644 (file)
@@ -915,12 +915,11 @@ proc test_virtual_calls {} {
     #
     # -- chastain 2002-02-20
 
-    if {$gcc_compiled} then { setup_xfail "*-*-*" }
-
     send_gdb "print pEe->D::vg()\n"
-    setup_xfail "*-*-*"
     gdb_expect {
        -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
+       -re "Attempt to take address of value not located in memory.\r\n$gdb_prompt $"
+       { kfail "gdb/1064" "print pEe->D::vg()" }
        -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
        timeout { fail "print pEe->D::vg() (timeout)" }
        eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
@@ -937,18 +936,7 @@ proc do_tests {} {
     gdb_start;
     gdb_virtfunc_init;
 
-    # Get the debug format for the compiled test case.  If that
-    # format is DWARF 1 then just skip all the tests since none of
-    # them will pass.
-
-    if [ runto_main ] then {
-       get_debug_format
-       if [ setup_xfail_format "DWARF 1" ] then {
-           fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
-           return
-       }
-       clear_xfail "*-*-*"
-    }
+    runto_main
 
     test_ptype_of_classes
 
index 7cb1b1e..0db2a26 100644 (file)
@@ -7,7 +7,7 @@ all info install-info dvi install uninstall installcheck check:
        @echo "Nothing to be done for $@..."
 
 clean mostlyclean:
-       -rm -f *.o *.diff *~ *.bad core h8300s hppa mn10200 mn10300 sh3
+       -rm -f *.o *.diff *~ *.bad core h8300s hppa mn10300 sh3
 
 distclean maintainer-clean realclean: clean
        -rm -f Makefile config.status config.log
index 33cdb47..a47b341 100644 (file)
-
-# Copyright 1997 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
-# This file was written by Jeff Law. (law@cygnus.com)
-
-if $tracelevel then {
-       strace $tracelevel
-}
-
-if ![istarget "mn10200*-*-*"] {
-    verbose "Tests ignored for all but mn10200 based targets."
-    return
-}
-
-global exec_output
-set prms_id 0
-set bug_id 0
-
-set testfile "mn10200"
-set srcfile ${srcdir}/${subdir}/${testfile}.s
-set binfile ${objdir}/${subdir}/${testfile}
-if  { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
-}
-
-proc add_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/12i add_tests\n"
-    gdb_expect {
-       -re "
-.*add  d1,d2.*
-.*add  d2,a3.*
-.*add  a2,d1.*
-.*add  a3,a2.*
-.*add  16,d1.*
-.*add  256,d2.*
-.*add  131071,d3.*
-.*add  16,a1.*
-.*add  256,a2.*
-.*add  131071,a3.*
-.*addc d1,d2.*
-.*addnf        16,a2.*
-.*$gdb_prompt $" { pass "add tests" }
-       -re "$gdb_prompt $" { fail "add tests" }
-       timeout { fail "(timeout) add tests" }
-    }
-}
-
-proc bcc_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/15i bCC_tests\n"
-    gdb_expect {
-       -re "
-.*beq  0x\[0-9a-f]+ <bCC_tests>.*
-.*bne  0x\[0-9a-f]+ <bCC_tests>.*
-.*bgt  0x\[0-9a-f]+ <bCC_tests>.*
-.*bge  0x\[0-9a-f]+ <bCC_tests>.*
-.*ble  0x\[0-9a-f]+ <bCC_tests>.*
-.*blt  0x\[0-9a-f]+ <bCC_tests>.*
-.*bhi  0x\[0-9a-f]+ <bCC_tests>.*
-.*bcc  0x\[0-9a-f]+ <bCC_tests>.*
-.*bls  0x\[0-9a-f]+ <bCC_tests>.*
-.*bcs  0x\[0-9a-f]+ <bCC_tests>.*
-.*bvc  0x\[0-9a-f]+ <bCC_tests>.*
-.*bvs  0x\[0-9a-f]+ <bCC_tests>.*
-.*bnc  0x\[0-9a-f]+ <bCC_tests>.*
-.*bns  0x\[0-9a-f]+ <bCC_tests>.*
-.*bra  0x\[0-9a-f]+ <bCC_tests>.*
-.*$gdb_prompt $" { pass "bCC tests" }
-       -re "$gdb_prompt $" { fail "bCC tests" }
-       timeout { fail "(timeout) bCC tests" }
-    }
-}
-
-proc bccx_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/14i bCCx_tests\n"
-    gdb_expect {
-       -re "
-.*beqx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bnex 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bgtx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bgex 0x\[0-9a-f]+ <bCCx_tests>.*
-.*blex 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bltx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bhix 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bccx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*blsx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bcsx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bvcx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bvsx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bncx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*bnsx 0x\[0-9a-f]+ <bCCx_tests>.*
-.*$gdb_prompt $" { pass "bCCx tests" }
-       -re "$gdb_prompt $" { fail "bCCx tests" }
-       timeout { fail "(timeout) bCCx tests" }
-    }
-}
-
-proc bit_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/4 bit_tests\n"
-    gdb_expect {
-       -re "
-.*btst 64,d1.*
-.*btst 8192,d2.*
-.*bset d1,\\(a2\\).*
-.*bclr d1,\\(a2\\).*
-.*$gdb_prompt $" { pass "bit tests" }
-       -re "$gdb_prompt $" { fail "bit tests" }
-       timeout { fail "(timeout) bit tests" }
-    }
-}
-
-proc cmp_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/9i cmp_tests\n"
-    gdb_expect {
-       -re "
-.*cmp  d1,d2.*
-.*cmp  d2,a3.*
-.*cmp  a3,d3.*
-.*cmp  a3,a2.*
-.*cmp  16,d3.*
-.*cmp  256,d2.*
-.*cmp  131071,d1.*
-.*cmp  256,a2.*
-.*cmp  131071,a1.*
-.*$gdb_prompt $" { pass "cmp tests" }
-       -re "$gdb_prompt $" { fail "cmp tests" }
-       timeout { fail "(timeout) cmp tests" }
-    }
-}
-
-proc extend_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/5i extend_tests\n"
-    gdb_expect {
-       -re "
-.*ext  d1.*
-.*extx d2.*
-.*extxu        d3.*
-.*extxb        d2.*
-.*extxbu       d1.*
-.*$gdb_prompt $" { pass "extend tests" }
-       -re "$gdb_prompt $" { fail "extend tests" }
-       timeout { fail "(timeout) extend tests" }
-    }
-}
-
-proc logical_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/11i logical_tests\n"
-    gdb_expect {
-       -re "
-.*and  d1,d2.*
-.*and  127,d2.*
-.*and  32767,d3.*
-.*and  32767,psw.*
-.*or   d1,d2.*
-.*or   127,d2.*
-.*or   32767,d3.*
-.*or   32767,psw.*
-.*xor  d1,d2.*
-.*xor  32767,d3.*
-.*not  d3.*
-.*$gdb_prompt $" { pass "logical tests" }
-       -re "$gdb_prompt $" { fail "logical tests" }
-       timeout { fail "(timeout) logical tests" }
-    }
-}
-
-proc mov_tests_1 { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/12i mov_tests_1\n"
-    gdb_expect {
-       -re "
-.*mov  d1,a2.*
-.*mov  a2,d1.*
-.*mov  d1,d2.*
-.*mov  a2,a1.*
-.*mov  psw,d3.*
-.*mov  d2,psw.*
-.*mov  mdr,d1.*
-.*mov  d2,mdr.*
-.*mov  \\(a2\\),d1.*
-.*mov  \\(8,a2\\),d1.*
-.*mov  \\(256,a2\\),d1.*
-.*mov  \\(131071,a2\\),d1.*
-.*$gdb_prompt $" { pass "mov1 tests" }
-       -re "$gdb_prompt $" { fail "mov1 tests" }
-       timeout { fail "(timeout) mov1 tests" }
-    }
-}
-
-proc mov_tests_2 { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/9 mov_tests_2\n"
-    gdb_expect {
-       -re "
-.*mov  \\(d1,a1\\),d2.*
-.*mov  \\(0x8000.*\\),d1.*
-.*mov  \\(0x1ffff.*\\),d1.*
-.*mov  \\(8,a2\\),a1.*
-.*mov  \\(256,a2\\),a1.*
-.*mov  \\(131071,a2\\),a1.*
-.*mov  \\(d1,a1\\),a2.*
-.*mov  \\(0x8000.*\\),a1.*
-.*mov  \\(0x1ffff.*\\),a1.*
-.*$gdb_prompt $" { pass "mov2 tests" }
-       -re "$gdb_prompt $" { fail "mov2 tests" }
-       timeout { fail "(timeout) mov2 tests" }
-    }
-}
-
-proc mov_tests_3 { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/10 mov_tests_3\n"
-    gdb_expect {
-       -re "
-.*mov  d1,\\(a2\\).*
-.*mov  d1,\\(32,a2\\).*
-.*mov  d1,\\(256,a2\\).*
-.*mov  d1,\\(131071,a2\\).*
-.*mov  d1,\\(d2,a2\\).*
-.*mov  d1,\\(0x80.*\\).*
-.*mov  d1,\\(0x1ffff.*\\).*
-.*mov  a1,\\(32,a2\\).*
-.*mov  a1,\\(256,a2\\).*
-.*mov  a1,\\(131071,a2\\).*
-.*$gdb_prompt $" { pass "mov3 tests" }
-       -re "$gdb_prompt $" { fail "mov3 tests" }
-       timeout { fail "(timeout) mov3 tests" }
-    }
-}
-
-proc mov_tests_4 { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/8 mov_tests_4\n"
-    gdb_expect {
-       -re "
-.*mov  a1,\\(d2,a2\\).*
-.*mov  a1,\\(0x80.*\\).*
-.*mov  a1,\\(0x1ffff.*\\).*
-.*mov  8,d1.*
-.*mov  256,d1.*
-.*mov  131071,d1.*
-.*mov  256,a1.*
-.*mov  131071,a1.*
-.*$gdb_prompt $" { pass "mov4 tests" }
-       -re "$gdb_prompt $" { fail "mov4 tests" }
-       timeout { fail "(timeout) mov4 tests" }
-    }
-}
-
-proc movb_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/12 movb_tests\n"
-    gdb_expect {
-       -re "
-.*movb \\(8,a2\\),d1.*
-.*movb \\(256,a2\\),d1.*
-.*movb \\(131071,a2\\),d1.*
-.*movb \\(d2,a2\\),d3.*
-.*movb \\(0x1ffff.*\\),d2.*
-.*movb d1,\\(a2\\).*
-.*movb d1,\\(8,a2\\).*
-.*movb d1,\\(256,a2\\).*
-.*movb d1,\\(131071,a2\\).*
-.*movb d1,\\(d2,a2\\).*
-.*movb d1,\\(0x100.*\\).*
-.*movb d1,\\(0x1ffff.*\\).*
-.*$gdb_prompt $" { pass "movb tests" }
-       -re "$gdb_prompt $" { fail "movb tests" }
-       timeout { fail "(timeout) movb tests" }
-    }
-}
-
-proc movbu_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/7 movbu_tests\n"
-    gdb_expect {
-       -re "
-.*movbu        \\(a2\\),d1.*
-.*movbu        \\(8,a2\\),d1.*
-.*movbu        \\(256,a2\\),d1.*
-.*movbu        \\(131071,a2\\),d1.*
-.*movbu        \\(d1,a1\\),d2.*
-.*movbu        \\(0x8000.*\\),d1.*
-.*movbu        \\(0x1ffff.*\\),d1.*
-.*$gdb_prompt $" { pass "movbu tests" }
-       -re "$gdb_prompt $" { fail "movbu tests" }
-       timeout { fail "(timeout) movbu tests" }
-    }
-}
-
-proc movx_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/6 movx_tests\n"
-    gdb_expect {
-       -re "
-.*movx \\(8,a2\\),d1.*
-.*movx \\(256,a2\\),d1.*
-.*movx \\(131071,a2\\),d1.*
-.*movx d1,\\(8,a2\\).*
-.*movx d1,\\(256,a2\\).*
-.*movx d1,\\(131071,a2\\).*
-.*$gdb_prompt $" { pass "movx tests" }
-       -re "$gdb_prompt $" { fail "movx tests" }
-       timeout { fail "(timeout) movx tests" }
-    }
-}
-
-proc muldiv_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/3 muldiv_tests\n"
-    gdb_expect {
-       -re "
-.*mul  d1,d2.*
-.*mulu d2,d3.*
-.*divu d3,d2.*
-.*$gdb_prompt $" { pass "muldiv tests" }
-       -re "$gdb_prompt $" { fail "muldiv tests" }
-       timeout { fail "(timeout) muldiv tests" }
-    }
-}
-
-proc misc_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/9 misc_tests\n"
-    gdb_expect {
-       -re "
-.*jmp  0x\[0-9a-f]+ <main>.*
-.*jmp  0x\[0-9a-f]+ <start>.*
-.*jmp  \\(a2\\).*
-.*jsr  0x\[0-9a-f]+ <main>.*
-.*jsr  0x\[0-9a-f]+ <start>.*
-.*jsr  \\(a2\\).*
-.*rts.*
-.*rti.*
-.*nop.*
-.*$gdb_prompt $" { pass "misc tests" }
-       -re "$gdb_prompt $" { fail "misc tests" }
-       timeout { fail "(timeout) misc tests" }
-    }
-}
-
-proc shift_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/4i shift_tests\n"
-    gdb_expect {
-       -re "
-.*asr  d2.*
-.*lsr  d3.*
-.*ror  d1.*
-.*rol  d2.*
-.*$gdb_prompt $" { pass "shift tests" }
-       -re "$gdb_prompt $" { fail "shift tests" }
-       timeout { fail "(timeout) shift tests" }
-    }
-}
-
-proc sub_tests { } {
-    global gdb_prompt
-    global hex
-    global decimal
-
-    send_gdb "x/9i sub_tests\n"
-    gdb_expect {
-       -re "
-.*sub  d1,d2.*
-.*sub  d2,a3.*
-.*sub  a3,d3.*
-.*sub  a3,a2.*
-.*sub  32767,d2.*
-.*sub  131071,d2.*
-.*sub  32767,a2.*
-.*sub  131071,a2.*
-.*subc d1,d2.*
-.*$gdb_prompt $" { pass "sub tests" }
-       -re "$gdb_prompt $" { fail "sub tests" }
-       timeout { fail "(timeout) sub tests" }
-    }
-}
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
-
-add_tests
-bcc_tests
-bccx_tests
-bit_tests
-cmp_tests
-extend_tests
-logical_tests
-mov_tests_1
-mov_tests_2
-mov_tests_3
-mov_tests_4
-movb_tests
-movbu_tests
-movx_tests
-muldiv_tests
-misc_tests
-shift_tests
-sub_tests
+# OBSOLETE 
+# OBSOLETE # Copyright 1997 Free Software Foundation, Inc.
+# OBSOLETE 
+# OBSOLETE # This program is free software; you can redistribute it and/or modify
+# OBSOLETE # it under the terms of the GNU General Public License as published by
+# OBSOLETE # the Free Software Foundation; either version 2 of the License, or
+# OBSOLETE # (at your option) any later version.
+# OBSOLETE # 
+# OBSOLETE # This program is distributed in the hope that it will be useful,
+# OBSOLETE # but WITHOUT ANY WARRANTY; without even the implied warranty of
+# OBSOLETE # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# OBSOLETE # GNU General Public License for more details.
+# OBSOLETE # 
+# OBSOLETE # You should have received a copy of the GNU General Public License
+# OBSOLETE # along with this program; if not, write to the Free Software
+# OBSOLETE # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+# OBSOLETE 
+# OBSOLETE # Please email any bugs, comments, and/or additions to this file to:
+# OBSOLETE # bug-gdb@prep.ai.mit.edu
+# OBSOLETE 
+# OBSOLETE # This file was written by Jeff Law. (law@cygnus.com)
+# OBSOLETE 
+# OBSOLETE if $tracelevel then {
+# OBSOLETE     strace $tracelevel
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE if ![istarget "mn10200*-*-*"] {
+# OBSOLETE     verbose "Tests ignored for all but mn10200 based targets."
+# OBSOLETE     return
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE global exec_output
+# OBSOLETE set prms_id 0
+# OBSOLETE set bug_id 0
+# OBSOLETE 
+# OBSOLETE set testfile "mn10200"
+# OBSOLETE set srcfile ${srcdir}/${subdir}/${testfile}.s
+# OBSOLETE set binfile ${objdir}/${subdir}/${testfile}
+# OBSOLETE if  { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
+# OBSOLETE      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc add_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/12i add_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*add       d1,d2.*
+# OBSOLETE .*add       d2,a3.*
+# OBSOLETE .*add       a2,d1.*
+# OBSOLETE .*add       a3,a2.*
+# OBSOLETE .*add       16,d1.*
+# OBSOLETE .*add       256,d2.*
+# OBSOLETE .*add       131071,d3.*
+# OBSOLETE .*add       16,a1.*
+# OBSOLETE .*add       256,a2.*
+# OBSOLETE .*add       131071,a3.*
+# OBSOLETE .*addc      d1,d2.*
+# OBSOLETE .*addnf     16,a2.*
+# OBSOLETE .*$gdb_prompt $" { pass "add tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "add tests" }
+# OBSOLETE     timeout { fail "(timeout) add tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc bcc_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/15i bCC_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*beq       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bne       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bgt       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bge       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*ble       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*blt       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bhi       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bcc       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bls       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bcs       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bvc       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bvs       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bnc       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bns       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*bra       0x\[0-9a-f]+ <bCC_tests>.*
+# OBSOLETE .*$gdb_prompt $" { pass "bCC tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "bCC tests" }
+# OBSOLETE     timeout { fail "(timeout) bCC tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc bccx_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/14i bCCx_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*beqx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bnex      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bgtx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bgex      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*blex      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bltx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bhix      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bccx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*blsx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bcsx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bvcx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bvsx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bncx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*bnsx      0x\[0-9a-f]+ <bCCx_tests>.*
+# OBSOLETE .*$gdb_prompt $" { pass "bCCx tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "bCCx tests" }
+# OBSOLETE     timeout { fail "(timeout) bCCx tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc bit_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/4 bit_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*btst      64,d1.*
+# OBSOLETE .*btst      8192,d2.*
+# OBSOLETE .*bset      d1,\\(a2\\).*
+# OBSOLETE .*bclr      d1,\\(a2\\).*
+# OBSOLETE .*$gdb_prompt $" { pass "bit tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "bit tests" }
+# OBSOLETE     timeout { fail "(timeout) bit tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc cmp_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/9i cmp_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*cmp       d1,d2.*
+# OBSOLETE .*cmp       d2,a3.*
+# OBSOLETE .*cmp       a3,d3.*
+# OBSOLETE .*cmp       a3,a2.*
+# OBSOLETE .*cmp       16,d3.*
+# OBSOLETE .*cmp       256,d2.*
+# OBSOLETE .*cmp       131071,d1.*
+# OBSOLETE .*cmp       256,a2.*
+# OBSOLETE .*cmp       131071,a1.*
+# OBSOLETE .*$gdb_prompt $" { pass "cmp tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "cmp tests" }
+# OBSOLETE     timeout { fail "(timeout) cmp tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc extend_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/5i extend_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*ext       d1.*
+# OBSOLETE .*extx      d2.*
+# OBSOLETE .*extxu     d3.*
+# OBSOLETE .*extxb     d2.*
+# OBSOLETE .*extxbu    d1.*
+# OBSOLETE .*$gdb_prompt $" { pass "extend tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "extend tests" }
+# OBSOLETE     timeout { fail "(timeout) extend tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc logical_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/11i logical_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*and       d1,d2.*
+# OBSOLETE .*and       127,d2.*
+# OBSOLETE .*and       32767,d3.*
+# OBSOLETE .*and       32767,psw.*
+# OBSOLETE .*or        d1,d2.*
+# OBSOLETE .*or        127,d2.*
+# OBSOLETE .*or        32767,d3.*
+# OBSOLETE .*or        32767,psw.*
+# OBSOLETE .*xor       d1,d2.*
+# OBSOLETE .*xor       32767,d3.*
+# OBSOLETE .*not       d3.*
+# OBSOLETE .*$gdb_prompt $" { pass "logical tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "logical tests" }
+# OBSOLETE     timeout { fail "(timeout) logical tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc mov_tests_1 { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/12i mov_tests_1\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*mov       d1,a2.*
+# OBSOLETE .*mov       a2,d1.*
+# OBSOLETE .*mov       d1,d2.*
+# OBSOLETE .*mov       a2,a1.*
+# OBSOLETE .*mov       psw,d3.*
+# OBSOLETE .*mov       d2,psw.*
+# OBSOLETE .*mov       mdr,d1.*
+# OBSOLETE .*mov       d2,mdr.*
+# OBSOLETE .*mov       \\(a2\\),d1.*
+# OBSOLETE .*mov       \\(8,a2\\),d1.*
+# OBSOLETE .*mov       \\(256,a2\\),d1.*
+# OBSOLETE .*mov       \\(131071,a2\\),d1.*
+# OBSOLETE .*$gdb_prompt $" { pass "mov1 tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "mov1 tests" }
+# OBSOLETE     timeout { fail "(timeout) mov1 tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc mov_tests_2 { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/9 mov_tests_2\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*mov       \\(d1,a1\\),d2.*
+# OBSOLETE .*mov       \\(0x8000.*\\),d1.*
+# OBSOLETE .*mov       \\(0x1ffff.*\\),d1.*
+# OBSOLETE .*mov       \\(8,a2\\),a1.*
+# OBSOLETE .*mov       \\(256,a2\\),a1.*
+# OBSOLETE .*mov       \\(131071,a2\\),a1.*
+# OBSOLETE .*mov       \\(d1,a1\\),a2.*
+# OBSOLETE .*mov       \\(0x8000.*\\),a1.*
+# OBSOLETE .*mov       \\(0x1ffff.*\\),a1.*
+# OBSOLETE .*$gdb_prompt $" { pass "mov2 tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "mov2 tests" }
+# OBSOLETE     timeout { fail "(timeout) mov2 tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc mov_tests_3 { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/10 mov_tests_3\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*mov       d1,\\(a2\\).*
+# OBSOLETE .*mov       d1,\\(32,a2\\).*
+# OBSOLETE .*mov       d1,\\(256,a2\\).*
+# OBSOLETE .*mov       d1,\\(131071,a2\\).*
+# OBSOLETE .*mov       d1,\\(d2,a2\\).*
+# OBSOLETE .*mov       d1,\\(0x80.*\\).*
+# OBSOLETE .*mov       d1,\\(0x1ffff.*\\).*
+# OBSOLETE .*mov       a1,\\(32,a2\\).*
+# OBSOLETE .*mov       a1,\\(256,a2\\).*
+# OBSOLETE .*mov       a1,\\(131071,a2\\).*
+# OBSOLETE .*$gdb_prompt $" { pass "mov3 tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "mov3 tests" }
+# OBSOLETE     timeout { fail "(timeout) mov3 tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc mov_tests_4 { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/8 mov_tests_4\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*mov       a1,\\(d2,a2\\).*
+# OBSOLETE .*mov       a1,\\(0x80.*\\).*
+# OBSOLETE .*mov       a1,\\(0x1ffff.*\\).*
+# OBSOLETE .*mov       8,d1.*
+# OBSOLETE .*mov       256,d1.*
+# OBSOLETE .*mov       131071,d1.*
+# OBSOLETE .*mov       256,a1.*
+# OBSOLETE .*mov       131071,a1.*
+# OBSOLETE .*$gdb_prompt $" { pass "mov4 tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "mov4 tests" }
+# OBSOLETE     timeout { fail "(timeout) mov4 tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc movb_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/12 movb_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*movb      \\(8,a2\\),d1.*
+# OBSOLETE .*movb      \\(256,a2\\),d1.*
+# OBSOLETE .*movb      \\(131071,a2\\),d1.*
+# OBSOLETE .*movb      \\(d2,a2\\),d3.*
+# OBSOLETE .*movb      \\(0x1ffff.*\\),d2.*
+# OBSOLETE .*movb      d1,\\(a2\\).*
+# OBSOLETE .*movb      d1,\\(8,a2\\).*
+# OBSOLETE .*movb      d1,\\(256,a2\\).*
+# OBSOLETE .*movb      d1,\\(131071,a2\\).*
+# OBSOLETE .*movb      d1,\\(d2,a2\\).*
+# OBSOLETE .*movb      d1,\\(0x100.*\\).*
+# OBSOLETE .*movb      d1,\\(0x1ffff.*\\).*
+# OBSOLETE .*$gdb_prompt $" { pass "movb tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "movb tests" }
+# OBSOLETE     timeout { fail "(timeout) movb tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc movbu_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/7 movbu_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*movbu     \\(a2\\),d1.*
+# OBSOLETE .*movbu     \\(8,a2\\),d1.*
+# OBSOLETE .*movbu     \\(256,a2\\),d1.*
+# OBSOLETE .*movbu     \\(131071,a2\\),d1.*
+# OBSOLETE .*movbu     \\(d1,a1\\),d2.*
+# OBSOLETE .*movbu     \\(0x8000.*\\),d1.*
+# OBSOLETE .*movbu     \\(0x1ffff.*\\),d1.*
+# OBSOLETE .*$gdb_prompt $" { pass "movbu tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "movbu tests" }
+# OBSOLETE     timeout { fail "(timeout) movbu tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc movx_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/6 movx_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*movx      \\(8,a2\\),d1.*
+# OBSOLETE .*movx      \\(256,a2\\),d1.*
+# OBSOLETE .*movx      \\(131071,a2\\),d1.*
+# OBSOLETE .*movx      d1,\\(8,a2\\).*
+# OBSOLETE .*movx      d1,\\(256,a2\\).*
+# OBSOLETE .*movx      d1,\\(131071,a2\\).*
+# OBSOLETE .*$gdb_prompt $" { pass "movx tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "movx tests" }
+# OBSOLETE     timeout { fail "(timeout) movx tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc muldiv_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/3 muldiv_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*mul       d1,d2.*
+# OBSOLETE .*mulu      d2,d3.*
+# OBSOLETE .*divu      d3,d2.*
+# OBSOLETE .*$gdb_prompt $" { pass "muldiv tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "muldiv tests" }
+# OBSOLETE     timeout { fail "(timeout) muldiv tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc misc_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/9 misc_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*jmp       0x\[0-9a-f]+ <main>.*
+# OBSOLETE .*jmp       0x\[0-9a-f]+ <start>.*
+# OBSOLETE .*jmp       \\(a2\\).*
+# OBSOLETE .*jsr       0x\[0-9a-f]+ <main>.*
+# OBSOLETE .*jsr       0x\[0-9a-f]+ <start>.*
+# OBSOLETE .*jsr       \\(a2\\).*
+# OBSOLETE .*rts.*
+# OBSOLETE .*rti.*
+# OBSOLETE .*nop.*
+# OBSOLETE .*$gdb_prompt $" { pass "misc tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "misc tests" }
+# OBSOLETE     timeout { fail "(timeout) misc tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc shift_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/4i shift_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*asr       d2.*
+# OBSOLETE .*lsr       d3.*
+# OBSOLETE .*ror       d1.*
+# OBSOLETE .*rol       d2.*
+# OBSOLETE .*$gdb_prompt $" { pass "shift tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "shift tests" }
+# OBSOLETE     timeout { fail "(timeout) shift tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE proc sub_tests { } {
+# OBSOLETE     global gdb_prompt
+# OBSOLETE     global hex
+# OBSOLETE     global decimal
+# OBSOLETE 
+# OBSOLETE     send_gdb "x/9i sub_tests\n"
+# OBSOLETE     gdb_expect {
+# OBSOLETE     -re "
+# OBSOLETE .*sub       d1,d2.*
+# OBSOLETE .*sub       d2,a3.*
+# OBSOLETE .*sub       a3,d3.*
+# OBSOLETE .*sub       a3,a2.*
+# OBSOLETE .*sub       32767,d2.*
+# OBSOLETE .*sub       131071,d2.*
+# OBSOLETE .*sub       32767,a2.*
+# OBSOLETE .*sub       131071,a2.*
+# OBSOLETE .*subc      d1,d2.*
+# OBSOLETE .*$gdb_prompt $" { pass "sub tests" }
+# OBSOLETE     -re "$gdb_prompt $" { fail "sub tests" }
+# OBSOLETE     timeout { fail "(timeout) sub tests" }
+# OBSOLETE     }
+# OBSOLETE }
+# OBSOLETE 
+# OBSOLETE # Start with a fresh gdb.
+# OBSOLETE 
+# OBSOLETE gdb_exit
+# OBSOLETE gdb_start
+# OBSOLETE gdb_reinitialize_dir $srcdir/$subdir
+# OBSOLETE gdb_load $binfile
+# OBSOLETE 
+# OBSOLETE add_tests
+# OBSOLETE bcc_tests
+# OBSOLETE bccx_tests
+# OBSOLETE bit_tests
+# OBSOLETE cmp_tests
+# OBSOLETE extend_tests
+# OBSOLETE logical_tests
+# OBSOLETE mov_tests_1
+# OBSOLETE mov_tests_2
+# OBSOLETE mov_tests_3
+# OBSOLETE mov_tests_4
+# OBSOLETE movb_tests
+# OBSOLETE movbu_tests
+# OBSOLETE movx_tests
+# OBSOLETE muldiv_tests
+# OBSOLETE misc_tests
+# OBSOLETE shift_tests
+# OBSOLETE sub_tests
index 2e2a82e..d089462 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-23  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * mi-syn-frame.exp: Don't run this test when gdb,nosignals is set.
+
 2002-12-13  Jeff Johnston  <jjohnstn@redhat.com>
 
        * mi-basics.exp: Change tests for -environment-directory.  Also add
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
new file mode 100644 (file)
index 0000000..62501e0
--- /dev/null
@@ -0,0 +1,208 @@
+# Copyright 2002, 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file tests that GDB's console can be accessed via the MI.
+# Specifically, we are testing the "interpreter-exec" command and that
+# the commands that are executed via this command are properly executed.
+# Console commands executed via MI should use MI output wrappers, MI event
+# handlers, etc.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+    continue
+}
+
+set testfile "basics"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
+     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+mi_gdb_reinitialize_dir $srcdir/$subdir
+
+mi_gdb_test "-interpreter-exec" \
+  {\^error,msg="mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command"} \
+  "-interpreter-exec with no arguments"
+
+mi_gdb_test "-interpreter-exec console" \
+  {\^error,msg="mi_cmd_interpreter_exec: Usage: -interpreter-exec interp command"} \
+  "-interpreter-exec with one argument"
+
+mi_gdb_test "-interpreter-exec bogus command" \
+  {\^error,msg="mi_cmd_interpreter_exec: could not find interpreter \\\"bogus\\\""} \
+  "-interpreter-exec with bogus interpreter"
+
+set msg {Undefined command: \\\"bogus\\\"\.  Try \\\"help\\\"\.}
+mi_gdb_test "-interpreter-exec console bogus" \
+    "&\\\"$msg\\\\n\\\".*\\^error,msg=\\\"$msg\\\".*" \
+  "-interpreter-exec console bogus"
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
+#   {(=.*)+\^done} \
+#   "-interpreter-exec console \"file \$binfile\""
+mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
+  {\^done} \
+  "-interpreter-exec console \"file \$binfile\""
+
+mi_run_to_main
+
+mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
+  {\^done} \
+  "-interpreter-exec console \"set args foobar\""
+
+mi_gdb_test "-interpreter-exec console \"show args\"" \
+  {\~"Argument list to give program being debugged when it is started is \\\"foobar\\\"\.\\n".*\^done} \
+  "-interpreter-exec console \"show args\""
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"break callee4\"" \
+#   {(&.*)*.*~"Breakpoint 2 at.*\\n".*=breakpoint-create,number="2".*\^done} \
+#   "-interpreter-exec console \"break callee4\""
+mi_gdb_test "-interpreter-exec console \"break callee4\"" \
+  {(&.*)*.*~"Breakpoint 2 at.*\\n".*\^done} \
+  "-interpreter-exec console \"break callee4\""
+
+mi_gdb_test "-interpreter-exec console \"info break\"" \
+  {\~"Num[ \t]*Type[ \t]*Disp[ \t]*Enb[ \t]*Address[ \t]*What\\n".*~"2[ \t]*breakpoint[ \t]*keep[ \t]*y[ \t]*0x[0-9A-Fa-f]+[ \t]*in callee4 at .*basics.c:[0-9]+\\n".*\^done} \
+  "-interpreter-exec console \"info break\""
+
+mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
+  {\^done} \
+  "-interpreter-exec console \"set listsize 1\""
+
+mi_gdb_test "-interpreter-exec console \"list\"" \
+  {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done} \
+  "-interpreter-exec console \"list\""
+
+# # NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-exec-continue" \
+#    {.*\*stopped,reason="breakpoint-hit",.*func="callee4".*file=".*basics.c",line="8"\}} \
+#    "-interpreter-exec console \"continue to callee4\""
+send_gdb "999-exec-continue\n"
+gdb_expect {
+    -re "999\\^running\[\r\n\]+$mi_gdb_prompt.*999\\*stopped,reason=.breakpoint-hit.*$mi_gdb_prompt$" {
+       pass "continue to callee4"
+    }
+    timeout {
+       fail "continue to callee4 (timeout)"
+    }
+}
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "100-interpreter-exec console \"delete 2\"" \
+#   {.*=breakpoint-delete,number=\"2\".*\^done} \
+#   "-interpreter-exec console \"delete 2\""
+mi_gdb_test "100-interpreter-exec console \"delete 2\"" \
+  {100\^done} \
+  "-interpreter-exec console \"delete 2\""
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "200-interpreter-exec console \"up\"" \
+#   {.*=selected-frame-level-changed,level="1".*\^done} \
+#   "-interpreter-exec console \"up\""
+mi_gdb_test "200-interpreter-exec console \"up\"" \
+  {200\^done} \
+  "-interpreter-exec console \"up\""
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "300-interpreter-exec console \"down\"" \
+#   {.*=selected-frame-level-changed,level="0".*\^done} \
+#   "-interpreter-exec console \"down\""
+mi_gdb_test "300-interpreter-exec console \"down\"" \
+  {300\^done} \
+  "-interpreter-exec console \"down\""
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"frame 2\"" \
+#   {.*=selected-frame-level-changed,level="2".*\^done} \
+#   "-interpreter-exec console \"frame 2\""
+mi_gdb_test "400-interpreter-exec console \"frame 2\"" \
+  {400\^done} \
+  "-interpreter-exec console \"frame 2\""
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-stack-select-frame 0" \
+#   {.*=selected-frame-level-changed,level="0".*\^done} \
+#   "-stack-select-frame 0"
+mi_gdb_test "500-stack-select-frame 0" \
+  {500\^done} \
+  "-stack-select-frame 0"
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-break-insert -t basics.c:35" \
+#   {.*=breakpoint-create,number="3".*\^done} \
+#   "-break-insert -t basics.c:35"
+mi_gdb_test "600-break-insert -t basics.c:35" \
+       {600\^done,bkpt=.number="3",type="breakpoint".*\}} \
+       "-break-insert -t basics.c:35"
+
+# mi_gdb_test "-exec-continue" \
+#   {.*\*stopped.*,file=".*basics.c",line="35"\}} \
+#   "-exec-continue to line 35"
+send_gdb "700-exec-continue\n"
+gdb_expect {
+    -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.35.*$mi_gdb_prompt$" {
+       pass "-exec-continue to line 35"
+    }
+    timeout {
+       fail "-exec-continue to line 35"
+    }
+}
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-exec-next" \
+#   {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
+#   "-exec-next to line 37"
+send_gdb "800-exec-next\n"
+gdb_expect {
+    -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.37.*$mi_gdb_prompt$" {
+       pass "-exec-next to line 37"
+    }
+    timeout {
+       fail "-exec-next to line 37"
+    }
+}
+
+mi_gdb_test "-interpreter-exec console \"list\"" \
+  {\~"37[ \t(\\t)]*return 0;\\n".*\^done} \
+  "-interpreter-exec console \"list\" at basics.c:37"
+
+mi_gdb_test "-interpreter-exec console \"help set args\"" \
+  {\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \
+  "-interpreter-exec console \"help set args\""
+
+# NOTE: cagney/2003-02-03: Not yet.
+# mi_gdb_test "-interpreter-exec console \"set \$pc=0x0\"" \
+#   {.*=target-changed.*\^done} \
+#   "-interpreter-exec console \"set \$pc=0x0\""
+mi_gdb_test "888-interpreter-exec console \"set \$pc=0x0\"" \
+  {888\^done} \
+  "-interpreter-exec console \"set \$pc=0x0\""
+
+#mi_gdb_test "-interpreter-exec console \"\"" \
+  {} \
+  "-interpreter-exec console \"\""
+
+mi_gdb_exit
+return 0
index 83d2d46..580b534 100644 (file)
@@ -43,11 +43,16 @@ handler (int sig)
   subroutine (sig);
 }
 
+/* The first statement in subroutine () is a place for a breakpoint.  
+   Without it, the breakpoint is put on the while comparison and will
+   be hit at each iteration. */
+
 void
 subroutine (int in)
 {
-  while (in < 100)
-    in++;
+  int count = in;
+  while (count < 100)
+    count++;
 }
 
 void
index 49f9772..44ce845 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 2002, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # Test MI output with synthetic frames on the stack (call dummies,
 # signal handlers).
 
+if [target_info exists gdb,nosignals] {
+    verbose "Skipping mi-syn-frame.exp because of nosignals."
+    continue
+}
+
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
index b416c3b..89bd185 100644 (file)
@@ -8,7 +8,7 @@ all info install-info dvi install uninstall installcheck check:
 
 clean mostlyclean:
        -rm -f actions circ collection limits
-       -rm -f *.o *.diff *~ *.bad core sh3 hppa mn10200 mn10300
+       -rm -f *.o *.diff *~ *.bad core sh3 hppa mn10300
 
 distclean maintainer-clean realclean: clean
        -rm -f Makefile config.status config.log
index dca41dc..d2b6fbd 100644 (file)
@@ -1004,6 +1004,15 @@ proc skip_cplus_tests {} {
     if { [istarget "h8300-*-*"] } {
        return 1
     }
+
+    # The C++ IO streams are too large for HC11/HC12 and are thus not
+    # available.  The gdb C++ tests use them and don't compile.
+    if { [istarget "m6811-*-*"] } {
+       return 1
+    }
+    if { [istarget "m6812-*-*"] } {
+       return 1
+    }
     return 0
 }
 
index f36def1..2c70ee5 100644 (file)
@@ -261,11 +261,12 @@ do_captured_list_thread_ids (struct ui_out *uiout,
 {
   struct thread_info *tp;
   int num = 0;
+  struct cleanup *cleanup_chain;
 
   prune_threads ();
   target_find_new_threads ();
 
-  ui_out_tuple_begin (uiout, "thread-ids");
+  cleanup_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "thread-ids");
 
   for (tp = thread_list; tp; tp = tp->next)
     {
@@ -273,7 +274,7 @@ do_captured_list_thread_ids (struct ui_out *uiout,
       ui_out_field_int (uiout, "thread-id", tp->num);
     }
 
-  ui_out_tuple_end (uiout);
+  do_cleanups (cleanup_chain);
   ui_out_field_int (uiout, "number-of-threads", num);
   return GDB_RC_OK;
 }
index dcffb05..fea71df 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2124,19 +2124,4 @@ gdb_init (char *argv0)
      it wants GDB to revert to the CLI, it should clear init_ui_hook. */
   if (init_ui_hook)
     init_ui_hook (argv0);
-
-  /* Install the default UI */
-  if (!init_ui_hook)
-    {
-      uiout = cli_out_new (gdb_stdout);
-
-      /* All the interpreters should have had a look at things by now.
-        Initialize the selected interpreter. */
-      if (interpreter_p)
-       {
-         fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
-                             interpreter_p);
-         exit (1);
-       }
-    }
 }
index cd1c752..855a5b2 100644 (file)
@@ -1,6 +1,6 @@
 /* Tracing functionality for remote targets in custom GDB protocol
 
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
    Foundation, Inc.
 
    This file is part of GDB.
@@ -37,6 +37,7 @@
 #include "regcache.h"
 #include "completer.h"
 #include "gdb-events.h"
+#include "block.h"
 
 #include "ax.h"
 #include "ax-gdb.h"
@@ -279,12 +280,12 @@ set_traceframe_context (CORE_ADDR trace_pc)
 
   /* save func name as "$trace_func", a debugger variable visible to users */
   if (traceframe_fun == NULL ||
-      SYMBOL_NAME (traceframe_fun) == NULL)
+      DEPRECATED_SYMBOL_NAME (traceframe_fun) == NULL)
     set_internalvar (lookup_internalvar ("trace_func"),
                     value_from_pointer (charstar, (LONGEST) 0));
   else
     {
-      len = strlen (SYMBOL_NAME (traceframe_fun));
+      len = strlen (DEPRECATED_SYMBOL_NAME (traceframe_fun));
       func_range = create_range_type (func_range,
                                      builtin_type_int, 0, len - 1);
       func_string = create_array_type (func_string,
@@ -292,7 +293,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
       func_val = allocate_value (func_string);
       VALUE_TYPE (func_val) = func_string;
       memcpy (VALUE_CONTENTS_RAW (func_val),
-             SYMBOL_NAME (traceframe_fun),
+             DEPRECATED_SYMBOL_NAME (traceframe_fun),
              len);
       func_val->modifiable = 0;
       set_internalvar (lookup_internalvar ("trace_func"), func_val);
@@ -508,7 +509,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
          if (sym)
            {
              fputs_filtered ("in ", gdb_stdout);
-             fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
+             fputs_filtered (SYMBOL_PRINT_NAME (sym), gdb_stdout);
              wrap_here (wrap_indent);
              fputs_filtered (" at ", gdb_stdout);
            }
@@ -959,14 +960,14 @@ validate_actionline (char **line, struct tracepoint *t)
              if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_CONST)
                {
                  warning ("constant %s (value %ld) will not be collected.",
-                          SYMBOL_NAME (exp->elts[2].symbol),
+                          DEPRECATED_SYMBOL_NAME (exp->elts[2].symbol),
                           SYMBOL_VALUE (exp->elts[2].symbol));
                  return BADLINE;
                }
              else if (SYMBOL_CLASS (exp->elts[2].symbol) == LOC_OPTIMIZED_OUT)
                {
                  warning ("%s is optimized away and cannot be collected.",
-                          SYMBOL_NAME (exp->elts[2].symbol));
+                          DEPRECATED_SYMBOL_NAME (exp->elts[2].symbol));
                  return BADLINE;
                }
            }
@@ -1186,11 +1187,11 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
     {
     default:
       printf_filtered ("%s: don't know symbol class %d\n",
-                      SYMBOL_NAME (sym), SYMBOL_CLASS (sym));
+                      DEPRECATED_SYMBOL_NAME (sym), SYMBOL_CLASS (sym));
       break;
     case LOC_CONST:
       printf_filtered ("constant %s (value %ld) will not be collected.\n",
-                      SYMBOL_NAME (sym), SYMBOL_VALUE (sym));
+                      DEPRECATED_SYMBOL_NAME (sym), SYMBOL_VALUE (sym));
       break;
     case LOC_STATIC:
       offset = SYMBOL_VALUE_ADDRESS (sym);
@@ -1200,7 +1201,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
 
          sprintf_vma (tmp, offset);
          printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n",
-                          SYMBOL_NAME (sym), len, tmp /* address */);
+                          DEPRECATED_SYMBOL_NAME (sym), len, tmp /* address */);
        }
       add_memrange (collect, -1, offset, len); /* 0 == memory */
       break;
@@ -1208,7 +1209,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
     case LOC_REGPARM:
       reg = SYMBOL_VALUE (sym);
       if (info_verbose)
-       printf_filtered ("LOC_REG[parm] %s: ", SYMBOL_NAME (sym));
+       printf_filtered ("LOC_REG[parm] %s: ", DEPRECATED_SYMBOL_NAME (sym));
       add_register (collect, reg);
       /* check for doubles stored in two registers */
       /* FIXME: how about larger types stored in 3 or more regs? */
@@ -1219,7 +1220,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
     case LOC_REF_ARG:
       printf_filtered ("Sorry, don't know how to do LOC_REF_ARG yet.\n");
       printf_filtered ("       (will not collect %s)\n",
-                      SYMBOL_NAME (sym));
+                      DEPRECATED_SYMBOL_NAME (sym));
       break;
     case LOC_ARG:
       reg = frame_regno;
@@ -1227,7 +1228,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
       if (info_verbose)
        {
          printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ",
-                          SYMBOL_NAME (sym), len);
+                          DEPRECATED_SYMBOL_NAME (sym), len);
          printf_vma (offset);
          printf_filtered (" from frame ptr reg %d\n", reg);
        }
@@ -1239,7 +1240,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
       if (info_verbose)
        {
          printf_filtered ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset ",
-                          SYMBOL_NAME (sym), len);
+                          DEPRECATED_SYMBOL_NAME (sym), len);
          printf_vma (offset);
          printf_filtered (" from reg %d\n", reg);
        }
@@ -1252,7 +1253,7 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
       if (info_verbose)
        {
          printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ",
-                          SYMBOL_NAME (sym), len);
+                          DEPRECATED_SYMBOL_NAME (sym), len);
          printf_vma (offset);
          printf_filtered (" from frame ptr reg %d\n", reg);
        }
@@ -1265,18 +1266,18 @@ collect_symbol (struct collection_list *collect, struct symbol *sym,
       if (info_verbose)
        {
          printf_filtered ("LOC_BASEREG %s: collect %ld bytes at offset ",
-                          SYMBOL_NAME (sym), len);
+                          DEPRECATED_SYMBOL_NAME (sym), len);
          printf_vma (offset);
          printf_filtered (" from basereg %d\n", reg);
        }
       add_memrange (collect, reg, offset, len);
       break;
     case LOC_UNRESOLVED:
-      printf_filtered ("Don't know LOC_UNRESOLVED %s\n", SYMBOL_NAME (sym));
+      printf_filtered ("Don't know LOC_UNRESOLVED %s\n", DEPRECATED_SYMBOL_NAME (sym));
       break;
     case LOC_OPTIMIZED_OUT:
       printf_filtered ("%s has been optimized out of existence.\n",
-                      SYMBOL_NAME (sym));
+                      DEPRECATED_SYMBOL_NAME (sym));
       break;
     }
 }
@@ -1300,7 +1301,7 @@ add_local_symbols (struct collection_list *collect, CORE_ADDR pc,
            {
            default:
              warning ("don't know how to trace local symbol %s", 
-                      SYMBOL_NAME (sym));
+                      DEPRECATED_SYMBOL_NAME (sym));
            case LOC_LOCAL:
            case LOC_STATIC:
            case LOC_REGISTER:
@@ -2355,7 +2356,7 @@ scope_info (char *args, int from_tty)
            printf_filtered ("Scope for %s:\n", save_args);
          count++;
 
-         symname = SYMBOL_NAME (sym);
+         symname = DEPRECATED_SYMBOL_NAME (sym);
          if (symname == NULL || *symname == '\0')
            continue;           /* probably botched, certainly useless */
 
@@ -2431,7 +2432,7 @@ scope_info (char *args, int from_tty)
                               REGISTER_NAME (SYMBOL_BASEREG (sym)));
              break;
            case LOC_UNRESOLVED:
-             msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, NULL);
+             msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (sym), NULL, NULL);
              if (msym == NULL)
                printf_filtered ("Unresolved Static");
              else
index 88ad5e7..c3e659d 100644 (file)
@@ -1,3 +1,25 @@
+2003-02-14  Andrew Cagney  <ac131313@redhat.com>
+
+       * tui.c (tui_enable, tui_disable): Don't modify tui_version.
+       (tui_is_window_visible, tui_get_command_dimension): Test
+       tui_active instead of tui_version.
+       * tuiData.h (tui_version): Delete declaration.
+       * tui-hooks.c (tui_init_hook, tui_event_loop): Delete function,
+       moved to "tui-interp.c".
+       (tui_exit, tui_command_loop): Ditto.
+       (_initialize_tui): Don't initialize init_ui_hook.  Initialize
+       target_new_objfile_hook.
+       * tui-interp.c: New file.
+
+2003-02-12  Andrew Cagney  <ac131313@redhat.com>
+
+       * tuiIO.c (tui_prep_terminal): Add one notused parameter.
+       * tui.c (tui_rl_switch_mode): Add two notused parameters.
+       (tui_rl_change_windows, tui_rl_next_keymap): Ditto.
+       (tui_rl_delete_other_windows): Ditto.
+       (tui_rl_change_windows, tui_rl_delete_other_windows): Update
+       calls.
+
 2002-12-08  Elena Zannoni  <ezannoni@redhat.com>
 
        Import of readline 4.3.
index ff36d49..db6c3f6 100644 (file)
@@ -69,8 +69,6 @@
 int tui_target_has_run = 0;
 
 static void (* tui_target_new_objfile_chain) (struct objfile*);
-static void tui_event_loop (void);
-static void tui_command_loop (void);
 
 static void
 tui_new_objfile_hook (struct objfile* objfile)
@@ -325,131 +323,12 @@ tui_remove_hooks (void)
   set_gdb_event_hooks (tui_old_event_hooks);
 }
 
-/* Cleanup the tui before exiting.  */
-static void
-tui_exit (void)
-{
-  /* Disable the tui.  Curses mode is left leaving the screen
-     in a clean state (see endwin()).  */
-  tui_disable ();
-}
-
-/* Initialize all the necessary variables, start the event loop,
-   register readline, and stdin, start the loop. */
-static void
-tui_command_loop (void)
-{
-  int length;
-  char *a_prompt;
-  char *gdb_prompt = get_prompt ();
-
-  /* If we are using readline, set things up and display the first
-     prompt, otherwise just print the prompt. */
-  if (async_command_editing_p)
-    {
-      /* Tell readline what the prompt to display is and what function it
-         will need to call after a whole line is read. This also displays
-         the first prompt. */
-      length = strlen (PREFIX (0)) + strlen (gdb_prompt) + strlen (SUFFIX (0)) + 1;
-      a_prompt = (char *) xmalloc (length);
-      strcpy (a_prompt, PREFIX (0));
-      strcat (a_prompt, gdb_prompt);
-      strcat (a_prompt, SUFFIX (0));
-      rl_callback_handler_install (a_prompt, input_handler);
-    }
-  else
-    display_gdb_prompt (0);
-
-  /* Now it's time to start the event loop. */
-  tui_event_loop ();
-}
-
-/* Start up the event loop. This is the entry point to the event loop
-   from the command loop. */
-
-static void
-tui_event_loop (void)
-{
-  /* Loop until there is nothing to do. This is the entry point to the
-     event loop engine. gdb_do_one_event, called via catch_errors()
-     will process one event for each invocation.  It blocks waits for
-     an event and then processes it.  >0 when an event is processed, 0
-     when catch_errors() caught an error and <0 when there are no
-     longer any event sources registered. */
-  while (1)
-    {
-      int result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL);
-      if (result < 0)
-       break;
-
-      /* Update gdb output according to TUI mode.  Since catch_errors
-         preserves the uiout from changing, this must be done at top
-         level of event loop.  */
-      if (tui_active)
-        uiout = tui_out;
-      else
-        uiout = tui_old_uiout;
-      
-      if (result == 0)
-       {
-         /* FIXME: this should really be a call to a hook that is
-            interface specific, because interfaces can display the
-            prompt in their own way. */
-         display_gdb_prompt (0);
-         /* This call looks bizarre, but it is required.  If the user
-            entered a command that caused an error,
-            after_char_processing_hook won't be called from
-            rl_callback_read_char_wrapper.  Using a cleanup there
-            won't work, since we want this function to be called
-            after a new prompt is printed.  */
-         if (after_char_processing_hook)
-           (*after_char_processing_hook) ();
-         /* Maybe better to set a flag to be checked somewhere as to
-            whether display the prompt or not. */
-       }
-    }
+void _initialize_tui_hooks (void);
 
-  /* We are done with the event loop. There are no more event sources
-     to listen to.  So we exit GDB. */
-  return;
-}
-
-/* Initialize the tui by installing several gdb hooks, initializing
-   the tui IO and preparing the readline with the kind binding.  */
-static void
-tui_init_hook (char *argv0)
+void
+_initialize_tui_hooks (void)
 {
-  /* Don't enable the TUI if a specific interpreter is installed.  */
-  if (interpreter_p)
-    return;
-
-  /* Install exit handler to leave the screen in a good shape.  */
-  atexit (tui_exit);
-
-  initializeStaticData ();
-
   /* Install the permanent hooks.  */
   tui_target_new_objfile_chain = target_new_objfile_hook;
   target_new_objfile_hook = tui_new_objfile_hook;
-
-  tui_initialize_io ();
-  tui_initialize_readline ();
-
-  /* Tell gdb to use the tui_command_loop as the main loop. */
-  command_loop_hook = tui_command_loop;
-
-  /* Decide in which mode to start using GDB (based on -tui).  */
-  if (tui_version)
-    {
-      tui_enable ();
-    }
 }
-
-/* Initialize the tui.  */
-void
-_initialize_tui (void)
-{
-  /* Setup initialization hook.  */
-  init_ui_hook = tui_init_hook;
-}
-
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
new file mode 100644 (file)
index 0000000..f935ea4
--- /dev/null
@@ -0,0 +1,180 @@
+/* TUI Interpreter definitions for GDB, the GNU debugger.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "interps.h"
+#include "top.h"
+#include "event-top.h"
+#include "event-loop.h"
+#include "ui-out.h"
+#include "tui/tuiData.h"
+#include "readline/readline.h"
+#include "tui/tuiWin.h"
+#include "tui/tui.h"
+#include "tui/tuiIO.h"
+
+/* Cleanup the tui before exiting.  */
+
+static void
+tui_exit (void)
+{
+  /* Disable the tui.  Curses mode is left leaving the screen
+     in a clean state (see endwin()).  */
+  tui_disable ();
+}
+
+/* These implement the TUI interpreter.  */
+
+static void *
+tui_init (void)
+{
+  /* Install exit handler to leave the screen in a good shape.  */
+  atexit (tui_exit);
+
+  initializeStaticData ();
+
+  tui_initialize_io ();
+  tui_initialize_readline ();
+
+  return NULL;
+}
+
+static int
+tui_resume (void *data)
+{
+  gdb_setup_readline ();
+  tui_enable ();
+  return 1;
+}
+
+static int
+tui_suspend (void *data)
+{
+  tui_disable ();
+  return 1;
+}
+
+/* Display the prompt if we are silent.  */
+
+static int
+tui_display_prompt_p (void *data)
+{
+  if (interp_quiet_p (NULL))
+    return 0;
+  else
+    return 1;
+}
+
+static int
+tui_exec (void *data, const char *command_str)
+{
+  internal_error (__FILE__, __LINE__, "tui_exec called");
+}
+
+
+/* Initialize all the necessary variables, start the event loop,
+   register readline, and stdin, start the loop.  */
+
+static void
+tui_command_loop (void *data)
+{
+  int length;
+  char *a_prompt;
+  char *gdb_prompt = get_prompt ();
+
+  /* If we are using readline, set things up and display the first
+     prompt, otherwise just print the prompt.  */
+  if (async_command_editing_p)
+    {
+      /* Tell readline what the prompt to display is and what function
+         it will need to call after a whole line is read. This also
+         displays the first prompt.  */
+      length = strlen (PREFIX (0)) + strlen (gdb_prompt) + strlen (SUFFIX (0)) + 1;
+      a_prompt = (char *) xmalloc (length);
+      strcpy (a_prompt, PREFIX (0));
+      strcat (a_prompt, gdb_prompt);
+      strcat (a_prompt, SUFFIX (0));
+      rl_callback_handler_install (a_prompt, input_handler);
+    }
+  else
+    display_gdb_prompt (0);
+
+  /* Loop until there is nothing to do. This is the entry point to the
+     event loop engine. gdb_do_one_event, called via catch_errors()
+     will process one event for each invocation.  It blocks waits for
+     an event and then processes it.  >0 when an event is processed, 0
+     when catch_errors() caught an error and <0 when there are no
+     longer any event sources registered.  */
+  while (1)
+    {
+      int result = catch_errors (gdb_do_one_event, 0, "", RETURN_MASK_ALL);
+      if (result < 0)
+       break;
+
+      /* Update gdb output according to TUI mode.  Since catch_errors
+         preserves the uiout from changing, this must be done at top
+         level of event loop.  */
+      if (tui_active)
+        uiout = tui_out;
+      else
+        uiout = tui_old_uiout;
+      
+      if (result == 0)
+       {
+         /* FIXME: this should really be a call to a hook that is
+            interface specific, because interfaces can display the
+            prompt in their own way.  */
+         display_gdb_prompt (0);
+         /* This call looks bizarre, but it is required.  If the user
+            entered a command that caused an error,
+            after_char_processing_hook won't be called from
+            rl_callback_read_char_wrapper.  Using a cleanup there
+            won't work, since we want this function to be called
+            after a new prompt is printed.  */
+         if (after_char_processing_hook)
+           (*after_char_processing_hook) ();
+         /* Maybe better to set a flag to be checked somewhere as to
+            whether display the prompt or not.  */
+       }
+    }
+
+  /* We are done with the event loop. There are no more event sources
+     to listen to.  So we exit GDB.  */
+  return;
+}
+
+void
+_initialize_tui_interp (void)
+{
+  static const struct interp_procs procs = {
+    tui_init,
+    tui_resume,
+    tui_suspend,
+    tui_exec,
+    tui_display_prompt_p,
+    tui_command_loop,
+  };
+  struct interp *tui_interp;
+
+  /* Create a default uiout builder for the TUI. */
+  tui_out = tui_out_new (gdb_stdout);
+  interp_add (interp_new ("tui", NULL, tui_out, &procs));
+}
index d5cde22..517cf46 100644 (file)
@@ -102,7 +102,7 @@ static Keymap tui_readline_standard_keymap;
 /* TUI readline command.
    Switch the output mode between TUI/standard gdb.  */
 static int
-tui_rl_switch_mode (void)
+tui_rl_switch_mode (int notused1, int notused2)
 {
   if (tui_active)
     {
@@ -138,10 +138,10 @@ tui_rl_switch_mode (void)
    a functionality close to the Emacs split-window command.  We always
    show two windows (src+asm), (src+regs) or (asm+regs).  */
 static int
-tui_rl_change_windows (void)
+tui_rl_change_windows (int notused1, int notused2)
 {
   if (!tui_active)
-    tui_rl_switch_mode ();
+    tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
 
   if (tui_active)
     {
@@ -186,10 +186,10 @@ tui_rl_change_windows (void)
 /* TUI readline command.
    Delete the second TUI window to only show one.  */
 static int
-tui_rl_delete_other_windows (void)
+tui_rl_delete_other_windows (int notused1, int notused2)
 {
   if (!tui_active)
-    tui_rl_switch_mode ();
+    tui_rl_switch_mode (0/*notused*/, 0/*notused*/);
 
   if (tui_active)
     {
@@ -255,7 +255,7 @@ tui_rl_command_mode (int count, int key)
 /* TUI readline command.
    Switch between TUI SingleKey mode and gdb readline editing.  */
 static int
-tui_rl_next_keymap (void)
+tui_rl_next_keymap (int notused1, int notused2)
 {
   tui_set_key_mode (tui_current_key_mode == tui_command_mode
                     ? tui_single_key_mode : tui_command_mode);
@@ -393,7 +393,6 @@ tui_enable (void)
   
   tui_setup_io (1);
 
-  tui_version = 1;
   tui_active = 1;
   if (deprecated_selected_frame)
      tuiShowFrameInfo (deprecated_selected_frame);
@@ -435,7 +434,6 @@ tui_disable (void)
   /* Update gdb's knowledge of its terminal.  */
   target_terminal_save_ours ();
 
-  tui_version = 0;
   tui_active = 0;
   tui_update_gdb_sizes ();
 }
@@ -563,7 +561,7 @@ tui_show_assembly (CORE_ADDR addr)
 int
 tui_is_window_visible (TuiWinType type)
 {
-  if (tui_version == 0)
+  if (tui_active == 0)
     return 0;
 
   if (winList[type] == 0)
@@ -575,7 +573,7 @@ tui_is_window_visible (TuiWinType type)
 int
 tui_get_command_dimension (int *width, int *height)
 {
-  if (!tui_version || !m_winPtrNotNull (cmdWin))
+  if (!tui_active || !m_winPtrNotNull (cmdWin))
     {
       return 0;
     }
index 8a4eb9f..6fcf875 100644 (file)
@@ -328,7 +328,6 @@ TuiWinInfo, *TuiWinInfoPtr;
 
 /* Global Data */
 extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
-extern int tui_version;
 
 /* Macros */
 #define srcWin            winList[SRC_WIN]
index b9b373c..f53cef3 100644 (file)
@@ -262,7 +262,7 @@ tui_redisplay_readline (void)
 /* Readline callback to prepare the terminal.  It is called once
    each time we enter readline.  Terminal is already setup in curses mode.  */
 static void
-tui_prep_terminal (void)
+tui_prep_terminal (int notused1)
 {
   /* Save the prompt registered in readline to correctly display it.
      (we can't use gdb_prompt() due to secondary prompts and can't use
index 8e517a0..22a1eab 100644 (file)
@@ -67,16 +67,16 @@ typedef_print (struct type *type, struct symbol *new, struct ui_file *stream)
       fprintf_filtered (stream, "typedef ");
       type_print (type, "", stream, 0);
       if (TYPE_NAME ((SYMBOL_TYPE (new))) == 0
-         || !STREQ (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_NAME (new)))
-       fprintf_filtered (stream, " %s", SYMBOL_SOURCE_NAME (new));
+         || strcmp (TYPE_NAME ((SYMBOL_TYPE (new))), DEPRECATED_SYMBOL_NAME (new)) != 0)
+       fprintf_filtered (stream, " %s", SYMBOL_PRINT_NAME (new));
       break;
 #endif
 #ifdef _LANG_m2
     case language_m2:
       fprintf_filtered (stream, "TYPE ");
-      if (!TYPE_NAME (SYMBOL_TYPE (new)) ||
-         !STREQ (TYPE_NAME (SYMBOL_TYPE (new)), SYMBOL_NAME (new)))
-       fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
+      if (!TYPE_NAME (SYMBOL_TYPE (new))
+         || strcmp (TYPE_NAME ((SYMBOL_TYPE (new))), DEPRECATED_SYMBOL_NAME (new)) != 0)
+       fprintf_filtered (stream, "%s = ", SYMBOL_PRINT_NAME (new));
       else
        fprintf_filtered (stream, "<builtin> = ");
       type_print (type, "", stream, 0);
@@ -85,7 +85,7 @@ typedef_print (struct type *type, struct symbol *new, struct ui_file *stream)
 #ifdef _LANG_pascal
     case language_pascal:
       fprintf_filtered (stream, "type ");
-      fprintf_filtered (stream, "%s = ", SYMBOL_SOURCE_NAME (new));
+      fprintf_filtered (stream, "%s = ", SYMBOL_PRINT_NAME (new));
       type_print (type, "", stream, 0);
       break;
 #endif
index d98cf16..ed32da3 100644 (file)
@@ -273,7 +273,7 @@ static void init_ui_out_state (struct ui_out *uiout);
 
 /* Mark beginning of a table */
 
-void
+static void
 ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
                    int nr_rows,
                    const char *tblid)
@@ -318,7 +318,7 @@ columns.");
   uo_table_body (uiout);
 }
 
-void
+static void
 ui_out_table_end (struct ui_out *uiout)
 {
   if (!uiout->table.flag)
@@ -351,6 +351,22 @@ and before table_body.");
   uo_table_header (uiout, width, alignment, col_name, colhdr);
 }
 
+static void
+do_cleanup_table_end (void *data)
+{
+  struct ui_out *ui_out = data;
+
+  ui_out_table_end (ui_out);
+}
+
+struct cleanup *
+make_cleanup_ui_out_table_begin_end (struct ui_out *ui_out, int nr_cols,
+                                     int nr_rows, const char *tblid)
+{
+  ui_out_table_begin (ui_out, nr_cols, nr_rows, tblid);
+  return make_cleanup (do_cleanup_table_end, ui_out);
+}
+
 void
 ui_out_begin (struct ui_out *uiout,
              enum ui_out_type type,
@@ -388,19 +404,6 @@ specified after table_body.");
 }
 
 void
-ui_out_list_begin (struct ui_out *uiout,
-                  const char *id)
-{
-  ui_out_begin (uiout, ui_out_type_list, id);
-}
-
-void
-ui_out_tuple_begin (struct ui_out *uiout, const char *id)
-{
-  ui_out_begin (uiout, ui_out_type_tuple, id);
-}
-
-void
 ui_out_end (struct ui_out *uiout,
            enum ui_out_type type)
 {
@@ -408,18 +411,6 @@ ui_out_end (struct ui_out *uiout,
   uo_end (uiout, type, old_level);
 }
 
-void
-ui_out_list_end (struct ui_out *uiout)
-{
-  ui_out_end (uiout, ui_out_type_list);
-}
-
-void
-ui_out_tuple_end (struct ui_out *uiout)
-{
-  ui_out_end (uiout, ui_out_type_tuple);
-}
-
 struct ui_out_end_cleanup_data
 {
   struct ui_out *uiout;
@@ -458,7 +449,7 @@ struct cleanup *
 make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout,
                                     const char *id)
 {
-  ui_out_tuple_begin (uiout, id);
+  ui_out_begin (uiout, ui_out_type_tuple, id);
   return make_cleanup_ui_out_end (uiout, ui_out_type_tuple);
 }
 
@@ -466,7 +457,7 @@ struct cleanup *
 make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
                                    const char *id)
 {
-  ui_out_list_begin (uiout, id);
+  ui_out_begin (uiout, ui_out_type_list, id);
   return make_cleanup_ui_out_end (uiout, ui_out_type_list);
 }
 
index c8ed9dd..a52c345 100644 (file)
@@ -88,31 +88,21 @@ extern struct cleanup *ui_out_begin_cleanup_end (struct ui_out *uiout,
    implied structure: ``table = { hdr = { header, ... } , body = [ {
    field, ... }, ... ] }''. If NR_ROWS is negative then there is at
    least one row. */
-
-extern void ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
-                               int nr_rows, const char *tblid);
-
 extern void ui_out_table_header (struct ui_out *uiout, int width,
                                 enum ui_align align, const char *col_name,
                                 const char *colhdr);
 
 extern void ui_out_table_body (struct ui_out *uiout);
 
-extern void ui_out_table_end (struct ui_out *uiout);
-
+extern struct cleanup *make_cleanup_ui_out_table_begin_end (struct ui_out *ui_out,
+                                                            int nr_cols,
+                                                           int nr_rows,
+                                                           const char *tblid);
 /* Compatibility wrappers.  */
 
-extern void ui_out_list_begin (struct ui_out *uiout, const char *id);
-
-extern void ui_out_list_end (struct ui_out *uiout);
-
 extern struct cleanup *make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
                                                           const char *id);
 
-extern void ui_out_tuple_begin (struct ui_out *uiout, const char *id);
-
-extern void ui_out_tuple_end (struct ui_out *uiout);
-
 extern struct cleanup *make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout,
                                                            const char *id);
 
index 0e92b21..f7ece88 100644 (file)
@@ -831,7 +831,8 @@ safe_strerror (int errnum)
   char *msg;
   static char buf[32];
 
-  if ((msg = strerror (errnum)) == NULL)
+  msg = strerror (errnum);
+  if (msg == NULL)
     {
       sprintf (buf, "(undocumented errno %d)", errnum);
       msg = buf;
@@ -1447,14 +1448,15 @@ parse_escape (char **string_ptr)
          register int count = 0;
          while (++count < 3)
            {
-             if ((c = *(*string_ptr)++) >= '0' && c <= '7')
+             c = (**string_ptr);
+             if (c >= '0' && c <= '7')
                {
+                 (*string_ptr)++;
                  i *= 8;
                  i += c - '0';
                }
              else
                {
-                 (*string_ptr)--;
                  break;
                }
            }
@@ -1603,8 +1605,6 @@ init_page_info (void)
       chars_per_line = 80;
 
 #if !defined (_WIN32)
-      /* No termcap under MPW, although might be cool to do something
-         by looking at worksheet or console window sizes. */
       /* Initialize the screen height and width from termcap.  */
       {
        char *termtype = getenv ("TERM");
@@ -1640,7 +1640,7 @@ init_page_info (void)
              }
          }
       }
-#endif /* MPW */
+#endif
 
 #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER)
 
@@ -2357,6 +2357,94 @@ strcmp_iw (const char *string1, const char *string2)
     }
   return (*string1 != '\0' && *string1 != '(') || (*string2 != '\0');
 }
+
+/* This is like strcmp except that it ignores whitespace and treats
+   '(' as the first non-NULL character in terms of ordering.  Like
+   strcmp (and unlike strcmp_iw), it returns negative if STRING1 <
+   STRING2, 0 if STRING2 = STRING2, and positive if STRING1 > STRING2
+   according to that ordering.
+
+   If a list is sorted according to this function and if you want to
+   find names in the list that match some fixed NAME according to
+   strcmp_iw(LIST_ELT, NAME), then the place to start looking is right
+   where this function would put NAME.
+
+   Here are some examples of why using strcmp to sort is a bad idea:
+
+   Whitespace example:
+
+   Say your partial symtab contains: "foo<char *>", "goo".  Then, if
+   we try to do a search for "foo<char*>", strcmp will locate this
+   after "foo<char *>" and before "goo".  Then lookup_partial_symbol
+   will start looking at strings beginning with "goo", and will never
+   see the correct match of "foo<char *>".
+
+   Parenthesis example:
+
+   In practice, this is less like to be an issue, but I'll give it a
+   shot.  Let's assume that '$' is a legitimate character to occur in
+   symbols.  (Which may well even be the case on some systems.)  Then
+   say that the partial symbol table contains "foo$" and "foo(int)".
+   strcmp will put them in this order, since '$' < '('.  Now, if the
+   user searches for "foo", then strcmp will sort "foo" before "foo$".
+   Then lookup_partial_symbol will notice that strcmp_iw("foo$",
+   "foo") is false, so it won't proceed to the actual match of
+   "foo(int)" with "foo".  */
+
+int
+strcmp_iw_ordered (const char *string1, const char *string2)
+{
+  while ((*string1 != '\0') && (*string2 != '\0'))
+    {
+      while (isspace (*string1))
+       {
+         string1++;
+       }
+      while (isspace (*string2))
+       {
+         string2++;
+       }
+      if (*string1 != *string2)
+       {
+         break;
+       }
+      if (*string1 != '\0')
+       {
+         string1++;
+         string2++;
+       }
+    }
+
+  switch (*string1)
+    {
+      /* Characters are non-equal unless they're both '\0'; we want to
+        make sure we get the comparison right according to our
+        comparison in the cases where one of them is '\0' or '('.  */
+    case '\0':
+      if (*string2 == '\0')
+       return 0;
+      else
+       return -1;
+    case '(':
+      if (*string2 == '\0')
+       return 1;
+      else
+       return -1;
+    default:
+      if (*string2 == '(')
+       return 1;
+      else
+       return *string1 - *string2;
+    }
+}
+
+/* A simple comparison function with opposite semantics to strcmp.  */
+
+int
+streq (const char *lhs, const char *rhs)
+{
+  return !strcmp (lhs, rhs);
+}
 \f
 
 /*
@@ -2676,8 +2764,8 @@ gdb_realpath (const char *filename)
     if (rp == NULL)
       rp = filename;
     return xstrdup (rp);
-  }
 # endif
+  }
 #endif /* HAVE_REALPATH */
 
   /* Method 2: The host system (i.e., GNU) has the function
index 3970145..0894a8f 100644 (file)
@@ -1232,9 +1232,9 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, E_ALL_REGS_SIZE);
   set_gdbarch_register_byte (gdbarch, v850_register_byte);
   set_gdbarch_register_raw_size (gdbarch, v850_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, v850_reg_size);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, v850_reg_size);
   set_gdbarch_register_virtual_size (gdbarch, v850_register_raw_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, v850_reg_size);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, v850_reg_size);
   set_gdbarch_register_virtual_type (gdbarch, v850_reg_virtual_type);
 
   set_gdbarch_read_fp (gdbarch, v850_target_read_fp);
@@ -1242,8 +1242,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /*
    * Frame Info
    */
-  set_gdbarch_init_extra_frame_info (gdbarch, v850_init_extra_frame_info);
-  set_gdbarch_frame_init_saved_regs (gdbarch, v850_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, v850_frame_init_saved_regs);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, v850_init_extra_frame_info);
   set_gdbarch_frame_chain (gdbarch, v850_frame_chain);
   set_gdbarch_saved_pc_after_call (gdbarch, v850_saved_pc_after_call);
   set_gdbarch_frame_saved_pc (gdbarch, v850_frame_saved_pc);
@@ -1268,7 +1268,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Call Dummies
    * 
    * These values and methods are used when gdb calls a target function.  */
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, v850_push_return_address);
   set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, v850_push_arguments);
index 2304274..6dcc6f1 100644 (file)
@@ -33,6 +33,7 @@
 #include "gdbcmd.h"
 #include "regcache.h"
 #include "cp-abi.h"
+#include "block.h"
 
 #include <errno.h>
 #include "gdb_string.h"
@@ -834,9 +835,9 @@ value_of_variable (struct symbol *var, struct block *b)
       if (!frame)
        {
          if (BLOCK_FUNCTION (b)
-             && SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)))
+             && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)))
            error ("No frame is currently executing in block %s.",
-                  SYMBOL_SOURCE_NAME (BLOCK_FUNCTION (b)));
+                  SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b)));
          else
            error ("No frame is currently executing in specified block");
        }
@@ -844,7 +845,7 @@ value_of_variable (struct symbol *var, struct block *b)
 
   val = read_var_value (var, frame);
   if (!val)
-    error ("Address of symbol \"%s\" is unknown.", SYMBOL_SOURCE_NAME (var));
+    error ("Address of symbol \"%s\" is unknown.", SYMBOL_PRINT_NAME (var));
 
   return val;
 }
@@ -1299,10 +1300,34 @@ hand_function_call (struct value *function, int nargs, struct value **args)
   inf_status = save_inferior_status (1);
   inf_status_cleanup = make_cleanup_restore_inferior_status (inf_status);
 
-  /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers
-     (and POP_FRAME for restoring them).  (At least on most machines)
-     they are saved on the stack in the inferior.  */
-  PUSH_DUMMY_FRAME;
+  if (DEPRECATED_PUSH_DUMMY_FRAME_P ())
+    {
+      /* DEPRECATED_PUSH_DUMMY_FRAME is responsible for saving the
+        inferior registers (and POP_FRAME for restoring them).  (At
+        least on most machines) they are saved on the stack in the
+        inferior.  */
+      DEPRECATED_PUSH_DUMMY_FRAME;
+    }
+  else
+    {
+      /* FIXME: cagney/2003-02-26: Step zero of this little tinker is
+      to extract the generic dummy frame code from the architecture
+      vector.  Hence this direct call.
+
+      A follow-on change is to modify this interface so that it takes
+      thread OR frame OR tpid as a parameter, and returns a dummy
+      frame handle.  The handle can then be used further down as a
+      parameter SAVE_DUMMY_FRAME_TOS.  Hmm, thinking about it, since
+      everything is ment to be using generic dummy frames, why not
+      even use some of the dummy frame code to here - do a regcache
+      dup and then pass the duped regcache, along with all the other
+      stuff, at one single point.
+
+      In fact, you can even save the structure's return address in the
+      dummy frame and fix one of those nasty lost struct return edge
+      conditions.  */
+      generic_push_dummy_frame ();
+    }
 
   old_sp = read_sp ();
 
@@ -1657,7 +1682,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
     symbol = find_pc_function (funaddr);
     if (symbol)
       {
-       name = SYMBOL_SOURCE_NAME (symbol);
+       name = SYMBOL_PRINT_NAME (symbol);
       }
     else
       {
@@ -1666,7 +1691,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
 
        if (msymbol)
          {
-           name = SYMBOL_SOURCE_NAME (msymbol);
+           name = SYMBOL_PRINT_NAME (msymbol);
          }
       }
     if (name == NULL)
@@ -2734,7 +2759,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method,
   else
     {
       int i = -1;
-      func_name = cplus_demangle (SYMBOL_NAME (fsym), DMGL_NO_OPTS);
+      func_name = cplus_demangle (DEPRECATED_SYMBOL_NAME (fsym), DMGL_NO_OPTS);
 
       /* If the name is NULL this must be a C-style function.
          Just return the same symbol. */
index 8f222fc..04be76a 100644 (file)
@@ -24,6 +24,7 @@
 #define VALUE_H 1
 
 struct regcache;
+struct block;
 
 #include "doublest.h"
 
index a994862..8b1d013 100644 (file)
@@ -36,6 +36,7 @@
 #include "doublest.h"
 #include "gdb_assert.h"
 #include "regcache.h"
+#include "block.h"
 
 /* Prototypes for exported functions. */
 
@@ -406,7 +407,7 @@ lookup_internalvar (char *name)
   register struct internalvar *var;
 
   for (var = internalvars; var; var = var->next)
-    if (STREQ (var->name, name))
+    if (strcmp (var->name, name) == 0)
       return var;
 
   var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
@@ -423,11 +424,6 @@ value_of_internalvar (struct internalvar *var)
 {
   struct value *val;
 
-#ifdef IS_TRAPPED_INTERNALVAR
-  if (IS_TRAPPED_INTERNALVAR (var->name))
-    return VALUE_OF_TRAPPED_INTERNALVAR (var);
-#endif
-
   val = value_copy (var->value);
   if (VALUE_LAZY (val))
     value_fetch_lazy (val);
@@ -442,11 +438,6 @@ set_internalvar_component (struct internalvar *var, int offset, int bitpos,
 {
   register char *addr = VALUE_CONTENTS (var->value) + offset;
 
-#ifdef IS_TRAPPED_INTERNALVAR
-  if (IS_TRAPPED_INTERNALVAR (var->name))
-    SET_TRAPPED_INTERNALVAR (var, newval, bitpos, bitsize, offset);
-#endif
-
   if (bitsize)
     modify_field (addr, value_as_long (newval),
                  bitpos, bitsize);
@@ -459,11 +450,6 @@ set_internalvar (struct internalvar *var, struct value *val)
 {
   struct value *newval;
 
-#ifdef IS_TRAPPED_INTERNALVAR
-  if (IS_TRAPPED_INTERNALVAR (var->name))
-    SET_TRAPPED_INTERNALVAR (var, val, 0, 0, 0);
-#endif
-
   newval = value_copy (val);
   newval->modifiable = 1;
 
@@ -517,10 +503,6 @@ show_convenience (char *ignore, int from_tty)
 
   for (var = internalvars; var; var = var->next)
     {
-#ifdef IS_TRAPPED_INTERNALVAR
-      if (IS_TRAPPED_INTERNALVAR (var->name))
-       continue;
-#endif
       if (!varseen)
        {
          varseen = 1;
index 52438d5..ab968b6 100644 (file)
@@ -46,14 +46,13 @@ static gdbarch_frame_chain_ftype vax_frame_chain;
 static gdbarch_frame_saved_pc_ftype vax_frame_saved_pc;
 static gdbarch_frame_args_address_ftype vax_frame_args_address;
 static gdbarch_frame_locals_address_ftype vax_frame_locals_address;
-static gdbarch_frame_init_saved_regs_ftype vax_frame_init_saved_regs;
 
 static gdbarch_store_struct_return_ftype vax_store_struct_return;
 static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value;
 static gdbarch_deprecated_extract_struct_value_address_ftype
     vax_extract_struct_value_address;
 
-static gdbarch_push_dummy_frame_ftype vax_push_dummy_frame;
+static gdbarch_deprecated_push_dummy_frame_ftype vax_push_dummy_frame;
 static gdbarch_pop_frame_ftype vax_pop_frame;
 static gdbarch_fix_call_dummy_ftype vax_fix_call_dummy;
 
@@ -636,9 +635,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, VAX_REGISTER_BYTES);
   set_gdbarch_register_byte (gdbarch, vax_register_byte);
   set_gdbarch_register_raw_size (gdbarch, vax_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, VAX_MAX_REGISTER_RAW_SIZE);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, VAX_MAX_REGISTER_RAW_SIZE);
   set_gdbarch_register_virtual_size (gdbarch, vax_register_virtual_size);
-  set_gdbarch_max_register_virtual_size (gdbarch,
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch,
                                          VAX_MAX_REGISTER_VIRTUAL_SIZE);
   set_gdbarch_register_virtual_type (gdbarch, vax_register_virtual_type);
 
@@ -656,7 +655,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_args_address (gdbarch, vax_frame_args_address);
   set_gdbarch_frame_locals_address (gdbarch, vax_frame_locals_address);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, vax_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, vax_frame_init_saved_regs);
 
   set_gdbarch_frame_args_skip (gdbarch, 4);
 
@@ -669,7 +668,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address);
 
   /* Call dummy info */
-  set_gdbarch_push_dummy_frame (gdbarch, vax_push_dummy_frame);
+  set_gdbarch_deprecated_push_dummy_frame (gdbarch, vax_push_dummy_frame);
   set_gdbarch_pop_frame (gdbarch, vax_pop_frame);
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_call_dummy_p (gdbarch, 1);
index 9e082a0..8f49c2d 100644 (file)
@@ -1 +1 @@
-2003-02-02-cvs
+2003-03-03-cvs
index d6bb27e..72e8c3f 100644 (file)
@@ -602,8 +602,8 @@ register_loaded_dll (const char *name, DWORD load_addr)
   so = (struct so_stuff *) xmalloc (sizeof (struct so_stuff) + strlen (ppath) + 8 + 1);
   so->loaded = 0;
   so->load_addr = load_addr;
-  if (!VirtualQueryEx (current_process_handle, (void *) load_addr, &m,
-                      sizeof (m)))
+  if (VirtualQueryEx (current_process_handle, (void *) load_addr, &m,
+                     sizeof (m)))
     so->end_addr = (DWORD) m.AllocationBase + m.RegionSize;
   else
     so->end_addr = load_addr + 0x2000; /* completely arbitrary */
@@ -635,21 +635,16 @@ get_image_name (HANDLE h, void *address, int unicode)
   if (address == NULL)
     return NULL;
 
-  ReadProcessMemory (h, address,  &address_ptr, sizeof (address_ptr), &done);
-
   /* See if we could read the address of a string, and that the
      address isn't null. */
-
-  if (done != sizeof (address_ptr) || !address_ptr)
+  if (!ReadProcessMemory (h, address,  &address_ptr, sizeof (address_ptr), &done) 
+      || done != sizeof (address_ptr) || !address_ptr)
     return NULL;
 
   /* Find the length of the string */
-  do
-    {
-      ReadProcessMemory (h, address_ptr + len * size, &b, size, &done);
-      len++;
-    }
-  while ((b[0] != 0 || b[size - 1] != 0) && done == size);
+  while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done)
+        && (b[0] != 0 || b[size - 1] != 0) && done == size)
+    continue;
 
   if (!unicode)
     ReadProcessMemory (h, address_ptr, buf, len, &done);
@@ -750,11 +745,66 @@ child_clear_solibs (void)
   max_dll_name_len = sizeof ("DLL Name") - 1;
 }
 
+/* Get the loaded address of all sections, given that .text was loaded
+   at text_load. Assumes that all sections are subject to the same
+   relocation offset. Returns NULL if problems occur or if the
+   sections were not relocated. */
+
+static struct section_addr_info *
+get_relocated_section_addrs (bfd *abfd, CORE_ADDR text_load)
+{
+  struct section_addr_info *result = NULL;
+  int section_count = bfd_count_sections (abfd);
+  asection *text_section = bfd_get_section_by_name (abfd, ".text");
+  CORE_ADDR text_vma;
+
+  if (!text_section)
+    {
+      /* Couldn't get the .text section. Weird. */
+    }
+
+  else if (text_load == (text_vma = bfd_get_section_vma (abfd, text_section)))
+    {
+      /* DLL wasn't relocated. */
+    }
+
+  else
+    {
+      /* Figure out all sections' loaded addresses. The offset here is
+        such that taking a bfd_get_section_vma() result and adding
+        offset will give the real load address of the section. */
+
+      CORE_ADDR offset = text_load - text_vma;
+
+      struct section_table *table_start = NULL;
+      struct section_table *table_end = NULL;
+      struct section_table *iter = NULL;
+
+      build_section_table (abfd, &table_start, &table_end);
+
+      for (iter = table_start; iter < table_end; ++iter)
+       {
+         /* Relocated addresses. */
+         iter->addr += offset;
+         iter->endaddr += offset;
+       }
+
+      result = build_section_addr_info_from_section_table (table_start,
+                                                          table_end);
+
+      xfree (table_start);
+    }
+
+  return result;
+}
+
 /* Add DLL symbol information. */
 static struct objfile *
 solib_symbols_add (char *name, int from_tty, CORE_ADDR load_addr)
 {
-  struct section_addr_info section_addrs;
+  struct section_addr_info *section_addrs_ptr = NULL;
+  static struct objfile *result = NULL;
+  bfd *abfd = NULL;
 
   /* The symbols in a dll are offset by 0x1000, which is the
      the offset from 0 of the first byte in an image - because
@@ -763,10 +813,46 @@ solib_symbols_add (char *name, int from_tty, CORE_ADDR load_addr)
   if (!name || !name[0])
     return NULL;
 
-  memset (&section_addrs, 0, sizeof (section_addrs));
-  section_addrs.other[0].name = ".text";
-  section_addrs.other[0].addr = load_addr;
-  return safe_symbol_file_add (name, from_tty, &section_addrs, 0, OBJF_SHARED);
+  abfd = bfd_openr (name, "pei-i386");
+
+  if (!abfd)
+    {
+      /* pei failed - try pe */
+      abfd = bfd_openr (name, "pe-i386");
+    }
+
+  if (abfd)
+    {
+      if (bfd_check_format (abfd, bfd_object))
+       {
+         section_addrs_ptr = get_relocated_section_addrs (abfd, load_addr);
+       }
+
+      bfd_close (abfd);
+    }
+
+  if (section_addrs_ptr)
+    {
+      result = safe_symbol_file_add (name, from_tty, section_addrs_ptr,
+                                    0, OBJF_SHARED);
+
+      free_section_addr_info (section_addrs_ptr);
+    }
+
+  else
+    {
+      /* Fallback on handling just the .text section. */
+      struct section_addr_info section_addrs;
+
+      memset (&section_addrs, 0, sizeof (section_addrs));
+      section_addrs.other[0].name = ".text";
+      section_addrs.other[0].addr = load_addr;
+
+      result = safe_symbol_file_add (name, from_tty, &section_addrs,
+                                    0, OBJF_SHARED);
+    }
+
+  return result;
 }
 
 /* Load DLL symbol info. */
@@ -858,7 +944,7 @@ display_selector (HANDLE thread, DWORD sel)
             + info.BaseLow;
       limit = (info.HighWord.Bits.LimitHi << 16) + info.LimitLow;
       if (info.HighWord.Bits.Granularity)
-       limit = (limit << 12) | 0xfff;
+       limit = (limit << 12) | 0xfff;
       printf_filtered ("base=0x%08x limit=0x%08x", base, limit);
       if (info.HighWord.Bits.Default_Big)
        puts_filtered(" 32-bit ");
@@ -1410,12 +1496,12 @@ set_process_privilege (const char *privilege, BOOL enable)
        AdjustTokenPrivileges = GetProcAddress (advapi32,
                                                "AdjustTokenPrivileges");
       if (!OpenProcessToken || !LookupPrivilegeValue || !AdjustTokenPrivileges)
-        {
+       {
          advapi32 = NULL;
          goto out;
        }
     }
-  
+
   if (!OpenProcessToken (GetCurrentProcess (),
                         TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
                         &token_hdl))
@@ -1429,7 +1515,7 @@ set_process_privilege (const char *privilege, BOOL enable)
   new_priv.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0;
 
   if (!AdjustTokenPrivileges (token_hdl, FALSE, &new_priv,
-                              sizeof orig_priv, &orig_priv, &size))
+                             sizeof orig_priv, &orig_priv, &size))
     goto out;
 #if 0
   /* Disabled, otherwise every `attach' in an unprivileged user session
@@ -1480,7 +1566,7 @@ child_attach (char *args, int from_tty)
        ok = DebugActiveProcess (pid);
 
       if (!ok)
-    error ("Can't attach to process.");
+       error ("Can't attach to process.");
     }
 
   if (has_detach_ability ())
@@ -1772,21 +1858,23 @@ child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
                   int write, struct mem_attrib *mem,
                   struct target_ops *target)
 {
-  DWORD done;
+  DWORD done = 0;
   if (write)
     {
       DEBUG_MEM (("gdb: write target memory, %d bytes at 0x%08lx\n",
                  len, (DWORD) memaddr));
-      WriteProcessMemory (current_process_handle, (LPVOID) memaddr, our,
-                         len, &done);
+      if (!WriteProcessMemory (current_process_handle, (LPVOID) memaddr, our,
+                              len, &done))
+       done = 0;
       FlushInstructionCache (current_process_handle, (LPCVOID) memaddr, len);
     }
   else
     {
       DEBUG_MEM (("gdb: read target memory, %d bytes at 0x%08lx\n",
                  len, (DWORD) memaddr));
-      ReadProcessMemory (current_process_handle, (LPCVOID) memaddr, our, len,
-                        &done);
+      if (!ReadProcessMemory (current_process_handle, (LPCVOID) memaddr, our,
+                             len, &done))
+       done = 0;
     }
   return done;
 }
@@ -1873,16 +1961,16 @@ child_resume (ptid_t ptid, int step, enum target_signal sig)
 
       if (th->context.ContextFlags)
        {
-     if (debug_registers_changed)
-       {
-         th->context.Dr0 = dr[0];
-         th->context.Dr1 = dr[1];
-         th->context.Dr2 = dr[2];
-         th->context.Dr3 = dr[3];
-         /* th->context.Dr6 = dr[6];
-          FIXME: should we set dr6 also ?? */
-         th->context.Dr7 = dr[7];
-       }
+         if (debug_registers_changed)
+           {
+             th->context.Dr0 = dr[0];
+             th->context.Dr1 = dr[1];
+             th->context.Dr2 = dr[2];
+             th->context.Dr3 = dr[3];
+             /* th->context.Dr6 = dr[6];
+              FIXME: should we set dr6 also ?? */
+             th->context.Dr7 = dr[7];
+           }
          CHECK (SetThreadContext (th->h, &th->context));
          th->context.ContextFlags = 0;
        }
index 977a77d..b287b29 100644 (file)
@@ -21,6 +21,8 @@
 #include "gdb.h"
 
 struct value;
+struct expression;
+struct block;
 
 /* Use this struct to pass arguments to wrapper routines. */
 struct gdb_wrapper_arguments;
index 8676176..044236c 100644 (file)
@@ -158,7 +158,7 @@ fill_gregset (elf_gregset_t * gregsetp, int regno)
 
   for (i = 0; i < x86_64_num_gregs; i++)
     if ((regno == -1 || regno == i))
-      deprecated_read_register_gen (i, (char *) (regp + x86_64_regmap[i]));
+      regcache_collect (i, (char *) (regp + x86_64_regmap[i]));
 }
 
 /* Fetch all general-purpose registers from process/thread TID and
index a47ef17..5ba1da2 100644 (file)
@@ -31,6 +31,7 @@
 #include "x86-64-tdep.h"
 #include "dwarf2cfi.h"
 #include "gdb_assert.h"
+#include "block.h"
 
 /* Register numbers of various important registers.  */
 #define RAX_REGNUM 0
@@ -559,7 +560,8 @@ x86_64_use_struct_convention (int gcc_p, struct type *value_type)
    into VALBUF.  */
 
 void
-x86_64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+x86_64_extract_return_value (struct type *type, struct regcache *regcache,
+                            void *valbuf)
 {
   enum x86_64_reg_class class[MAX_CLASSES];
   int n = classify_argument (type, class, 0);
@@ -576,7 +578,7 @@ x86_64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
       needed_intregs > RET_INT_REGS || needed_sseregs > RET_SSE_REGS)
     {                          /* memory class */
       CORE_ADDR addr;
-      memcpy (&addr, regbuf, REGISTER_RAW_SIZE (RAX_REGNUM));
+      regcache_cooked_read (regcache, RAX_REGNUM, &addr);
       read_memory (addr, valbuf, TYPE_LENGTH (type));
       return;
     }
@@ -590,41 +592,40 @@ x86_64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
            case X86_64_NO_CLASS:
              break;
            case X86_64_INTEGER_CLASS:
-             memcpy (valbuf + offset,
-                     regbuf + REGISTER_BYTE (ret_int_r[(intreg + 1) / 2]),
-                     8);
+             regcache_cooked_read (regcache, ret_int_r[(intreg + 1) / 2],
+                                   (char *) valbuf + offset);
              offset += 8;
              intreg += 2;
              break;
            case X86_64_INTEGERSI_CLASS:
-             memcpy (valbuf + offset,
-                     regbuf + REGISTER_BYTE (ret_int_r[intreg / 2]), 4);
+             regcache_cooked_read_part (regcache, ret_int_r[intreg / 2],
+                                        0, 4, (char *) valbuf + offset);
              offset += 8;
              intreg++;
              break;
            case X86_64_SSEDF_CLASS:
            case X86_64_SSESF_CLASS:
            case X86_64_SSE_CLASS:
-             memcpy (valbuf + offset,
-                     regbuf + REGISTER_BYTE (ret_sse_r[(ssereg + 1) / 2]),
-                     8);
+             regcache_cooked_read_part (regcache,
+                                        ret_sse_r[(ssereg + 1) / 2], 0, 8,
+                                        (char *) valbuf + offset);
              offset += 8;
              ssereg += 2;
              break;
            case X86_64_SSEUP_CLASS:
-             memcpy (valbuf + offset + 8,
-                     regbuf + REGISTER_BYTE (ret_sse_r[ssereg / 2]), 8);
+             regcache_cooked_read_part (regcache, ret_sse_r[ssereg / 2],
+                                        0, 8, (char *) valbuf + offset);
              offset += 8;
              ssereg++;
              break;
            case X86_64_X87_CLASS:
-             memcpy (valbuf + offset, regbuf + REGISTER_BYTE (FP0_REGNUM),
-                     8);
+             regcache_cooked_read_part (regcache, FP0_REGNUM,
+                                        0, 8, (char *) valbuf + offset);
              offset += 8;
              break;
            case X86_64_X87UP_CLASS:
-             memcpy (valbuf + offset,
-                     regbuf + REGISTER_BYTE (FP0_REGNUM) + 8, 8);
+             regcache_cooked_read_part (regcache, FP0_REGNUM,
+                                        8, 2, (char *) valbuf + offset);
              offset += 8;
              break;
            case X86_64_MEMORY_CLASS:
@@ -749,7 +750,8 @@ x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
 /* Write into the appropriate registers a function return value stored
    in VALBUF of type TYPE, given in virtual format.  */
 void
-x86_64_store_return_value (struct type *type, char *valbuf)
+x86_64_store_return_value (struct type *type, struct regcache *regcache,
+                          const void *valbuf)
 {
   int len = TYPE_LENGTH (type);
 
@@ -760,8 +762,7 @@ x86_64_store_return_value (struct type *type, char *valbuf)
          && TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext)
        {
          /* Copy straight over.  */
-         deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), valbuf,
-                                          FPU_REG_RAW_SIZE);
+         regcache_cooked_write (regcache, FP0_REGNUM, valbuf);
        }
       else
        {
@@ -774,8 +775,8 @@ x86_64_store_return_value (struct type *type, char *valbuf)
             it is the best we can do.  */
          val = extract_floating (valbuf, TYPE_LENGTH (type));
          floatformat_from_doublest (&floatformat_i387_ext, &val, buf);
-         deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), buf,
-                                          FPU_REG_RAW_SIZE);
+         regcache_cooked_write_part (regcache, FP0_REGNUM,
+                                     0, FPU_REG_RAW_SIZE, buf);
        }
     }
   else
@@ -784,13 +785,13 @@ x86_64_store_return_value (struct type *type, char *valbuf)
       int high_size = REGISTER_RAW_SIZE (1);
 
       if (len <= low_size)
-       deprecated_write_register_bytes (REGISTER_BYTE (0), valbuf, len);
+        regcache_cooked_write_part (regcache, 0, 0, len, valbuf);
       else if (len <= (low_size + high_size))
        {
-         deprecated_write_register_bytes (REGISTER_BYTE (0), valbuf,
-                                          low_size);
-         deprecated_write_register_bytes (REGISTER_BYTE (1),
-                                          valbuf + low_size, len - low_size);
+         regcache_cooked_write_part (regcache, 0, 0, low_size, valbuf);
+         regcache_cooked_write_part (regcache, 1, 0,
+                                     len - low_size,
+                                     (const char *) valbuf + low_size);
        }
       else
        internal_error (__FILE__, __LINE__,
@@ -979,23 +980,18 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   /* FIXME: kettenis/20021026: Should we set parm_boundary to 64 here?  */
   set_gdbarch_read_fp (gdbarch, cfi_read_fp);
 
-  /* FIXME: kettenis/20021026: Should be undeprecated.  */
-  set_gdbarch_extract_return_value (gdbarch, NULL);
-  set_gdbarch_deprecated_extract_return_value (gdbarch,
-                                              x86_64_extract_return_value);
+  set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value);
+
   set_gdbarch_push_arguments (gdbarch, x86_64_push_arguments);
   set_gdbarch_push_return_address (gdbarch, x86_64_push_return_address);
   set_gdbarch_pop_frame (gdbarch, x86_64_pop_frame);
   set_gdbarch_store_struct_return (gdbarch, x86_64_store_struct_return);
-  /* FIXME: kettenis/20021026: Should be undeprecated.  */
-  set_gdbarch_store_return_value (gdbarch, NULL);
-  set_gdbarch_deprecated_store_return_value (gdbarch,
-                                            x86_64_store_return_value);
+  set_gdbarch_store_return_value (gdbarch, x86_64_store_return_value);
   /* Override, since this is handled by x86_64_extract_return_value.  */
   set_gdbarch_extract_struct_value_address (gdbarch, NULL);
   set_gdbarch_use_struct_convention (gdbarch, x86_64_use_struct_convention);
 
-  set_gdbarch_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs);
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, x86_64_frame_init_saved_regs);
   set_gdbarch_skip_prologue (gdbarch, x86_64_skip_prologue);
 
   set_gdbarch_frame_chain (gdbarch, x86_64_linux_frame_chain);
@@ -1015,7 +1011,7 @@ x86_64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_dwarf2_build_frame_info (gdbarch, dwarf2_build_frame_info);
 
   /* Initialization of per-frame CFI.  */
-  set_gdbarch_init_extra_frame_info (gdbarch, cfi_init_extra_frame_info);
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch, cfi_init_extra_frame_info);
 
   /* Frame PC initialization is handled by using CFI.  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, x86_64_init_frame_pc);
index 991acdc..dd6541a 100644 (file)
@@ -1478,7 +1478,7 @@ process_xcoff_symbol (register struct coff_symbol *cs, struct objfile *objfile)
          will be patched with the type from its stab entry later on in
          patch_block_stabs (), unless the file was compiled without -g.  */
 
-      SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
+      DEPRECATED_SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
       SYMBOL_TYPE (sym) = func_symbol_type;
 
       SYMBOL_CLASS (sym) = LOC_BLOCK;
index 3ecfd3c..2bbd402 100644 (file)
@@ -1045,17 +1045,17 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_bytes (gdbarch, E_ALL_REGS_SIZE);
   set_gdbarch_register_byte (gdbarch, xstormy16_register_byte);
   set_gdbarch_register_raw_size (gdbarch, xstormy16_register_raw_size);
-  set_gdbarch_max_register_raw_size (gdbarch, xstormy16_pc_size);
+  set_gdbarch_deprecated_max_register_raw_size (gdbarch, xstormy16_pc_size);
   set_gdbarch_register_virtual_size (gdbarch, xstormy16_register_raw_size);
-  set_gdbarch_max_register_virtual_size (gdbarch, 4);
+  set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
   set_gdbarch_register_virtual_type (gdbarch, xstormy16_reg_virtual_type);
 
   /*
    * Frame Info
    */
-  set_gdbarch_init_extra_frame_info (gdbarch,
+  set_gdbarch_deprecated_init_extra_frame_info (gdbarch,
                                     xstormy16_init_extra_frame_info);
-  set_gdbarch_frame_init_saved_regs (gdbarch,
+  set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
                                     xstormy16_frame_init_saved_regs);
   set_gdbarch_frame_chain (gdbarch, xstormy16_frame_chain);
   set_gdbarch_get_saved_register (gdbarch, xstormy16_get_saved_register);
@@ -1086,7 +1086,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Call Dummies
    * 
    * These values and methods are used when gdb calls a target function.  */
-  set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address);
   set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments);
index 5b30940..d6d42e3 100644 (file)
-/* Target-machine dependent code for Zilog Z8000, for GDB.
-
-   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-   2002, 2003 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/*
-   Contributed by Steve Chamberlain
-   sac@cygnus.com
- */
-
-#include "defs.h"
-#include "frame.h"
-#include "symtab.h"
-#include "gdbcmd.h"
-#include "gdbtypes.h"
-#include "dis-asm.h"
-#include "gdbcore.h"
-#include "regcache.h"
-
-#include "value.h" /* For read_register() */
-
-
-static int read_memory_pointer (CORE_ADDR x);
-
-/* Return the saved PC from this frame.
-
-   If the frame has a memory copy of SRP_REGNUM, use that.  If not,
-   just use the register SRP_REGNUM itself.  */
-
-CORE_ADDR
-z8k_frame_saved_pc (struct frame_info *frame)
-{
-  return read_memory_pointer (frame->frame + (BIG ? 4 : 2));
-}
-
-#define IS_PUSHL(x) (BIG ? ((x & 0xfff0) == 0x91e0):((x & 0xfff0) == 0x91F0))
-#define IS_PUSHW(x) (BIG ? ((x & 0xfff0) == 0x93e0):((x & 0xfff0)==0x93f0))
-#define IS_MOVE_FP(x) (BIG ? x == 0xa1ea : x == 0xa1fa)
-#define IS_MOV_SP_FP(x) (BIG ? x == 0x94ea : x == 0x0d76)
-#define IS_SUB2_SP(x) (x==0x1b87)
-#define IS_MOVK_R5(x) (x==0x7905)
-#define IS_SUB_SP(x) ((x & 0xffff) == 0x020f)
-#define IS_PUSH_FP(x) (BIG ? (x == 0x93ea) : (x == 0x93fa))
-
-/* work out how much local space is on the stack and
-   return the pc pointing to the first push */
-
-static CORE_ADDR
-skip_adjust (CORE_ADDR pc, int *size)
-{
-  *size = 0;
-
-  if (IS_PUSH_FP (read_memory_short (pc))
-      && IS_MOV_SP_FP (read_memory_short (pc + 2)))
-    {
-      /* This is a function with an explict frame pointer */
-      pc += 4;
-      *size += 2;              /* remember the frame pointer */
-    }
-
-  /* remember any stack adjustment */
-  if (IS_SUB_SP (read_memory_short (pc)))
-    {
-      *size += read_memory_short (pc + 2);
-      pc += 4;
-    }
-  return pc;
-}
-
-static CORE_ADDR examine_frame (CORE_ADDR, CORE_ADDR * regs, CORE_ADDR);
-static CORE_ADDR
-examine_frame (CORE_ADDR pc, CORE_ADDR *regs, CORE_ADDR sp)
-{
-  int w = read_memory_short (pc);
-  int offset = 0;
-  int regno;
-
-  for (regno = 0; regno < NUM_REGS; regno++)
-    regs[regno] = 0;
-
-  while (IS_PUSHW (w) || IS_PUSHL (w))
-    {
-      /* work out which register is being pushed to where */
-      if (IS_PUSHL (w))
-       {
-         regs[w & 0xf] = offset;
-         regs[(w & 0xf) + 1] = offset + 2;
-         offset += 4;
-       }
-      else
-       {
-         regs[w & 0xf] = offset;
-         offset += 2;
-       }
-      pc += 2;
-      w = read_memory_short (pc);
-    }
-
-  if (IS_MOVE_FP (w))
-    {
-      /* We know the fp */
-
-    }
-  else if (IS_SUB_SP (w))
-    {
-      /* Subtracting a value from the sp, so were in a function
-         which needs stack space for locals, but has no fp.  We fake up
-         the values as if we had an fp */
-      regs[FP_REGNUM] = sp;
-    }
-  else
-    {
-      /* This one didn't have an fp, we'll fake it up */
-      regs[SP_REGNUM] = sp;
-    }
-  /* stack pointer contains address of next frame */
-  /*  regs[fp_regnum()] = fp; */
-  regs[SP_REGNUM] = sp;
-  return pc;
-}
-
-CORE_ADDR
-z8k_skip_prologue (CORE_ADDR start_pc)
-{
-  CORE_ADDR dummy[NUM_REGS];
-
-  return examine_frame (start_pc, dummy, 0);
-}
-
-CORE_ADDR
-z8k_addr_bits_remove (CORE_ADDR addr)
-{
-  return (addr & PTR_MASK);
-}
-
-static int
-read_memory_pointer (CORE_ADDR x)
-{
-  return read_memory_integer (ADDR_BITS_REMOVE (x), BIG ? 4 : 2);
-}
-
-CORE_ADDR
-z8k_frame_chain (struct frame_info *thisframe)
-{
-  if (!inside_entry_file (get_frame_pc (thisframe)))
-    {
-      return read_memory_pointer (thisframe->frame);
-    }
-  return 0;
-}
-
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of the saved registers of frame described by FRAME_INFO.
-   This includes special registers such as pc and fp saved in special
-   ways in the stack frame.  sp is even more special:
-   the address we return for it IS the sp for the next frame.  */
-
-void
-z8k_frame_init_saved_regs (struct frame_info *frame_info)
-{
-  CORE_ADDR pc;
-  int w;
-
-  frame_saved_regs_zalloc (frame_info);
-  pc = get_pc_function_start (get_frame_pc (frame_info));
-
-  /* wander down the instruction stream */
-  examine_frame (pc, frame_info->saved_regs, frame_info->frame);
-
-}
-
-void
-z8k_push_dummy_frame (void)
-{
-  internal_error (__FILE__, __LINE__, "failed internal consistency check");
-}
-
-int
-gdb_print_insn_z8k (bfd_vma memaddr, disassemble_info *info)
-{
-  if (BIG)
-    return print_insn_z8001 (memaddr, info);
-  else
-    return print_insn_z8002 (memaddr, info);
-}
-
-/* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
-   is not the address of a valid instruction, the address of the next
-   instruction beyond ADDR otherwise.  *PWORD1 receives the first word
-   of the instruction. */
-
-CORE_ADDR
-NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, short *pword1)
-{
-  char buf[2];
-  if (addr < lim + 8)
-    {
-      read_memory (addr, buf, 2);
-      *pword1 = extract_signed_integer (buf, 2);
-
-      return addr + 2;
-    }
-  return 0;
-}
-
-#if 0
-/* Put here the code to store, into a struct frame_saved_regs,
-   the addresses of the saved registers of frame described by FRAME_INFO.
-   This includes special registers such as pc and fp saved in special
-   ways in the stack frame.  sp is even more special:
-   the address we return for it IS the sp for the next frame.
-
-   We cache the result of doing this in the frame_cache_obstack, since
-   it is fairly expensive.  */
-
-void
-frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp)
-{
-  int locals;
-  CORE_ADDR pc;
-  CORE_ADDR adr;
-  int i;
-
-  memset (fsrp, 0, sizeof *fsrp);
-
-  pc = skip_adjust (get_pc_function_start (get_frame_pc (fip)), &locals);
-
-  {
-    adr = get_frame_base (fip) - locals;
-    for (i = 0; i < 8; i++)
-      {
-       int word = read_memory_short (pc);
-
-       pc += 2;
-       if (IS_PUSHL (word))
-         {
-           fsrp->regs[word & 0xf] = adr;
-           fsrp->regs[(word & 0xf) + 1] = adr - 2;
-           adr -= 4;
-         }
-       else if (IS_PUSHW (word))
-         {
-           fsrp->regs[word & 0xf] = adr;
-           adr -= 2;
-         }
-       else
-         break;
-      }
-
-  }
-
-  fsrp->regs[PC_REGNUM] = fip->frame + 4;
-  fsrp->regs[FP_REGNUM] = fip->frame;
-
-}
-#endif
-
-int
-z8k_saved_pc_after_call (struct frame_info *frame)
-{
-  return ADDR_BITS_REMOVE
-    (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE));
-}
-
-
-void
-extract_return_value (struct type *type, char *regbuf, char *valbuf)
-{
-  int b;
-  int len = TYPE_LENGTH (type);
-
-  for (b = 0; b < len; b += 2)
-    {
-      int todo = len - b;
-
-      if (todo > 2)
-       todo = 2;
-      memcpy (valbuf + b, regbuf + b, todo);
-    }
-}
-
-void
-write_return_value (struct type *type, char *valbuf)
-{
-  int reg;
-  int len;
-
-  for (len = 0; len < TYPE_LENGTH (type); len += 2)
-    deprecated_write_register_bytes (REGISTER_BYTE (len / 2 + 2),
-                                    valbuf + len, 2);
-}
-
-void
-store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
-{
-  write_register (2, addr);
-}
-
-
-static void
-z8k_print_register_hook (int regno)
-{
-  if ((regno & 1) == 0 && regno < 16)
-    {
-      unsigned char l[4];
-
-      frame_register_read (deprecated_selected_frame, regno, l + 0);
-      frame_register_read (deprecated_selected_frame, regno + 1, l + 2);
-      printf_unfiltered ("\t");
-      printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]);
-    }
-
-  if ((regno & 3) == 0 && regno < 16)
-    {
-      unsigned char l[8];
-
-      frame_register_read (deprecated_selected_frame, regno, l + 0);
-      frame_register_read (deprecated_selected_frame, regno + 1, l + 2);
-      frame_register_read (deprecated_selected_frame, regno + 2, l + 4);
-      frame_register_read (deprecated_selected_frame, regno + 3, l + 6);
-
-      printf_unfiltered ("\t");
-      printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x",
-                         l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]);
-    }
-  if (regno == 15)
-    {
-      unsigned short rval;
-      int i;
-
-      frame_register_read (deprecated_selected_frame, regno, (char *) (&rval));
-
-      printf_unfiltered ("\n");
-      for (i = 0; i < 10; i += 2)
-       {
-         printf_unfiltered ("(sp+%d=%04x)", i,
-                            (unsigned int)read_memory_short (rval + i));
-       }
-    }
-}
-
-static void
-z8k_print_registers_info (struct gdbarch *gdbarch,
-                         struct ui_file *file,
-                         struct frame_info *frame,
-                         int regnum, int print_all)
-{
-  int i;
-  const int numregs = NUM_REGS + NUM_PSEUDO_REGS;
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
-  char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
-
-  for (i = 0; i < numregs; i++)
-    {
-      /* Decide between printing all regs, non-float / vector regs, or
-         specific reg.  */
-      if (regnum == -1)
-       {
-         if (!print_all)
-           {
-             if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
-               continue;
-             if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
-               continue;
-           }
-       }
-      else
-       {
-         if (i != regnum)
-           continue;
-       }
-
-      /* If the register name is empty, it is undefined for this
-         processor, so don't display anything.  */
-      if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
-       continue;
-
-      fputs_filtered (REGISTER_NAME (i), file);
-      print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file);
-
-      /* Get the data in raw format.  */
-      if (! frame_register_read (frame, i, raw_buffer))
-       {
-         fprintf_filtered (file, "*value not available*\n");
-         continue;
-       }
-
-      /* FIXME: cagney/2002-08-03: This code shouldn't be necessary.
-         The function frame_register_read() should have returned the
-         pre-cooked register so no conversion is necessary.  */
-      /* Convert raw data to virtual format if necessary.  */
-      if (REGISTER_CONVERTIBLE (i))
-       {
-         REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
-                                      raw_buffer, virtual_buffer);
-       }
-      else
-       {
-         memcpy (virtual_buffer, raw_buffer,
-                 REGISTER_VIRTUAL_SIZE (i));
-       }
-
-      /* If virtual format is floating, print it that way, and in raw
-         hex.  */
-      if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
-       {
-         int j;
-
-         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-                    file, 0, 1, 0, Val_pretty_default);
-
-         fprintf_filtered (file, "\t(raw 0x");
-         for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
-           {
-             int idx;
-             if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-               idx = j;
-             else
-               idx = REGISTER_RAW_SIZE (i) - 1 - j;
-             fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]);
-           }
-         fprintf_filtered (file, ")");
-       }
-      else
-       {
-         /* Print the register in hex.  */
-         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-                    file, 'x', 1, 0, Val_pretty_default);
-          /* If not a vector register, print it also according to its
-             natural format.  */
-         if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
-           {
-             fprintf_filtered (file, "\t");
-             val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
-                        file, 0, 1, 0, Val_pretty_default);
-           }
-       }
-
-      /* Some z8k specific info.  */
-      z8k_print_register_hook (i);
-
-      fprintf_filtered (file, "\n");
-    }
-}
-
-void
-z8k_do_registers_info (int regnum, int all)
-{
-  z8k_print_registers_info (current_gdbarch, gdb_stdout,
-                           deprecated_selected_frame, regnum, all);
-}
-
-void
-z8k_pop_frame (void)
-{
-}
-
-struct cmd_list_element *setmemorylist;
-
-void
-z8k_set_pointer_size (int newsize)
-{
-  static int oldsize = 0;
-
-  if (oldsize != newsize)
-    {
-      printf_unfiltered ("pointer size set to %d bits\n", newsize);
-      oldsize = newsize;
-      if (newsize == 32)
-       {
-         BIG = 1;
-       }
-      else
-       {
-         BIG = 0;
-       }
-      /* FIXME: This code should be using the GDBARCH framework to
-         handle changed type sizes.  If this problem is ever fixed
-         (the direct reference to _initialize_gdbtypes() below
-         eliminated) then Makefile.in should be updated so that
-         z8k-tdep.c is again compiled with -Werror. */
-      _initialize_gdbtypes ();
-    }
-}
-
-static void
-segmented_command (char *args, int from_tty)
-{
-  z8k_set_pointer_size (32);
-}
-
-static void
-unsegmented_command (char *args, int from_tty)
-{
-  z8k_set_pointer_size (16);
-}
-
-static void
-set_memory (char *args, int from_tty)
-{
-  printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
-  help_list (setmemorylist, "set memory ", -1, gdb_stdout);
-}
-
-void
-_initialize_z8ktdep (void)
-{
-  tm_print_insn = gdb_print_insn_z8k;
-
-  add_prefix_cmd ("memory", no_class, set_memory,
-                 "set the memory model", &setmemorylist, "set memory ", 0,
-                 &setlist);
-  add_cmd ("segmented", class_support, segmented_command,
-          "Set segmented memory model.", &setmemorylist);
-  add_cmd ("unsegmented", class_support, unsegmented_command,
-          "Set unsegmented memory model.", &setmemorylist);
-
-}
+// OBSOLETE /* Target-machine dependent code for Zilog Z8000, for GDB.
+// OBSOLETE 
+// OBSOLETE    Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+// OBSOLETE    2002, 2003 Free Software Foundation, Inc.
+// OBSOLETE 
+// OBSOLETE    This file is part of GDB.
+// OBSOLETE 
+// OBSOLETE    This program is free software; you can redistribute it and/or modify
+// OBSOLETE    it under the terms of the GNU General Public License as published by
+// OBSOLETE    the Free Software Foundation; either version 2 of the License, or
+// OBSOLETE    (at your option) any later version.
+// OBSOLETE 
+// OBSOLETE    This program is distributed in the hope that it will be useful,
+// OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of
+// OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// OBSOLETE    GNU General Public License for more details.
+// OBSOLETE 
+// OBSOLETE    You should have received a copy of the GNU General Public License
+// OBSOLETE    along with this program; if not, write to the Free Software
+// OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330,
+// OBSOLETE    Boston, MA 02111-1307, USA.  */
+// OBSOLETE 
+// OBSOLETE /*
+// OBSOLETE    Contributed by Steve Chamberlain
+// OBSOLETE    sac@cygnus.com
+// OBSOLETE  */
+// OBSOLETE 
+// OBSOLETE #include "defs.h"
+// OBSOLETE #include "frame.h"
+// OBSOLETE #include "symtab.h"
+// OBSOLETE #include "gdbcmd.h"
+// OBSOLETE #include "gdbtypes.h"
+// OBSOLETE #include "dis-asm.h"
+// OBSOLETE #include "gdbcore.h"
+// OBSOLETE #include "regcache.h"
+// OBSOLETE 
+// OBSOLETE #include "value.h" /* For read_register() */
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE static int read_memory_pointer (CORE_ADDR x);
+// OBSOLETE 
+// OBSOLETE /* Return the saved PC from this frame.
+// OBSOLETE 
+// OBSOLETE    If the frame has a memory copy of SRP_REGNUM, use that.  If not,
+// OBSOLETE    just use the register SRP_REGNUM itself.  */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE z8k_frame_saved_pc (struct frame_info *frame)
+// OBSOLETE {
+// OBSOLETE   return read_memory_pointer (frame->frame + (BIG ? 4 : 2));
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE #define IS_PUSHL(x) (BIG ? ((x & 0xfff0) == 0x91e0):((x & 0xfff0) == 0x91F0))
+// OBSOLETE #define IS_PUSHW(x) (BIG ? ((x & 0xfff0) == 0x93e0):((x & 0xfff0)==0x93f0))
+// OBSOLETE #define IS_MOVE_FP(x) (BIG ? x == 0xa1ea : x == 0xa1fa)
+// OBSOLETE #define IS_MOV_SP_FP(x) (BIG ? x == 0x94ea : x == 0x0d76)
+// OBSOLETE #define IS_SUB2_SP(x) (x==0x1b87)
+// OBSOLETE #define IS_MOVK_R5(x) (x==0x7905)
+// OBSOLETE #define IS_SUB_SP(x) ((x & 0xffff) == 0x020f)
+// OBSOLETE #define IS_PUSH_FP(x) (BIG ? (x == 0x93ea) : (x == 0x93fa))
+// OBSOLETE 
+// OBSOLETE /* work out how much local space is on the stack and
+// OBSOLETE    return the pc pointing to the first push */
+// OBSOLETE 
+// OBSOLETE static CORE_ADDR
+// OBSOLETE skip_adjust (CORE_ADDR pc, int *size)
+// OBSOLETE {
+// OBSOLETE   *size = 0;
+// OBSOLETE 
+// OBSOLETE   if (IS_PUSH_FP (read_memory_short (pc))
+// OBSOLETE       && IS_MOV_SP_FP (read_memory_short (pc + 2)))
+// OBSOLETE     {
+// OBSOLETE       /* This is a function with an explict frame pointer */
+// OBSOLETE       pc += 4;
+// OBSOLETE       *size += 2;          /* remember the frame pointer */
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   /* remember any stack adjustment */
+// OBSOLETE   if (IS_SUB_SP (read_memory_short (pc)))
+// OBSOLETE     {
+// OBSOLETE       *size += read_memory_short (pc + 2);
+// OBSOLETE       pc += 4;
+// OBSOLETE     }
+// OBSOLETE   return pc;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static CORE_ADDR examine_frame (CORE_ADDR, CORE_ADDR * regs, CORE_ADDR);
+// OBSOLETE static CORE_ADDR
+// OBSOLETE examine_frame (CORE_ADDR pc, CORE_ADDR *regs, CORE_ADDR sp)
+// OBSOLETE {
+// OBSOLETE   int w = read_memory_short (pc);
+// OBSOLETE   int offset = 0;
+// OBSOLETE   int regno;
+// OBSOLETE 
+// OBSOLETE   for (regno = 0; regno < NUM_REGS; regno++)
+// OBSOLETE     regs[regno] = 0;
+// OBSOLETE 
+// OBSOLETE   while (IS_PUSHW (w) || IS_PUSHL (w))
+// OBSOLETE     {
+// OBSOLETE       /* work out which register is being pushed to where */
+// OBSOLETE       if (IS_PUSHL (w))
+// OBSOLETE    {
+// OBSOLETE      regs[w & 0xf] = offset;
+// OBSOLETE      regs[(w & 0xf) + 1] = offset + 2;
+// OBSOLETE      offset += 4;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      regs[w & 0xf] = offset;
+// OBSOLETE      offset += 2;
+// OBSOLETE    }
+// OBSOLETE       pc += 2;
+// OBSOLETE       w = read_memory_short (pc);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   if (IS_MOVE_FP (w))
+// OBSOLETE     {
+// OBSOLETE       /* We know the fp */
+// OBSOLETE 
+// OBSOLETE     }
+// OBSOLETE   else if (IS_SUB_SP (w))
+// OBSOLETE     {
+// OBSOLETE       /* Subtracting a value from the sp, so were in a function
+// OBSOLETE          which needs stack space for locals, but has no fp.  We fake up
+// OBSOLETE          the values as if we had an fp */
+// OBSOLETE       regs[FP_REGNUM] = sp;
+// OBSOLETE     }
+// OBSOLETE   else
+// OBSOLETE     {
+// OBSOLETE       /* This one didn't have an fp, we'll fake it up */
+// OBSOLETE       regs[SP_REGNUM] = sp;
+// OBSOLETE     }
+// OBSOLETE   /* stack pointer contains address of next frame */
+// OBSOLETE   /*  regs[fp_regnum()] = fp; */
+// OBSOLETE   regs[SP_REGNUM] = sp;
+// OBSOLETE   return pc;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE z8k_skip_prologue (CORE_ADDR start_pc)
+// OBSOLETE {
+// OBSOLETE   CORE_ADDR dummy[NUM_REGS];
+// OBSOLETE 
+// OBSOLETE   return examine_frame (start_pc, dummy, 0);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE z8k_addr_bits_remove (CORE_ADDR addr)
+// OBSOLETE {
+// OBSOLETE   return (addr & PTR_MASK);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static int
+// OBSOLETE read_memory_pointer (CORE_ADDR x)
+// OBSOLETE {
+// OBSOLETE   return read_memory_integer (ADDR_BITS_REMOVE (x), BIG ? 4 : 2);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE z8k_frame_chain (struct frame_info *thisframe)
+// OBSOLETE {
+// OBSOLETE   if (!inside_entry_file (get_frame_pc (thisframe)))
+// OBSOLETE     {
+// OBSOLETE       return read_memory_pointer (thisframe->frame);
+// OBSOLETE     }
+// OBSOLETE   return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
+// OBSOLETE    the addresses of the saved registers of frame described by FRAME_INFO.
+// OBSOLETE    This includes special registers such as pc and fp saved in special
+// OBSOLETE    ways in the stack frame.  sp is even more special:
+// OBSOLETE    the address we return for it IS the sp for the next frame.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE z8k_frame_init_saved_regs (struct frame_info *frame_info)
+// OBSOLETE {
+// OBSOLETE   CORE_ADDR pc;
+// OBSOLETE   int w;
+// OBSOLETE 
+// OBSOLETE   frame_saved_regs_zalloc (frame_info);
+// OBSOLETE   pc = get_pc_function_start (get_frame_pc (frame_info));
+// OBSOLETE 
+// OBSOLETE   /* wander down the instruction stream */
+// OBSOLETE   examine_frame (pc, frame_info->saved_regs, frame_info->frame);
+// OBSOLETE 
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE z8k_push_dummy_frame (void)
+// OBSOLETE {
+// OBSOLETE   internal_error (__FILE__, __LINE__, "failed internal consistency check");
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE int
+// OBSOLETE gdb_print_insn_z8k (bfd_vma memaddr, disassemble_info *info)
+// OBSOLETE {
+// OBSOLETE   if (BIG)
+// OBSOLETE     return print_insn_z8001 (memaddr, info);
+// OBSOLETE   else
+// OBSOLETE     return print_insn_z8002 (memaddr, info);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
+// OBSOLETE    is not the address of a valid instruction, the address of the next
+// OBSOLETE    instruction beyond ADDR otherwise.  *PWORD1 receives the first word
+// OBSOLETE    of the instruction. */
+// OBSOLETE 
+// OBSOLETE CORE_ADDR
+// OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, short *pword1)
+// OBSOLETE {
+// OBSOLETE   char buf[2];
+// OBSOLETE   if (addr < lim + 8)
+// OBSOLETE     {
+// OBSOLETE       read_memory (addr, buf, 2);
+// OBSOLETE       *pword1 = extract_signed_integer (buf, 2);
+// OBSOLETE 
+// OBSOLETE       return addr + 2;
+// OBSOLETE     }
+// OBSOLETE   return 0;
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE #if 0
+// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs,
+// OBSOLETE    the addresses of the saved registers of frame described by FRAME_INFO.
+// OBSOLETE    This includes special registers such as pc and fp saved in special
+// OBSOLETE    ways in the stack frame.  sp is even more special:
+// OBSOLETE    the address we return for it IS the sp for the next frame.
+// OBSOLETE 
+// OBSOLETE    We cache the result of doing this in the frame_cache_obstack, since
+// OBSOLETE    it is fairly expensive.  */
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp)
+// OBSOLETE {
+// OBSOLETE   int locals;
+// OBSOLETE   CORE_ADDR pc;
+// OBSOLETE   CORE_ADDR adr;
+// OBSOLETE   int i;
+// OBSOLETE 
+// OBSOLETE   memset (fsrp, 0, sizeof *fsrp);
+// OBSOLETE 
+// OBSOLETE   pc = skip_adjust (get_pc_function_start (get_frame_pc (fip)), &locals);
+// OBSOLETE 
+// OBSOLETE   {
+// OBSOLETE     adr = get_frame_base (fip) - locals;
+// OBSOLETE     for (i = 0; i < 8; i++)
+// OBSOLETE       {
+// OBSOLETE    int word = read_memory_short (pc);
+// OBSOLETE 
+// OBSOLETE    pc += 2;
+// OBSOLETE    if (IS_PUSHL (word))
+// OBSOLETE      {
+// OBSOLETE        fsrp->regs[word & 0xf] = adr;
+// OBSOLETE        fsrp->regs[(word & 0xf) + 1] = adr - 2;
+// OBSOLETE        adr -= 4;
+// OBSOLETE      }
+// OBSOLETE    else if (IS_PUSHW (word))
+// OBSOLETE      {
+// OBSOLETE        fsrp->regs[word & 0xf] = adr;
+// OBSOLETE        adr -= 2;
+// OBSOLETE      }
+// OBSOLETE    else
+// OBSOLETE      break;
+// OBSOLETE       }
+// OBSOLETE 
+// OBSOLETE   }
+// OBSOLETE 
+// OBSOLETE   fsrp->regs[PC_REGNUM] = fip->frame + 4;
+// OBSOLETE   fsrp->regs[FP_REGNUM] = fip->frame;
+// OBSOLETE 
+// OBSOLETE }
+// OBSOLETE #endif
+// OBSOLETE 
+// OBSOLETE int
+// OBSOLETE z8k_saved_pc_after_call (struct frame_info *frame)
+// OBSOLETE {
+// OBSOLETE   return ADDR_BITS_REMOVE
+// OBSOLETE     (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE));
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE extract_return_value (struct type *type, char *regbuf, char *valbuf)
+// OBSOLETE {
+// OBSOLETE   int b;
+// OBSOLETE   int len = TYPE_LENGTH (type);
+// OBSOLETE 
+// OBSOLETE   for (b = 0; b < len; b += 2)
+// OBSOLETE     {
+// OBSOLETE       int todo = len - b;
+// OBSOLETE 
+// OBSOLETE       if (todo > 2)
+// OBSOLETE    todo = 2;
+// OBSOLETE       memcpy (valbuf + b, regbuf + b, todo);
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE write_return_value (struct type *type, char *valbuf)
+// OBSOLETE {
+// OBSOLETE   int reg;
+// OBSOLETE   int len;
+// OBSOLETE 
+// OBSOLETE   for (len = 0; len < TYPE_LENGTH (type); len += 2)
+// OBSOLETE     deprecated_write_register_bytes (REGISTER_BYTE (len / 2 + 2),
+// OBSOLETE                                 valbuf + len, 2);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
+// OBSOLETE {
+// OBSOLETE   write_register (2, addr);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE z8k_print_register_hook (int regno)
+// OBSOLETE {
+// OBSOLETE   if ((regno & 1) == 0 && regno < 16)
+// OBSOLETE     {
+// OBSOLETE       unsigned char l[4];
+// OBSOLETE 
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno, l + 0);
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno + 1, l + 2);
+// OBSOLETE       printf_unfiltered ("\t");
+// OBSOLETE       printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]);
+// OBSOLETE     }
+// OBSOLETE 
+// OBSOLETE   if ((regno & 3) == 0 && regno < 16)
+// OBSOLETE     {
+// OBSOLETE       unsigned char l[8];
+// OBSOLETE 
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno, l + 0);
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno + 1, l + 2);
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno + 2, l + 4);
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno + 3, l + 6);
+// OBSOLETE 
+// OBSOLETE       printf_unfiltered ("\t");
+// OBSOLETE       printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x",
+// OBSOLETE                          l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]);
+// OBSOLETE     }
+// OBSOLETE   if (regno == 15)
+// OBSOLETE     {
+// OBSOLETE       unsigned short rval;
+// OBSOLETE       int i;
+// OBSOLETE 
+// OBSOLETE       frame_register_read (deprecated_selected_frame, regno, (char *) (&rval));
+// OBSOLETE 
+// OBSOLETE       printf_unfiltered ("\n");
+// OBSOLETE       for (i = 0; i < 10; i += 2)
+// OBSOLETE    {
+// OBSOLETE      printf_unfiltered ("(sp+%d=%04x)", i,
+// OBSOLETE                         (unsigned int)read_memory_short (rval + i));
+// OBSOLETE    }
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE z8k_print_registers_info (struct gdbarch *gdbarch,
+// OBSOLETE                      struct ui_file *file,
+// OBSOLETE                      struct frame_info *frame,
+// OBSOLETE                      int regnum, int print_all)
+// OBSOLETE {
+// OBSOLETE   int i;
+// OBSOLETE   const int numregs = NUM_REGS + NUM_PSEUDO_REGS;
+// OBSOLETE   char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+// OBSOLETE   char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
+// OBSOLETE 
+// OBSOLETE   for (i = 0; i < numregs; i++)
+// OBSOLETE     {
+// OBSOLETE       /* Decide between printing all regs, non-float / vector regs, or
+// OBSOLETE          specific reg.  */
+// OBSOLETE       if (regnum == -1)
+// OBSOLETE    {
+// OBSOLETE      if (!print_all)
+// OBSOLETE        {
+// OBSOLETE          if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+// OBSOLETE            continue;
+// OBSOLETE          if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)))
+// OBSOLETE            continue;
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      if (i != regnum)
+// OBSOLETE        continue;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* If the register name is empty, it is undefined for this
+// OBSOLETE          processor, so don't display anything.  */
+// OBSOLETE       if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
+// OBSOLETE    continue;
+// OBSOLETE 
+// OBSOLETE       fputs_filtered (REGISTER_NAME (i), file);
+// OBSOLETE       print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file);
+// OBSOLETE 
+// OBSOLETE       /* Get the data in raw format.  */
+// OBSOLETE       if (! frame_register_read (frame, i, raw_buffer))
+// OBSOLETE    {
+// OBSOLETE      fprintf_filtered (file, "*value not available*\n");
+// OBSOLETE      continue;
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* FIXME: cagney/2002-08-03: This code shouldn't be necessary.
+// OBSOLETE          The function frame_register_read() should have returned the
+// OBSOLETE          pre-cooked register so no conversion is necessary.  */
+// OBSOLETE       /* Convert raw data to virtual format if necessary.  */
+// OBSOLETE       if (REGISTER_CONVERTIBLE (i))
+// OBSOLETE    {
+// OBSOLETE      REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
+// OBSOLETE                                   raw_buffer, virtual_buffer);
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      memcpy (virtual_buffer, raw_buffer,
+// OBSOLETE              REGISTER_VIRTUAL_SIZE (i));
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* If virtual format is floating, print it that way, and in raw
+// OBSOLETE          hex.  */
+// OBSOLETE       if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
+// OBSOLETE    {
+// OBSOLETE      int j;
+// OBSOLETE 
+// OBSOLETE      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+// OBSOLETE                 file, 0, 1, 0, Val_pretty_default);
+// OBSOLETE 
+// OBSOLETE      fprintf_filtered (file, "\t(raw 0x");
+// OBSOLETE      for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
+// OBSOLETE        {
+// OBSOLETE          int idx;
+// OBSOLETE          if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+// OBSOLETE            idx = j;
+// OBSOLETE          else
+// OBSOLETE            idx = REGISTER_RAW_SIZE (i) - 1 - j;
+// OBSOLETE          fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]);
+// OBSOLETE        }
+// OBSOLETE      fprintf_filtered (file, ")");
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      /* Print the register in hex.  */
+// OBSOLETE      val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+// OBSOLETE                 file, 'x', 1, 0, Val_pretty_default);
+// OBSOLETE           /* If not a vector register, print it also according to its
+// OBSOLETE              natural format.  */
+// OBSOLETE      if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0)
+// OBSOLETE        {
+// OBSOLETE          fprintf_filtered (file, "\t");
+// OBSOLETE          val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
+// OBSOLETE                     file, 0, 1, 0, Val_pretty_default);
+// OBSOLETE        }
+// OBSOLETE    }
+// OBSOLETE 
+// OBSOLETE       /* Some z8k specific info.  */
+// OBSOLETE       z8k_print_register_hook (i);
+// OBSOLETE 
+// OBSOLETE       fprintf_filtered (file, "\n");
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE z8k_do_registers_info (int regnum, int all)
+// OBSOLETE {
+// OBSOLETE   z8k_print_registers_info (current_gdbarch, gdb_stdout,
+// OBSOLETE                        deprecated_selected_frame, regnum, all);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE z8k_pop_frame (void)
+// OBSOLETE {
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE struct cmd_list_element *setmemorylist;
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE z8k_set_pointer_size (int newsize)
+// OBSOLETE {
+// OBSOLETE   static int oldsize = 0;
+// OBSOLETE 
+// OBSOLETE   if (oldsize != newsize)
+// OBSOLETE     {
+// OBSOLETE       printf_unfiltered ("pointer size set to %d bits\n", newsize);
+// OBSOLETE       oldsize = newsize;
+// OBSOLETE       if (newsize == 32)
+// OBSOLETE    {
+// OBSOLETE      BIG = 1;
+// OBSOLETE    }
+// OBSOLETE       else
+// OBSOLETE    {
+// OBSOLETE      BIG = 0;
+// OBSOLETE    }
+// OBSOLETE       /* FIXME: This code should be using the GDBARCH framework to
+// OBSOLETE          handle changed type sizes.  If this problem is ever fixed
+// OBSOLETE          (the direct reference to _initialize_gdbtypes() below
+// OBSOLETE          eliminated) then Makefile.in should be updated so that
+// OBSOLETE          z8k-tdep.c is again compiled with -Werror. */
+// OBSOLETE       _initialize_gdbtypes ();
+// OBSOLETE     }
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE segmented_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   z8k_set_pointer_size (32);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE unsegmented_command (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   z8k_set_pointer_size (16);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE static void
+// OBSOLETE set_memory (char *args, int from_tty)
+// OBSOLETE {
+// OBSOLETE   printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
+// OBSOLETE   help_list (setmemorylist, "set memory ", -1, gdb_stdout);
+// OBSOLETE }
+// OBSOLETE 
+// OBSOLETE void
+// OBSOLETE _initialize_z8ktdep (void)
+// OBSOLETE {
+// OBSOLETE   tm_print_insn = gdb_print_insn_z8k;
+// OBSOLETE 
+// OBSOLETE   add_prefix_cmd ("memory", no_class, set_memory,
+// OBSOLETE              "set the memory model", &setmemorylist, "set memory ", 0,
+// OBSOLETE              &setlist);
+// OBSOLETE   add_cmd ("segmented", class_support, segmented_command,
+// OBSOLETE       "Set segmented memory model.", &setmemorylist);
+// OBSOLETE   add_cmd ("unsegmented", class_support, unsegmented_command,
+// OBSOLETE       "Set unsegmented memory model.", &setmemorylist);
+// OBSOLETE 
+// OBSOLETE }
index 829d187..c98e61e 100644 (file)
@@ -1,3 +1,15 @@
+2003-02-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * libiberty.h: Document return value of physmem routines.
+
+2003-02-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * libiberty.h (physmem_total, physmem_available): Prototype.
+
+2003-02-20  Daniel Jacobowitz  <drow@mvista.com>
+
+       * libiberty.h (lrealpath): Add declaration.
+
 2003-01-31  Grant Grundler  <grundler@dsl2.external.hp.com>
 
         * hppa.h (ldwa, ldda): Add ordered opcodes.
index 7b6f177..beb85a7 100644 (file)
@@ -1,3 +1,24 @@
+2003-02-21  Ian Wienand  <ianw@gelato.unsw.edu.au>
+
+       * ia64.h (SHT_IA_64_LOPSREG, SHT_IA_64_HIPSREG,
+       SHT_IA_64_PRIORITY_INIT): Define.
+
+2003-02-18  Alan Modra  <amodra@bigpond.net.au>
+
+       * ppc64.h (IS_PPC64_TLS_RELOC): Rename from IS_TLS_RELOC.
+
+       * ppc.h: Replace DTPMOD64, TPREL64, DTPREL64 with DTPMOD32 etc.
+       (IS_PPC_TLS_RELOC): Define.
+
+2003-02-10  Nick Clifton  <nickc@redhat.com>
+
+       * arm.h (EF_ARM_MAVERICK_FLOAT): Define.
+
+2003-02-05  Alan Modra  <amodra@bigpond.net.au>
+
+       * ppc.h: Add TLS relocs.  Format.
+       * ppc64.h: Likewise.
+
 2003-01-27  Alexandre Oliva  <aoliva@redhat.com>
 
        * mips.h (EF_MIPS_XGOT): Define.
index 269a225..5347017 100644 (file)
@@ -34,6 +34,7 @@
 #define EF_ARM_OLD_ABI     0x100
 #define EF_ARM_SOFT_FLOAT  0x200
 #define EF_ARM_VFP_FLOAT   0x400
+#define EF_ARM_MAVERICK_FLOAT 0x800
 
 /* Other constants defined in the ARM ELF spec. version B-01.  */
 #define EF_ARM_SYMSARESORTED 0x04      /* NB conflicts with EF_INTERWORK */
index 310a7f7..06dfa60 100644 (file)
@@ -1,45 +1,44 @@
 /* IA-64 ELF support for BFD.
-   Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-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 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_IA64_H
 #define _ELF_IA64_H
 
 /* Bits in the e_flags field of the Elf64_Ehdr:  */
 
-#define EF_IA_64_MASKOS         0x0000000f     /* os-specific flags */
-#define EF_IA_64_ARCH   0xff000000     /* arch. version mask */
+#define EF_IA_64_MASKOS         0x0000000f     /* OS-specific flags.  */
+#define EF_IA_64_ARCH   0xff000000     /* Arch. version mask.  */
 
 /* ??? These four definitions are not part of the SVR4 ABI.
    They were present in David's initial code drop, so it is probable
    that they are used by HP/UX.  */
-#define EF_IA_64_TRAPNIL (1 << 0)      /* trap NIL pointer dereferences */
-#define EF_IA_64_EXT    (1 << 2)       /* program uses arch. extensions */
-#define EF_IA_64_BE     (1 << 3)       /* PSR BE bit set (big-endian) */
-#define EFA_IA_64_EAS2_3 0x23000000    /* ia64 EAS 2.3 */
+#define EF_IA_64_TRAPNIL (1 << 0)      /* Trap NIL pointer dereferences.  */
+#define EF_IA_64_EXT    (1 << 2)       /* Program uses arch. extensions.  */
+#define EF_IA_64_BE     (1 << 3)       /* PSR BE bit set (big-endian) */
+#define EFA_IA_64_EAS2_3 0x23000000    /* IA64 EAS 2.3.  */
 
-#define EF_IA_64_ABI64             (1 << 4) /* 64-bit ABI */
+#define EF_IA_64_ABI64             (1 << 4) /* 64-bit ABI */
 /* Not used yet.  */
 #define EF_IA_64_REDUCEDFP         (1 << 5) /* Only FP6-FP11 used.  */
-#define EF_IA_64_CONS_GP           (1 << 6) /* gp as program wide constant. */
-#define EF_IA_64_NOFUNCDESC_CONS_GP (1 << 7) /* And no function descriptors. */
+#define EF_IA_64_CONS_GP           (1 << 6) /* gp as program wide constant.  */
+#define EF_IA_64_NOFUNCDESC_CONS_GP (1 << 7) /* And no function descriptors.  */
 /* Not used yet.  */
 #define EF_IA_64_ABSOLUTE          (1 << 8) /* Load at absolute addresses.  */
 
@@ -54,13 +53,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Bits in the sh_flags field of Elf64_Shdr:  */
 
-#define SHF_IA_64_SHORT                0x10000000      /* section near gp */
-#define SHF_IA_64_NORECOV      0x20000000      /* spec insns w/o recovery */
+#define SHF_IA_64_SHORT                0x10000000      /* Section near gp.  */
+#define SHF_IA_64_NORECOV      0x20000000      /* Spec insns w/o recovery.  */
 
 /* Possible values for sh_type in Elf64_Shdr: */
 
-#define SHT_IA_64_EXT          (SHT_LOPROC + 0)        /* extension bits */
-#define SHT_IA_64_UNWIND       (SHT_LOPROC + 1)        /* unwind bits */
+#define SHT_IA_64_EXT          (SHT_LOPROC + 0)        /* Extension bits.  */
+#define SHT_IA_64_UNWIND       (SHT_LOPROC + 1)        /* Unwind bits.  */
+#define SHT_IA_64_LOPSREG      (SHT_LOPROC + 0x8000000) 
+/* ABI says (SHT_LOPROC + 0xfffffff) but I think it's a typo -- this makes sense.  */
+#define SHT_IA_64_HIPSREG      (SHT_LOPROC + 0x8ffffff) 
+#define SHT_IA_64_PRIORITY_INIT (SHT_LOPROC + 0x9000000)
 
 /* SHT_IA_64_HP_OPT_ANOT is only generated by HPUX compilers for its
    optimization annotation section.  GCC does not generate it but we
@@ -74,8 +77,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Possible values for p_type in Elf64_Phdr:  */
 
-#define PT_IA_64_ARCHEXT       (PT_LOPROC + 0) /* arch extension bits */
-#define PT_IA_64_UNWIND        (PT_LOPROC + 1) /* ia64 unwind bits */
+#define PT_IA_64_ARCHEXT       (PT_LOPROC + 0) /* Arch extension bits,  */
+#define PT_IA_64_UNWIND        (PT_LOPROC + 1) /* IA64 unwind bits.  */
 
 /* HP-UX specific values for p_type in Elf64_Phdr.
    These values are currently just used to make
@@ -92,10 +95,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 /* This section only used by HP-UX, The HP linker gives weak symbols
    precedence over regular common symbols.  We want common to override
    weak.  Using this common instead of SHN_COMMON does that.  */
-
 #define SHN_IA_64_ANSI_COMMON 0xFF00
 
-/* ia64-specific relocation types: */
+/* IA64-specific relocation types: */
 
 /* Relocs apply to specific instructions within a bundle.  The least
    significant 2 bits of the address indicate which instruction in the
index 9234860..52bcc1e 100644 (file)
@@ -32,74 +32,106 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Relocations.  */
 START_RELOC_NUMBERS (elf_ppc_reloc_type)
-  RELOC_NUMBER (R_PPC_NONE, 0)
-  RELOC_NUMBER (R_PPC_ADDR32, 1)
-  RELOC_NUMBER (R_PPC_ADDR24, 2)
-  RELOC_NUMBER (R_PPC_ADDR16, 3)
-  RELOC_NUMBER (R_PPC_ADDR16_LO, 4)
-  RELOC_NUMBER (R_PPC_ADDR16_HI, 5)
-  RELOC_NUMBER (R_PPC_ADDR16_HA, 6)
-  RELOC_NUMBER (R_PPC_ADDR14, 7)
-  RELOC_NUMBER (R_PPC_ADDR14_BRTAKEN, 8)
-  RELOC_NUMBER (R_PPC_ADDR14_BRNTAKEN, 9)
-  RELOC_NUMBER (R_PPC_REL24, 10)
-  RELOC_NUMBER (R_PPC_REL14, 11)
-  RELOC_NUMBER (R_PPC_REL14_BRTAKEN, 12)
-  RELOC_NUMBER (R_PPC_REL14_BRNTAKEN, 13)
-  RELOC_NUMBER (R_PPC_GOT16, 14)
-  RELOC_NUMBER (R_PPC_GOT16_LO, 15)
-  RELOC_NUMBER (R_PPC_GOT16_HI, 16)
-  RELOC_NUMBER (R_PPC_GOT16_HA, 17)
-  RELOC_NUMBER (R_PPC_PLTREL24, 18)
-  RELOC_NUMBER (R_PPC_COPY, 19)
-  RELOC_NUMBER (R_PPC_GLOB_DAT, 20)
-  RELOC_NUMBER (R_PPC_JMP_SLOT, 21)
-  RELOC_NUMBER (R_PPC_RELATIVE, 22)
-  RELOC_NUMBER (R_PPC_LOCAL24PC, 23)
-  RELOC_NUMBER (R_PPC_UADDR32, 24)
-  RELOC_NUMBER (R_PPC_UADDR16, 25)
-  RELOC_NUMBER (R_PPC_REL32, 26)
-  RELOC_NUMBER (R_PPC_PLT32, 27)
-  RELOC_NUMBER (R_PPC_PLTREL32, 28)
-  RELOC_NUMBER (R_PPC_PLT16_LO, 29)
-  RELOC_NUMBER (R_PPC_PLT16_HI, 30)
-  RELOC_NUMBER (R_PPC_PLT16_HA, 31)
-  RELOC_NUMBER (R_PPC_SDAREL16, 32)
-  RELOC_NUMBER (R_PPC_SECTOFF, 33)
-  RELOC_NUMBER (R_PPC_SECTOFF_LO, 34)
-  RELOC_NUMBER (R_PPC_SECTOFF_HI, 35)
-  RELOC_NUMBER (R_PPC_SECTOFF_HA, 36)
-  RELOC_NUMBER (R_PPC_ADDR30, 37)
+  RELOC_NUMBER (R_PPC_NONE,              0)
+  RELOC_NUMBER (R_PPC_ADDR32,            1)
+  RELOC_NUMBER (R_PPC_ADDR24,            2)
+  RELOC_NUMBER (R_PPC_ADDR16,            3)
+  RELOC_NUMBER (R_PPC_ADDR16_LO,         4)
+  RELOC_NUMBER (R_PPC_ADDR16_HI,         5)
+  RELOC_NUMBER (R_PPC_ADDR16_HA,         6)
+  RELOC_NUMBER (R_PPC_ADDR14,            7)
+  RELOC_NUMBER (R_PPC_ADDR14_BRTAKEN,    8)
+  RELOC_NUMBER (R_PPC_ADDR14_BRNTAKEN,   9)
+  RELOC_NUMBER (R_PPC_REL24,            10)
+  RELOC_NUMBER (R_PPC_REL14,            11)
+  RELOC_NUMBER (R_PPC_REL14_BRTAKEN,    12)
+  RELOC_NUMBER (R_PPC_REL14_BRNTAKEN,   13)
+  RELOC_NUMBER (R_PPC_GOT16,            14)
+  RELOC_NUMBER (R_PPC_GOT16_LO,                 15)
+  RELOC_NUMBER (R_PPC_GOT16_HI,                 16)
+  RELOC_NUMBER (R_PPC_GOT16_HA,                 17)
+  RELOC_NUMBER (R_PPC_PLTREL24,                 18)
+  RELOC_NUMBER (R_PPC_COPY,             19)
+  RELOC_NUMBER (R_PPC_GLOB_DAT,                 20)
+  RELOC_NUMBER (R_PPC_JMP_SLOT,                 21)
+  RELOC_NUMBER (R_PPC_RELATIVE,                 22)
+  RELOC_NUMBER (R_PPC_LOCAL24PC,        23)
+  RELOC_NUMBER (R_PPC_UADDR32,          24)
+  RELOC_NUMBER (R_PPC_UADDR16,          25)
+  RELOC_NUMBER (R_PPC_REL32,            26)
+  RELOC_NUMBER (R_PPC_PLT32,            27)
+  RELOC_NUMBER (R_PPC_PLTREL32,                 28)
+  RELOC_NUMBER (R_PPC_PLT16_LO,                 29)
+  RELOC_NUMBER (R_PPC_PLT16_HI,                 30)
+  RELOC_NUMBER (R_PPC_PLT16_HA,                 31)
+  RELOC_NUMBER (R_PPC_SDAREL16,                 32)
+  RELOC_NUMBER (R_PPC_SECTOFF,          33)
+  RELOC_NUMBER (R_PPC_SECTOFF_LO,       34)
+  RELOC_NUMBER (R_PPC_SECTOFF_HI,       35)
+  RELOC_NUMBER (R_PPC_SECTOFF_HA,       36)
+  RELOC_NUMBER (R_PPC_ADDR30,           37)
+
+  /* Relocs added to support TLS.  */
+  RELOC_NUMBER (R_PPC_TLS,              67)
+  RELOC_NUMBER (R_PPC_DTPMOD32,                 68)
+  RELOC_NUMBER (R_PPC_TPREL16,          69)
+  RELOC_NUMBER (R_PPC_TPREL16_LO,       70)
+  RELOC_NUMBER (R_PPC_TPREL16_HI,       71)
+  RELOC_NUMBER (R_PPC_TPREL16_HA,       72)
+  RELOC_NUMBER (R_PPC_TPREL32,          73)
+  RELOC_NUMBER (R_PPC_DTPREL16,                 74)
+  RELOC_NUMBER (R_PPC_DTPREL16_LO,      75)
+  RELOC_NUMBER (R_PPC_DTPREL16_HI,      76)
+  RELOC_NUMBER (R_PPC_DTPREL16_HA,      77)
+  RELOC_NUMBER (R_PPC_DTPREL32,                 78)
+  RELOC_NUMBER (R_PPC_GOT_TLSGD16,      79)
+  RELOC_NUMBER (R_PPC_GOT_TLSGD16_LO,   80)
+  RELOC_NUMBER (R_PPC_GOT_TLSGD16_HI,   81)
+  RELOC_NUMBER (R_PPC_GOT_TLSGD16_HA,   82)
+  RELOC_NUMBER (R_PPC_GOT_TLSLD16,      83)
+  RELOC_NUMBER (R_PPC_GOT_TLSLD16_LO,   84)
+  RELOC_NUMBER (R_PPC_GOT_TLSLD16_HI,   85)
+  RELOC_NUMBER (R_PPC_GOT_TLSLD16_HA,   86)
+  RELOC_NUMBER (R_PPC_GOT_TPREL16,      87)
+  RELOC_NUMBER (R_PPC_GOT_TPREL16_LO,   88)
+  RELOC_NUMBER (R_PPC_GOT_TPREL16_HI,   89)
+  RELOC_NUMBER (R_PPC_GOT_TPREL16_HA,   90)
+  RELOC_NUMBER (R_PPC_GOT_DTPREL16,     91)
+  RELOC_NUMBER (R_PPC_GOT_DTPREL16_LO,  92)
+  RELOC_NUMBER (R_PPC_GOT_DTPREL16_HI,  93)
+  RELOC_NUMBER (R_PPC_GOT_DTPREL16_HA,  94)
 
 /* The remaining relocs are from the Embedded ELF ABI, and are not
    in the SVR4 ELF ABI.  */
-  RELOC_NUMBER (R_PPC_EMB_NADDR32, 101)
-  RELOC_NUMBER (R_PPC_EMB_NADDR16, 102)
-  RELOC_NUMBER (R_PPC_EMB_NADDR16_LO, 103)
-  RELOC_NUMBER (R_PPC_EMB_NADDR16_HI, 104)
-  RELOC_NUMBER (R_PPC_EMB_NADDR16_HA, 105)
-  RELOC_NUMBER (R_PPC_EMB_SDAI16, 106)
-  RELOC_NUMBER (R_PPC_EMB_SDA2I16, 107)
-  RELOC_NUMBER (R_PPC_EMB_SDA2REL, 108)
-  RELOC_NUMBER (R_PPC_EMB_SDA21, 109)
-  RELOC_NUMBER (R_PPC_EMB_MRKREF, 110)
-  RELOC_NUMBER (R_PPC_EMB_RELSEC16, 111)
-  RELOC_NUMBER (R_PPC_EMB_RELST_LO, 112)
-  RELOC_NUMBER (R_PPC_EMB_RELST_HI, 113)
-  RELOC_NUMBER (R_PPC_EMB_RELST_HA, 114)
-  RELOC_NUMBER (R_PPC_EMB_BIT_FLD, 115)
-  RELOC_NUMBER (R_PPC_EMB_RELSDA, 116)
+  RELOC_NUMBER (R_PPC_EMB_NADDR32,     101)
+  RELOC_NUMBER (R_PPC_EMB_NADDR16,     102)
+  RELOC_NUMBER (R_PPC_EMB_NADDR16_LO,  103)
+  RELOC_NUMBER (R_PPC_EMB_NADDR16_HI,  104)
+  RELOC_NUMBER (R_PPC_EMB_NADDR16_HA,  105)
+  RELOC_NUMBER (R_PPC_EMB_SDAI16,      106)
+  RELOC_NUMBER (R_PPC_EMB_SDA2I16,     107)
+  RELOC_NUMBER (R_PPC_EMB_SDA2REL,     108)
+  RELOC_NUMBER (R_PPC_EMB_SDA21,       109)
+  RELOC_NUMBER (R_PPC_EMB_MRKREF,      110)
+  RELOC_NUMBER (R_PPC_EMB_RELSEC16,    111)
+  RELOC_NUMBER (R_PPC_EMB_RELST_LO,    112)
+  RELOC_NUMBER (R_PPC_EMB_RELST_HI,    113)
+  RELOC_NUMBER (R_PPC_EMB_RELST_HA,    114)
+  RELOC_NUMBER (R_PPC_EMB_BIT_FLD,     115)
+  RELOC_NUMBER (R_PPC_EMB_RELSDA,      116)
 
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
-  RELOC_NUMBER (R_PPC_GNU_VTINHERIT, 253)
-  RELOC_NUMBER (R_PPC_GNU_VTENTRY, 254)
+  RELOC_NUMBER (R_PPC_GNU_VTINHERIT,   253)
+  RELOC_NUMBER (R_PPC_GNU_VTENTRY,     254)
 
 /* This is a phony reloc to handle any old fashioned TOC16 references
    that may still be in object files.  */
-  RELOC_NUMBER (R_PPC_TOC16, 255)
+  RELOC_NUMBER (R_PPC_TOC16,           255)
 
 END_RELOC_NUMBERS (R_PPC_max)
 
+#define IS_PPC_TLS_RELOC(R) \
+  ((R) >= R_PPC_TLS && (R) <= R_PPC_GOT_DTPREL16_HA)
 
 /* Processor specific flags for the ELF header e_flags field.  */
 
index 1cbb639..ee2b0ea 100644 (file)
@@ -24,83 +24,128 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Relocations.  */
 START_RELOC_NUMBERS (elf_ppc64_reloc_type)
-  RELOC_NUMBER (R_PPC64_NONE,            0)
-  RELOC_NUMBER (R_PPC64_ADDR32,                  1)
-  RELOC_NUMBER (R_PPC64_ADDR24,                  2)
-  RELOC_NUMBER (R_PPC64_ADDR16,                  3)
-  RELOC_NUMBER (R_PPC64_ADDR16_LO,       4)
-  RELOC_NUMBER (R_PPC64_ADDR16_HI,       5)
-  RELOC_NUMBER (R_PPC64_ADDR16_HA,       6)
-  RELOC_NUMBER (R_PPC64_ADDR14,                  7)
-  RELOC_NUMBER (R_PPC64_ADDR14_BRTAKEN,          8)
-  RELOC_NUMBER (R_PPC64_ADDR14_BRNTAKEN,  9)
-  RELOC_NUMBER (R_PPC64_REL24,          10)
-  RELOC_NUMBER (R_PPC64_REL14,          11)
-  RELOC_NUMBER (R_PPC64_REL14_BRTAKEN,  12)
-  RELOC_NUMBER (R_PPC64_REL14_BRNTAKEN,         13)
-  RELOC_NUMBER (R_PPC64_GOT16,          14)
-  RELOC_NUMBER (R_PPC64_GOT16_LO,       15)
-  RELOC_NUMBER (R_PPC64_GOT16_HI,       16)
-  RELOC_NUMBER (R_PPC64_GOT16_HA,       17)
+  RELOC_NUMBER (R_PPC64_NONE,               0)
+  RELOC_NUMBER (R_PPC64_ADDR32,                     1)
+  RELOC_NUMBER (R_PPC64_ADDR24,                     2)
+  RELOC_NUMBER (R_PPC64_ADDR16,                     3)
+  RELOC_NUMBER (R_PPC64_ADDR16_LO,          4)
+  RELOC_NUMBER (R_PPC64_ADDR16_HI,          5)
+  RELOC_NUMBER (R_PPC64_ADDR16_HA,          6)
+  RELOC_NUMBER (R_PPC64_ADDR14,                     7)
+  RELOC_NUMBER (R_PPC64_ADDR14_BRTAKEN,             8)
+  RELOC_NUMBER (R_PPC64_ADDR14_BRNTAKEN,     9)
+  RELOC_NUMBER (R_PPC64_REL24,             10)
+  RELOC_NUMBER (R_PPC64_REL14,             11)
+  RELOC_NUMBER (R_PPC64_REL14_BRTAKEN,     12)
+  RELOC_NUMBER (R_PPC64_REL14_BRNTAKEN,            13)
+  RELOC_NUMBER (R_PPC64_GOT16,             14)
+  RELOC_NUMBER (R_PPC64_GOT16_LO,          15)
+  RELOC_NUMBER (R_PPC64_GOT16_HI,          16)
+  RELOC_NUMBER (R_PPC64_GOT16_HA,          17)
   /* 18 unused.  32-bit reloc is R_PPC_PLTREL24.  */
-  RELOC_NUMBER (R_PPC64_COPY,           19)
-  RELOC_NUMBER (R_PPC64_GLOB_DAT,       20)
-  RELOC_NUMBER (R_PPC64_JMP_SLOT,       21)
-  RELOC_NUMBER (R_PPC64_RELATIVE,       22)
+  RELOC_NUMBER (R_PPC64_COPY,              19)
+  RELOC_NUMBER (R_PPC64_GLOB_DAT,          20)
+  RELOC_NUMBER (R_PPC64_JMP_SLOT,          21)
+  RELOC_NUMBER (R_PPC64_RELATIVE,          22)
   /* 23 unused.  32-bit reloc is R_PPC_LOCAL24PC.  */
-  RELOC_NUMBER (R_PPC64_UADDR32,        24)
-  RELOC_NUMBER (R_PPC64_UADDR16,        25)
-  RELOC_NUMBER (R_PPC64_REL32,          26)
-  RELOC_NUMBER (R_PPC64_PLT32,          27)
-  RELOC_NUMBER (R_PPC64_PLTREL32,       28)
-  RELOC_NUMBER (R_PPC64_PLT16_LO,       29)
-  RELOC_NUMBER (R_PPC64_PLT16_HI,       30)
-  RELOC_NUMBER (R_PPC64_PLT16_HA,       31)
+  RELOC_NUMBER (R_PPC64_UADDR32,           24)
+  RELOC_NUMBER (R_PPC64_UADDR16,           25)
+  RELOC_NUMBER (R_PPC64_REL32,             26)
+  RELOC_NUMBER (R_PPC64_PLT32,             27)
+  RELOC_NUMBER (R_PPC64_PLTREL32,          28)
+  RELOC_NUMBER (R_PPC64_PLT16_LO,          29)
+  RELOC_NUMBER (R_PPC64_PLT16_HI,          30)
+  RELOC_NUMBER (R_PPC64_PLT16_HA,          31)
   /* 32 unused.  32-bit reloc is R_PPC_SDAREL16.  */
-  RELOC_NUMBER (R_PPC64_SECTOFF,        33)
-  RELOC_NUMBER (R_PPC64_SECTOFF_LO,     34)
-  RELOC_NUMBER (R_PPC64_SECTOFF_HI,     35)
-  RELOC_NUMBER (R_PPC64_SECTOFF_HA,     36)
-  RELOC_NUMBER (R_PPC64_REL30,          37)
-  RELOC_NUMBER (R_PPC64_ADDR64,                 38)
-  RELOC_NUMBER (R_PPC64_ADDR16_HIGHER,  39)
-  RELOC_NUMBER (R_PPC64_ADDR16_HIGHERA,         40)
-  RELOC_NUMBER (R_PPC64_ADDR16_HIGHEST,         41)
-  RELOC_NUMBER (R_PPC64_ADDR16_HIGHESTA, 42)
-  RELOC_NUMBER (R_PPC64_UADDR64,        43)
-  RELOC_NUMBER (R_PPC64_REL64,          44)
-  RELOC_NUMBER (R_PPC64_PLT64,          45)
-  RELOC_NUMBER (R_PPC64_PLTREL64,       46)
-  RELOC_NUMBER (R_PPC64_TOC16,          47)
-  RELOC_NUMBER (R_PPC64_TOC16_LO,       48)
-  RELOC_NUMBER (R_PPC64_TOC16_HI,       49)
-  RELOC_NUMBER (R_PPC64_TOC16_HA,       50)
-  RELOC_NUMBER (R_PPC64_TOC,            51)
-  RELOC_NUMBER (R_PPC64_PLTGOT16,       52)
-  RELOC_NUMBER (R_PPC64_PLTGOT16_LO,    53)
-  RELOC_NUMBER (R_PPC64_PLTGOT16_HI,    54)
-  RELOC_NUMBER (R_PPC64_PLTGOT16_HA,    55)
+  RELOC_NUMBER (R_PPC64_SECTOFF,           33)
+  RELOC_NUMBER (R_PPC64_SECTOFF_LO,        34)
+  RELOC_NUMBER (R_PPC64_SECTOFF_HI,        35)
+  RELOC_NUMBER (R_PPC64_SECTOFF_HA,        36)
+  RELOC_NUMBER (R_PPC64_REL30,             37)
+  RELOC_NUMBER (R_PPC64_ADDR64,                    38)
+  RELOC_NUMBER (R_PPC64_ADDR16_HIGHER,     39)
+  RELOC_NUMBER (R_PPC64_ADDR16_HIGHERA,            40)
+  RELOC_NUMBER (R_PPC64_ADDR16_HIGHEST,            41)
+  RELOC_NUMBER (R_PPC64_ADDR16_HIGHESTA,    42)
+  RELOC_NUMBER (R_PPC64_UADDR64,           43)
+  RELOC_NUMBER (R_PPC64_REL64,             44)
+  RELOC_NUMBER (R_PPC64_PLT64,             45)
+  RELOC_NUMBER (R_PPC64_PLTREL64,          46)
+  RELOC_NUMBER (R_PPC64_TOC16,             47)
+  RELOC_NUMBER (R_PPC64_TOC16_LO,          48)
+  RELOC_NUMBER (R_PPC64_TOC16_HI,          49)
+  RELOC_NUMBER (R_PPC64_TOC16_HA,          50)
+  RELOC_NUMBER (R_PPC64_TOC,               51)
+  RELOC_NUMBER (R_PPC64_PLTGOT16,          52)
+  RELOC_NUMBER (R_PPC64_PLTGOT16_LO,       53)
+  RELOC_NUMBER (R_PPC64_PLTGOT16_HI,       54)
+  RELOC_NUMBER (R_PPC64_PLTGOT16_HA,       55)
 
-/* The following relocs were added in the 64-bit PowerPC ELF ABI
-   revision 1.2. */
-  RELOC_NUMBER (R_PPC64_ADDR16_DS,      56)
-  RELOC_NUMBER (R_PPC64_ADDR16_LO_DS,   57)
-  RELOC_NUMBER (R_PPC64_GOT16_DS,       58)
-  RELOC_NUMBER (R_PPC64_GOT16_LO_DS,    59)
-  RELOC_NUMBER (R_PPC64_PLT16_LO_DS,    60)
-  RELOC_NUMBER (R_PPC64_SECTOFF_DS,     61)
-  RELOC_NUMBER (R_PPC64_SECTOFF_LO_DS,  62)
-  RELOC_NUMBER (R_PPC64_TOC16_DS,       63)
-  RELOC_NUMBER (R_PPC64_TOC16_LO_DS,    64)
-  RELOC_NUMBER (R_PPC64_PLTGOT16_DS,    65)
-  RELOC_NUMBER (R_PPC64_PLTGOT16_LO_DS,         66)
+  /* The following relocs were added in the 64-bit PowerPC ELF ABI
+     revision 1.2. */
+  RELOC_NUMBER (R_PPC64_ADDR16_DS,         56)
+  RELOC_NUMBER (R_PPC64_ADDR16_LO_DS,      57)
+  RELOC_NUMBER (R_PPC64_GOT16_DS,          58)
+  RELOC_NUMBER (R_PPC64_GOT16_LO_DS,       59)
+  RELOC_NUMBER (R_PPC64_PLT16_LO_DS,       60)
+  RELOC_NUMBER (R_PPC64_SECTOFF_DS,        61)
+  RELOC_NUMBER (R_PPC64_SECTOFF_LO_DS,     62)
+  RELOC_NUMBER (R_PPC64_TOC16_DS,          63)
+  RELOC_NUMBER (R_PPC64_TOC16_LO_DS,       64)
+  RELOC_NUMBER (R_PPC64_PLTGOT16_DS,       65)
+  RELOC_NUMBER (R_PPC64_PLTGOT16_LO_DS,            66)
+
+  /* Relocs added to support TLS.  PowerPC64 ELF ABI revision 1.5.  */
+  RELOC_NUMBER (R_PPC64_TLS,               67)
+  RELOC_NUMBER (R_PPC64_DTPMOD64,          68)
+  RELOC_NUMBER (R_PPC64_TPREL16,           69)
+  RELOC_NUMBER (R_PPC64_TPREL16_LO,        70)
+  RELOC_NUMBER (R_PPC64_TPREL16_HI,        71)
+  RELOC_NUMBER (R_PPC64_TPREL16_HA,        72)
+  RELOC_NUMBER (R_PPC64_TPREL64,           73)
+  RELOC_NUMBER (R_PPC64_DTPREL16,          74)
+  RELOC_NUMBER (R_PPC64_DTPREL16_LO,       75)
+  RELOC_NUMBER (R_PPC64_DTPREL16_HI,       76)
+  RELOC_NUMBER (R_PPC64_DTPREL16_HA,       77)
+  RELOC_NUMBER (R_PPC64_DTPREL64,          78)
+  RELOC_NUMBER (R_PPC64_GOT_TLSGD16,       79)
+  RELOC_NUMBER (R_PPC64_GOT_TLSGD16_LO,            80)
+  RELOC_NUMBER (R_PPC64_GOT_TLSGD16_HI,            81)
+  RELOC_NUMBER (R_PPC64_GOT_TLSGD16_HA,            82)
+  RELOC_NUMBER (R_PPC64_GOT_TLSLD16,       83)
+  RELOC_NUMBER (R_PPC64_GOT_TLSLD16_LO,            84)
+  RELOC_NUMBER (R_PPC64_GOT_TLSLD16_HI,            85)
+  RELOC_NUMBER (R_PPC64_GOT_TLSLD16_HA,            86)
+  RELOC_NUMBER (R_PPC64_GOT_TPREL16_DS,            87)
+  RELOC_NUMBER (R_PPC64_GOT_TPREL16_LO_DS,  88)
+  RELOC_NUMBER (R_PPC64_GOT_TPREL16_HI,            89)
+  RELOC_NUMBER (R_PPC64_GOT_TPREL16_HA,            90)
+  RELOC_NUMBER (R_PPC64_GOT_DTPREL16_DS,    91)
+  RELOC_NUMBER (R_PPC64_GOT_DTPREL16_LO_DS, 92)
+  RELOC_NUMBER (R_PPC64_GOT_DTPREL16_HI,    93)
+  RELOC_NUMBER (R_PPC64_GOT_DTPREL16_HA,    94)
+  RELOC_NUMBER (R_PPC64_TPREL16_DS,        95)
+  RELOC_NUMBER (R_PPC64_TPREL16_LO_DS,     96)
+  RELOC_NUMBER (R_PPC64_TPREL16_HIGHER,            97)
+  RELOC_NUMBER (R_PPC64_TPREL16_HIGHERA,    98)
+  RELOC_NUMBER (R_PPC64_TPREL16_HIGHEST,    99)
+  RELOC_NUMBER (R_PPC64_TPREL16_HIGHESTA,  100)
+  RELOC_NUMBER (R_PPC64_DTPREL16_DS,      101)
+  RELOC_NUMBER (R_PPC64_DTPREL16_LO_DS,           102)
+  RELOC_NUMBER (R_PPC64_DTPREL16_HIGHER,   103)
+  RELOC_NUMBER (R_PPC64_DTPREL16_HIGHERA,  104)
+  RELOC_NUMBER (R_PPC64_DTPREL16_HIGHEST,  105)
+  RELOC_NUMBER (R_PPC64_DTPREL16_HIGHESTA, 106)
 
   /* These are GNU extensions to enable C++ vtable garbage collection.  */
-  RELOC_NUMBER (R_PPC64_GNU_VTINHERIT, 253)
-  RELOC_NUMBER (R_PPC64_GNU_VTENTRY,   254)
+  RELOC_NUMBER (R_PPC64_GNU_VTINHERIT,    253)
+  RELOC_NUMBER (R_PPC64_GNU_VTENTRY,      254)
 
 END_RELOC_NUMBERS (R_PPC64_max)
 
+#define IS_PPC64_TLS_RELOC(R) \
+  ((R) >= R_PPC64_TLS && (R) <= R_PPC64_DTPREL16_HIGHESTA)
+
 /* Specify the start of the .glink section.  */
 #define DT_PPC64_GLINK         DT_LOPROC
 
index b36341d..f60f7b1 100644 (file)
@@ -1,3 +1,17 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * remote-sim.h (sim_open, sim_load, sim_create_inferior): Rename
+       _bfd to bfd.
+
+2003-02-20  Andrew Cagney  <ac131313@redhat.com>
+
+       * remote-sim.h (SIM_RC): Delete unused SIM_RC_UNKNOWN_BREAKPOINT,
+       SIM_RC_INSUFFICIENT_RESOURCES and SIM_RC_DUPLICATE_BREAKPOINT.
+       (sim_set_breakpoint, sim_clear_breakpoint): Delete declarations.
+       (sim_clear_all_breakpoints, sim_enable_breakpoint): Ditto.
+       (sim_enable_all_breakpoints, sim_disable_breakpoint): Ditto.
+       (sim_disable_all_breakpoints): Ditto.
+
 2002-12-26  Kazu Hirata  <kazu@cs.umass.edu>
 
        * sim-h8300.h: Remove ^M.
index 14d90b4..a49ba1a 100644 (file)
@@ -58,16 +58,13 @@ typedef enum {
 
 typedef enum {
   SIM_RC_FAIL = 0,
-  SIM_RC_OK = 1,
-  SIM_RC_UNKNOWN_BREAKPOINT = 2,
-  SIM_RC_INSUFFICIENT_RESOURCES = 3,
-  SIM_RC_DUPLICATE_BREAKPOINT = 4
+  SIM_RC_OK = 1
 } SIM_RC;
 
 
 /* The bfd struct, as an opaque type.  */
 
-struct _bfd;
+struct bfd;
 
 
 /* Main simulator entry points.  */
@@ -108,7 +105,7 @@ struct _bfd;
    sim_create_inferior.  FIXME: What should the state of the simulator
    be? */
 
-SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct _bfd *abfd, char **argv));
+SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct bfd *abfd, char **argv));
 
 
 /* Destory a simulator instance.
@@ -145,7 +142,7 @@ void sim_close PARAMS ((SIM_DESC sd, int quitting));
    Such manipulation should probably (?) occure in
    sim_create_inferior. */
 
-SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty));
+SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty));
 
 
 /* Prepare to run the simulated program.
@@ -165,7 +162,7 @@ SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tt
    address space (according to the applicable ABI) and the program
    counter and stack pointer set accordingly. */
 
-SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct _bfd *abfd, char **argv, char **env));
+SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct bfd *abfd, char **argv, char **env));
 
 
 /* Fetch LENGTH bytes of the simulated program's memory.  Start fetch
@@ -278,19 +275,6 @@ void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc));
 
 void sim_do_command PARAMS ((SIM_DESC sd, char *cmd));
 
-/* Call these functions to set and clear breakpoints at ADDR. */
-
-SIM_RC sim_set_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr));
-SIM_RC sim_clear_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr));
-SIM_RC sim_clear_all_breakpoints PARAMS ((SIM_DESC sd));
-
-/* These functions are used to enable and disable breakpoints. */
-
-SIM_RC sim_enable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr));
-SIM_RC sim_disable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr));
-SIM_RC sim_enable_all_breakpoints PARAMS ((SIM_DESC sd));
-SIM_RC sim_disable_all_breakpoints PARAMS ((SIM_DESC sd));
-
 #ifdef __cplusplus
 }
 #endif
index f9916c5..676ceab 100644 (file)
@@ -85,6 +85,10 @@ extern char *basename ();
 
 extern const char *lbasename PARAMS ((const char *));
 
+/* A well-defined realpath () that is always compiled in.  */
+
+extern char *lrealpath PARAMS ((const char *));
+
 /* Concatenate an arbitrary number of strings.  You must pass NULL as
    the last argument of this function, to terminate the list of
    strings.  Allocates memory using xmalloc.  */
@@ -242,6 +246,10 @@ extern char *xstrdup PARAMS ((const char *)) ATTRIBUTE_MALLOC;
 
 extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)) ATTRIBUTE_MALLOC;
 
+/* Physical memory routines.  Return values are in BYTES.  */
+extern double physmem_total PARAMS ((void));
+extern double physmem_available PARAMS ((void));
+
 /* hex character manipulation routines */
 
 #define _hex_array_size 256
index c7c4484..f04439c 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-21  Noida D.Venkatasubramanian  <dvenkat@noida.hcltech.com>
+
+       * h8300.h (ldmac, stmac): Replace MACREG with MS32 and MD32.
+
 2003-01-23  Alan Modra  <amodra@bigpond.net.au>
 
        * m68hc11.h (cpu6812s): Define.
index 4141c57..034c7bc 100644 (file)
@@ -1,5 +1,5 @@
 /* Opcode table for the H8/300
-   Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, 2002
+   Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, 2002, 2003
    Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>.
    
@@ -48,7 +48,7 @@ typedef int op_type;
 #define L_32           0x04
 #define L_P             0x08
 #define L_24           0x10
-#define MEMRELAX       0x20                    /* move insn which may relax */ 
+#define MEMRELAX       0x20                    /* Move insn which may relax.  */ 
 #define SRC             0x40
 #define DST             0x80
 
@@ -66,10 +66,10 @@ typedef int op_type;
 #define DBIT            0x80000
 #define DISPREG         0x100000
 #define IGNORE                 0x200000
-#define E                      0x400000                /* FIXME: end of nibble sequence? */
+#define E                      0x400000                /* FIXME: end of nibble sequence?  */
 #define L_2            0x800000
-#define B30            0x1000000               /* bit 3 must be low */
-#define B31            0x2000000               /* bit 3 must be high */
+#define B30            0x1000000               /* Bit 3 must be low.  */
+#define B31            0x2000000               /* Bit 3 must be high.  */
 #define CCR            0x4000000
 #define ABS             0x8000000
 #define ABSJMP         0x10000000  
@@ -77,54 +77,57 @@ typedef int op_type;
 #define PCREL           0x40000000
 #define MEMIND          0x80000000
 
-#define IMM3           IMM|L_3
-#define IMM2           IMM|L_2
+#define IMM3           IMM | L_3
+#define IMM2           IMM | L_2
 
-#define SIZE           (L_2|L_3|L_8|L_16|L_32|L_P|L_24)
-#define MODE           (REG|IMM|DISP|IND|INC|DEC|CCR|ABS|MEMIND|EXR)
+#define SIZE           (L_2 | L_3 | L_8 | L_16 | L_32 | L_P | L_24)
+#define MODE           (REG | IMM | DISP | IND | INC | DEC | CCR | ABS | MEMIND | EXR)
 
-#define RD8            (DST|L_8|REG)
-#define RD16           (DST|L_16|REG)
-#define RD32           (DST|L_32|REG)
-#define RS8            (SRC|L_8|REG)
-#define RS16           (SRC|L_16|REG)
-#define RS32           (SRC|L_32|REG)
+#define RD8            (DST | L_8  | REG)
+#define RD16           (DST | L_16 | REG)
+#define RD32           (DST | L_32 | REG)
+#define RS8            (SRC | L_8  | REG)
+#define RS16           (SRC | L_16 | REG)
+#define RS32           (SRC | L_32 | REG)
 
-#define RSP            (SRC|L_P|REG)
-#define RDP            (DST|L_P|REG)
+#define RSP            (SRC | L_P | REG)
+#define RDP            (DST | L_P | REG)
 
-#define IMM8           (IMM|SRC|L_8)
-#define IMM16          (IMM|SRC|L_16)
-#define IMM32          (IMM|SRC|L_32)
+#define IMM8           (IMM | SRC | L_8)
+#define IMM16          (IMM | SRC | L_16)
+#define IMM32          (IMM | SRC | L_32)
 
-#define ABS8SRC        (SRC|ABS|L_8|ABS8MEM)
-#define ABS8DST                (DST|ABS|L_8|ABS8MEM)
+#define ABS8SRC        (SRC | ABS | L_8 | ABS8MEM)
+#define ABS8DST                (DST | ABS | L_8 | ABS8MEM)
 
-#define DISP8          (PCREL|L_8)
-#define DISP16                 (PCREL|L_16)
+#define DISP8          (PCREL | L_8)
+#define DISP16                 (PCREL | L_16)
 
-#define DISP8SRC       (DISP|L_8|SRC)
-#define DISP16SRC      (DISP|L_16|SRC)
+#define DISP8SRC       (DISP | L_8  | SRC)
+#define DISP16SRC      (DISP | L_16 | SRC)
 
-#define DISP8DST       (DISP|L_8|DST)
-#define DISP16DST      (DISP|L_16|DST)
+#define DISP8DST       (DISP | L_8  | DST)
+#define DISP16DST      (DISP | L_16 | DST)
 
-#define ABS16SRC       (SRC|ABS|L_16)
-#define ABS16DST       (DST|ABS|L_16)
-#define ABS24SRC       (SRC|ABS|L_24)
-#define ABS24DST       (DST|ABS|L_24)
-#define ABS32SRC       (SRC|ABS|L_32)
-#define ABS32DST       (DST|ABS|L_32)
+#define ABS16SRC       (SRC | ABS | L_16)
+#define ABS16DST       (DST | ABS | L_16)
+#define ABS24SRC       (SRC | ABS | L_24)
+#define ABS24DST       (DST | ABS | L_24)
+#define ABS32SRC       (SRC | ABS | L_32)
+#define ABS32DST       (DST | ABS | L_32)
 
-#define RDDEC          (DST|DEC)
-#define RSINC          (SRC|INC)
-#define RDINC          (DST|INC)
+#define RDDEC          (DST | DEC)
+#define RSINC          (SRC | INC)
+#define RDINC          (DST | INC)
 
-#define RDIND          (DST|IND)
-#define RSIND          (SRC|IND)
+#define RDIND          (DST | IND)
+#define RSIND          (SRC | IND)
+
+#define MS32            (SRC | L_32 | MACREG)
+#define MD32            (DST | L_32 | MACREG)
 
 #if 1
-#define OR8 RS8                /* ??? OR as in One Register? */
+#define OR8 RS8                /* ??? OR as in One Register?  */
 #define OR16 RS16
 #define OR32 RS32
 #else
@@ -211,7 +214,7 @@ struct h8_opcode
 #define PREFIXLDC 0x0,0x1,0x4,0x0
 
 
-#define O(op, size) (op*4+size)
+#define O(op, size) (op * 4 + size)
 
 #define O_RECOMPILE 0
 #define O_ADD  1
@@ -316,7 +319,6 @@ struct h8_opcode
 #define SL 2
 #define SN 3
 
-
 /* FIXME: Lots of insns have "E, 0, 0, 0, 0" in the nibble code sequences.
    Methinks the zeroes aren't necessary.  Once confirmed, nuke 'em.  */
 
@@ -596,8 +598,8 @@ const struct h8_opcode h8_opcodes[] =
 
   NEW_SOP(O(O_CLRMAC,SN),1,2,"clrmac"),{{E, 0, 0}},{{0x0,0x1,0xa,0x0,E}} EOP,
   NEW_SOP(O(O_MAC,SL),1,2,"mac"),{{RSINC,RDINC,E}},{{0x0,0x1,0x6,0x0,0x6,0xd,B30|RSINC,B30|RDINC,E}} EOP,
-  NEW_SOP(O(O_LDMAC,SL),1,2,"ldmac"),{{RS32,MACREG,E}},{{0x0,0x3,MACREG,RS32,E}} EOP,
-  NEW_SOP(O(O_STMAC,SL),1,2,"stmac"),{{MACREG,RD32,E}},{{0x0,0x2,MACREG,RD32,E}} EOP,
+  NEW_SOP(O(O_LDMAC,SL),1,2,"ldmac"),{{RS32,MD32,E}},{{0x0,0x3,MD32,RS32,E}} EOP,
+  NEW_SOP(O(O_STMAC,SL),1,2,"stmac"),{{MS32,RD32,E}},{{0x0,0x2,MS32,RD32,E}} EOP,  
   NEW_SOP(O(O_LDM,SL),0,6,"ldm.l"),{{RSINC, RS32, E}},{{ 0x0,0x1,IGNORE,0x0,0x6,0xD,0x7,IGNORE,E}}EOP,
   NEW_SOP(O(O_STM,SL),0,6,"stm.l"),{{RS32, RDDEC, E}},{{0x0,0x1,IGNORE,0x0,0x6,0xD,0xF,IGNORE,E}}EOP,
   {0, 0, 0, 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}}}
index 9945c9c..5e507af 100644 (file)
@@ -1,3 +1,112 @@
+2003-02-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * physmem.c: Formatting changes from upstream.
+
+2003-02-24  Danny Smith  <dannysmith@users.source.forge.net>
+
+       * physmem.c (physmem_total): Add _WIN32 support.
+       (physmem_available): Likewise.
+
+2003-02-24  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Test for
+       GSI_PHYSMEM.
+       (physmem_available) [HAVE_TABLE]: Test for TBL_VMSTATS.
+
+2003-02-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * configure.in: Check for sys/systemcfg.h and
+       _system_configuration.
+       * physmem.c: Add support for AIX.  Tweek formatting as per
+       upstream coreutils beta.
+
+2003-02-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+           Richard Earnshaw  <rearnsha@arm.com>
+           Geoffrey Keating  <geoffk@apple.com>
+
+       * configure.in: Check for sys/sysctl.h and sysctl.
+       * physmem.c: Add support for *bsd and darwin.
+       * Makefile.in: Generate depedency for physmem.o.
+
+2003-02-21  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * physmem.c (physmem_total) [HAVE_GETSYSINFO]: Use getsysinfo on
+       Tru64 UNIX.
+       (physmem_available) [HAVE_TABLE && HAVE_SYS_TABLE_H]: Use table on
+       Tru64 UNIX.
+
+       * configure.in (AC_CHECK_HEADERS): Check for sys/sysinfo.h,
+       machine/hal_sysinfo.h, sys/table.h.
+       (checkfuncs, AC_CHECKFUNCS): Check for getsysinfo, table.
+       * configure, config.in: Regenerate.
+
+2003-02-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * physmem.c (physmem_total, physmem_available): De-ANSI-fy.
+       * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and
+       pstat_getdynamic.
+
+2003-02-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * Makefile.in (CFILES): Add physmem.c.
+       (REQUIRED_OFILES): Add physmem.o.
+       * configure.in: Check for sys/pstat.h.
+       (checkfuncs): Add pstat_getstatic and pstat_getdynamic.
+       * physmem.c: New file, copied from textutils.
+
+       * config.in, configure: Regenerated.
+
+2003-02-20  Daniel Jacobowitz  <drow@mvista.com>
+
+       * Makefile.in (CFILES): Add lrealpath.c.
+       (REQUIRED_OFILES): Add lrealpath.o.
+       (lrealpath.o): Add rule.
+       * aclocal.m4 (libiberty_NEED_DECLARATION): Add.
+       * configure.in: Add realpath and canonicalize_file_name to
+       checkfuncs and AC_CHECK_FUNCS.  Use libiberty_NEED_DECLARATION
+       for canonicalize_file_name.
+       * lrealpath.c: New file.
+       * make-relative-prefix.c: Update documentation.
+       (make_relative_prefix): Simplify.  Use lbasename and lrealpath.
+       * config.in: Regenerated.
+       * configure: Regenerated.
+       * functions.texi: Regenerated.
+
+2003-02-20  jmc  <jmc@prioris.mini.pw.edu.pl>
+
+       * cplus_dem.c: Fix typo: intializes -> initializes.
+
+2003-02-20  Alexandre Oliva  <aoliva@redhat.com>
+
+       * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to
+       config.status.
+       * configure: Rebuilt.
+
+2003-02-13  Daniel Jacobowitz  <drow@mvista.com>
+
+       Fix PR c++/7612.
+       * cplus-dem.c (demangle_signature): Call string_delete.
+       Remove extra string_init.
+       (demangle_arm_hp_template): Call string_delete instead of
+       string_clear.  Add missing string_delete call.
+       (demangle_qualified): Add missing string_delete call.
+       (do_type): Remove unused variable btype.  Add missing string_delete
+       call.  Call string_delete instead of string_clear.
+       (demangle_fund_type): Move variable btype inside of the switch
+       statement.  Add missing string_delete call.
+       (do_arg): Call string_delete instead of string_clear.  Remove extra
+       string_init.
+       (demangle_nested_args): Free work->previous_argument.
+
+2003-02-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * acconfig.h: New file.  Add uintptr_t.
+       * config.in: Regenerated.
+
+2003-02-04  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       * libiberty.texi: Update to GFDL 1.2.
+
 2003-01-30  Christian Cornelssen  <ccorn@cs.tu-berlin.de>
 
        * Makefile.in (libiberty_topdir): New subst.
index 761c674..0641796 100644 (file)
@@ -137,6 +137,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c                                \
        hashtab.c hex.c                                                 \
        index.c insque.c                                                \
        lbasename.c                                                     \
+       lrealpath.c                                                     \
        make-relative-prefix.c                                          \
        make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c     \
         memset.c mkstemps.c                                            \
@@ -144,7 +145,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c                                \
        partition.c                                                     \
         pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c                    \
         pex-unix.c pex-win32.c                                         \
-         putenv.c                                                      \
+         physmem.c putenv.c                                            \
        random.c regex.c rename.c rindex.c                              \
        safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c              \
         splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c         \
@@ -165,10 +166,11 @@ REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o         \
        getopt.o getopt1.o getpwd.o getruntime.o                        \
        hashtab.o hex.o                                                 \
        lbasename.o                                                     \
+       lrealpath.o                                                     \
        make-relative-prefix.o                                          \
        make-temp-file.o                                                \
        objalloc.o obstack.o                                            \
-       partition.o @pexecute@                                          \
+       partition.o physmem.o @pexecute@                                                \
        safe-ctype.o sort.o spaces.o splay-tree.o strerror.o            \
         strsignal.o                                                    \
        ternary.o                                                       \
@@ -443,6 +445,7 @@ hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \
 hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
        $(INCDIR)/safe-ctype.h
+lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h
@@ -463,6 +466,7 @@ pex-msdos.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
 pex-os2.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 pex-unix.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
 pex-win32.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
+physmem.o: config.h $(INCDIR)/libiberty.h
 putenv.o: config.h $(INCDIR)/ansidecl.h
 random.o: $(INCDIR)/ansidecl.h
 regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
diff --git a/libiberty/acconfig.h b/libiberty/acconfig.h
new file mode 100644 (file)
index 0000000..364cb41
--- /dev/null
@@ -0,0 +1,3 @@
+/* Define to `unsigned long' if <sys/types.h> doesn't define.  */
+#undef uintptr_t
+
index 103e246..6c5dc6a 100644 (file)
@@ -87,6 +87,35 @@ then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
 fi
 ])
 
+dnl See whether we need a declaration for a function.
+AC_DEFUN(libiberty_NEED_DECLARATION,
+[AC_MSG_CHECKING([whether $1 must be declared])
+AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
+[AC_TRY_COMPILE([
+#include "confdefs.h"
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif],
+[char *(*pfn) = (char *(*)) $1],
+libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
+AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
+if test $libiberty_cv_decl_needed_$1 = yes; then
+  AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
+            [Define if $1 is not declared in system header files.])
+fi
+])dnl
+
 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
 # are probably using a cross compiler, which will not be able to fully
index e06bbce..f0e1746 100644 (file)
@@ -1,4 +1,4 @@
-/* config.in.  Generated automatically from configure.in by autoheader 2.13.  */
+/* config.in.  Generated automatically from configure.in by autoheader.  */
 
 /* Define to empty if the keyword does not work.  */
 #undef const
@@ -15,6 +15,9 @@
 /* Define as __inline if that's what the C compiler calls it.  */
 #undef inline
 
+/* Define if your C compiler doesn't accept -c and -o together.  */
+#undef NO_MINUS_C_MINUS_O
+
 /* Define to `int' if <sys/types.h> doesn't define.  */
 #undef pid_t
 
@@ -30,6 +33,9 @@
 /* Define vfork as fork if vfork does not work.  */
 #undef vfork
 
+/* Define to `unsigned long' if <sys/types.h> doesn't define.  */
+#undef uintptr_t
+
 /* Define if you have the _doprnt function.  */
 #undef HAVE__DOPRNT
 
@@ -57,6 +63,9 @@
 /* Define if you have the calloc function.  */
 #undef HAVE_CALLOC
 
+/* Define if you have the canonicalize_file_name function.  */
+#undef HAVE_CANONICALIZE_FILE_NAME
+
 /* Define if you have the clock function.  */
 #undef HAVE_CLOCK
 
@@ -72,6 +81,9 @@
 /* Define if you have the getrusage function.  */
 #undef HAVE_GETRUSAGE
 
+/* Define if you have the getsysinfo function.  */
+#undef HAVE_GETSYSINFO
+
 /* Define if you have the gettimeofday function.  */
 #undef HAVE_GETTIMEOFDAY
 
 /* Define if you have the psignal function.  */
 #undef HAVE_PSIGNAL
 
+/* Define if you have the pstat_getdynamic function.  */
+#undef HAVE_PSTAT_GETDYNAMIC
+
+/* Define if you have the pstat_getstatic function.  */
+#undef HAVE_PSTAT_GETSTATIC
+
 /* Define if you have the putenv function.  */
 #undef HAVE_PUTENV
 
 /* Define if you have the random function.  */
 #undef HAVE_RANDOM
 
+/* Define if you have the realpath function.  */
+#undef HAVE_REALPATH
+
 /* Define if you have the rename function.  */
 #undef HAVE_RENAME
 
 /* Define if you have the sysconf function.  */
 #undef HAVE_SYSCONF
 
+/* Define if you have the sysctl function.  */
+#undef HAVE_SYSCTL
+
+/* Define if you have the sysmp function.  */
+#undef HAVE_SYSMP
+
+/* Define if you have the table function.  */
+#undef HAVE_TABLE
+
 /* Define if you have the times function.  */
 #undef HAVE_TIMES
 
 /* Define if you have the <limits.h> header file.  */
 #undef HAVE_LIMITS_H
 
+/* Define if you have the <machine/hal_sysinfo.h> header file.  */
+#undef HAVE_MACHINE_HAL_SYSINFO_H
+
 /* Define if you have the <stdlib.h> header file.  */
 #undef HAVE_STDLIB_H
 
 /* Define if you have the <sys/param.h> header file.  */
 #undef HAVE_SYS_PARAM_H
 
+/* Define if you have the <sys/pstat.h> header file.  */
+#undef HAVE_SYS_PSTAT_H
+
 /* Define if you have the <sys/resource.h> header file.  */
 #undef HAVE_SYS_RESOURCE_H
 
 /* Define if you have the <sys/stat.h> header file.  */
 #undef HAVE_SYS_STAT_H
 
+/* Define if you have the <sys/sysctl.h> header file.  */
+#undef HAVE_SYS_SYSCTL_H
+
+/* Define if you have the <sys/sysinfo.h> header file.  */
+#undef HAVE_SYS_SYSINFO_H
+
+/* Define if you have the <sys/sysmp.h> header file.  */
+#undef HAVE_SYS_SYSMP_H
+
+/* Define if you have the <sys/systemcfg.h> header file.  */
+#undef HAVE_SYS_SYSTEMCFG_H
+
+/* Define if you have the <sys/table.h> header file.  */
+#undef HAVE_SYS_TABLE_H
+
 /* Define if you have the <sys/time.h> header file.  */
 #undef HAVE_SYS_TIME_H
 
 /* Define if you have the sys_siglist variable. */
 #undef HAVE_SYS_SIGLIST
 
+/* Define if you have the _system_configuration variable. */
+#undef HAVE__SYSTEM_CONFIGURATION
+
 /* 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. */
         STACK_DIRECTION = 0 => direction of growth unknown */
 #undef STACK_DIRECTION
 
+/* Define if canonicalize_file_name is not declared in system header files. */
+#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME
+
index 86037ae..3f46ebf 100755 (executable)
@@ -1356,7 +1356,7 @@ else
 fi
 echo "$ac_t""$CPP" 1>&6
 
-for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h
+for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -1735,9 +1735,11 @@ funcs="$funcs waitpid"
 
 # Also in the old function.def file: alloca, vfork, getopt.
 
-vars="sys_errlist sys_nerr sys_siglist"
+vars="sys_errlist sys_nerr sys_siglist _system_configuration"
 
 checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
+checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
+checkfuncs="$checkfuncs getsysinfo table sysctl"
 
 # These are neither executed nor required, but they help keep
 # autoheader happy without adding a bunch of text to acconfig.h.
@@ -1745,12 +1747,12 @@ if test "x" = "y"; then
   for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1749: checking for $ac_func" >&5
+echo "configure:1751: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1754 "configure"
+#line 1756 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1773,7 +1775,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1779: \"$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
@@ -1800,12 +1802,12 @@ done
   for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1804: checking for $ac_func" >&5
+echo "configure:1806: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1809 "configure"
+#line 1811 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1828,7 +1830,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1834: \"$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
@@ -1855,12 +1857,12 @@ done
   for ac_func in memmove memset putenv random rename rindex sigsetmask
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1859: checking for $ac_func" >&5
+echo "configure:1861: 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 1864 "configure"
+#line 1866 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1883,7 +1885,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1889: \"$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
@@ -1910,12 +1912,12 @@ done
   for ac_func in strcasecmp setenv strchr strdup strncasecmp strrchr strstr
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1914: checking for $ac_func" >&5
+echo "configure:1916: 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 1919 "configure"
+#line 1921 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1938,7 +1940,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1944: \"$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
@@ -1965,12 +1967,12 @@ done
   for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1969: checking for $ac_func" >&5
+echo "configure:1971: 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 1974 "configure"
+#line 1976 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1993,7 +1995,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1999: \"$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
@@ -2020,12 +2022,12 @@ done
   for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2024: checking for $ac_func" >&5
+echo "configure:2026: 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 2029 "configure"
+#line 2031 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2048,7 +2050,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2054: \"$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
@@ -2075,12 +2077,12 @@ done
   for ac_func in sysconf times sbrk gettimeofday ffs
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2079: checking for $ac_func" >&5
+echo "configure:2081: 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 2084 "configure"
+#line 2086 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2103,7 +2105,117 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2136: 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 2141 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+  for ac_func in realpath canonicalize_file_name
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2191: 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 2196 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2219: \"$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
@@ -2139,6 +2251,10 @@ EOF
 #define HAVE_SYS_SIGLIST 1
 EOF
 
+  cat >> confdefs.h <<\EOF
+#define HAVE__SYSTEM_CONFIGURATION 1
+EOF
+
 fi
 
 # For each of these functions, if the host does not provide the
@@ -2333,7 +2449,7 @@ if test -z "${setobjs}"; then
   # We haven't set the list of objects yet.  Use the standard autoconf
   # tests.  This will only work if the compiler works.
   echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2337: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2453: 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.
@@ -2344,12 +2460,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 2348 "configure"
+#line 2464 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2469: \"$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
@@ -2375,19 +2491,19 @@ 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:2379: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2495: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
   for ac_func in $funcs
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2386: checking for $ac_func" >&5
+echo "configure:2502: 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 2391 "configure"
+#line 2507 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2410,7 +2526,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2437,12 +2553,12 @@ done
 
 
   echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2441: checking whether alloca needs Cray hooks" >&5
+echo "configure:2557: 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 2446 "configure"
+#line 2562 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -2467,12 +2583,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
 if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; do
     echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2471: checking for $ac_func" >&5
+echo "configure:2587: 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 2476 "configure"
+#line 2592 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2495,7 +2611,7 @@ $ac_func();
 
 ; 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:2615: \"$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
@@ -2521,7 +2637,7 @@ fi
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2525: checking stack direction for C alloca" >&5
+echo "configure:2641: 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
@@ -2529,7 +2645,7 @@ else
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 2533 "configure"
+#line 2649 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -2548,7 +2664,7 @@ main ()
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2668: \"$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
@@ -2570,17 +2686,17 @@ EOF
 
   ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:2574: checking for vfork.h" >&5
+echo "configure:2690: checking for vfork.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2579 "configure"
+#line 2695 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2700: \"$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*
@@ -2605,18 +2721,18 @@ else
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:2609: checking for working vfork" >&5
+echo "configure:2725: checking for working vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
   echo $ac_n "checking for vfork""... $ac_c" 1>&6
-echo "configure:2615: checking for vfork" >&5
+echo "configure:2731: checking for vfork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2620 "configure"
+#line 2736 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vfork(); below.  */
@@ -2639,7 +2755,7 @@ vfork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vfork=yes"
 else
@@ -2661,7 +2777,7 @@ fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 else
   cat > conftest.$ac_ext <<EOF
-#line 2665 "configure"
+#line 2781 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -2756,7 +2872,7 @@ main() {
   }
 }
 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:2876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_vfork_works=yes
 else
@@ -2788,12 +2904,12 @@ fi
     for ac_func in _doprnt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2792: checking for $ac_func" >&5
+echo "configure:2908: 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 2797 "configure"
+#line 2913 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2816,7 +2932,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2820: \"$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
@@ -2846,12 +2962,12 @@ done
     for ac_func in _doprnt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2850: checking for $ac_func" >&5
+echo "configure:2966: 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 2855 "configure"
+#line 2971 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2874,7 +2990,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2994: \"$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
@@ -2902,19 +3018,19 @@ done
 
   for v in $vars; do
     echo $ac_n "checking for $v""... $ac_c" 1>&6
-echo "configure:2906: checking for $v" >&5
+echo "configure:3022: checking for $v" >&5
     if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2911 "configure"
+#line 3027 "configure"
 #include "confdefs.h"
 int *p;
 int main() {
 extern int $v []; p = $v;
 ; return 0; }
 EOF
-if { (eval echo configure:2918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "libiberty_cv_var_$v=yes"
 else
@@ -2940,12 +3056,12 @@ EOF
   for ac_func in $checkfuncs
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2944: checking for $ac_func" >&5
+echo "configure:3060: 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 2949 "configure"
+#line 3065 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2968,7 +3084,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3088: \"$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
@@ -2992,6 +3108,54 @@ else
 fi
 done
 
+  echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6
+echo "configure:3113: checking whether canonicalize_file_name must be declared" >&5
+if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3118 "configure"
+#include "confdefs.h"
+
+#include "confdefs.h"
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+int main() {
+char *(*pfn) = (char *(*)) canonicalize_file_name
+; return 0; }
+EOF
+if { (eval echo configure:3140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libiberty_cv_decl_needed_canonicalize_file_name=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  libiberty_cv_decl_needed_canonicalize_file_name=yes
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$libiberty_cv_decl_needed_canonicalize_file_name" 1>&6
+if test $libiberty_cv_decl_needed_canonicalize_file_name = yes; then
+  cat >> confdefs.h <<\EOF
+#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1
+EOF
+
+fi
+
 fi
 
 # Figure out which version of pexecute to use.
@@ -3004,21 +3168,21 @@ case "${host}" in
 esac
 
 
-for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
+for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3012: checking for $ac_hdr" >&5
+echo "configure:3176: 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 3017 "configure"
+#line 3181 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3186: \"$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*
@@ -3047,12 +3211,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3051: checking for $ac_func" >&5
+echo "configure:3215: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3056 "configure"
+#line 3220 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3075,7 +3239,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3243: \"$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
@@ -3100,7 +3264,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3104: checking for working mmap" >&5
+echo "configure:3268: 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
@@ -3108,7 +3272,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 3112 "configure"
+#line 3276 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3136,24 +3300,11 @@ else
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+# endif
 
 /* Assume that all systems that can run configure have sys/param.h.  */
 # ifndef HAVE_SYS_PARAM_H
@@ -3261,7 +3412,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:3265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3416: \"$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
@@ -3285,7 +3436,7 @@ fi
 
 
 echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3289: checking for working strncmp" >&5
+echo "configure:3440: checking for working strncmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3293,7 +3444,7 @@ else
   ac_cv_func_strncmp_works=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 3297 "configure"
+#line 3448 "configure"
 #include "confdefs.h"
 
 /* Test by Jim Wilson and Kaveh Ghazi.
@@ -3357,7 +3508,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:3361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_strncmp_works=yes
 else
@@ -3772,6 +3923,7 @@ with_build_subdir=${with_build_subdir}
 with_multisubdir=${with_multisubdir}
 ac_configure_args="--enable-multilib ${ac_configure_args}"
 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
 libiberty_topdir=${libiberty_topdir}
 
 EOF
index 1329f13..5b38660 100644 (file)
@@ -142,7 +142,7 @@ AC_SUBST_FILE(host_makefile_frag)
 # It's OK to check for header files.  Although the compiler may not be
 # able to link anything, it had better be able to at least compile
 # something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h)
+AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
 
@@ -204,9 +204,11 @@ funcs="$funcs waitpid"
 
 # Also in the old function.def file: alloca, vfork, getopt.
 
-vars="sys_errlist sys_nerr sys_siglist"
+vars="sys_errlist sys_nerr sys_siglist _system_configuration"
 
 checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
+checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
+checkfuncs="$checkfuncs getsysinfo table sysctl"
 
 # These are neither executed nor required, but they help keep
 # autoheader happy without adding a bunch of text to acconfig.h.
@@ -218,9 +220,12 @@ if test "x" = "y"; then
   AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
   AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
   AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
+  AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl)
+  AC_CHECK_FUNCS(realpath canonicalize_file_name)
   AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
   AC_DEFINE(HAVE_SYS_NERR,    1, [Define if you have the sys_nerr variable.])
   AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
+  AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.])
 fi
 
 # For each of these functions, if the host does not provide the
@@ -424,6 +429,7 @@ if test -z "${setobjs}"; then
     fi
   done
   AC_CHECK_FUNCS($checkfuncs)
+  libiberty_NEED_DECLARATION(canonicalize_file_name)
 fi
 
 # Figure out which version of pexecute to use.
@@ -466,5 +472,6 @@ with_build_subdir=${with_build_subdir}
 with_multisubdir=${with_multisubdir}
 ac_configure_args="--enable-multilib ${ac_configure_args}"
 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
 libiberty_topdir=${libiberty_topdir}
 )
index f42d618..0b5a3e0 100644 (file)
@@ -1064,7 +1064,7 @@ ada_demangle (mangled, option)
 /* This function performs most of what cplus_demangle use to do, but
    to be able to demangle a name with a B, K or n code, we need to
    have a longer term memory of what types have been seen. The original
-   now intializes and cleans up the squangle code info, while internal
+   now initializes and cleans up the squangle code info, while internal
    calls go directly to this routine to avoid resetting that info. */
 
 static char *
@@ -1429,6 +1429,7 @@ demangle_signature (work, mangled, declp)
              {
                string_append (&s, SCOPE_STRING (work));
                string_prepends (declp, &s);
+               string_delete (&s);
              }
            oldmangled = NULL;
            expect_func = 1;
@@ -1508,7 +1509,6 @@ demangle_signature (work, mangled, declp)
            {
              /* Read the return type. */
              string return_type;
-             string_init (&return_type);
 
              (*mangled)++;
              success = do_type (work, mangled, &return_type);
@@ -2321,7 +2321,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
       string_append (declp, "<");
       while (1)
         {
-          string_clear (&arg);
+          string_delete (&arg);
           switch (**mangled)
             {
               case 'T':
@@ -2378,7 +2378,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
       string_append (declp, "<");
       /* should do error checking here */
       while (args < e) {
-       string_clear (&arg);
+       string_delete (&arg);
 
        /* Check for type or literal here */
        switch (*args)
@@ -2393,6 +2393,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
              goto cfront_template_args_done;
             string_append (&arg, "(");
             string_appends (&arg, &type_str);
+            string_delete (&type_str);
             string_append (&arg, ")");
             if (*args != 'L')
               goto cfront_template_args_done;
@@ -3350,6 +3351,7 @@ demangle_qualified (work, mangled, result, isfuncname, append)
             }
           else
             {
+              string_delete (&last_name);
               success = do_type (work, mangled, &last_name);
               if (!success)
                 break;
@@ -3492,10 +3494,8 @@ do_type (work, mangled, result)
   string decl;
   const char *remembered_type;
   int type_quals;
-  string btype;
   type_kind_t tk = tk_none;
 
-  string_init (&btype);
   string_init (&decl);
   string_init (result);
 
@@ -3613,6 +3613,7 @@ do_type (work, mangled, result)
                string temp;
                do_type (work, mangled, &temp);
                string_prepends (&decl, &temp);
+               string_delete (&temp);
              }
            else if (**mangled == 't')
              {
@@ -3623,7 +3624,7 @@ do_type (work, mangled, result)
                if (success)
                  {
                    string_prependn (&decl, temp.b, temp.p - temp.b);
-                   string_clear (&temp);
+                   string_delete (&temp);
                  }
                else
                  break;
@@ -3803,11 +3804,8 @@ demangle_fund_type (work, mangled, result)
   int success = 1;
   char buf[10];
   unsigned int dec = 0;
-  string btype;
   type_kind_t tk = tk_integral;
 
-  string_init (&btype);
-
   /* First pick off any type qualifiers.  There can be more than one.  */
 
   while (!done)
@@ -3979,8 +3977,11 @@ demangle_fund_type (work, mangled, result)
       }
     case 't':
       {
+        string btype;
+        string_init (&btype);
         success = demangle_template (work, mangled, &btype, 0, 1, 1);
         string_appends (result, &btype);
+        string_delete (&btype);
         break;
       }
     default:
@@ -4182,12 +4183,9 @@ do_arg (work, mangled, result)
      do not want to add additional types to the back-referenceable
      type vector when processing a repeated type.  */
   if (work->previous_argument)
-    string_clear (work->previous_argument);
+    string_delete (work->previous_argument);
   else
-    {
-      work->previous_argument = (string*) xmalloc (sizeof (string));
-      string_init (work->previous_argument);
-    }
+    work->previous_argument = (string*) xmalloc (sizeof (string));
 
   if (!do_type (work, mangled, work->previous_argument))
     return 0;
@@ -4551,7 +4549,10 @@ demangle_nested_args (work, mangled, declp)
 
   /* Restore the previous_argument field.  */
   if (work->previous_argument)
-    string_delete (work->previous_argument);
+    {
+      string_delete (work->previous_argument);
+      free ((char *) work->previous_argument);
+    }
   work->previous_argument = saved_previous_argument;
   --work->forgetting_types;
   work->nrepeats = saved_nrepeats;
index 18b2480..2c7b9e1 100644 (file)
@@ -392,19 +392,38 @@ and a path ending in @code{/} returns the empty string after it.
 
 @end deftypefn
 
-@c make-relative-prefix.c:24
-@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
+@c lrealpath.c:25
+@deftypefn Replacement {const char*} lrealpath (const char *@var{name})
+
+Given a pointer to a string containing a pathname, returns a canonical
+version of the filename.  Symlinks will be resolved, and ``.'' and ``..''
+components will be simplified.  The returned value will be allocated using
+@code{xmalloc} or @code{malloc}.
 
-Given three strings @var{progname}, @var{bin_prefix}, @var{prefix}, return a string
-that gets to @var{prefix} starting with the directory portion of @var{progname} and
-a relative pathname of the difference between @var{bin_prefix} and @var{prefix}.
+@end deftypefn
 
-For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta}, @var{prefix}
-is @code{/alpha/beta/gamma/omega/}, and @var{progname} is @code{/red/green/blue/gcc},
-then this function will return @code{/red/green/blue/../../omega/}.
+@c make-relative-prefix.c:24
+@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
 
-The return value is normally allocated via @code{malloc}.  If no relative prefix
-can be found, return @code{NULL}.
+Given three paths @var{progname}, @var{bin_prefix}, @var{prefix},
+return the path that is in the same position relative to
+@var{progname}'s directory as @var{prefix} is relative to
+@var{bin_prefix}.  That is, a string starting with the directory
+portion of @var{progname}, followed by a relative pathname of the
+difference between @var{bin_prefix} and @var{prefix}.
+
+If @var{progname} does not contain any directory separators,
+@code{make_relative_prefix} will search @env{PATH} to find a program
+named @var{progname}.  Also, if @var{progname} is a symbolic link,
+the symbolic link will be resolved.
+
+For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta},
+@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is
+@code{/red/green/blue/gcc}, then this function will return
+@code{/red/green/blue/../../omega/}.
+
+The return value is normally allocated via @code{malloc}.  If no
+relative prefix can be found, return @code{NULL}.
 
 @end deftypefn
 
index 4b60d6a..b57e3c5 100644 (file)
@@ -29,7 +29,7 @@ This edition accompanies GCC 3, September 2001.
 Copyright @copyright{} 2001 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
-      under the terms of the GNU Free Documentation License, Version 1.1
+      under the terms of the GNU Free Documentation License, Version 1.2
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, with no Front-Cover Texts, and with no
       Back-Cover Texts.  A copy of the license is included in the
@@ -58,7 +58,7 @@ notice identical to this one except for the removal of this paragraph
 Copyright @copyright{} 2001 Free Software Foundation, Inc.
 
       Permission is granted to copy, distribute and/or modify this document
-      under the terms of the GNU Free Documentation License, Version 1.1
+      under the terms of the GNU Free Documentation License, Version 1.2
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, with no Front-Cover Texts, and with no
       Back-Cover Texts.  A copy of the license is included in the
diff --git a/libiberty/lrealpath.c b/libiberty/lrealpath.c
new file mode 100644 (file)
index 0000000..b001b38
--- /dev/null
@@ -0,0 +1,128 @@
+/* Libiberty realpath.  Like realpath, but more consistent behavior.
+   Based on gdb_realpath from GDB.
+
+   Copyright 2003 Free Software Foundation, Inc.
+
+   This file is part of the libiberty 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.  */
+
+/*
+
+@deftypefn Replacement {const char*} lrealpath (const char *@var{name})
+
+Given a pointer to a string containing a pathname, returns a canonical
+version of the filename.  Symlinks will be resolved, and ``.'' and ``..''
+components will be simplified.  The returned value will be allocated using
+@code{malloc}, or @code{NULL} will be returned on a memory allocation error.
+
+@end deftypefn
+
+*/
+
+#include "config.h"
+#include "ansidecl.h"
+#include "libiberty.h"
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* On GNU libc systems the declaration is only visible with _GNU_SOURCE.  */
+#if defined(HAVE_CANONICALIZE_FILE_NAME) \
+    && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME)
+extern char *canonicalize_file_name (const char *);
+#endif
+
+#if defined(HAVE_REALPATH)
+# if defined (PATH_MAX)
+#  define REALPATH_LIMIT PATH_MAX
+# else
+#  if defined (MAXPATHLEN)
+#   define REALPATH_LIMIT MAXPATHLEN
+#  endif
+# endif
+#endif
+
+char *
+lrealpath (filename)
+     const char *filename;
+{
+  /* Method 1: The system has a compile time upper bound on a filename
+     path.  Use that and realpath() to canonicalize the name.  This is
+     the most common case.  Note that, if there isn't a compile time
+     upper bound, you want to avoid realpath() at all costs.  */
+#if defined(REALPATH_LIMIT)
+  {
+    char buf[REALPATH_LIMIT];
+    const char *rp = realpath (filename, buf);
+    if (rp == NULL)
+      rp = filename;
+    return strdup (rp);
+  }
+#endif /* REALPATH_LIMIT */
+
+  /* Method 2: The host system (i.e., GNU) has the function
+     canonicalize_file_name() which malloc's a chunk of memory and
+     returns that, use that.  */
+#if defined(HAVE_CANONICALIZE_FILE_NAME)
+  {
+    char *rp = canonicalize_file_name (filename);
+    if (rp == NULL)
+      return strdup (filename);
+    else
+      return rp;
+  }
+#endif
+
+  /* Method 3: Now we're getting desperate!  The system doesn't have a
+     compile time buffer size and no alternative function.  Query the
+     OS, using pathconf(), for the buffer limit.  Care is needed
+     though, some systems do not limit PATH_MAX (return -1 for
+     pathconf()) making it impossible to pass a correctly sized buffer
+     to realpath() (it could always overflow).  On those systems, we
+     skip this.  */
+#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H)
+  {
+    /* Find out the max path size.  */
+    long path_max = pathconf ("/", _PC_PATH_MAX);
+    if (path_max > 0)
+      {
+       /* PATH_MAX is bounded.  */
+       char *buf, *rp, *ret;
+       buf = malloc (path_max);
+       if (buf == NULL)
+         return NULL;
+       rp = realpath (filename, buf);
+       ret = strdup (rp ? rp : filename);
+       free (buf);
+       return ret;
+      }
+  }
+#endif
+
+  /* This system is a lost cause, just duplicate the filename.  */
+  return strdup (filename);
+}
index c208cdc..dc4f8d5 100644 (file)
@@ -23,16 +23,25 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 @deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix})
 
-Given three strings @var{progname}, @var{bin_prefix}, @var{prefix}, return a string
-that gets to @var{prefix} starting with the directory portion of @var{progname} and
-a relative pathname of the difference between @var{bin_prefix} and @var{prefix}.
-
-For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta}, @var{prefix}
-is @code{/alpha/beta/gamma/omega/}, and @var{progname} is @code{/red/green/blue/gcc},
-then this function will return @code{/red/green/blue/../../omega/}.
-
-The return value is normally allocated via @code{malloc}.  If no relative prefix
-can be found, return @code{NULL}.
+Given three paths @var{progname}, @var{bin_prefix}, @var{prefix},
+return the path that is in the same position relative to
+@var{progname}'s directory as @var{prefix} is relative to
+@var{bin_prefix}.  That is, a string starting with the directory
+portion of @var{progname}, followed by a relative pathname of the
+difference between @var{bin_prefix} and @var{prefix}.
+
+If @var{progname} does not contain any directory separators,
+@code{make_relative_prefix} will search @env{PATH} to find a program
+named @var{progname}.  Also, if @var{progname} is a symbolic link,
+the symbolic link will be resolved.
+
+For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta},
+@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is
+@code{/red/green/blue/gcc}, then this function will return
+@code{/red/green/blue/../../omega/}.
+
+The return value is normally allocated via @code{malloc}.  If no
+relative prefix can be found, return @code{NULL}.
 
 @end deftypefn
 
@@ -223,19 +232,14 @@ make_relative_prefix (progname, bin_prefix, prefix)
   int prog_num, bin_num, prefix_num;
   int i, n, common;
   int needed_len;
-  char *ret, *ptr;
+  char *ret, *ptr, *full_progname = NULL;
 
   if (progname == NULL || bin_prefix == NULL || prefix == NULL)
     return NULL;
 
-  prog_dirs = split_directories (progname, &prog_num);
-  bin_dirs = split_directories (bin_prefix, &bin_num);
-  if (bin_dirs == NULL || prog_dirs == NULL)
-    return NULL;
-
   /* If there is no full pathname, try to find the program by checking in each
      of the directories specified in the PATH environment variable.  */
-  if (prog_num == 1)
+  if (lbasename (progname) == progname)
     {
       char *temp;
 
@@ -278,14 +282,7 @@ make_relative_prefix (progname, bin_prefix, prefix)
 #endif
                      )
                    {
-                     free_split_directories (prog_dirs);
                      progname = nstore;
-                     prog_dirs = split_directories (progname, &prog_num);
-                     if (prog_dirs == NULL)
-                       {
-                         free_split_directories (bin_dirs);
-                         return NULL;
-                       }
                      break;
                    }
 
@@ -299,6 +296,16 @@ make_relative_prefix (progname, bin_prefix, prefix)
        }
     }
 
+  full_progname = lrealpath (progname);
+  if (full_progname == NULL)
+    return NULL;
+
+  prog_dirs = split_directories (full_progname, &prog_num);
+  bin_dirs = split_directories (bin_prefix, &bin_num);
+  free (full_progname);
+  if (bin_dirs == NULL || prog_dirs == NULL)
+    return NULL;
+
   /* Remove the program name from comparison of directory names.  */
   prog_num--;
 
diff --git a/libiberty/physmem.c b/libiberty/physmem.c
new file mode 100644 (file)
index 0000000..9185c12
--- /dev/null
@@ -0,0 +1,305 @@
+/* Calculate the size of physical memory.
+   Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Written by Paul Eggert.  */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_SYS_PSTAT_H
+# include <sys/pstat.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+# include <sys/sysmp.h>
+#endif
+
+#if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H
+# include <sys/sysinfo.h>
+# include <machine/hal_sysinfo.h>
+#endif
+
+#if HAVE_SYS_TABLE_H
+# include <sys/table.h>
+#endif
+
+#include <sys/types.h>
+
+#if HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+# include <sys/sysctl.h>
+#endif
+
+#if HAVE_SYS_SYSTEMCFG_H
+# include <sys/systemcfg.h>
+#endif
+
+#ifdef _WIN32
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/*  MEMORYSTATUSEX is missing from older windows headers, so define
+    a local replacement.  */
+typedef struct
+{
+  DWORD dwLength;
+  DWORD dwMemoryLoad;
+  DWORDLONG ullTotalPhys;
+  DWORDLONG ullAvailPhys;
+  DWORDLONG ullTotalPageFile;
+  DWORDLONG ullAvailPageFile;
+  DWORDLONG ullTotalVirtual;
+  DWORDLONG ullAvailVirtual;
+  DWORDLONG ullAvailExtendedVirtual;
+} lMEMORYSTATUSEX;
+typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*);
+#endif
+
+#include "libiberty.h"
+
+/* Return the total amount of physical memory.  */
+double
+physmem_total ()
+{
+#if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
+  { /* This works on linux-gnu, solaris2 and cygwin.  */
+    double pages = sysconf (_SC_PHYS_PAGES);
+    double pagesize = sysconf (_SC_PAGESIZE);
+    if (0 <= pages && 0 <= pagesize)
+      return pages * pagesize;
+  }
+#endif
+
+#if HAVE_PSTAT_GETSTATIC
+  { /* This works on hpux11.  */
+    struct pst_static pss;
+    if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0))
+      {
+       double pages = pss.physical_memory;
+       double pagesize = pss.page_size;
+       if (0 <= pages && 0 <= pagesize)
+         return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
+  { /* This works on irix6. */
+    struct rminfo realmem;
+    if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
+      {
+       double pagesize = sysconf (_SC_PAGESIZE);
+       double pages = realmem.physmem;
+       if (0 <= pages && 0 <= pagesize)
+         return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_GETSYSINFO && defined GSI_PHYSMEM
+  { /* This works on Tru64 UNIX V4/5.  */
+    int physmem;
+
+    if (getsysinfo (GSI_PHYSMEM, (caddr_t) &physmem, sizeof (physmem),
+                   NULL, NULL, NULL) == 1)
+      {
+       double kbytes = physmem;
+
+       if (0 <= kbytes)
+         return kbytes * 1024.0;
+      }
+  }
+#endif
+
+#if HAVE_SYSCTL && defined HW_PHYSMEM
+  { /* This works on *bsd and darwin.  */
+    unsigned int physmem;
+    size_t len = sizeof physmem;
+    static int mib[2] = { CTL_HW, HW_PHYSMEM };
+
+    if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
+       && len == sizeof (physmem))
+      return (double) physmem;
+  }
+#endif
+
+#if HAVE__SYSTEM_CONFIGURATION
+  /* This works on AIX.  */
+  return _system_configuration.physmem;
+#endif
+
+#if defined _WIN32
+  { /* this works on windows */
+    PFN_MS_EX pfnex;
+    HMODULE h = GetModuleHandle ("kernel32.dll");
+
+    if (!h)
+      return 0.0;
+
+    /*  Use GlobalMemoryStatusEx if available.  */
+    if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
+      {
+       lMEMORYSTATUSEX lms_ex;
+       lms_ex.dwLength = sizeof lms_ex;
+       if (!pfnex (&lms_ex))
+         return 0.0;
+       return (double) lms_ex.ullTotalPhys;
+      }
+
+    /*  Fall back to GlobalMemoryStatus which is always available.
+        but returns wrong results for physical memory > 4GB.  */
+    else
+      {
+       MEMORYSTATUS ms;
+       GlobalMemoryStatus (&ms);
+       return (double) ms.dwTotalPhys;
+      }
+  }
+#endif
+
+  /* Return 0 if we can't determine the value.  */
+  return 0;
+}
+
+/* Return the amount of physical memory available.  */
+double
+physmem_available ()
+{
+#if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE
+  { /* This works on linux-gnu, solaris2 and cygwin.  */
+    double pages = sysconf (_SC_AVPHYS_PAGES);
+    double pagesize = sysconf (_SC_PAGESIZE);
+    if (0 <= pages && 0 <= pagesize)
+      return pages * pagesize;
+  }
+#endif
+
+#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
+  { /* This works on hpux11.  */
+    struct pst_static pss;
+    struct pst_dynamic psd;
+    if (0 <= pstat_getstatic (&pss, sizeof pss, 1, 0)
+       && 0 <= pstat_getdynamic (&psd, sizeof psd, 1, 0))
+      {
+       double pages = psd.psd_free;
+       double pagesize = pss.page_size;
+       if (0 <= pages && 0 <= pagesize)
+         return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_SYSMP && defined MP_SAGET && defined MPSA_RMINFO && defined _SC_PAGESIZE
+  { /* This works on irix6. */
+    struct rminfo realmem;
+    if (sysmp (MP_SAGET, MPSA_RMINFO, &realmem, sizeof realmem) == 0)
+      {
+       double pagesize = sysconf (_SC_PAGESIZE);
+       double pages = realmem.availrmem;
+       if (0 <= pages && 0 <= pagesize)
+         return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_TABLE && defined TBL_VMSTATS
+  { /* This works on Tru64 UNIX V4/5.  */
+    struct tbl_vmstats vmstats;
+
+    if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1)
+      {
+       double pages = vmstats.free_count;
+       double pagesize = vmstats.pagesize;
+
+       if (0 <= pages && 0 <= pagesize)
+         return pages * pagesize;
+      }
+  }
+#endif
+
+#if HAVE_SYSCTL && defined HW_USERMEM
+  { /* This works on *bsd and darwin.  */
+    unsigned int usermem;
+    size_t len = sizeof usermem;
+    static int mib[2] = { CTL_HW, HW_USERMEM };
+
+    if (sysctl (mib, ARRAY_SIZE (mib), &usermem, &len, NULL, 0) == 0
+       && len == sizeof (usermem))
+      return (double) usermem;
+  }
+#endif
+
+#if defined _WIN32
+  { /* this works on windows */
+    PFN_MS_EX pfnex;
+    HMODULE h = GetModuleHandle ("kernel32.dll");
+
+    if (!h)
+      return 0.0;
+
+    /*  Use GlobalMemoryStatusEx if available.  */
+    if ((pfnex = (PFN_MS_EX) GetProcAddress (h, "GlobalMemoryStatusEx")))
+      {
+       lMEMORYSTATUSEX lms_ex;
+       lms_ex.dwLength = sizeof lms_ex;
+       if (!pfnex (&lms_ex))
+         return 0.0;
+       return (double) lms_ex.ullAvailPhys;
+      }
+
+    /*  Fall back to GlobalMemoryStatus which is always available.
+        but returns wrong results for physical memory > 4GB  */
+    else
+      {
+       MEMORYSTATUS ms;
+       GlobalMemoryStatus (&ms);
+       return (double) ms.dwAvailPhys;
+      }
+  }
+#endif
+
+  /* Guess 25% of physical memory.  */
+  return physmem_total () / 4;
+}
+
+
+#if DEBUG
+
+# include <stdio.h>
+# include <stdlib.h>
+
+int
+main ()
+{
+  printf ("%12.f %12.f\n", physmem_total (), physmem_available ());
+  exit (0);
+}
+
+#endif /* DEBUG */
+
+/*
+Local Variables:
+compile-command: "gcc -DDEBUG -DHAVE_CONFIG_H -I.. -g -O -Wall -W physmem.c"
+End:
+*/
index 3f452bc..eca1da3 100644 (file)
@@ -144,6 +144,19 @@ case $host in
   # Find out which ABI we are using.
   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
     case `/usr/bin/file conftest.$ac_objext` in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -155,6 +168,7 @@ case $host in
       LD="${LD-ld} -64"
       ;;
     esac
+   fi
   fi
   rm -rf conftest*
   ;;
index bdc67f9..9059b1a 100644 (file)
@@ -2,7 +2,7 @@
 
 # ltcf-cxx.sh - Create a C++ compiler specific configuration
 #
-# Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
 # Original C++ support by:Gary V. Vaughan <gvv@techie.com>
@@ -68,11 +68,16 @@ if { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (ev
   # Set up default GNU C++ configuration
 
   # Check if GNU C++ uses GNU ld as the underlying linker, since the
-  # archiving commands below assume that GNU ld is being used.
-  if eval "`$CC -print-prog-name=ld` --version 2>&1" | \
-      egrep 'GNU ld' > /dev/null; then
-    with_gnu_ld=yes
-
+  # archiving commands below assume that GNU ld is being used.  The
+  # assumption here is that the linker is going to be the same as that
+  # used by the C compiler.  For the purposes of GCC, this is ok, but
+  # if someone uses g++ along with a non-GNU C compiler that doesn't
+  # use GNU ld, we may lose.  This is ok for the toolchain tree, since
+  # the only users of ltcf-cxx.sh are libstdc++-v3 and libjava,
+  # anyway, and those use both gcc and g++, so the settings are bound
+  # to be the same.
+
+  if test "$with_gnu_ld" = yes; then
     archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
     archive_expsym_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
@@ -92,7 +97,6 @@ if { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (ev
       whole_archive_flag_spec=
     fi
   else
-    with_gnu_ld=no
     wlarc=
 
     # A generic and very simple default shared library creation
@@ -110,7 +114,6 @@ if { ac_try='${CC-c++} -E conftest.$ac_ext'; { (eval echo \"$ac_try\") 1>&5; (ev
 
 else
   with_gcc=no
-  with_gnu_ld=no
   wlarc=
 fi
 
@@ -323,7 +326,7 @@ case $host_os in
           if test "$with_gnu_ld" = no; then
             archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
           else
-            archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
+            archive_cmds='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
           fi
         fi
         hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -610,9 +613,9 @@ case $host_os in
         if test "$with_gcc" = yes && test "$with_gnu_ld" = no; then
          no_undefined_flag=' ${wl}-z ${wl}defs'
           if $CC --version | egrep -v '^2\.7' > /dev/null; then
-            archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
+            archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
             archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
 
             # Commands to make compiler produce verbose output that lists
             # what "hidden" libraries, object files and flags are used when
@@ -621,9 +624,9 @@ case $host_os in
           else
             # g++ 2.7 appears to require `-G' NOT `-shared' on this
             # platform.
-            archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
+            archive_cmds='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
             archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
 
             # Commands to make compiler produce verbose output that lists
             # what "hidden" libraries, object files and flags are used when
index d33278a..2d70497 100644 (file)
@@ -2,7 +2,7 @@
 
 # ltcf-gcj.sh - Create a GCJ compiler specific configuration
 #
-# Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1996-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
 # Original GCJ support by:
@@ -492,9 +492,9 @@ else
 
   solaris*)
     no_undefined_flag=' ${wl}-z ${wl}defs'
-    archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
+    archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
     archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-      $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
+      $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
 
     # Commands to make compiler produce verbose output that lists
     # what "hidden" libraries, object files and flags are used when
index 5ccefe0..7a4d635 100755 (executable)
--- a/ltconfig
+++ b/ltconfig
@@ -1186,6 +1186,11 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 irix5* | irix6*)
+  if test "$with_gnu_ld" = yes; then
+    version_type=linux
+  else
+    version_type=irix
+  fi
   version_type=irix
   need_lib_prefix=no
   need_version=no
@@ -1197,9 +1202,12 @@ irix5* | irix6*)
     ;;
   *)
     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;;
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
     *) libsuff= shlibsuff= libmagic=never-match;;
     esac
     ;;
index a0c083b..42cf257 100644 (file)
@@ -1,3 +1,29 @@
+2003-02-25  Alan Modra  <amodra@bigpond.net.au>
+
+       * hppa-dis.c: Formatting.
+
+2003-02-25  Matthew Wilcox  <willy@debian.org>
+
+       * hppa-dis.c (print_insn_hppa): Implement fcnv instruction modifiers.
+
+       * hppa-dis.c (print_insn_hppa <2 bit space register>): Do not print
+       the space register when the value is zero.
+
+2003-02-23  Elias Athanasopoulos  <elathan@phys.uoa.gr>
+
+       * mips-dis.c (print_mips_disassembler_options): Make 'i' unsigned,
+       use ARRAY_SIZE in loops.
+
+2003-02-12  Dave Brolley  <brolley@redhat.com>
+
+       * fr30-desc.c: Regenerate.
+
+2003-02-06  Gwenole Beauchesne  <gbeauchesne@mandrakesoft.com>
+
+       * i386-dis.c (dq_mode, Edq): Define.
+       (dis386_twobyte): Correct movd operands.
+       (OP_E): Handle dq_mode case.
+
 2003-01-29  Henric Jungheim <henric@attbi.com>
 
        * sparc-dis.c (print_insn_sparc): When examining values added in
index a404f9b..a263da7 100644 (file)
@@ -325,6 +325,7 @@ const CGEN_IFLD fr30_cgen_ifld_table[] =
   { FR30_F_I8, "f-i8", 0, 16, 4, 8, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_I20_4, "f-i20-4", 0, 16, 8, 4, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_I20_16, "f-i20-16", 16, 16, 0, 16, { 0, { (1<<MACH_BASE) } }  },
+  { FR30_F_I20, "f-i20", 0, 0, 0, 0,{ 0|A(VIRTUAL), { (1<<MACH_BASE) } }  },
   { FR30_F_I32, "f-i32", 16, 32, 0, 32, { 0|A(SIGN_OPT), { (1<<MACH_BASE) } }  },
   { FR30_F_UDISP6, "f-udisp6", 0, 16, 8, 4, { 0, { (1<<MACH_BASE) } }  },
   { FR30_F_DISP8, "f-disp8", 0, 16, 4, 8, { 0, { (1<<MACH_BASE) } }  },
@@ -357,8 +358,8 @@ const CGEN_MAYBE_MULTI_IFLD FR30_F_I20_MULTI_IFIELD [];
 
 const CGEN_MAYBE_MULTI_IFLD FR30_F_I20_MULTI_IFIELD [] =
 {
-    { 0, { (const PTR) &fr30_cgen_ifld_table[23] } },
-    { 0, { (const PTR) &fr30_cgen_ifld_table[24] } },
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_I20_4] } },
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_I20_16] } },
     { 0, { (const PTR) 0 } }
 };
 
@@ -379,39 +380,39 @@ const CGEN_OPERAND fr30_cgen_operand_table[] =
 {
 /* pc: program counter */
   { "pc", FR30_OPERAND_PC, HW_H_PC, 0, 0,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[0] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_NIL] } }, 
     { 0|A(SEM_ONLY), { (1<<MACH_BASE) } }  },
 /* Ri: destination register */
   { "Ri", FR30_OPERAND_RI, HW_H_GR, 12, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[10] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_RI] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* Rj: source register */
   { "Rj", FR30_OPERAND_RJ, HW_H_GR, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[9] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_RJ] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* Ric: target register coproc insn */
   { "Ric", FR30_OPERAND_RIC, HW_H_GR, 12, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[14] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_RIC] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* Rjc: source register coproc insn */
   { "Rjc", FR30_OPERAND_RJC, HW_H_GR, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[13] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_RJC] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* CRi: coprocessor register */
   { "CRi", FR30_OPERAND_CRI, HW_H_CR, 12, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[16] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_CRI] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* CRj: coprocessor register */
   { "CRj", FR30_OPERAND_CRJ, HW_H_CR, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[15] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_CRJ] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* Rs1: dedicated register */
   { "Rs1", FR30_OPERAND_RS1, HW_H_DR, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[11] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_RS1] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* Rs2: dedicated register */
   { "Rs2", FR30_OPERAND_RS2, HW_H_DR, 12, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[12] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_RS2] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* R13: General Register 13 */
   { "R13", FR30_OPERAND_R13, HW_H_R13, 0, 0,
@@ -431,51 +432,51 @@ const CGEN_OPERAND fr30_cgen_operand_table[] =
     { 0, { (1<<MACH_BASE) } }  },
 /* u4: 4  bit unsigned immediate */
   { "u4", FR30_OPERAND_U4, HW_H_UINT, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[17] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_U4] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* u4c: 4  bit unsigned immediate */
   { "u4c", FR30_OPERAND_U4C, HW_H_UINT, 12, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[18] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_U4C] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* u8: 8  bit unsigned immediate */
   { "u8", FR30_OPERAND_U8, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[21] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_U8] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* i8: 8  bit unsigned immediate */
   { "i8", FR30_OPERAND_I8, HW_H_UINT, 4, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[22] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_I8] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* udisp6: 6  bit unsigned immediate */
   { "udisp6", FR30_OPERAND_UDISP6, HW_H_UINT, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[26] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_UDISP6] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* disp8: 8  bit signed   immediate */
   { "disp8", FR30_OPERAND_DISP8, HW_H_SINT, 4, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[27] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_DISP8] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* disp9: 9  bit signed   immediate */
   { "disp9", FR30_OPERAND_DISP9, HW_H_SINT, 4, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[28] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_DISP9] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* disp10: 10 bit signed   immediate */
   { "disp10", FR30_OPERAND_DISP10, HW_H_SINT, 4, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[29] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_DISP10] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* s10: 10 bit signed   immediate */
   { "s10", FR30_OPERAND_S10, HW_H_SINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[30] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_S10] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* u10: 10 bit unsigned immediate */
   { "u10", FR30_OPERAND_U10, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[31] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_U10] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* i32: 32 bit immediate */
   { "i32", FR30_OPERAND_I32, HW_H_UINT, 0, 32,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[25] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_I32] } }, 
     { 0|A(HASH_PREFIX)|A(SIGN_OPT), { (1<<MACH_BASE) } }  },
 /* m4: 4  bit negative immediate */
   { "m4", FR30_OPERAND_M4, HW_H_SINT, 8, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[20] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_M4] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* i20: 20 bit immediate */
   { "i20", FR30_OPERAND_I20, HW_H_UINT, 0, 20,
@@ -483,47 +484,47 @@ const CGEN_OPERAND fr30_cgen_operand_table[] =
     { 0|A(HASH_PREFIX)|A(VIRTUAL), { (1<<MACH_BASE) } }  },
 /* dir8: 8  bit direct address */
   { "dir8", FR30_OPERAND_DIR8, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[33] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_DIR8] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* dir9: 9  bit direct address */
   { "dir9", FR30_OPERAND_DIR9, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[34] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_DIR9] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* dir10: 10 bit direct address */
   { "dir10", FR30_OPERAND_DIR10, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[35] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_DIR10] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* label9: 9  bit pc relative address */
   { "label9", FR30_OPERAND_LABEL9, HW_H_IADDR, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[32] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_REL9] } }, 
     { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } }  },
 /* label12: 12 bit pc relative address */
   { "label12", FR30_OPERAND_LABEL12, HW_H_IADDR, 5, 11,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[36] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_REL12] } }, 
     { 0|A(PCREL_ADDR), { (1<<MACH_BASE) } }  },
 /* reglist_low_ld: 8 bit low register mask for ldm */
   { "reglist_low_ld", FR30_OPERAND_REGLIST_LOW_LD, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[40] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_REGLIST_LOW_LD] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* reglist_hi_ld: 8 bit high register mask for ldm */
   { "reglist_hi_ld", FR30_OPERAND_REGLIST_HI_LD, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[39] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_REGLIST_HI_LD] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* reglist_low_st: 8 bit low register mask for stm */
   { "reglist_low_st", FR30_OPERAND_REGLIST_LOW_ST, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[38] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_REGLIST_LOW_ST] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* reglist_hi_st: 8 bit high register mask for stm */
   { "reglist_hi_st", FR30_OPERAND_REGLIST_HI_ST, HW_H_UINT, 8, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[37] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_REGLIST_HI_ST] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* cc: condition codes */
   { "cc", FR30_OPERAND_CC, HW_H_UINT, 4, 4,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[7] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_CC] } }, 
     { 0, { (1<<MACH_BASE) } }  },
 /* ccc: coprocessor calc */
   { "ccc", FR30_OPERAND_CCC, HW_H_UINT, 0, 8,
-    { 0, { (const PTR) &fr30_cgen_ifld_table[8] } }, 
+    { 0, { (const PTR) &fr30_cgen_ifld_table[FR30_F_CCC] } }, 
     { 0|A(HASH_PREFIX), { (1<<MACH_BASE) } }  },
 /* nbit: negative   bit */
   { "nbit", FR30_OPERAND_NBIT, HW_H_NBIT, 0, 0,
index d9ab9dd..5f33297 100644 (file)
@@ -1,5 +1,5 @@
 /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
-   Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
+   Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2003
    Free Software Foundation, Inc.
 
    Contributed by the Center for Software Science at the
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Integer register names, indexed by the numbers which appear in the
    opcodes.  */
-static const char *const reg_names[] = 
+static const char *const reg_names[] =
  {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
   "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
   "r20", "r21", "r22", "r23", "r24", "r25", "r26", "dp", "ret0", "ret1",
@@ -34,10 +34,10 @@ static const char *const reg_names[] =
 
 /* Floating point register names, indexed by the numbers which appear in the
    opcodes.  */
-static const char *const fp_reg_names[] = 
- {"fpsr", "fpe2", "fpe4", "fpe6", 
-  "fr4", "fr5", "fr6", "fr7", "fr8", 
-  "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", 
+static const char *const fp_reg_names[] =
+ {"fpsr", "fpe2", "fpe4", "fpe6",
+  "fr4", "fr5", "fr6", "fr7", "fr8",
+  "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
   "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
   "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"};
 
@@ -123,6 +123,8 @@ 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 *const fcnv_fixed_names[] = {",w", ",dw", "", ",qw"};
+static const char *const fcnv_ufixed_names[] = {",uw", ",udw", "", ",uqw"};
 static const char *const float_comp_names[] =
 {
   ",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
@@ -136,7 +138,7 @@ 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 
+/* For a bunch of different instructions form an index into a
    completer name table.  */
 #define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \
                         GET_FIELD (insn, 18, 18) << 1)
@@ -194,8 +196,8 @@ fput_fp_reg_r (reg, info)
   if (reg < 4)
     (*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1);
   else
-    (*info->fprintf_func) (info->stream, "%sR", reg ? fp_reg_names[reg] 
-                                                   : "fr0");
+    (*info->fprintf_func) (info->stream, "%sR",
+                          reg ? fp_reg_names[reg] : "fr0");
 }
 
 static void
@@ -336,8 +338,8 @@ extract_12 (word)
      unsigned word;
 {
   return sign_extend (GET_FIELD (word, 19, 28) |
-                      GET_FIELD (word, 29, 29) << 10 |
-                      (word & 0x1) << 11, 12) << 2;
+                     GET_FIELD (word, 29, 29) << 10 |
+                     (word & 0x1) << 11, 12) << 2;
 }
 
 /* Extract a 17 bit constant from branch instructions, returning the
@@ -348,9 +350,9 @@ extract_17 (word)
      unsigned word;
 {
   return sign_extend (GET_FIELD (word, 19, 28) |
-                      GET_FIELD (word, 29, 29) << 10 |
-                      GET_FIELD (word, 11, 15) << 11 |
-                      (word & 0x1) << 16, 17) << 2;
+                     GET_FIELD (word, 29, 29) << 10 |
+                     GET_FIELD (word, 11, 15) << 11 |
+                     (word & 0x1) << 16, 17) << 2;
 }
 
 static int
@@ -358,10 +360,10 @@ 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;
+                     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.  */
@@ -397,7 +399,7 @@ print_insn_hppa (memaddr, info)
 #endif
          (*info->fprintf_func) (info->stream, "%s", opcode->name);
 
-         if (!strchr ("cfCY?-+nHNZFIuv", opcode->args[0]))
+         if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0]))
            (*info->fprintf_func) (info->stream, " ");
          for (s = opcode->args; *s != '\0'; ++s)
            {
@@ -417,7 +419,7 @@ print_insn_hppa (memaddr, info)
                  fput_reg (GET_FIELD (insn, 27, 31), info);
                  break;
 
-               /* Handle floating point registers.  */
+                 /* Handle floating point registers.  */
                case 'f':
                  switch (*++s)
                    {
@@ -437,21 +439,19 @@ print_insn_hppa (memaddr, info)
                        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.  */
+                     /* '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 */
+                     /* 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))
@@ -516,14 +516,13 @@ print_insn_hppa (memaddr, info)
                        break;
                      }
 
-                   /* 'fe' will not generate a space before the register
-                       name.  Normally that is fine.  Except that it
-                       causes problems with fstw fe,y(b) which has no FP
-                       format completer.  */
+                     /* 'fe' will not generate a space before the register
+                        name.  Normally that is fine.  Except that it
+                        causes problems with fstw fe,y(b) which has no FP
+                        format completer.  */
                    case 'E':
                      fputs_filtered (" ", info);
-
-                   /* FALLTHRU */
+                     /* FALLTHRU */
 
                    case 'e':
                      if (GET_FIELD (insn, 30, 30))
@@ -541,41 +540,52 @@ print_insn_hppa (memaddr, info)
                  fput_const (extract_5_load (insn), info);
                  break;
                case 's':
-                 (*info->fprintf_func) (info->stream,
-                                        "sr%d", GET_FIELD (insn, 16, 17));
+                 {
+                   int space = GET_FIELD (insn, 16, 17);
+                   /* Zero means implicit addressing, not use of sr0.  */
+                   if (space != 0)
+                     (*info->fprintf_func) (info->stream, "sr%d", space);
+                 }
                  break;
 
                case 'S':
-                 (*info->fprintf_func) (info->stream, "sr%d", extract_3 (insn));
+                 (*info->fprintf_func) (info->stream, "sr%d",
+                                        extract_3 (insn));
                  break;
 
-               /* Handle completers.  */
+                 /* Handle completers.  */
                case 'c':
                  switch (*++s)
                    {
                    case 'x':
-                     (*info->fprintf_func) (info->stream, "%s",
-                                            index_compl_names[GET_COMPL (insn)]);
+                     (*info->fprintf_func)
+                       (info->stream, "%s",
+                        index_compl_names[GET_COMPL (insn)]);
                      break;
                    case 'X':
-                     (*info->fprintf_func) (info->stream, "%s ",
-                                            index_compl_names[GET_COMPL (insn)]);
+                     (*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)]);
+                     (*info->fprintf_func)
+                       (info->stream, "%s",
+                        short_ldst_compl_names[GET_COMPL (insn)]);
                      break;
                    case 'M':
-                     (*info->fprintf_func) (info->stream, "%s ",
-                                            short_ldst_compl_names[GET_COMPL (insn)]);
+                     (*info->fprintf_func)
+                       (info->stream, "%s ",
+                        short_ldst_compl_names[GET_COMPL (insn)]);
                      break;
                    case 'A':
-                     (*info->fprintf_func) (info->stream, "%s ",
-                                            short_bytes_compl_names[GET_COMPL (insn)]);
+                     (*info->fprintf_func)
+                       (info->stream, "%s ",
+                        short_bytes_compl_names[GET_COMPL (insn)]);
                      break;
                    case 's':
-                     (*info->fprintf_func) (info->stream, "%s",
-                                            short_bytes_compl_names[GET_COMPL (insn)]);
+                     (*info->fprintf_func)
+                       (info->stream, "%s",
+                        short_bytes_compl_names[GET_COMPL (insn)]);
                      break;
                    case 'c':
                    case 'C':
@@ -618,8 +628,9 @@ print_insn_hppa (memaddr, info)
                      (*info->fprintf_func) (info->stream, ",l");
                      break;
                    case 'w':
-                     (*info->fprintf_func) (info->stream, "%s ",
-                                            read_write_names[GET_FIELD (insn, 25, 25)]);
+                     (*info->fprintf_func)
+                       (info->stream, "%s ",
+                        read_write_names[GET_FIELD (insn, 25, 25)]);
                      break;
                    case 'W':
                      (*info->fprintf_func) (info->stream, ",w");
@@ -644,18 +655,18 @@ print_insn_hppa (memaddr, info)
                      break;
                    case 'a':
                      (*info->fprintf_func)
-                       (info->stream, "%s", add_compl_names[GET_FIELD
-                                                           (insn, 20, 21)]);
+                       (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)]);
+                       (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)]);
+                       (info->stream, ",c%s",
+                        add_compl_names[GET_FIELD (insn, 20, 21)]);
                      break;
                    case 'v':
                      if (GET_FIELD (insn, 20, 20))
@@ -684,28 +695,28 @@ print_insn_hppa (memaddr, info)
                      /* EXTRD/W has a following condition.  */
                      if (*(s + 1) == '?')
                        (*info->fprintf_func)
-                         (info->stream, "%s", signed_unsigned_names[GET_FIELD
-                                                                   (insn, 21, 21)]);
+                         (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)]);
+                         (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)]);
+                       (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)]);
+                       (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));
+                       (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':
@@ -766,85 +777,101 @@ print_insn_hppa (memaddr, info)
                    }
                  break;
 
-               /* Handle conditions.  */
+                 /* Handle conditions.  */
                case '?':
                  {
                    s++;
                    switch (*s)
                      {
                      case 'f':
-                       (*info->fprintf_func) (info->stream, "%s ",
-                                              float_comp_names[GET_FIELD
-                                                              (insn, 27, 31)]);
+                       (*info->fprintf_func)
+                         (info->stream, "%s ",
+                          float_comp_names[GET_FIELD (insn, 27, 31)]);
                        break;
 
-                     /* these four conditions are for the set of instructions
+                       /* 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);
+                       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);
+                       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);
+                       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);
+                       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);
+                       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)]);
+                       (*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)]);
+                       (*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)]);
+                       (*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)]);
+                       (*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)]);
+                       (*info->fprintf_func)
+                         (info->stream, "%s",
+                          add_cond_names[GET_FIELD (insn, 16, 18)]);
                        break;
 
                      case 'W':
-                       (*info->fprintf_func) 
+                       (*info->fprintf_func)
                          (info->stream, "%s",
-                          wide_add_cond_names[GET_FIELD (insn, 16, 18) + 
-                                             GET_FIELD (insn, 4, 4) * 8]);
+                          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)]);
+                       (*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)]);
+                       (*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)]);
+                       (*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)]);
+                       (*info->fprintf_func)
+                         (info->stream, "%s ",
+                          unit_cond_64_names[GET_COND (insn)]);
                        break;
                      case 'y':
                      case 'x':
@@ -859,8 +886,9 @@ print_insn_hppa (memaddr, info)
                          (*info->fprintf_func) (info->stream, " ");
                        break;
                      case 'X':
-                       (*info->fprintf_func) (info->stream, "%s ",
-                                              shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
+                       (*info->fprintf_func)
+                         (info->stream, "%s ",
+                          shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
                        break;
                      case 'B':
                        (*info->fprintf_func)
@@ -921,14 +949,13 @@ print_insn_hppa (memaddr, info)
                    (*info->fprintf_func) (info->stream, " ");
                  break;
                case 'w':
-                 (*info->print_address_func) (memaddr + 8 + extract_12 (insn),
-                                              info);
+                 (*info->print_address_func)
+                   (memaddr + 8 + extract_12 (insn), info);
                  break;
                case 'W':
                  /* 17 bit PC-relative branch.  */
-                 (*info->print_address_func) ((memaddr + 8 
-                                               + extract_17 (insn)),
-                                              info);
+                 (*info->print_address_func)
+                   ((memaddr + 8 + extract_17 (insn)), info);
                  break;
                case 'z':
                  /* 17 bit displacement.  This is an offset from a register
@@ -946,25 +973,25 @@ print_insn_hppa (memaddr, info)
                  /* 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));
+                                        GET_FIELD (insn, 24, 25));
                  break;
                case '*':
                  (*info->fprintf_func) (info->stream, "%d",
-                                   GET_FIELD (insn, 22, 25));
+                                        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));
+                                        31 - GET_FIELD (insn, 22, 26));
                  break;
                case '~':
                  {
@@ -976,7 +1003,7 @@ print_insn_hppa (memaddr, info)
                  }
                case 'P':
                  (*info->fprintf_func) (info->stream, "%d",
-                                   GET_FIELD (insn, 22, 26));
+                                        GET_FIELD (insn, 22, 26));
                  break;
                case 'q':
                  {
@@ -988,7 +1015,7 @@ print_insn_hppa (memaddr, info)
                  }
                case 'T':
                  (*info->fprintf_func) (info->stream, "%d",
-                                   32 - GET_FIELD (insn, 27, 31));
+                                        32 - GET_FIELD (insn, 27, 31));
                  break;
                case '%':
                  {
@@ -1016,7 +1043,8 @@ print_insn_hppa (memaddr, info)
                  fput_const (GET_FIELD (insn, 6, 31), info);
                  break;
                case 'v':
-                 (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
+                 (*info->fprintf_func) (info->stream, ",%d",
+                                        GET_FIELD (insn, 23, 25));
                  break;
                case 'O':
                  fput_const ((GET_FIELD (insn, 6,20) << 5 |
@@ -1038,47 +1066,48 @@ print_insn_hppa (memaddr, info)
                               GET_FIELD (insn, 27, 31)), info);
                  break;
                case 'u':
-                 (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
+                 (*info->fprintf_func) (info->stream, ",%d",
+                                        GET_FIELD (insn, 23, 25));
                  break;
                case 'F':
                  /* if no destination completer and not before a completer
                     for fcmp, need a space here */
                  if (s[1] == 'G' || s[1] == '?')
-                   fputs_filtered (float_format_names[GET_FIELD (insn, 19, 20)],
-                                   info);
+                   fputs_filtered
+                     (float_format_names[GET_FIELD (insn, 19, 20)], info);
                  else
-                   (*info->fprintf_func) (info->stream, "%s ",
-                                          float_format_names[GET_FIELD
-                                                             (insn, 19, 20)]);
+                   (*info->fprintf_func)
+                     (info->stream, "%s ",
+                      float_format_names[GET_FIELD (insn, 19, 20)]);
                  break;
                case 'G':
-                 (*info->fprintf_func) (info->stream, "%s ",
-                                   float_format_names[GET_FIELD (insn,
-                                                                 17, 18)]);
+                 (*info->fprintf_func)
+                   (info->stream, "%s ",
+                    float_format_names[GET_FIELD (insn, 17, 18)]);
                  break;
                case 'H':
                  if (GET_FIELD (insn, 26, 26) == 1)
                    (*info->fprintf_func) (info->stream, "%s ",
-                                   float_format_names[0]);
+                                          float_format_names[0]);
                  else
                    (*info->fprintf_func) (info->stream, "%s ",
-                                   float_format_names[1]);
+                                          float_format_names[1]);
                  break;
                case 'I':
                  /* if no destination completer and not before a completer
                     for fcmp, need a space here */
                  if (s[1] == '?')
-                   fputs_filtered (float_format_names[GET_FIELD (insn, 20, 20)],
-                                   info);
+                   fputs_filtered
+                     (float_format_names[GET_FIELD (insn, 20, 20)], info);
                  else
-                   (*info->fprintf_func) (info->stream, "%s ",
-                                          float_format_names[GET_FIELD
-                                                             (insn, 20, 20)]);
+                   (*info->fprintf_func)
+                     (info->stream, "%s ",
+                      float_format_names[GET_FIELD (insn, 20, 20)]);
                  break;
 
-                case 'J':
-                  fput_const (extract_14 (insn), info);
-                  break;
+               case 'J':
+                 fput_const (extract_14 (insn), info);
+                 break;
 
                case '#':
                  {
@@ -1095,7 +1124,7 @@ print_insn_hppa (memaddr, info)
                    fput_const (disp, info);
                    break;
                  }
-                case 'K':
+               case 'K':
                case 'd':
                  {
                    int sign = GET_FIELD (insn, 31, 31);
@@ -1131,11 +1160,33 @@ print_insn_hppa (memaddr, info)
                    break;
                  }
 
-               /* ?!? FIXME */
                case '_':
+                 break; /* Dealt with by '{' */
+
                case '{':
-                 fputs_filtered ("Disassembler botch.\n", info);
-                 break;
+                 {
+                   int sub = GET_FIELD (insn, 14, 16);
+                   int df = GET_FIELD (insn, 17, 18);
+                   int sf = GET_FIELD (insn, 19, 20);
+                   const char * const * source = float_format_names;
+                   const char * const * dest = float_format_names;
+                   char *t = "";
+                   if (sub == 4)
+                     {
+                       fputs_filtered (",UND ", info);
+                       break;
+                     }
+                   if ((sub & 3) == 3)
+                     t = ",t";
+                   if ((sub & 3) == 1)
+                     source = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
+                   if (sub & 2)
+                     dest = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
+
+                   (*info->fprintf_func) (info->stream, "%s%s%s ",
+                                          t, source[sf], dest[df]);
+                   break;
+                 }
 
                case 'm':
                  {
@@ -1181,9 +1232,8 @@ print_insn_hppa (memaddr, info)
                  }
 
                case 'X':
-                 (*info->print_address_func) ((memaddr + 8 
-                                               + extract_22 (insn)),
-                                              info);
+                 (*info->print_address_func)
+                   (memaddr + 8 + extract_22 (insn), info);
                  break;
                case 'L':
                  fputs_filtered (",%r2", info);
index 65c36f1..f185b28 100644 (file)
@@ -1,7 +1,6 @@
 /* Print i386 instructions for GDB, the GNU debugger.
    Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2001
-   Free Software Foundation, Inc.
+   2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -176,9 +175,9 @@ fetch_data (info, addr)
   if (status != 0)
     {
       /* 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.  */
+        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);
@@ -193,6 +192,7 @@ fetch_data (info, addr)
 #define Eb OP_E, b_mode
 #define Ev OP_E, v_mode
 #define Ed OP_E, d_mode
+#define Edq OP_E, dq_mode
 #define indirEb OP_indirE, b_mode
 #define indirEv OP_indirE, v_mode
 #define Ew OP_E, w_mode
@@ -312,6 +312,7 @@ fetch_data (info, addr)
 #define m_mode 7  /* d_mode in 32bit, q_mode in 64bit mode.  */
 #define cond_jump_mode 8
 #define loop_jcxz_mode 9
+#define dq_mode 10 /* operand size depends on REX prefixes.  */
 
 #define es_reg 100
 #define cs_reg 101
@@ -878,7 +879,7 @@ static const struct dis386 dis386_twobyte[] = {
   { "packssdw",                MX, EM, XX },
   { PREGRP26 },
   { PREGRP24 },
-  { "movd",            MX, Ed, XX },
+  { "movd",            MX, Edq, XX },
   { PREGRP19 },
   /* 70 */
   { PREGRP22 },
@@ -1611,9 +1612,9 @@ static const struct dis386 prefix_user_table[][4] = {
   },
   /* PREGRP23 */
   {
-    { "movd", Ed, MX, XX },
+    { "movd", Edq, MX, XX },
     { "movq", XM, EX, XX },
-    { "movd", Ed, XM, XX },
+    { "movd", Edq, XM, XX },
     { "(bad)", Ed, XM, XX },
   },
   /* PREGRP24 */
@@ -1808,9 +1809,9 @@ prefix_name (pref, sizeflag)
       return (sizeflag & DFLAG) ? "data16" : "data32";
     case 0x67:
       if (mode_64bit)
-        return (sizeflag & AFLAG) ? "addr32" : "addr64";
+       return (sizeflag & AFLAG) ? "addr32" : "addr64";
       else
-        return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
+       return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
     case FWAIT_OPCODE:
       return "fwait";
     default:
@@ -2040,7 +2041,7 @@ print_insn (pc, info)
       const char *name;
 
       /* fwait not followed by floating point instruction.  Print the
-         first prefix, which is probably fwait itself.  */
+        first prefix, which is probably fwait itself.  */
       name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
       if (name == NULL)
        name = INTERNAL_DISASSEMBLER_ERROR;
@@ -2273,7 +2274,7 @@ static const char *float_mem[] = {
   "fsubr{s||s|}",
   "fdiv{s||s|}",
   "fdivr{s||s|}",
-  /*  d9 */
+  /* d9 */
   "fld{s||s|}",
   "(bad)",
   "fst{s||s|}",
@@ -2518,11 +2519,11 @@ dofloat (sizeflag)
       putop (float_mem[(floatop - 0xd8) * 8 + reg], sizeflag);
       obufp = op1out;
       if (floatop == 0xdb)
-        OP_E (x_mode, sizeflag);
+       OP_E (x_mode, sizeflag);
       else if (floatop == 0xdd)
-        OP_E (d_mode, sizeflag);
+       OP_E (d_mode, sizeflag);
       else
-        OP_E (v_mode, sizeflag);
+       OP_E (v_mode, sizeflag);
       return;
     }
   /* Skip mod/rm byte.  */
@@ -2617,14 +2618,14 @@ putop (template, sizeflag)
        case '}':
          break;
        case 'A':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
            *obufp++ = 'b';
          break;
        case 'B':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (sizeflag & SUFFIX_ALWAYS)
            *obufp++ = 'b';
          break;
@@ -2642,8 +2643,8 @@ putop (template, sizeflag)
          used_prefixes |= (prefixes & PREFIX_ADDR);
          break;
        case 'F':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if ((prefixes & PREFIX_ADDR) || (sizeflag & SUFFIX_ALWAYS))
            {
              if (sizeflag & AFLAG)
@@ -2654,8 +2655,8 @@ putop (template, sizeflag)
            }
          break;
        case 'H':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if ((prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_CS
              || (prefixes & (PREFIX_CS | PREFIX_DS)) == PREFIX_DS)
            {
@@ -2669,8 +2670,8 @@ putop (template, sizeflag)
            }
          break;
        case 'L':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (sizeflag & SUFFIX_ALWAYS)
            *obufp++ = 'l';
          break;
@@ -2688,8 +2689,8 @@ putop (template, sizeflag)
            *obufp++ = 'd';
          break;
        case 'T':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (mode_64bit)
            {
              *obufp++ = 'q';
@@ -2697,8 +2698,8 @@ putop (template, sizeflag)
            }
          /* Fall through.  */
        case 'P':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if ((prefixes & PREFIX_DATA)
              || (rex & REX_MODE64)
              || (sizeflag & SUFFIX_ALWAYS))
@@ -2717,8 +2718,8 @@ putop (template, sizeflag)
            }
          break;
        case 'U':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (mode_64bit)
            {
              *obufp++ = 'q';
@@ -2726,8 +2727,8 @@ putop (template, sizeflag)
            }
          /* Fall through.  */
        case 'Q':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          USED_REX (REX_MODE64);
          if (mod != 3 || (sizeflag & SUFFIX_ALWAYS))
            {
@@ -2745,7 +2746,7 @@ putop (template, sizeflag)
          break;
        case 'R':
          USED_REX (REX_MODE64);
-          if (intel_syntax)
+         if (intel_syntax)
            {
              if (rex & REX_MODE64)
                {
@@ -2776,8 +2777,8 @@ putop (template, sizeflag)
            used_prefixes |= (prefixes & PREFIX_DATA);
          break;
        case 'S':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (sizeflag & SUFFIX_ALWAYS)
            {
              if (rex & REX_MODE64)
@@ -2797,11 +2798,11 @@ putop (template, sizeflag)
            *obufp++ = 'd';
          else
            *obufp++ = 's';
-          used_prefixes |= (prefixes & PREFIX_DATA);
+         used_prefixes |= (prefixes & PREFIX_DATA);
          break;
        case 'Y':
-          if (intel_syntax)
-            break;
+         if (intel_syntax)
+           break;
          if (rex & REX_MODE64)
            {
              USED_REX (REX_MODE64);
@@ -2818,7 +2819,7 @@ putop (template, sizeflag)
            *obufp++ = 'w';
          else
            *obufp++ = 'b';
-          if (intel_syntax)
+         if (intel_syntax)
            {
              if (rex)
                {
@@ -3000,10 +3001,11 @@ OP_E (bytemode, sizeflag)
            oappend (names32[rm + add]);
          break;
        case v_mode:
+       case dq_mode:
          USED_REX (REX_MODE64);
          if (rex & REX_MODE64)
            oappend (names64[rm + add]);
-         else if (sizeflag & DFLAG)
+         else if ((sizeflag & DFLAG) || bytemode == dq_mode)
            oappend (names32[rm + add]);
          else
            oappend (names16[rm + add]);
@@ -3076,52 +3078,52 @@ OP_E (bytemode, sizeflag)
        }
 
       if (!intel_syntax)
-        if (mod != 0 || (base & 7) == 5)
-          {
+       if (mod != 0 || (base & 7) == 5)
+         {
            print_operand_value (scratchbuf, !riprel, disp);
-            oappend (scratchbuf);
+           oappend (scratchbuf);
            if (riprel)
              {
                set_op (disp, 1);
                oappend ("(%rip)");
              }
-          }
+         }
 
       if (havebase || (havesib && (index != 4 || scale != 0)))
        {
-          if (intel_syntax)
-            {
-              switch (bytemode)
-                {
-                case b_mode:
-                  oappend ("BYTE PTR ");
-                  break;
-                case w_mode:
-                  oappend ("WORD PTR ");
-                  break;
-                case v_mode:
-                  oappend ("DWORD PTR ");
-                  break;
-                case d_mode:
-                  oappend ("QWORD PTR ");
-                  break;
-                case m_mode:
+         if (intel_syntax)
+           {
+             switch (bytemode)
+               {
+               case b_mode:
+                 oappend ("BYTE PTR ");
+                 break;
+               case w_mode:
+                 oappend ("WORD PTR ");
+                 break;
+               case v_mode:
+                 oappend ("DWORD PTR ");
+                 break;
+               case d_mode:
+                 oappend ("QWORD PTR ");
+                 break;
+               case m_mode:
                  if (mode_64bit)
                    oappend ("DWORD PTR ");
                  else
                    oappend ("QWORD PTR ");
                  break;
-                case x_mode:
-                  oappend ("XWORD PTR ");
-                  break;
-                default:
-                  break;
-                }
-             }
+               case x_mode:
+                 oappend ("XWORD PTR ");
+                 break;
+               default:
+                 break;
+               }
+            }
          *obufp++ = open_char;
          if (intel_syntax && riprel)
            oappend ("rip + ");
-          *obufp = '\0';
+         *obufp = '\0';
          USED_REX (REX_EXTZ);
          if (!havesib && (rex & REX_EXTZ))
            base += 8;
@@ -3132,41 +3134,41 @@ OP_E (bytemode, sizeflag)
            {
              if (index != 4)
                {
-                  if (intel_syntax)
-                    {
-                      if (havebase)
-                        {
-                          *obufp++ = separator_char;
-                          *obufp = '\0';
-                        }
-                      sprintf (scratchbuf, "%s",
+                 if (intel_syntax)
+                   {
+                     if (havebase)
+                       {
+                         *obufp++ = separator_char;
+                         *obufp = '\0';
+                       }
+                     sprintf (scratchbuf, "%s",
                               mode_64bit && (sizeflag & AFLAG)
                               ? names64[index] : names32[index]);
-                    }
-                  else
+                   }
+                 else
                    sprintf (scratchbuf, ",%s",
                             mode_64bit && (sizeflag & AFLAG)
                             ? names64[index] : names32[index]);
                  oappend (scratchbuf);
                }
-              if (!intel_syntax
-                  || (intel_syntax
-                      && bytemode != b_mode
-                      && bytemode != w_mode
-                      && bytemode != v_mode))
-                {
-                  *obufp++ = scale_char;
-                  *obufp = '\0';
-                 sprintf (scratchbuf, "%d", 1 << scale);
-                 oappend (scratchbuf);
-                }
+             if (!intel_syntax
+                 || (intel_syntax
+                     && bytemode != b_mode
+                     && bytemode != w_mode
+                     && bytemode != v_mode))
+               {
+                 *obufp++ = scale_char;
+                 *obufp = '\0';
+                 sprintf (scratchbuf, "%d", 1 << scale);
+                 oappend (scratchbuf);
+               }
            }
-          if (intel_syntax)
-            if (mod != 0 || (base & 7) == 5)
-              {
+         if (intel_syntax)
+           if (mod != 0 || (base & 7) == 5)
+             {
                /* Don't print zero displacements.  */
-                if (disp != 0)
-                  {
+               if (disp != 0)
+                 {
                    if ((bfd_signed_vma) disp > 0)
                      {
                        *obufp++ = '+';
@@ -3174,17 +3176,17 @@ OP_E (bytemode, sizeflag)
                      }
 
                    print_operand_value (scratchbuf, 0, disp);
-                    oappend (scratchbuf);
-                  }
-              }
+                   oappend (scratchbuf);
+                 }
+             }
 
          *obufp++ = close_char;
-          *obufp = '\0';
+         *obufp = '\0';
        }
       else if (intel_syntax)
-        {
-          if (mod != 0 || (base & 7) == 5)
-            {
+       {
+         if (mod != 0 || (base & 7) == 5)
+           {
              if (prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
                              | PREFIX_ES | PREFIX_FS | PREFIX_GS))
                ;
@@ -3194,9 +3196,9 @@ OP_E (bytemode, sizeflag)
                  oappend (":");
                }
              print_operand_value (scratchbuf, 1, disp);
-              oappend (scratchbuf);
-            }
-        }
+             oappend (scratchbuf);
+           }
+       }
     }
   else
     { /* 16 bit address mode */
@@ -3224,19 +3226,19 @@ OP_E (bytemode, sizeflag)
        }
 
       if (!intel_syntax)
-        if (mod != 0 || (rm & 7) == 6)
-          {
+       if (mod != 0 || (rm & 7) == 6)
+         {
            print_operand_value (scratchbuf, 0, disp);
-            oappend (scratchbuf);
-          }
+           oappend (scratchbuf);
+         }
 
       if (mod != 0 || (rm & 7) != 6)
        {
          *obufp++ = open_char;
-          *obufp = '\0';
+         *obufp = '\0';
          oappend (index16[rm + add]);
-          *obufp++ = close_char;
-          *obufp = '\0';
+         *obufp++ = close_char;
+         *obufp = '\0';
        }
     }
 }
@@ -3383,9 +3385,9 @@ OP_REG (code, sizeflag)
     {
     case indir_dx_reg:
       if (intel_syntax)
-        s = "[dx]";
+       s = "[dx]";
       else
-        s = "(%dx)";
+       s = "(%dx)";
       break;
     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
     case sp_reg: case bp_reg: case si_reg: case di_reg:
@@ -3441,9 +3443,9 @@ OP_IMREG (code, sizeflag)
     {
     case indir_dx_reg:
       if (intel_syntax)
-        s = "[dx]";
+       s = "[dx]";
       else
-        s = "(%dx)";
+       s = "(%dx)";
       break;
     case ax_reg: case cx_reg: case dx_reg: case bx_reg:
     case sp_reg: case bp_reg: case si_reg: case di_reg:
@@ -3725,7 +3727,7 @@ OP_OFF (bytemode, sizeflag)
   if (intel_syntax)
     {
       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
+                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
        {
          oappend (names_seg[ds_reg - es_reg]);
          oappend (":");
@@ -3755,7 +3757,7 @@ OP_OFF64 (bytemode, sizeflag)
   if (intel_syntax)
     {
       if (!(prefixes & (PREFIX_CS | PREFIX_SS | PREFIX_DS
-                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
+                       | PREFIX_ES | PREFIX_FS | PREFIX_GS)))
        {
          oappend (names_seg[ds_reg - es_reg]);
          oappend (":");
@@ -3780,9 +3782,9 @@ ptr_reg (code, sizeflag)
   if (rex & REX_MODE64)
     {
       if (!(sizeflag & AFLAG))
-        s = names32[code - eAX_reg];
+       s = names32[code - eAX_reg];
       else
-        s = names64[code - eAX_reg];
+       s = names64[code - eAX_reg];
     }
   else if (sizeflag & AFLAG)
     s = names32[code - eAX_reg];
index 176ffeb..1ed436a 100644 (file)
@@ -1758,7 +1758,7 @@ void
 print_mips_disassembler_options (stream)
      FILE *stream;
 {
-  int i;
+  unsigned int i;
 
   fprintf (stream, _("\n\
 The following MIPS specific disassembler options are supported for use\n\
@@ -1793,14 +1793,14 @@ with the -M switch (multiple options should be separated by commas):\n"));
   fprintf (stream, _("\n\
   For the options above, the following values are supported for \"ABI\":\n\
    "));
-  for (i = 0; mips_abi_choices[i].name != NULL; i++)
+  for (i = 0; i < ARRAY_SIZE (mips_abi_choices); i++)
     fprintf (stream, " %s", mips_abi_choices[i].name);
   fprintf (stream, _("\n"));
 
   fprintf (stream, _("\n\
   For the options above, The following values are supported for \"ARCH\":\n\
    "));
-  for (i = 0; mips_arch_choices[i].name != NULL; i++)
+  for (i = 0; i < ARRAY_SIZE (mips_arch_choices); i++)
     if (*mips_arch_choices[i].name != '\0')
       fprintf (stream, " %s", mips_arch_choices[i].name);
   fprintf (stream, _("\n"));
index 7323018..40eef93 100644 (file)
@@ -1,3 +1,18 @@
+2003-03-03  Joel Brobecker  <brobecker@gnat.com>
+
+       * aclocal.m4: Add check for mbrtowc.
+       * config.h.in: Regenerate.
+       * configure: Regenerate.
+       * rlmbutil.h: Disable multi-byte if mbrtowc is not defined.
+
+2003-03-03  Kris Warkentin  <kewarken@qnx.com>
+
+       * aclocal.m4: Cause wcwidth check to substitute
+       HAVE_WCWIDTH for building.
+       * Makefile.in: Add wcwidth object to lib if required.
+       * shlib/Makefile.in: Likewise.
+       * configure: Regenerate.
+       
 2003-01-09  Michael Chastain  <mec@shout.net>
 
        From Chet Ramey, <chet@po.cwru.edu>, the readline maintainer:
index 720fb39..f039ec6 100644 (file)
@@ -86,6 +86,8 @@ GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT_FLAGS) @CFLAGS@ @LOCAL_CFLAGS@
 LIBRARY_NAME = libreadline.a
 STATIC_LIBS = libreadline.a libhistory.a
 
+WCWIDTH_OBJ = @WCWIDTH_OBJ@
+
 # The C code source files for this library.
 CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
           $(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
@@ -98,7 +100,7 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
           $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
           $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
           $(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
-          $(srcdir)/mbutil.c
+          $(srcdir)/mbutil.c $(srcdir)/support/wcwidth.c
 
 # The header files for this library.
 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
@@ -111,7 +113,8 @@ TILDEOBJ = tilde.o
 OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
          rltty.o complete.o bind.o isearch.o display.o signals.o \
          util.o kill.o undo.o macro.o input.o callback.o terminal.o \
-         text.o nls.o misc.o compat.o xmalloc.o $(HISTOBJ) $(TILDEOBJ)
+         text.o nls.o misc.o compat.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) \
+         $(WCWIDTH_OBJ)
 
 # The texinfo files which document this library.
 DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
@@ -147,6 +150,10 @@ libhistory.a: $(HISTOBJ) xmalloc.o
        $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
        -test -n "$(RANLIB)" && $(RANLIB) $@
 
+wcwidth.o: $(srcdir)/support/wcwidth.c
+       $(RM) $@
+       $(CC) $(CCFLAGS) -c $(srcdir)/support/wcwidth.c
+
 # Since tilde.c is shared between readline and bash, make sure we compile
 # it with the right flags when it's built as part of readline
 tilde.o:       tilde.c
index d1ad025..bc43d8d 100644 (file)
@@ -1652,8 +1652,15 @@ AC_CHECK_HEADERS(wctype.h)
 AC_CHECK_HEADERS(wchar.h)
 AC_CHECK_HEADERS(langinfo.h)
 
+AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
-AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
+AC_CHECK_FUNC(wcwidth, have_wcwidth=yes)
+if test "$have_wcwidth" = yes; then
+  AC_DEFINE(HAVE_WCWIDTH)
+  AC_SUBST(WCWIDTH_OBJ,)
+else
+  AC_SUBST(WCWIDTH_OBJ,wcwidth.o)
+fi
 
 AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
 [AC_TRY_RUN([
index c53c2a1..62883d3 100644 (file)
@@ -31,6 +31,9 @@
 /* Define if you have the lstat function. */
 #undef HAVE_LSTAT
 
+/* Define if you have the mbrtowc function. */
+#undef HAVE_MBRTOWC
+
 /* Define if you have the mbsrtowcs function. */
 #undef HAVE_MBSRTOWCS
 
index 92c7676..b5c2e8d 100755 (executable)
@@ -1,15 +1,84 @@
 #! /bin/sh
-# From configure.in for Readline 4.3, version 2.45, from autoconf version 2.52.
+# From configure.in for Readline 4.3, version 2.45, from autoconf version AC_ACVERSION.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by Autoconf 2.52 for readline 4.3.
+# Generated by GNU Autoconf 2.57 for readline 4.3.
 #
 # Report bugs to <bug-readline@gnu.org>.
 #
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
 
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
 # Avoid depending upon Character Ranges.
 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@@ -17,22 +86,113 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS
 as_cr_digits='0123456789'
 as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
 
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
 
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
-fi
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
 
-# Name of the executable.
-as_me=`echo "$0" |sed 's,.*[\\/],,'`
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
 
 if expr a : '\(a\)' >/dev/null 2>&1; then
   as_expr=expr
@@ -58,24 +218,20 @@ else
 fi
 rm -f conf$$ conf$$.exe conf$$.file
 
-as_executable_p="test -f"
-
-# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
-  as_unset=unset
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
 else
-  as_unset=false
+  as_mkdir_p=false
 fi
 
-# NLS nuisances.
-$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
-$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
-$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
-$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
-$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
-$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
-$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
-$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
 
 # IFS
 # We need space, tab and new line, in precisely that order.
@@ -84,7 +240,8 @@ as_nl='
 IFS="  $as_nl"
 
 # CDPATH.
-$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+$as_unset CDPATH
+
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -97,9 +254,11 @@ exec 6>&1
 # Initializations.
 #
 ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
 cross_compiling=no
 subdirs=
-MFLAGS= MAKEFLAGS=
+MFLAGS=
+MAKEFLAGS=
 SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Maximum number of lines to put in a shell here document.
@@ -107,6 +266,13 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # only ac_max_sed_lines should be used.
 : ${ac_max_here_lines=38}
 
+# Identity of this package.
+PACKAGE_NAME='readline'
+PACKAGE_TARNAME='readline'
+PACKAGE_VERSION='4.3'
+PACKAGE_STRING='readline 4.3'
+PACKAGE_BUGREPORT='bug-readline@gnu.org'
+
 ac_unique_file="readline.h"
 # Factoring default headers for most tests.
 ac_includes_default="\
@@ -145,6 +311,9 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP CROSS_COMPILING_FLAG CC_FOR_BUILD INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR RANLIB ac_ct_RANLIB MAKE_SHELL WCWIDTH_OBJ SHOBJ_CC SHOBJ_CFLAGS SHOBJ_LD SHOBJ_LDFLAGS SHOBJ_XLDFLAGS SHOBJ_LIBS SHOBJ_STATUS SHLIB_STATUS SHLIB_XLDFLAGS SHLIB_LIBSUFF SHLIB_LIBVERSION SHLIB_LIBS SHLIB_MAJOR SHLIB_MINOR STATIC_TARGET SHARED_TARGET STATIC_INSTALL_TARGET SHARED_INSTALL_TARGET BUILD_DIR LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS ARFLAGS LIBVERSION TERMCAP_LIB LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
 # Initialize some variables set by options.
 ac_init_help=
 ac_init_version=false
@@ -183,13 +352,6 @@ oldincludedir='/usr/include'
 infodir='${prefix}/info'
 mandir='${prefix}/man'
 
-# Identity of this package.
-PACKAGE_NAME='readline'
-PACKAGE_TARNAME='readline'
-PACKAGE_VERSION='4.3'
-PACKAGE_STRING='readline 4.3'
-PACKAGE_BUGREPORT='bug-readline@gnu.org'
-
 ac_prev=
 for ac_option
 do
@@ -322,7 +484,7 @@ do
     with_fp=no ;;
 
   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c)
+  | --no-cr | --no-c | -n)
     no_create=yes ;;
 
   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -501,7 +663,7 @@ do
   eval ac_val=$`echo $ac_var`
   case $ac_val in
     [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-    *)  { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
    { (exit 1); exit 1; }; };;
   esac
 done
@@ -513,18 +675,19 @@ do
   eval ac_val=$`echo $ac_var`
   case $ac_val in
     [\\/$]* | ?:[\\/]* ) ;;
-    *)  { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
    { (exit 1); exit 1; }; };;
   esac
 done
 
 # There might be people who depend on the old broken behavior: `$host'
 # used to hold the argument of --host etc.
+# FIXME: To remove some day.
 build=$build_alias
 host=$host_alias
 target=$target_alias
 
-# FIXME: should be removed in autoconf 3.0.
+# FIXME: To remove some day.
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
@@ -540,13 +703,23 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
 
 test "$silent" = yes && exec 6>/dev/null
 
+
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then its parent.
-  ac_prog=$0
-  ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'`
-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$0" : 'X\(//\)[^/]' \| \
+         X"$0" : 'X\(//\)$' \| \
+         X"$0" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
   srcdir=$ac_confdir
   if test ! -r $srcdir/$ac_unique_file; then
     srcdir=..
@@ -556,13 +729,16 @@ else
 fi
 if test ! -r $srcdir/$ac_unique_file; then
   if test "$ac_srcdir_defaulted" = yes; then
-    { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
    { (exit 1); exit 1; }; }
   else
-    { echo "$as_me: error: cannot find sources in $srcdir" >&2
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
    { (exit 1); exit 1; }; }
   fi
 fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
 srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
 ac_env_build_alias_set=${build_alias+set}
 ac_env_build_alias_value=$build_alias
@@ -603,7 +779,7 @@ ac_cv_env_CPP_value=$CPP
 if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
-  cat <<EOF
+  cat <<_ACEOF
 \`configure' configures readline 4.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -624,9 +800,9 @@ Configuration:
   -n, --no-create         do not create output files
       --srcdir=DIR        find the sources in DIR [configure dir or \`..']
 
-EOF
+_ACEOF
 
-  cat <<EOF
+  cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
                           [$ac_default_prefix]
@@ -653,21 +829,21 @@ Fine tuning of the installation directories:
   --oldincludedir=DIR    C header files for non-gcc [/usr/include]
   --infodir=DIR          info documentation [PREFIX/info]
   --mandir=DIR           man documentation [PREFIX/man]
-EOF
+_ACEOF
 
-  cat <<\EOF
+  cat <<\_ACEOF
 
 System types:
   --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       build programs to run on HOST [BUILD]
-EOF
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
 fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
      short | recursive ) echo "Configuration of readline 4.3:";;
    esac
-  cat <<\EOF
+  cat <<\_ACEOF
 
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
@@ -693,40 +869,60 @@ Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
 Report bugs to <bug-readline@gnu.org>.
-EOF
+_ACEOF
 fi
 
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
   ac_popdir=`pwd`
-  for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue
-    cd $ac_subdir
-    # A "../" for each directory in /$ac_subdir.
-    ac_dots=`echo $ac_subdir |
-             sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'`
-
-    case $srcdir in
-    .) # No --srcdir option.  We are building in place.
-      ac_sub_srcdir=$srcdir ;;
-    [\\/]* | ?:[\\/]* ) # Absolute path.
-      ac_sub_srcdir=$srcdir/$ac_subdir ;;
-    *) # Relative path.
-      ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;;
-    esac
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
 
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+    cd $ac_dir
     # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f $ac_sub_srcdir/configure.gnu; then
+    if test -f $ac_srcdir/configure.gnu; then
       echo
-      $SHELL $ac_sub_srcdir/configure.gnu  --help=recursive
-    elif test -f $ac_sub_srcdir/configure; then
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
       echo
-      $SHELL $ac_sub_srcdir/configure  --help=recursive
-    elif test -f $ac_sub_srcdir/configure.ac ||
-           test -f $ac_sub_srcdir/configure.in; then
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+           test -f $ac_srcdir/configure.in; then
       echo
       $ac_configure --help
     else
-      echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi
     cd $ac_popdir
   done
@@ -734,33 +930,33 @@ fi
 
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
-  cat <<\EOF
+  cat <<\_ACEOF
 readline configure 4.3
-generated by GNU Autoconf 2.52
+generated by GNU Autoconf 2.57
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
-EOF
+_ACEOF
   exit 0
 fi
 exec 5>config.log
-cat >&5 <<EOF
+cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by readline $as_me 4.3, which was
-generated by GNU Autoconf 2.52.  Invocation command line was
+generated by GNU Autoconf 2.57.  Invocation command line was
 
   $ $0 $@
 
-EOF
+_ACEOF
 {
 cat <<_ASUNAME
-## ---------- ##
-## Platform.  ##
-## ---------- ##
+## --------- ##
+## Platform. ##
+## --------- ##
 
 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
 uname -m = `(uname -m) 2>/dev/null || echo unknown`
@@ -779,51 +975,96 @@ hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
 
-PATH = $PATH
-
 _ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
 } >&5
 
-cat >&5 <<EOF
-## ------------ ##
-## Core tests.  ##
-## ------------ ##
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
 
-EOF
 
 # Keep a trace of the command line.
 # Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
 # Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
 ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
 ac_sep=
-for ac_arg
+ac_must_keep_next=false
+for ac_pass in 1 2
 do
-  case $ac_arg in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c) ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
-    ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-    ac_sep=" " ;;
-  *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg"
-     ac_sep=" " ;;
-  esac
-  # Get rid of the leading space.
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+        ac_must_keep_next=false # Got value, back to normal.
+      else
+        case $ac_arg in
+          *=* | --config-cache | -C | -disable-* | --disable-* \
+          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+          | -with-* | --with-* | -without-* | --without-* | --x)
+            case "$ac_configure_args0 " in
+              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+            esac
+            ;;
+          -* ) ac_must_keep_next=true ;;
+        esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
 done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
 
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
 # would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
 trap 'exit_status=$?
   # Save into config.log some information that might help in debugging.
-  echo >&5
-  echo "## ----------------- ##" >&5
-  echo "## Cache variables.  ##" >&5
-  echo "## ----------------- ##" >&5
-  echo >&5
-  # The following way of writing the cache mishandles newlines in values,
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
 {
   (set) 2>&1 |
     case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
@@ -837,21 +1078,53 @@ trap 'exit_status=$?
         "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
     esac;
-} >&5
-  sed "/^$/d" confdefs.h >conftest.log
-  if test -s conftest.log; then
-    echo >&5
-    echo "## ------------ ##" >&5
-    echo "## confdefs.h.  ##" >&5
-    echo "## ------------ ##" >&5
-    echo >&5
-    cat conftest.log >&5
-  fi
-  (echo; echo) >&5
-  test "$ac_signal" != 0 &&
-    echo "$as_me: caught signal $ac_signal" >&5
-  echo "$as_me: exit $exit_status" >&5
-  rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files &&
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+        echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core core.* *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
      ' 0
 for ac_signal in 1 2 13 15; do
@@ -864,6 +1137,33 @@ rm -rf conftest* confdefs.h
 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
 echo >confdefs.h
 
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
 # Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
 if test -z "$CONFIG_SITE"; then
@@ -875,9 +1175,9 @@ if test -z "$CONFIG_SITE"; then
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    { echo "$as_me:879: loading site script $ac_site_file" >&5
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
-    cat "$ac_site_file" >&5
+    sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file"
   fi
 done
@@ -886,7 +1186,7 @@ if test -r "$cache_file"; then
   # Some versions of bash will fail to source /dev/null (special
   # files actually), so we avoid doing that.
   if test -f "$cache_file"; then
-    { echo "$as_me:890: loading cache $cache_file" >&5
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . $cache_file;;
@@ -894,7 +1194,7 @@ echo "$as_me: loading cache $cache_file" >&6;}
     esac
   fi
 else
-  { echo "$as_me:898: creating cache $cache_file" >&5
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
 echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -910,42 +1210,42 @@ for ac_var in `(set) 2>&1 |
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
-      { echo "$as_me:914: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { echo "$as_me:918: error: \`$ac_var' was not set in the previous run" >&5
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:924: error: \`$ac_var' has changed since the previous run:" >&5
+        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:926:   former value:  $ac_old_val" >&5
+        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:928:   current value: $ac_new_val" >&5
+        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
         ac_cache_corrupted=:
       fi;;
   esac
-  # Pass precious variables to config.status.  It doesn't matter if
-  # we pass some twice (in addition to the command line arguments).
+  # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
     *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
-       ;;
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
     esac
   fi
 done
 if $ac_cache_corrupted; then
-  { echo "$as_me:947: error: changes in the environment can compromise the build" >&5
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:949: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -956,28 +1256,38 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)      ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-echo "#! $SHELL" >conftest.sh
-echo  "exit 0"   >>conftest.sh
-chmod +x conftest.sh
-if { (echo "$as_me:969: PATH=\".;.\"; conftest.sh") >&5
-  (PATH=".;."; conftest.sh) 2>&5
-  ac_status=$?
-  echo "$as_me:972: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  ac_path_separator=';'
-else
-  ac_path_separator=:
-fi
-PATH_SEPARATOR="$ac_path_separator"
-rm -f conftest.sh
 
-ac_config_headers="$ac_config_headers config.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+          ac_config_headers="$ac_config_headers config.h"
+
 
 LIBVERSION=4.3
 
@@ -998,7 +1308,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:1002: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
    { (exit 1); exit 1; }; }
 fi
@@ -1008,11 +1318,11 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
 # Make sure we can run config.sub.
 $ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:1012: error: cannot run $ac_config_sub" >&5
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
 echo "$as_me: error: cannot run $ac_config_sub" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:1016: checking build system type" >&5
+echo "$as_me:$LINENO: checking build system type" >&5
 echo $ECHO_N "checking build system type... $ECHO_C" >&6
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1021,23 +1331,24 @@ else
 test -z "$ac_cv_build_alias" &&
   ac_cv_build_alias=`$ac_config_guess`
 test -z "$ac_cv_build_alias" &&
-  { { echo "$as_me:1025: error: cannot guess build type; you must specify one" >&5
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
 ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:1029: error: $ac_config_sub $ac_cv_build_alias failed." >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;}
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1034: result: $ac_cv_build" >&5
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
 echo "${ECHO_T}$ac_cv_build" >&6
 build=$ac_cv_build
 build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
-echo "$as_me:1041: checking host system type" >&5
+
+echo "$as_me:$LINENO: checking host system type" >&5
 echo $ECHO_N "checking host system type... $ECHO_C" >&6
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1046,20 +1357,23 @@ else
 test -z "$ac_cv_host_alias" &&
   ac_cv_host_alias=$ac_cv_build_alias
 ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:1050: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:1055: result: $ac_cv_host" >&5
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
 echo "${ECHO_T}$ac_cv_host" >&6
 host=$ac_cv_host
 host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
+
+
 opt_curses=no
 
+
 # Check whether --with-curses or --without-curses was given.
 if test "${with_curses+set}" = set; then
   withval="$with_curses"
@@ -1086,16 +1400,16 @@ echo ""
 # We want these before the checks, so the checks can modify their values.
 test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
 
-echo "$as_me:1095: checking whether ${MAKE-make} sets \${MAKE}" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.make <<\EOF
+  cat >conftest.make <<\_ACEOF
 all:
-       @echo 'ac_maketemp="${MAKE}"'
-EOF
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
 if test -n "$ac_maketemp"; then
@@ -1106,11 +1420,11 @@ fi
 rm -f conftest.make
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:1115: result: yes" >&5
+  echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
   SET_MAKE=
 else
-  echo "$as_me:1119: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -1123,7 +1437,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:1132: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1131,25 +1445,28 @@ else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="${ac_tool_prefix}gcc"
-echo "$as_me:1147: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1155: result: $CC" >&5
+  echo "$as_me:$LINENO: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1158: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1158,7 +1475,7 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-echo "$as_me:1167: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1166,25 +1483,28 @@ else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="gcc"
-echo "$as_me:1182: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1190: result: $ac_ct_CC" >&5
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1193: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1197,7 +1517,7 @@ if test -z "$CC"; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:1206: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1205,25 +1525,28 @@ else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="${ac_tool_prefix}cc"
-echo "$as_me:1221: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1229: result: $CC" >&5
+  echo "$as_me:$LINENO: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1232: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1232,7 +1555,7 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:1241: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1240,25 +1563,28 @@ else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="cc"
-echo "$as_me:1256: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1264: result: $ac_ct_CC" >&5
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1267: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1271,7 +1597,7 @@ fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:1280: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1280,19 +1606,22 @@ else
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   ac_prog_rejected=no
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-  ac_prog_rejected=yes
-  continue
-fi
-ac_cv_prog_CC="cc"
-echo "$as_me:1300: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 if test $ac_prog_rejected = yes; then
@@ -1304,19 +1633,17 @@ if test $ac_prog_rejected = yes; then
     # However, it has the same basename, so the bogon will be chosen
     # first if we set CC to just the basename; use the full file name.
     shift
-    set dummy "$ac_dir/$ac_word" ${1+"$@"}
-    shift
-    ac_cv_prog_CC="$@"
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
   fi
 fi
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1322: result: $CC" >&5
+  echo "$as_me:$LINENO: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1325: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1327,7 +1654,7 @@ if test -z "$CC"; then
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:1336: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1335,25 +1662,28 @@ else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-echo "$as_me:1351: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:1359: result: $CC" >&5
+  echo "$as_me:$LINENO: result: $CC" >&5
 echo "${ECHO_T}$CC" >&6
 else
-  echo "$as_me:1362: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1366,7 +1696,7 @@ if test -z "$CC"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:1375: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1374,25 +1704,28 @@ else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_CC="$ac_prog"
-echo "$as_me:1390: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:1398: result: $ac_ct_CC" >&5
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
 echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "$as_me:1401: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1404,33 +1737,40 @@ fi
 
 fi
 
-test -z "$CC" && { { echo "$as_me:1413: error: no acceptable cc found in \$PATH" >&5
-echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:1418:" \
+echo "$as_me:$LINENO:" \
      "checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:1421: \"$ac_compiler --version </dev/null >&5\"") >&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
   (eval $ac_compiler --version </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1424: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1426: \"$ac_compiler -v </dev/null >&5\"") >&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
   (eval $ac_compiler -v </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1429: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:1431: \"$ac_compiler -V </dev/null >&5\"") >&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
   (eval $ac_compiler -V </dev/null >&5) 2>&5
   ac_status=$?
-  echo "$as_me:1434: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line 1438 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 int
 main ()
@@ -1441,100 +1781,120 @@ main ()
 }
 _ACEOF
 ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe"
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:1454: checking for C compiler default output" >&5
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:1457: \"$ac_link_default\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
   (eval $ac_link_default) 2>&5
   ac_status=$?
-  echo "$as_me:1460: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # Find the output, starting from the most likely.  This scheme is
 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
 # resort.
-for ac_file in `ls a.exe conftest.exe 2>/dev/null;
-                ls a.out conftest 2>/dev/null;
-                ls a.* conftest.* 2>/dev/null`; do
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
-    a.out ) # We found the default executable, but exeext='' is most
-            # certainly right.
-            break;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-          # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
-          export ac_cv_exeext
-          break;;
-    * ) break;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+        ;;
+    conftest.$ac_ext )
+        # This is the source file.
+        ;;
+    [ab].out )
+        # We found the default executable, but exeext='' is most
+        # certainly right.
+        break;;
+    *.* )
+        ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+        # FIXME: I believe we export ac_cv_exeext for Libtool,
+        # but it would be cool to find out if it's true.  Does anybody
+        # maintain Libtool? --akim.
+        export ac_cv_exeext
+        break;;
+    * )
+        break;;
   esac
 done
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-{ { echo "$as_me:1483: error: C compiler cannot create executables" >&5
-echo "$as_me: error: C compiler cannot create executables" >&2;}
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:1489: result: $ac_file" >&5
+echo "$as_me:$LINENO: result: $ac_file" >&5
 echo "${ECHO_T}$ac_file" >&6
 
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1494: checking whether the C compiler works" >&5
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:1500: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1503: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
     cross_compiling=no
   else
     if test "$cross_compiling" = maybe; then
        cross_compiling=yes
     else
-       { { echo "$as_me:1510: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'." >&5
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
 echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'." >&2;}
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
     fi
   fi
 fi
-echo "$as_me:1518: result: yes" >&5
+echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 
-rm -f a.out a.exe conftest$ac_cv_exeext
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
 # Check the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:1525: checking whether we are cross compiling" >&5
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:1527: result: $cross_compiling" >&5
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
 echo "${ECHO_T}$cross_compiling" >&6
 
-echo "$as_me:1530: checking for executable suffix" >&5
-echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
-if { (eval echo "$as_me:1532: \"$ac_link\"") >&5
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:1535: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
 # `rm'.
-for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
           export ac_cv_exeext
           break;;
@@ -1542,26 +1902,32 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
   esac
 done
 else
-  { { echo "$as_me:1551: error: cannot compute EXEEXT: cannot compile and link" >&5
-echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;}
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:1557: result: $ac_cv_exeext" >&5
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
 echo "${ECHO_T}$ac_cv_exeext" >&6
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:1563: checking for object suffix" >&5
-echo $ECHO_N "checking for object suffix... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1569 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 int
 main ()
@@ -1572,40 +1938,47 @@ main ()
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:1581: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1584: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
 done
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-{ { echo "$as_me:1596: error: cannot compute OBJEXT: cannot compile" >&5
-echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;}
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:1603: result: $ac_cv_objext" >&5
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
 echo "${ECHO_T}$ac_cv_objext" >&6
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:1607: checking whether we are using the GNU C compiler" >&5
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1613 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 int
 main ()
@@ -1619,41 +1992,46 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1628: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1631: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1634: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1637: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_compiler_gnu=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:1649: result: $ac_cv_c_compiler_gnu" >&5
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 CFLAGS="-g"
-echo "$as_me:1655: checking whether $CC accepts -g" >&5
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 1661 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 int
 main ()
@@ -1664,26 +2042,27 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1673: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1676: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1679: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1682: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_prog_cc_g=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:1692: result: $ac_cv_prog_cc_g" >&5
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -1700,6 +2079,102 @@ else
     CFLAGS=
   fi
 fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
 # Some people use a C++ compiler to compile C.  Since we use `exit',
 # in C++ we need to declare it.  In case someone uses the same compiler
 # for both compiling C and C++ we need to have the C++ compiler decide
@@ -1710,16 +2185,16 @@ cat >conftest.$ac_ext <<_ACEOF
 #endif
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1719: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1722: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1725: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1728: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   for ac_declaration in \
    ''\
@@ -1731,8 +2206,12 @@ if { (eval echo "$as_me:1719: \"$ac_compile\"") >&5
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line 1740 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <stdlib.h>
 $ac_declaration
 int
@@ -1744,27 +2223,32 @@ exit (42);
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1753: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1756: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1759: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1762: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   :
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 continue
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line 1772 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 $ac_declaration
 int
 main ()
@@ -1775,21 +2259,22 @@ exit (42);
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:1784: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:1787: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:1790: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:1793: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   break
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 done
@@ -1802,7 +2287,8 @@ fi
 
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 ac_ext=c
@@ -1811,12 +2297,13 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:1825: checking how to run the C preprocessor" >&5
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
@@ -1834,21 +2321,31 @@ for ac_c_preproc_warn_flag in '' yes
 do
   # Use a header file that comes with gcc, so configuring glibc
   # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1846 "configure"
-#include "confdefs.h"
-#include <assert.h>
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:1851: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1857: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1862,7 +2359,8 @@ if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
   # Broken: fails on valid input.
 continue
 fi
@@ -1871,17 +2369,21 @@ rm -f conftest.err conftest.$ac_ext
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1880 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:1884: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1890: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1896,7 +2398,8 @@ if test -z "$ac_cpp_err"; then
 continue
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
   # Passes both tests.
 ac_preproc_ok=:
 break
@@ -1918,28 +2421,38 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:1927: result: $CPP" >&5
+echo "$as_me:$LINENO: result: $CPP" >&5
 echo "${ECHO_T}$CPP" >&6
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
   # Use a header file that comes with gcc, so configuring glibc
   # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1937 "configure"
-#include "confdefs.h"
-#include <assert.h>
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
                      Syntax error
 _ACEOF
-if { (eval echo "$as_me:1942: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1948: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1953,7 +2466,8 @@ if test -z "$ac_cpp_err"; then
   :
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
   # Broken: fails on valid input.
 continue
 fi
@@ -1962,17 +2476,21 @@ rm -f conftest.err conftest.$ac_ext
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line 1971 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:1975: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:1981: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -1987,7 +2505,8 @@ if test -z "$ac_cpp_err"; then
 continue
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
   # Passes both tests.
 ac_preproc_ok=:
 break
@@ -2000,8 +2519,10 @@ rm -f conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:2009: error: C preprocessor \"$CPP\" fails sanity check" >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 fi
 
@@ -2011,190 +2532,543 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-echo "$as_me:2020: checking for minix/config.h" >&5
-echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6
-if test "${ac_cv_header_minix_config_h+set}" = set; then
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2026 "configure"
-#include "confdefs.h"
-#include <minix/config.h>
-_ACEOF
-if { (eval echo "$as_me:2030: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:2036: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_cv_header_minix_config_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_header_minix_config_h=no
-fi
-rm -f conftest.err conftest.$ac_ext
-fi
-echo "$as_me:2055: result: $ac_cv_header_minix_config_h" >&5
-echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6
-if test $ac_cv_header_minix_config_h = yes; then
-  MINIX=yes
-else
-  MINIX=
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
 fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
 
-if test "$MINIX" = yes; then
 
-cat >>confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 
-cat >>confdefs.h <<\EOF
-#define _POSIX_1_SOURCE 2
-EOF
+int
+main ()
+{
 
-cat >>confdefs.h <<\EOF
-#define _MINIX 1
-EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+ac_cv_header_stdc=no
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
 
-if test "x$cross_compiling" = "xyes"; then
-    case "${host}" in
-    *-cygwin*)
-       cross_cache=${srcdir}/cross-build/cygwin.cache
-       if test -r "${cross_cache}"; then
-           echo "loading cross-build cache file ${cross_cache}"
-           . ${cross_cache}
-       fi
-       LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
-       unset cross_cache
-       ;;
-    *)  echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
-       ;;
-    esac
-fi
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
 
-if test "x$cross_compiling" = "xyes"; then
-  CROSS_COMPILING_FLAG=-DCROSS_COMPILING
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
 else
-  CROSS_COMPILING_FLAG=
+  ac_cv_header_stdc=no
 fi
+rm -f conftest*
 
-if test -z "$CC_FOR_BUILD"; then
-    if test "x$cross_compiling" = "xno"; then
-        CC_FOR_BUILD='$(CC)'
-    else
-        CC_FOR_BUILD=gcc
-    fi
 fi
 
-# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
-test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
-
-if test $ac_cv_c_compiler_gnu = yes; then
-    echo "$as_me:2113: checking whether $CC needs -traditional" >&5
-echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
-if test "${ac_cv_prog_gcc_traditional+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-    ac_pattern="Autoconf.*'x'"
+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 <<_ACEOF
-#line 2120 "configure"
-#include "confdefs.h"
-#include <sgtty.h>
-Autoconf TIOCGETP
+#line $LINENO "configure"
+/* confdefs.h.  */
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "$ac_pattern" >/dev/null 2>&1; then
-  ac_cv_prog_gcc_traditional=yes
-else
-  ac_cv_prog_gcc_traditional=no
-fi
-rm -f conftest*
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
 
-  if test $ac_cv_prog_gcc_traditional = no; then
-    cat >conftest.$ac_ext <<_ACEOF
-#line 2135 "configure"
-#include "confdefs.h"
-#include <termio.h>
-Autoconf TCGETA
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "$ac_pattern" >/dev/null 2>&1; then
-  ac_cv_prog_gcc_traditional=yes
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
 fi
 rm -f conftest*
 
-  fi
-fi
-echo "$as_me:2148: result: $ac_cv_prog_gcc_traditional" >&5
-echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
-  if test $ac_cv_prog_gcc_traditional = yes; then
-    CC="$CC -traditional"
-  fi
 fi
 
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:2167: checking for a BSD compatible install" >&5
-echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                   (('a' <= (c) && (c) <= 'i') \
+                     || ('j' <= (c) && (c) <= 'r') \
+                     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+        || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-    ac_save_IFS=$IFS; IFS=$ac_path_separator
-  for ac_dir in $PATH; do
-    IFS=$ac_save_IFS
-    # Account for people who put trailing slashes in PATH elements.
-    case $ac_dir/ in
-    / | ./ | .// | /cC/* \
-    | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \
-    | /usr/ucb/* ) ;;
-    *)
-      # OSF1 and SCO ODT 3.0 have their own names for install.
-      # Don't use installbsd from OSF since it installs stuff as root
-      # by default.
-      for ac_prog in ginstall scoinst install; do
-        if $as_executable_p "$ac_dir/$ac_prog"; then
-         if test $ac_prog = install &&
-            grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           :
-         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
-         fi
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for minix/config.h" >&5
+echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking minix/config.h usability" >&5
+echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <minix/config.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking minix/config.h presence" >&5
+echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <minix/config.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for minix/config.h" >&5
+echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_minix_config_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6
+
+fi
+if test $ac_cv_header_minix_config_h = yes; then
+  MINIX=yes
+else
+  MINIX=
+fi
+
+
+if test "$MINIX" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_SOURCE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_1_SOURCE 2
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _MINIX 1
+_ACEOF
+
+fi
+
+
+
+if test "x$cross_compiling" = "xyes"; then
+    case "${host}" in
+    *-cygwin*)
+       cross_cache=${srcdir}/cross-build/cygwin.cache
+       if test -r "${cross_cache}"; then
+           echo "loading cross-build cache file ${cross_cache}"
+           . ${cross_cache}
        fi
-      done
-      ;;
+       LOCAL_CFLAGS="$LOCAL_CFLAGS -I${srcdir}/../libtermcap"
+       unset cross_cache
+       ;;
+    *)  echo "configure: cross-compiling for a non-cygwin target is not supported" >&2
+       ;;
     esac
-  done
+fi
+
+if test "x$cross_compiling" = "xyes"; then
+  CROSS_COMPILING_FLAG=-DCROSS_COMPILING
+else
+  CROSS_COMPILING_FLAG=
+fi
+
+
+if test -z "$CC_FOR_BUILD"; then
+    if test "x$cross_compiling" = "xno"; then
+        CC_FOR_BUILD='$(CC)'
+    else
+        CC_FOR_BUILD=gcc
+    fi
+fi
+
+
+
+# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
+test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+
+if test $ac_cv_c_compiler_gnu = yes; then
+    echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    ac_pattern="Autoconf.*'x'"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  ac_cv_prog_gcc_traditional=yes
+else
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
+  if test $ac_cv_prog_gcc_traditional = yes; then
+    CC="$CC -traditional"
+  fi
+fi
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+          if test $ac_prog = install &&
+            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+            # AIX install.  It has an incompatible calling convention.
+            :
+          elif test $ac_prog = install &&
+            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+            # program-specific install script used by HP pwplus--don't use.
+            :
+          else
+            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+            break 3
+          fi
+        fi
+      done
+    done
+    ;;
+esac
+done
+
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
@@ -2207,7 +3081,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:2216: result: $INSTALL" >&5
+echo "$as_me:$LINENO: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -2220,7 +3094,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-echo "$as_me:2229: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2228,15 +3102,18 @@ else
   if test -n "$AR"; then
   ac_cv_prog_AR="$AR" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_AR=""
-echo "$as_me:2244: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR=""
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
   test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
@@ -2244,10 +3121,10 @@ fi
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  echo "$as_me:2253: result: $AR" >&5
+  echo "$as_me:$LINENO: result: $AR" >&5
 echo "${ECHO_T}$AR" >&6
 else
-  echo "$as_me:2256: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2255,7 +3132,7 @@ test -n "$ARFLAGS" || ARFLAGS="cr"
 if test -n "$ac_tool_prefix"; then
   # 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 "$as_me:2264: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2263,25 +3140,28 @@ else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-echo "$as_me:2279: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
 fi
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  echo "$as_me:2287: result: $RANLIB" >&5
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
 echo "${ECHO_T}$RANLIB" >&6
 else
-  echo "$as_me:2290: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2290,7 +3170,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-echo "$as_me:2299: checking for $ac_word" >&5
+echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2298,15 +3178,18 @@ else
   if test -n "$ac_ct_RANLIB"; then
   ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
 else
-  ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="$PATH"
-for ac_dir in $ac_dummy; do
-  IFS=$ac_save_IFS
-  test -z "$ac_dir" && ac_dir=.
-  $as_executable_p "$ac_dir/$ac_word" || continue
-ac_cv_prog_ac_ct_RANLIB="ranlib"
-echo "$as_me:2314: found $ac_dir/$ac_word" >&5
-break
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
 done
 
   test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
@@ -2314,10 +3197,10 @@ fi
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  echo "$as_me:2323: result: $ac_ct_RANLIB" >&5
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
 echo "${ECHO_T}$ac_ct_RANLIB" >&6
 else
-  echo "$as_me:2326: result: no" >&5
+  echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -2326,107 +3209,22 @@ else
   RANLIB="$ac_cv_prog_RANLIB"
 fi
 
-MAKE_SHELL=/bin/sh
-
-echo "$as_me:2337: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-#line 2345 "configure"
-#include "confdefs.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX                  -qlanglvl=ansi
-# Ultrix and OSF/1     -std1
-# HP-UX 10.20 and later        -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4                 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2394: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:2397: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2400: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:2403: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
-else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
 
-fi
+MAKE_SHELL=/bin/sh
 
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:2420: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
-  *)
-    echo "$as_me:2423: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
 
-echo "$as_me:2428: checking for an ANSI C-conforming const" >&5
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
 if test "${ac_cv_c_const+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2434 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 int
 main ()
@@ -2483,289 +3281,123 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2492: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2495: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2498: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2501: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_const=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_c_const=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:2511: result: $ac_cv_c_const" >&5
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
 echo "${ECHO_T}$ac_cv_c_const" >&6
 if test $ac_cv_c_const = no; then
 
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define const
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:2521: checking for function prototypes" >&5
+echo "$as_me:$LINENO: checking for function prototypes" >&5
 echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6
 if test "$ac_cv_prog_cc_stdc" != no; then
-  echo "$as_me:2524: result: yes" >&5
+  echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
 
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define PROTOTYPES 1
-EOF
-
-else
-  echo "$as_me:2532: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-echo "$as_me:2536: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2542 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-_ACEOF
-if { (eval echo "$as_me:2550: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
-  ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:2556: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_cv_header_stdc=yes
-else
-  echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_header_stdc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2578 "configure"
-#include "confdefs.h"
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2596 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2617 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
 
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
-}
+cat >>confdefs.h <<\_ACEOF
+#define __PROTOTYPES 1
 _ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:2643: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:2646: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:2648: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:2651: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_header_stdc=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-fi
-echo "$as_me:2664: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
 
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:2680: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 2686 "configure"
-#include "confdefs.h"
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2692: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:2695: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2698: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:2701: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-echo "$as_me:2711: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
 
-fi
-done
 
-echo "$as_me:2721: checking whether char is unsigned" >&5
+echo "$as_me:$LINENO: checking whether char is unsigned" >&5
 echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6
 if test "${ac_cv_c_char_unsigned+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2727 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 $ac_includes_default
 int
 main ()
 {
-int _array_ [1 - 2 * !(((char) -1) < 0)]
+static int test_array [1 - 2 * !(((char) -1) < 0)];
+test_array [0] = 0
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2739: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2742: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2745: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2748: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_char_unsigned=no
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_c_char_unsigned=yes
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:2758: result: $ac_cv_c_char_unsigned" >&5
+echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
 echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6
 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
-  cat >>confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define __CHAR_UNSIGNED__ 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:2767: checking return type of signal handlers" >&5
+
+echo "$as_me:$LINENO: checking return type of signal handlers" >&5
 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
 if test "${ac_cv_type_signal+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2773 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <signal.h>
 #ifdef signal
@@ -2786,40 +3418,47 @@ int i;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2795: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2798: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2801: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2804: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_signal=void
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_type_signal=int
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:2814: result: $ac_cv_type_signal" >&5
+echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
 echo "${ECHO_T}$ac_cv_type_signal" >&6
 
-cat >>confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
-EOF
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
 
-echo "$as_me:2821: checking for size_t" >&5
+echo "$as_me:$LINENO: checking for size_t" >&5
 echo $ECHO_N "checking for size_t... $ECHO_C" >&6
 if test "${ac_cv_type_size_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2827 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 $ac_includes_default
 int
 main ()
@@ -2833,45 +3472,50 @@ if (sizeof (size_t))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2842: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2845: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2848: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2851: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_size_t=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_type_size_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:2861: result: $ac_cv_type_size_t" >&5
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
 echo "${ECHO_T}$ac_cv_type_size_t" >&6
 if test $ac_cv_type_size_t = yes; then
   :
 else
 
-cat >>confdefs.h <<EOF
+cat >>confdefs.h <<_ACEOF
 #define size_t unsigned
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:2873: checking for ssize_t" >&5
+echo "$as_me:$LINENO: checking for ssize_t" >&5
 echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6
 if test "${ac_cv_type_ssize_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2879 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 $ac_includes_default
 int
 main ()
@@ -2885,45 +3529,51 @@ if (sizeof (ssize_t))
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:2894: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:2897: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:2900: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:2903: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_ssize_t=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_type_ssize_t=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:2913: result: $ac_cv_type_ssize_t" >&5
+echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
 echo "${ECHO_T}$ac_cv_type_ssize_t" >&6
 if test $ac_cv_type_ssize_t = yes; then
   :
 else
 
-cat >>confdefs.h <<EOF
+cat >>confdefs.h <<_ACEOF
 #define ssize_t int
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:2925: checking whether stat file-mode macros are broken" >&5
+
+echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5
 echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6
 if test "${ac_cv_header_stat_broken+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2931 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -2953,7 +3603,7 @@ You lose.
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "You lose" >/dev/null 2>&1; then
+  $EGREP "You lose" >/dev/null 2>&1; then
   ac_cv_header_stat_broken=yes
 else
   ac_cv_header_stat_broken=no
@@ -2961,27 +3611,36 @@ fi
 rm -f conftest*
 
 fi
-echo "$as_me:2970: result: $ac_cv_header_stat_broken" >&5
+echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5
 echo "${ECHO_T}$ac_cv_header_stat_broken" >&6
 if test $ac_cv_header_stat_broken = yes; then
 
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define STAT_MACROS_BROKEN 1
-EOF
+_ACEOF
 
 fi
 
+
+
+
+
+
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-echo "$as_me:2983: checking for $ac_hdr that defines DIR" >&5
+echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 2989 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <$ac_hdr>
 
@@ -2995,31 +3654,32 @@ return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3004: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3007: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3010: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3013: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 eval "$as_ac_Header=no"
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:3023: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-EOF
+_ACEOF
 
 ac_header_dirent=$ac_hdr; break
 fi
@@ -3027,16 +3687,20 @@ fi
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  echo "$as_me:3036: checking for opendir in -ldir" >&5
-echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6
-if test "${ac_cv_lib_dir_opendir+set}" = set; then
+  echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldir  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
-#line 3044 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -3054,43 +3718,96 @@ opendir ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3063: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3066: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3069: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3072: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_dir_opendir=yes
+  ac_cv_search_opendir="none required"
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_lib_dir_opendir=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+if test "$ac_cv_search_opendir" = no; then
+  for ac_lib in dir; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char opendir ();
+int
+main ()
+{
+opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_opendir="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+  done
 fi
-echo "$as_me:3083: result: $ac_cv_lib_dir_opendir" >&5
-echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6
-if test $ac_cv_lib_dir_opendir = yes; then
-  LIBS="$LIBS -ldir"
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
 fi
 
 else
-  echo "$as_me:3090: checking for opendir in -lx" >&5
-echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6
-if test "${ac_cv_lib_x_opendir+set}" = set; then
+  echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+if test "${ac_cv_search_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lx  $LIBS"
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
-#line 3098 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -3108,105 +3825,182 @@ opendir ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3117: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3120: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3123: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3126: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_x_opendir=yes
+  ac_cv_search_opendir="none required"
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_lib_x_opendir=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+if test "$ac_cv_search_opendir" = no; then
+  for ac_lib in x; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char opendir ();
+int
+main ()
+{
+opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_opendir="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:3137: result: $ac_cv_lib_x_opendir" >&5
-echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6
-if test $ac_cv_lib_x_opendir = yes; then
-  LIBS="$LIBS -lx"
+echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6
+if test "$ac_cv_search_opendir" != no; then
+  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+
 fi
 
 fi
 
+
+
+
+
+
+
+
+
+
+
+
+
+
 for ac_func in lstat memmove putenv select setenv setlocale \
                strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:3149: checking for $ac_func" >&5
+echo "$as_me:$LINENO: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3155 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.  */
-#include <assert.h>
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
+{
 #endif
 /* 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 ()
-{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-f = $ac_func;
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
 #endif
 
+int
+main ()
+{
+return f != $ac_func;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3186: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3189: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3192: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3195: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 eval "$as_ac_var=no"
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:3205: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
 if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-EOF
+_ACEOF
 
 fi
 done
 
-echo "$as_me:3215: checking for working strcoll" >&5
+
+echo "$as_me:$LINENO: checking for working strcoll" >&5
 echo $ECHO_N "checking for working strcoll... $ECHO_C" >&6
 if test "${ac_cv_func_strcoll_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3215,8 +4009,12 @@ else
   ac_cv_func_strcoll_works=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3224 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 $ac_includes_default
 int
 main ()
@@ -3229,58 +4027,125 @@ exit (strcoll ("abc", "def") >= 0 ||
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:3238: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3241: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:3243: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3246: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_strcoll_works=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
 ac_cv_func_strcoll_works=no
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:3258: result: $ac_cv_func_strcoll_works" >&5
+echo "$as_me:$LINENO: result: $ac_cv_func_strcoll_works" >&5
 echo "${ECHO_T}$ac_cv_func_strcoll_works" >&6
 if test $ac_cv_func_strcoll_works = yes; then
 
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRCOLL 1
-EOF
+_ACEOF
 
 fi
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 for ac_header in unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
                limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
                termcap.h termios.h termio.h sys/file.h locale.h memory.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:3273: checking for $ac_header" >&5
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 3279 "configure"
-#include "confdefs.h"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:3283: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:3289: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -3291,33 +4156,85 @@ else
   ac_cpp_err=yes
 fi
 if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
+  ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
 fi
 rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=$ac_header_preproc"
 fi
-echo "$as_me:3308: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
+_ACEOF
 
 fi
+
 done
 
-echo "$as_me:3318: checking for type of signal functions" >&5
+
+
+echo "$as_me:$LINENO: checking for type of signal functions" >&5
 echo $ECHO_N "checking for type of signal functions... $ECHO_C" >&6
 if test "${bash_cv_signal_vintage+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
   cat >conftest.$ac_ext <<_ACEOF
-#line 3325 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <signal.h>
 int
 main ()
@@ -3334,25 +4251,30 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3343: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3346: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3349: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3352: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_signal_vintage=posix
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 
     cat >conftest.$ac_ext <<_ACEOF
-#line 3360 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <signal.h>
 int
 main ()
@@ -3366,25 +4288,30 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3375: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3378: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3381: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3384: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_signal_vintage=4.2bsd
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 
       cat >conftest.$ac_ext <<_ACEOF
-#line 3392 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
        #include <signal.h>
        RETSIGTYPE foo() { }
@@ -3401,21 +4328,22 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3410: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3413: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3416: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3419: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_signal_vintage=svr3
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_signal_vintage=v7
 
 fi
@@ -3429,39 +4357,45 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
 
-echo "$as_me:3438: result: $bash_cv_signal_vintage" >&5
+echo "$as_me:$LINENO: result: $bash_cv_signal_vintage" >&5
 echo "${ECHO_T}$bash_cv_signal_vintage" >&6
 if test "$bash_cv_signal_vintage" = posix; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_POSIX_SIGNALS 1
-EOF
+_ACEOF
 
 elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_BSD_SIGNALS 1
-EOF
+_ACEOF
 
 elif test "$bash_cv_signal_vintage" = svr3; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_USG_SIGHOLD 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:3457: checking if signal handlers must be reinstalled when invoked" >&5
+
+
+echo "$as_me:$LINENO: checking if signal handlers must be reinstalled when invoked" >&5
 echo $ECHO_N "checking if signal handlers must be reinstalled when invoked... $ECHO_C" >&6
 if test "${bash_cv_must_reinstall_sighandlers+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-  { echo "$as_me:3463: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5
+  { echo "$as_me:$LINENO: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5
 echo "$as_me: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&2;}
     bash_cv_must_reinstall_sighandlers=no
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3469 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <signal.h>
 #ifdef HAVE_UNISTD_H
@@ -3508,50 +4442,58 @@ main()
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:3517: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3520: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:3522: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3525: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_must_reinstall_sighandlers=no
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
 bash_cv_must_reinstall_sighandlers=yes
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 
-echo "$as_me:3538: result: $bash_cv_must_reinstall_sighandlers" >&5
+echo "$as_me:$LINENO: result: $bash_cv_must_reinstall_sighandlers" >&5
 echo "${ECHO_T}$bash_cv_must_reinstall_sighandlers" >&6
 if test $bash_cv_must_reinstall_sighandlers = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define MUST_REINSTALL_SIGHANDLERS 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:3547: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
+
+
+echo "$as_me:$LINENO: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
 echo $ECHO_N "checking for presence of POSIX-style sigsetjmp/siglongjmp... $ECHO_C" >&6
 if test "${bash_cv_func_sigsetjmp+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-  { echo "$as_me:3553: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5
+  { echo "$as_me:$LINENO: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5
 echo "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&2;}
      bash_cv_func_sigsetjmp=missing
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3559 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -3592,44 +4534,50 @@ exit(1);
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:3601: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3604: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:3606: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3609: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_func_sigsetjmp=present
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
 bash_cv_func_sigsetjmp=missing
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 
-echo "$as_me:3622: result: $bash_cv_func_sigsetjmp" >&5
+echo "$as_me:$LINENO: result: $bash_cv_func_sigsetjmp" >&5
 echo "${ECHO_T}$bash_cv_func_sigsetjmp" >&6
 if test $bash_cv_func_sigsetjmp = present; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_POSIX_SIGSETJMP 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:3631: checking for lstat" >&5
+echo "$as_me:$LINENO: checking for lstat" >&5
 echo $ECHO_N "checking for lstat... $ECHO_C" >&6
 if test "${bash_cv_func_lstat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3637 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3643,48 +4591,54 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3652: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3655: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3658: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3661: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_func_lstat=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_func_lstat=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:3671: result: $bash_cv_func_lstat" >&5
+echo "$as_me:$LINENO: result: $bash_cv_func_lstat" >&5
 echo "${ECHO_T}$bash_cv_func_lstat" >&6
 if test $bash_cv_func_lstat = yes; then
-  cat >>confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_LSTAT 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:3680: checking whether or not strcoll and strcmp differ" >&5
+
+echo "$as_me:$LINENO: checking whether or not strcoll and strcmp differ" >&5
 echo $ECHO_N "checking whether or not strcoll and strcmp differ... $ECHO_C" >&6
 if test "${bash_cv_func_strcoll_broken+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-  { echo "$as_me:3686: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5
+  { echo "$as_me:$LINENO: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5
 echo "$as_me: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&2;}
     bash_cv_func_strcoll_broken=no
 
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3692 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <stdio.h>
 #if defined (HAVE_LOCALE_H)
@@ -3723,123 +4677,91 @@ char    *v[];
 
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:3732: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:3735: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:3737: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3740: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_func_strcoll_broken=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
 bash_cv_func_strcoll_broken=no
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 
-echo "$as_me:3753: result: $bash_cv_func_strcoll_broken" >&5
+echo "$as_me:$LINENO: result: $bash_cv_func_strcoll_broken" >&5
 echo "${ECHO_T}$bash_cv_func_strcoll_broken" >&6
 if test $bash_cv_func_strcoll_broken = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define STRCOLL_BROKEN 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:3762: checking whether getpw functions are declared in pwd.h" >&5
+
+echo "$as_me:$LINENO: checking whether getpw functions are declared in pwd.h" >&5
 echo $ECHO_N "checking whether getpw functions are declared in pwd.h... $ECHO_C" >&6
 if test "${bash_cv_getpw_declared+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3768 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
-#endif
-#include <pwd.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "getpwuid" >/dev/null 2>&1; then
-  bash_cv_getpw_declared=yes
-else
-  bash_cv_getpw_declared=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$as_me:3788: result: $bash_cv_getpw_declared" >&5
-echo "${ECHO_T}$bash_cv_getpw_declared" >&6
-if test $bash_cv_getpw_declared = yes; then
-cat >>confdefs.h <<\EOF
-#define HAVE_GETPW_DECLS 1
-EOF
-
-fi
-
-echo "$as_me:3797: checking POSIX termios" >&5
-echo $ECHO_N "checking POSIX termios... $ECHO_C" >&6
-if test "${ac_cv_sys_posix_termios+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 3803 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <unistd.h>
-#include <termios.h>
-int
-main ()
-{
-/* SunOS 4.0.3 has termios.h but not the library calls.  */
-   tcgetattr(0, 0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:3818: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:3821: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:3824: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:3827: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sys_posix_termios=yes
+#endif
+#include <pwd.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "getpwuid" >/dev/null 2>&1; then
+  bash_cv_getpw_declared=yes
 else
-  echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-ac_cv_sys_posix_termios=no
+  bash_cv_getpw_declared=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest*
+
+fi
+
+echo "$as_me:$LINENO: result: $bash_cv_getpw_declared" >&5
+echo "${ECHO_T}$bash_cv_getpw_declared" >&6
+if test $bash_cv_getpw_declared = yes; then
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETPW_DECLS 1
+_ACEOF
+
 fi
-echo "$as_me:3837: result: $ac_cv_sys_posix_termios" >&5
-echo "${ECHO_T}$ac_cv_sys_posix_termios" >&6
 
-if test $ac_cv_sys_posix_termios = yes; then
-  echo "$as_me:3841: checking whether termios.h defines TIOCGWINSZ" >&5
+
+echo "$as_me:$LINENO: checking whether termios.h defines TIOCGWINSZ" >&5
 echo $ECHO_N "checking whether termios.h defines TIOCGWINSZ... $ECHO_C" >&6
 if test "${ac_cv_sys_tiocgwinsz_in_termios_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3847 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <termios.h>
 #ifdef TIOCGWINSZ
@@ -3848,7 +4770,7 @@ else
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "yes" >/dev/null 2>&1; then
+  $EGREP "yes" >/dev/null 2>&1; then
   ac_cv_sys_tiocgwinsz_in_termios_h=yes
 else
   ac_cv_sys_tiocgwinsz_in_termios_h=no
@@ -3856,19 +4778,22 @@ fi
 rm -f conftest*
 
 fi
-echo "$as_me:3865: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5
+echo "$as_me:$LINENO: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5
 echo "${ECHO_T}$ac_cv_sys_tiocgwinsz_in_termios_h" >&6
 
-fi
 if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
-  echo "$as_me:3870: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5
+  echo "$as_me:$LINENO: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5
 echo $ECHO_N "checking whether sys/ioctl.h defines TIOCGWINSZ... $ECHO_C" >&6
 if test "${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3876 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #ifdef TIOCGWINSZ
@@ -3877,7 +4802,7 @@ else
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "yes" >/dev/null 2>&1; then
+  $EGREP "yes" >/dev/null 2>&1; then
   ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes
 else
   ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no
@@ -3885,26 +4810,31 @@ fi
 rm -f conftest*
 
 fi
-echo "$as_me:3894: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
+echo "$as_me:$LINENO: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
 echo "${ECHO_T}$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6
 
   if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
 
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define GWINSZ_IN_SYS_IOCTL 1
-EOF
+_ACEOF
 
   fi
 fi
 
-echo "$as_me:3906: checking whether signal handlers are of type void" >&5
+
+echo "$as_me:$LINENO: checking whether signal handlers are of type void" >&5
 echo $ECHO_N "checking whether signal handlers are of type void... $ECHO_C" >&6
 if test "${bash_cv_void_sighandler+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3912 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <signal.h>
 #ifdef signal
@@ -3923,42 +4853,47 @@ int i;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3932: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3935: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3938: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3941: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_void_sighandler=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_void_sighandler=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:3951: result: $bash_cv_void_sighandler" >&5
+echo "$as_me:$LINENO: result: $bash_cv_void_sighandler" >&5
 echo "${ECHO_T}$bash_cv_void_sighandler" >&6
 if test $bash_cv_void_sighandler = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define VOID_SIGHANDLER 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:3960: checking for TIOCSTAT in sys/ioctl.h" >&5
+echo "$as_me:$LINENO: checking for TIOCSTAT in sys/ioctl.h" >&5
 echo $ECHO_N "checking for TIOCSTAT in sys/ioctl.h... $ECHO_C" >&6
 if test "${bash_cv_tiocstat_in_ioctl+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 3966 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/ioctl.h>
 int
@@ -3970,43 +4905,48 @@ int x = TIOCSTAT;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:3979: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:3982: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:3985: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:3988: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_tiocstat_in_ioctl=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_tiocstat_in_ioctl=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-echo "$as_me:3999: result: $bash_cv_tiocstat_in_ioctl" >&5
+echo "$as_me:$LINENO: result: $bash_cv_tiocstat_in_ioctl" >&5
 echo "${ECHO_T}$bash_cv_tiocstat_in_ioctl" >&6
 if test $bash_cv_tiocstat_in_ioctl = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define TIOCSTAT_IN_SYS_IOCTL 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:4008: checking for FIONREAD in sys/ioctl.h" >&5
+echo "$as_me:$LINENO: checking for FIONREAD in sys/ioctl.h" >&5
 echo $ECHO_N "checking for FIONREAD in sys/ioctl.h... $ECHO_C" >&6
 if test "${bash_cv_fionread_in_ioctl+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4014 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/ioctl.h>
 int
@@ -4018,43 +4958,48 @@ int x = FIONREAD;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4027: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4030: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4033: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4036: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_fionread_in_ioctl=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_fionread_in_ioctl=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-echo "$as_me:4047: result: $bash_cv_fionread_in_ioctl" >&5
+echo "$as_me:$LINENO: result: $bash_cv_fionread_in_ioctl" >&5
 echo "${ECHO_T}$bash_cv_fionread_in_ioctl" >&6
 if test $bash_cv_fionread_in_ioctl = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define FIONREAD_IN_SYS_IOCTL 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:4056: checking for speed_t in sys/types.h" >&5
+echo "$as_me:$LINENO: checking for speed_t in sys/types.h" >&5
 echo $ECHO_N "checking for speed_t in sys/types.h... $ECHO_C" >&6
 if test "${bash_cv_speed_t_in_sys_types+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4062 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 int
 main ()
@@ -4065,43 +5010,48 @@ speed_t x;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4074: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4077: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4080: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4083: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_speed_t_in_sys_types=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_speed_t_in_sys_types=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-echo "$as_me:4094: result: $bash_cv_speed_t_in_sys_types" >&5
+echo "$as_me:$LINENO: result: $bash_cv_speed_t_in_sys_types" >&5
 echo "${ECHO_T}$bash_cv_speed_t_in_sys_types" >&6
 if test $bash_cv_speed_t_in_sys_types = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define SPEED_T_IN_SYS_TYPES 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:4103: checking for struct winsize in sys/ioctl.h and termios.h" >&5
+echo "$as_me:$LINENO: checking for struct winsize in sys/ioctl.h and termios.h" >&5
 echo $ECHO_N "checking for struct winsize in sys/ioctl.h and termios.h... $ECHO_C" >&6
 if test "${bash_cv_struct_winsize_header+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4109 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/ioctl.h>
 int
@@ -4113,24 +5063,29 @@ struct winsize x;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4122: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4125: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4128: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4131: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_struct_winsize_header=ioctl_h
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 cat >conftest.$ac_ext <<_ACEOF
-#line 4138 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <sys/types.h>
 #include <termios.h>
 int
@@ -4142,21 +5097,22 @@ struct winsize x;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4151: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4154: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4157: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4160: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_struct_winsize_header=termios_h
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_struct_winsize_header=other
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
@@ -4166,32 +5122,37 @@ rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
 if test $bash_cv_struct_winsize_header = ioctl_h; then
-  echo "$as_me:4175: result: sys/ioctl.h" >&5
+  echo "$as_me:$LINENO: result: sys/ioctl.h" >&5
 echo "${ECHO_T}sys/ioctl.h" >&6
-  cat >>confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define STRUCT_WINSIZE_IN_SYS_IOCTL 1
-EOF
+_ACEOF
 
 elif test $bash_cv_struct_winsize_header = termios_h; then
-  echo "$as_me:4182: result: termios.h" >&5
+  echo "$as_me:$LINENO: result: termios.h" >&5
 echo "${ECHO_T}termios.h" >&6
-  cat >>confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define STRUCT_WINSIZE_IN_TERMIOS 1
-EOF
+_ACEOF
 
 else
-  echo "$as_me:4189: result: not found" >&5
+  echo "$as_me:$LINENO: result: not found" >&5
 echo "${ECHO_T}not found" >&6
 fi
 
-echo "$as_me:4193: checking if struct dirent has a d_ino member" >&5
+
+echo "$as_me:$LINENO: checking if struct dirent has a d_ino member" >&5
 echo $ECHO_N "checking if struct dirent has a d_ino member... $ECHO_C" >&6
 if test "${bash_cv_dirent_has_dino+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4199 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -4224,43 +5185,49 @@ struct dirent d; int z; z = d.d_ino;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4233: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4236: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4239: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4242: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_dirent_has_dino=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_dirent_has_dino=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-echo "$as_me:4253: result: $bash_cv_dirent_has_dino" >&5
+echo "$as_me:$LINENO: result: $bash_cv_dirent_has_dino" >&5
 echo "${ECHO_T}$bash_cv_dirent_has_dino" >&6
 if test $bash_cv_dirent_has_dino = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define STRUCT_DIRENT_HAS_D_INO 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:4262: checking if struct dirent has a d_fileno member" >&5
+
+echo "$as_me:$LINENO: checking if struct dirent has a d_fileno member" >&5
 echo $ECHO_N "checking if struct dirent has a d_fileno member... $ECHO_C" >&6
 if test "${bash_cv_dirent_has_d_fileno+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4268 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -4293,35 +5260,37 @@ struct dirent d; int z; z = d.d_fileno;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:4302: \"$ac_compile\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:4305: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:4308: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4311: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_dirent_has_d_fileno=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_dirent_has_d_fileno=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 fi
 
-echo "$as_me:4322: result: $bash_cv_dirent_has_d_fileno" >&5
+echo "$as_me:$LINENO: result: $bash_cv_dirent_has_d_fileno" >&5
 echo "${ECHO_T}$bash_cv_dirent_has_d_fileno" >&6
 if test $bash_cv_dirent_has_d_fileno = yes; then
-cat >>confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define STRUCT_DIRENT_HAS_D_FILENO 1
-EOF
+_ACEOF
 
 fi
 
+
 case "$host_os" in
 aix*)   prefer_curses=yes ;;
 esac
@@ -4329,14 +5298,14 @@ esac
 if test "X$bash_cv_termcap_lib" = "X"; then
 _bash_needmsg=yes
 else
-echo "$as_me:4338: checking which library has the termcap functions" >&5
+echo "$as_me:$LINENO: checking which library has the termcap functions" >&5
 echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6
 _bash_needmsg=
 fi
 if test "${bash_cv_termcap_lib+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me:4345: checking for tgetent in -ltermcap" >&5
+  echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
 echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6
 if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4344,8 +5313,12 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermcap  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4353 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -4363,32 +5336,33 @@ tgetent ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4372: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4375: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4378: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4381: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_termcap_tgetent=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_lib_termcap_tgetent=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4392: result: $ac_cv_lib_termcap_tgetent" >&5
+echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
 echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6
 if test $ac_cv_lib_termcap_tgetent = yes; then
   bash_cv_termcap_lib=libtermcap
 else
-  echo "$as_me:4397: checking for tgetent in -ltinfo" >&5
+  echo "$as_me:$LINENO: checking for tgetent in -ltinfo" >&5
 echo $ECHO_N "checking for tgetent in -ltinfo... $ECHO_C" >&6
 if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4396,8 +5370,12 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltinfo  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4405 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -4415,32 +5393,33 @@ tgetent ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4424: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4427: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4430: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4433: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_tinfo_tgetent=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_lib_tinfo_tgetent=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4444: result: $ac_cv_lib_tinfo_tgetent" >&5
+echo "$as_me:$LINENO: result: $ac_cv_lib_tinfo_tgetent" >&5
 echo "${ECHO_T}$ac_cv_lib_tinfo_tgetent" >&6
 if test $ac_cv_lib_tinfo_tgetent = yes; then
   bash_cv_termcap_lib=libtinfo
 else
-  echo "$as_me:4449: checking for tgetent in -lcurses" >&5
+  echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
 echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6
 if test "${ac_cv_lib_curses_tgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4448,8 +5427,12 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4457 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -4467,32 +5450,33 @@ tgetent ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4476: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4479: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4482: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4485: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_curses_tgetent=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_lib_curses_tgetent=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4496: result: $ac_cv_lib_curses_tgetent" >&5
+echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5
 echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6
 if test $ac_cv_lib_curses_tgetent = yes; then
   bash_cv_termcap_lib=libcurses
 else
-  echo "$as_me:4501: checking for tgetent in -lncurses" >&5
+  echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
 echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6
 if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4500,8 +5484,12 @@ else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lncurses  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line 4509 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
@@ -4519,27 +5507,28 @@ tgetent ();
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4528: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4531: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4534: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4537: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_lib_ncurses_tgetent=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_lib_ncurses_tgetent=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:4548: result: $ac_cv_lib_ncurses_tgetent" >&5
+echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5
 echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6
 if test $ac_cv_lib_ncurses_tgetent = yes; then
   bash_cv_termcap_lib=libncurses
@@ -4556,10 +5545,10 @@ fi
 fi
 
 if test "X$_bash_needmsg" = "Xyes"; then
-echo "$as_me:4565: checking which library has the termcap functions" >&5
+echo "$as_me:$LINENO: checking which library has the termcap functions" >&5
 echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6
 fi
-echo "$as_me:4568: result: using $bash_cv_termcap_lib" >&5
+echo "$as_me:$LINENO: result: using $bash_cv_termcap_lib" >&5
 echo "${ECHO_T}using $bash_cv_termcap_lib" >&6
 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
 LDFLAGS="$LDFLAGS -L./lib/termcap"
@@ -4587,26 +5576,75 @@ if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
        fi
 fi
 
+
+
 for ac_header in wctype.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:4599: checking for $ac_header" >&5
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 4605 "configure"
-#include "confdefs.h"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:4609: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4615: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4617,44 +5655,138 @@ else
   ac_cpp_err=yes
 fi
 if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
+  ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
 fi
 rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=$ac_header_preproc"
 fi
-echo "$as_me:4634: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
+_ACEOF
 
 fi
+
 done
 
+
 for ac_header in wchar.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:4647: checking for $ac_header" >&5
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 4653 "configure"
-#include "confdefs.h"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:4657: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4663: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4665,44 +5797,138 @@ else
   ac_cpp_err=yes
 fi
 if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
+  ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
 fi
 rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=$ac_header_preproc"
 fi
-echo "$as_me:4682: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
+_ACEOF
 
 fi
+
 done
 
+
 for ac_header in langinfo.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:4695: checking for $ac_header" >&5
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line 4701 "configure"
-#include "confdefs.h"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:4705: \"$ac_cpp conftest.$ac_ext\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
   ac_status=$?
-  egrep -v '^ *\+' conftest.er1 >conftest.err
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
-  echo "$as_me:4711: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
@@ -4713,167 +5939,335 @@ else
   ac_cpp_err=yes
 fi
 if test -z "$ac_cpp_err"; then
-  eval "$as_ac_Header=yes"
+  ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  eval "$as_ac_Header=no"
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
 fi
 rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=$ac_header_preproc"
 fi
-echo "$as_me:4730: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-EOF
+_ACEOF
 
 fi
+
 done
 
-echo "$as_me:4740: checking for mbsrtowcs" >&5
-echo $ECHO_N "checking for mbsrtowcs... $ECHO_C" >&6
-if test "${ac_cv_func_mbsrtowcs+set}" = set; then
+
+echo "$as_me:$LINENO: checking for mbrtowc" >&5
+echo $ECHO_N "checking for mbrtowc... $ECHO_C" >&6
+if test "${ac_cv_func_mbrtowc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4746 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char mbsrtowcs (); below.  */
-#include <assert.h>
+    which can conflict with char mbrtowc (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
+{
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char mbsrtowcs ();
-char (*f) ();
+char mbrtowc ();
+/* 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_mbrtowc) || defined (__stub___mbrtowc)
+choke me
+#else
+char (*f) () = mbrtowc;
+#endif
+#ifdef __cplusplus
+}
+#endif
 
 int
 main ()
 {
+return f != mbrtowc;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_mbrtowc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_mbrtowc=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5
+echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6
+if test $ac_cv_func_mbrtowc = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_MBRTOWC 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for mbsrtowcs" >&5
+echo $ECHO_N "checking for mbsrtowcs... $ECHO_C" >&6
+if test "${ac_cv_func_mbsrtowcs+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char mbsrtowcs (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char mbsrtowcs ();
 /* 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_mbsrtowcs) || defined (__stub___mbsrtowcs)
 choke me
 #else
-f = mbsrtowcs;
+char (*f) () = mbsrtowcs;
+#endif
+#ifdef __cplusplus
+}
 #endif
 
+int
+main ()
+{
+return f != mbsrtowcs;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4777: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4780: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4783: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4786: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_mbsrtowcs=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_func_mbsrtowcs=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:4796: result: $ac_cv_func_mbsrtowcs" >&5
+echo "$as_me:$LINENO: result: $ac_cv_func_mbsrtowcs" >&5
 echo "${ECHO_T}$ac_cv_func_mbsrtowcs" >&6
 if test $ac_cv_func_mbsrtowcs = yes; then
-  cat >>confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_MBSRTOWCS 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:4805: checking for wcwidth" >&5
+echo "$as_me:$LINENO: checking for wcwidth" >&5
 echo $ECHO_N "checking for wcwidth... $ECHO_C" >&6
 if test "${ac_cv_func_wcwidth+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4811 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char wcwidth (); below.  */
-#include <assert.h>
+    which can conflict with char wcwidth (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
+{
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
 char wcwidth ();
-char (*f) ();
-
-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_wcwidth) || defined (__stub___wcwidth)
 choke me
 #else
-f = wcwidth;
+char (*f) () = wcwidth;
+#endif
+#ifdef __cplusplus
+}
 #endif
 
+int
+main ()
+{
+return f != wcwidth;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4842: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4845: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4848: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4851: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_wcwidth=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 ac_cv_func_wcwidth=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:4861: result: $ac_cv_func_wcwidth" >&5
+echo "$as_me:$LINENO: result: $ac_cv_func_wcwidth" >&5
 echo "${ECHO_T}$ac_cv_func_wcwidth" >&6
 if test $ac_cv_func_wcwidth = yes; then
-  cat >>confdefs.h <<\EOF
+  have_wcwidth=yes
+fi
+
+if test "$have_wcwidth" = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_WCWIDTH 1
-EOF
+_ACEOF
+
+
+else
+  WCWIDTH_OBJ=wcwidth.o
 
 fi
 
-echo "$as_me:4870: checking for mbstate_t" >&5
+echo "$as_me:$LINENO: checking for mbstate_t" >&5
 echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
 if test "${bash_cv_have_mbstate_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:4876: error: cannot run test program while cross compiling" >&5
-echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4881 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
 #include <wchar.h>
 int
@@ -4884,43 +6278,49 @@ main ()
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:4893: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4896: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:4898: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4901: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_have_mbstate_t=yes
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
 bash_cv_have_mbstate_t=no
 fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
-echo "$as_me:4913: result: $bash_cv_have_mbstate_t" >&5
+echo "$as_me:$LINENO: result: $bash_cv_have_mbstate_t" >&5
 echo "${ECHO_T}$bash_cv_have_mbstate_t" >&6
 if test $bash_cv_have_mbstate_t = yes; then
-       cat >>confdefs.h <<\EOF
+       cat >>confdefs.h <<\_ACEOF
 #define HAVE_MBSTATE_T 1
-EOF
+_ACEOF
 
 fi
 
-echo "$as_me:4922: checking for nl_langinfo and CODESET" >&5
+echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5
 echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6
 if test "${bash_cv_langinfo_codeset+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 4928 "configure"
-#include "confdefs.h"
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 #include <langinfo.h>
 int
 main ()
@@ -4931,34 +6331,37 @@ char* cs = nl_langinfo(CODESET);
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:4940: \"$ac_link\"") >&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:4943: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:4946: \"$ac_try\"") >&5
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:4949: \$? = $ac_status" >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   bash_cv_langinfo_codeset=yes
 else
   echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
 bash_cv_langinfo_codeset=no
 fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:4959: result: $bash_cv_langinfo_codeset" >&5
+echo "$as_me:$LINENO: result: $bash_cv_langinfo_codeset" >&5
 echo "${ECHO_T}$bash_cv_langinfo_codeset" >&6
 if test $bash_cv_langinfo_codeset = yes; then
-  cat >>confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_LANGINFO_CODESET 1
-EOF
+_ACEOF
 
 fi
 
+
+
 case "$host_cpu" in
 *cray*)        LOCAL_CFLAGS=-DCRAY ;;
 *s390*) LOCAL_CFLAGS=-fsigned-char ;;
@@ -4974,11 +6377,22 @@ esac
 # ${srcdir}/support/shobj-conf
 #
 if test -f ${srcdir}/support/shobj-conf; then
-        echo "$as_me:4983: checking configuration for building shared libraries" >&5
+        echo "$as_me:$LINENO: checking configuration for building shared libraries" >&5
 echo $ECHO_N "checking configuration for building shared libraries... $ECHO_C" >&6
         eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
 
-        echo "$as_me:4987: result: $SHLIB_STATUS" >&5
+
+
+
+
+
+
+
+
+
+
+
+        echo "$as_me:$LINENO: result: $SHLIB_STATUS" >&5
 echo "${ECHO_T}$SHLIB_STATUS" >&6
 
        # SHLIB_STATUS is either `supported' or `unsupported'.  If it's
@@ -4992,6 +6406,7 @@ echo "${ECHO_T}$SHLIB_STATUS" >&6
        SHLIB_MAJOR=`expr "$LIBVERSION" : '\([0-9]\)\..*'`
        SHLIB_MINOR=`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`
 
+
 fi
 
 if test "$opt_static_libs" = "yes"; then
@@ -5003,13 +6418,35 @@ if test "$opt_shared_libs" = "yes"; then
        SHARED_INSTALL_TARGET=install-shared
 fi
 
+
+
+
+
+
 case "$host_os" in
 msdosdjgpp*)   BUILD_DIR=`pwd.exe` ;;  # to prevent //d/path/file
 *)             BUILD_DIR=`pwd` ;;
 esac
 
-ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile"
-ac_config_commands="$ac_config_commands default"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                                        ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile"
+          ac_config_commands="$ac_config_commands default"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -5020,7 +6457,7 @@ cat >confcache <<\_ACEOF
 # config.status only pays attention to the cache file if you give it
 # the --recheck option to rerun configure.
 #
-# `ac_cv_env_foo' variables (set or unset) will be overriden when
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
 # loading this file, other *unset* `ac_cv_foo' will be assigned the
 # following values.
 
@@ -5055,7 +6492,7 @@ _ACEOF
      t end
      /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
      : end' >>confcache
-if cmp -s $cache_file confcache; then :; else
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
   if test -w $cache_file; then
     test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
     cat confcache >$cache_file
 
 DEFS=-DHAVE_CONFIG_H
 
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:5098: creating $CONFIG_STATUS" >&5
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
 echo "$as_me: creating $CONFIG_STATUS" >&6;}
 cat >$CONFIG_STATUS <<_ACEOF
 #! $SHELL
-# Generated automatically by configure.
+# Generated by $as_me.
 # Run this file to recreate the current configuration.
 # Compiler output produced by configure, useful for debugging
 # configure, is in config.log if it exists.
 
 debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
 SHELL=\${CONFIG_SHELL-$SHELL}
-ac_cs_invocation="\$0 \$@"
-
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
 
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
 # Name of the executable.
-as_me=`echo "$0" |sed 's,.*[\\/],,'`
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
 
 if expr a : '\(a\)' >/dev/null 2>&1; then
   as_expr=expr
@@ -5140,24 +6769,20 @@ else
 fi
 rm -f conf$$ conf$$.exe conf$$.file
 
-as_executable_p="test -f"
-
-# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
-  as_unset=unset
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
 else
-  as_unset=false
+  as_mkdir_p=false
 fi
 
-# NLS nuisances.
-$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
-$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
-$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
-$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
-$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
-$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
-$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
-$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
 
 # IFS
 # We need space, tab and new line, in precisely that order.
@@ -5166,10 +6791,34 @@ as_nl='
 IFS="  $as_nl"
 
 # CDPATH.
-$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+$as_unset CDPATH
 
 exec 6>&1
 
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by readline $as_me 4.3, which was
+generated by GNU Autoconf 2.57.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
 _ACEOF
 
 # Files that config.status was made for.
@@ -5189,7 +6838,7 @@ if test -n "$ac_config_commands"; then
   echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
 fi
 
-cat >>$CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
@@ -5199,6 +6848,7 @@ Usage: $0 [OPTIONS] [FILE]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
   --file=FILE[:TEMPLATE]
@@ -5216,12 +6866,12 @@ Configuration commands:
 $config_commands
 
 Report bugs to <bug-autoconf@gnu.org>."
-EOF
+_ACEOF
 
-cat >>$CONFIG_STATUS <<EOF
+cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 readline config.status 4.3
-configured by $0, generated by GNU Autoconf 2.52,
+configured by $0, generated by GNU Autoconf 2.57,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
@@ -5230,9 +6880,9 @@ This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 srcdir=$srcdir
 INSTALL="$INSTALL"
-EOF
+_ACEOF
 
-cat >>$CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 # If no file are specified by the user, then we need to provide default
 # value.  By we need to know if files were specified by the user.
 ac_need_defaults=:
@@ -5242,30 +6892,30 @@ do
   --*=*)
     ac_option=`expr "x$1" : 'x\([^=]*\)='`
     ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
-    shift
-    set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
-    shift
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
     ;;
-  -*);;
   *) # This is not an option, so the user has probably given explicit
      # arguments.
+     ac_option=$1
      ac_need_defaults=false;;
   esac
 
-  case $1 in
+  case $ac_option in
   # Handling of the options.
-EOF
-cat >>$CONFIG_STATUS <<EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
-    exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
-EOF
-cat >>$CONFIG_STATUS <<\EOF
+    ac_cs_recheck=: ;;
   --version | --vers* | -V )
     echo "$ac_cs_version"; exit 0 ;;
   --he | --h)
     # Conflict between --help and --header
-    { { echo "$as_me:5274: error: ambiguous option: $1
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: ambiguous option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -5275,16 +6925,19 @@ Try \`$0 --help' for more information." >&2;}
   --debug | --d* | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
-    shift
-    CONFIG_FILES="$CONFIG_FILES $1"
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
-    shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $1"
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
     ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { { echo "$as_me:5293: error: unrecognized option: $1
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&5
 echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2;}
@@ -5296,25 +6949,27 @@ Try \`$0 --help' for more information." >&2;}
   shift
 done
 
-exec 5>>config.log
-cat >&5 << _ACEOF
+ac_configure_extra_args=
 
-## ----------------------- ##
-## Running config.status.  ##
-## ----------------------- ##
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
 
-This file was extended by $as_me (readline 4.3) 2.52, executed with
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  > $ac_cs_invocation
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
 
 _ACEOF
-EOF
 
-cat >>$CONFIG_STATUS <<\EOF
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
 for ac_config_target in $ac_config_targets
 do
   case "$ac_config_target" in
@@ -5325,7 +6980,7 @@ do
   "shlib/Makefile" ) CONFIG_FILES="$CONFIG_FILES shlib/Makefile" ;;
   "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-  *) { { echo "$as_me:5334: error: invalid argument: $ac_config_target" >&5
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
@@ -5341,6 +6996,9 @@ if $ac_need_defaults; then
   test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
 fi
 
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
 # Create a temporary directory, and hook for its removal unless debugging.
 $debug ||
 {
@@ -5349,23 +7007,23 @@ $debug ||
 }
 
 # Create a (secure) tmp directory for tmp files.
-: ${TMPDIR=/tmp}
+
 {
-  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
   test -n "$tmp" && test -d "$tmp"
 }  ||
 {
-  tmp=$TMPDIR/cs$$-$RANDOM
+  tmp=./confstat$$-$RANDOM
   (umask 077 && mkdir $tmp)
 } ||
 {
-   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   echo "$me: cannot create a temporary directory in ." >&2
    { (exit 1); exit 1; }
 }
 
-EOF
+_ACEOF
 
-cat >>$CONFIG_STATUS <<EOF
+cat >>$CONFIG_STATUS <<_ACEOF
 
 #
 # CONFIG_FILES section.
@@ -5378,6 +7036,12 @@ if test -n "\$CONFIG_FILES"; then
   sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
    s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
 s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
 s,@exec_prefix@,$exec_prefix,;t t
 s,@prefix@,$prefix,;t t
 s,@program_transform_name@,$program_transform_name,;t t
@@ -5393,19 +7057,13 @@ s,@includedir@,$includedir,;t t
 s,@oldincludedir@,$oldincludedir,;t t
 s,@infodir@,$infodir,;t t
 s,@mandir@,$mandir,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
 s,@build_alias@,$build_alias,;t t
 s,@host_alias@,$host_alias,;t t
 s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
 s,@ECHO_C@,$ECHO_C,;t t
 s,@ECHO_N@,$ECHO_N,;t t
 s,@ECHO_T@,$ECHO_T,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@DEFS@,$DEFS,;t t
 s,@LIBS@,$LIBS,;t t
 s,@build@,$build,;t t
 s,@build_cpu@,$build_cpu,;t t
@@ -5424,6 +7082,7 @@ s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
 s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
 s,@CROSS_COMPILING_FLAG@,$CROSS_COMPILING_FLAG,;t t
 s,@CC_FOR_BUILD@,$CC_FOR_BUILD,;t t
 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
@@ -5433,6 +7092,7 @@ s,@AR@,$AR,;t t
 s,@RANLIB@,$RANLIB,;t t
 s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
 s,@MAKE_SHELL@,$MAKE_SHELL,;t t
+s,@WCWIDTH_OBJ@,$WCWIDTH_OBJ,;t t
 s,@SHOBJ_CC@,$SHOBJ_CC,;t t
 s,@SHOBJ_CFLAGS@,$SHOBJ_CFLAGS,;t t
 s,@SHOBJ_LD@,$SHOBJ_LD,;t t
@@ -5458,11 +7118,13 @@ s,@LOCAL_DEFS@,$LOCAL_DEFS,;t t
 s,@ARFLAGS@,$ARFLAGS,;t t
 s,@LIBVERSION@,$LIBVERSION,;t t
 s,@TERMCAP_LIB@,$TERMCAP_LIB,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
 CEOF
 
-EOF
+_ACEOF
 
-  cat >>$CONFIG_STATUS <<\EOF
+  cat >>$CONFIG_STATUS <<\_ACEOF
   # Split the substitutions into bite-sized pieces for seds with
   # small command number limits, like on Digital OSF/1 and HP-UX.
   ac_max_sed_lines=48
@@ -5501,8 +7163,8 @@ EOF
   fi
 fi # test -n "$CONFIG_FILES"
 
-EOF
-cat >>$CONFIG_STATUS <<\EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
   case $ac_file in
@@ -5516,7 +7178,8 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   esac
 
   # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-  ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
          X"$ac_file" : 'X\(//\)[^/]' \| \
          X"$ac_file" : 'X\(//\)$' \| \
          X"$ac_file" : 'X\(/\)' \| \
@@ -5527,60 +7190,84 @@ echo X"$ac_file" |
          /^X\(\/\/\)$/{ s//\1/; q; }
          /^X\(\/\).*/{ s//\1/; q; }
          s/.*/./; q'`
-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    { case "$ac_dir" in
-  [\\/]* | ?:[\\/]* ) as_incr_dir=;;
-  *)                      as_incr_dir=.;;
-esac
-as_dummy="$ac_dir"
-for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
-  case $as_mkdir_dir in
-    # Skip DOS drivespec
-    ?:) as_incr_dir=$as_mkdir_dir ;;
-    *)
-      as_incr_dir=$as_incr_dir/$as_mkdir_dir
-      test -d "$as_incr_dir" || mkdir "$as_incr_dir"
-    ;;
-  esac
-done; }
-
-    ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`"
-    # A "../" for each directory in $ac_dir_suffix.
-    ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
   else
-    ac_dir_suffix= ac_dots=
-  fi
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$as_dir" : 'X\(//\)[^/]' \| \
+         X"$as_dir" : 'X\(//\)$' \| \
+         X"$as_dir" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
 
-  case $srcdir in
-  .)  ac_srcdir=.
-      if test -z "$ac_dots"; then
-         ac_top_srcdir=.
-      else
-         ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
-      fi ;;
-  [\\/]* | ?:[\\/]* )
-      ac_srcdir=$srcdir$ac_dir_suffix;
-      ac_top_srcdir=$srcdir ;;
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
   *) # Relative path.
-    ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_dots$srcdir ;;
-  esac
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
 
   case $INSTALL in
   [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_dots$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
   esac
 
   if test x"$ac_file" != x-; then
-    { echo "$as_me:5581: creating $ac_file" >&5
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
     rm -f "$ac_file"
   fi
   # Let's still pretend it is `configure' which instantiates (i.e., don't
   # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated automatically by config.status.  */
-  configure_input="Generated automatically from `echo $ac_file_in |
-                                                 sed 's,.*/,,'` by configure."
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                     sed 's,.*/,,'` by configure."
 
   # First look for the input files in the build tree, otherwise in the
   # src tree.
@@ -5590,7 +7277,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:5599: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -5603,23 +7290,29 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:5612: error: cannot find input file: $f" >&5
+           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
       esac
     done` || { (exit 1); exit 1; }
-EOF
-cat >>$CONFIG_STATUS <<EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub
 $extrasub
-EOF
-cat >>$CONFIG_STATUS <<\EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
 s,@configure_input@,$configure_input,;t t
 s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
 s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
 s,@INSTALL@,$ac_INSTALL,;t t
 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
   rm -f $tmp/stdin
@@ -5631,8 +7324,8 @@ s,@INSTALL@,$ac_INSTALL,;t t
   fi
 
 done
-EOF
-cat >>$CONFIG_STATUS <<\EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 
 #
 # CONFIG_HEADER section.
@@ -5664,7 +7357,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  test x"$ac_file" != x- && { echo "$as_me:5673: creating $ac_file" >&5
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
 echo "$as_me: creating $ac_file" >&6;}
 
   # First look for the input files in the build tree, otherwise in the
@@ -5675,7 +7368,7 @@ echo "$as_me: creating $ac_file" >&6;}
       -) echo $tmp/stdin ;;
       [\\/$]*)
          # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:5684: error: cannot find input file: $f" >&5
+         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          echo $f;;
@@ -5688,7 +7381,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
            echo $srcdir/$f
          else
            # /dev/null tree
-           { { echo "$as_me:5697: error: cannot find input file: $f" >&5
+           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
          fi;;
@@ -5697,7 +7390,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
   # Remove the trailing spaces.
   sed 's/[     ]*$//' $ac_file_inputs >$tmp/in
 
-EOF
+_ACEOF
 
 # Transform confdefs.h into two sed scripts, `conftest.defines' and
 # `conftest.undefs', that substitutes the proper values into
@@ -5713,16 +7406,16 @@ rm -f conftest.defines conftest.undefs
 # `end' is used to avoid that the second main sed command (meant for
 # 0-ary CPP macros) applies to n-ary macro definitions.
 # See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\EOF
+cat >confdef2sed.sed <<\_ACEOF
 s/[\\&,]/\\&/g
 s,[\\$`],\\&,g
 t clear
 : clear
-s,^[   ]*#[    ]*define[       ][      ]*\(\([^        (][^    (]*\)([^)]*)\)[         ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp
+s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
 t end
 s,^[   ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
 : end
-EOF
+_ACEOF
 # If some macros were called several times there might be several times
 # the same #defines, which is useless.  Nevertheless, we may not want to
 # sort them, since we want the *last* AC-DEFINE to be honored.
@@ -5733,14 +7426,14 @@ rm -f confdef2sed.sed
 # This sed command replaces #undef with comments.  This is necessary, for
 # example, in the case of _POSIX_SOURCE, which is predefined and required
 # on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\EOF
+cat >>conftest.undefs <<\_ACEOF
 s,^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-EOF
+_ACEOF
 
 # Break up conftest.defines because some shells have a limit on the size
 # of here documents, and old seds have small limits too (100 cmds).
 echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo '  if egrep "^[   ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  if grep "^[    ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
 echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
 echo '  :' >>$CONFIG_STATUS
 rm -f conftest.tail
@@ -5764,7 +7457,7 @@ do
   mv conftest.tail conftest.defines
 done
 rm -f conftest.defines
-echo '  fi # egrep' >>$CONFIG_STATUS
+echo '  fi # grep' >>$CONFIG_STATUS
 echo >>$CONFIG_STATUS
 
 # Break up conftest.undefs because some shells have a limit on the size
@@ -5792,23 +7485,24 @@ do
 done
 rm -f conftest.undefs
 
-cat >>$CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
   # Let's still pretend it is `configure' which instantiates (i.e., don't
   # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated automatically by config.status.  */
+  #    /* config.h.  Generated by config.status.  */
   if test x"$ac_file" = x-; then
-    echo "/* Generated automatically by configure.  */" >$tmp/config.h
+    echo "/* Generated by configure.  */" >$tmp/config.h
   else
-    echo "/* $ac_file.  Generated automatically by configure.  */" >$tmp/config.h
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
   fi
   cat $tmp/in >>$tmp/config.h
   rm -f $tmp/in
   if test x"$ac_file" != x-; then
-    if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
-      { echo "$as_me:5814: $ac_file is unchanged" >&5
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
-      ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
          X"$ac_file" : 'X\(//\)[^/]' \| \
          X"$ac_file" : 'X\(//\)$' \| \
          X"$ac_file" : 'X\(/\)' \| \
@@ -5819,24 +7513,31 @@ echo X"$ac_file" |
          /^X\(\/\/\)$/{ s//\1/; q; }
          /^X\(\/\).*/{ s//\1/; q; }
          s/.*/./; q'`
-      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-        { case "$ac_dir" in
-  [\\/]* | ?:[\\/]* ) as_incr_dir=;;
-  *)                      as_incr_dir=.;;
-esac
-as_dummy="$ac_dir"
-for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
-  case $as_mkdir_dir in
-    # Skip DOS drivespec
-    ?:) as_incr_dir=$as_mkdir_dir ;;
-    *)
-      as_incr_dir=$as_incr_dir/$as_mkdir_dir
-      test -d "$as_incr_dir" || mkdir "$as_incr_dir"
-    ;;
-  esac
-done; }
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$as_dir" : 'X\(//\)[^/]' \| \
+         X"$as_dir" : 'X\(//\)$' \| \
+         X"$as_dir" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
 
-      fi
       rm -f $ac_file
       mv $tmp/config.h $ac_file
     fi
@@ -5845,8 +7546,8 @@ done; }
     rm -f $tmp/config.h
   fi
 done
-EOF
-cat >>$CONFIG_STATUS <<\EOF
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 
 #
 # CONFIG_COMMANDS section.
@@ -5854,7 +7555,53 @@ cat >>$CONFIG_STATUS <<\EOF
 for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
   ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
   ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$ac_dest" : 'X\(//\)[^/]' \| \
+         X"$ac_dest" : 'X\(//\)$' \| \
+         X"$ac_dest" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
 
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
   case $ac_dest in
     default )
 # Makefile uses this timestamp file to record whether config.h is up to date.
@@ -5862,15 +7609,16 @@ echo > stamp-h
  ;;
   esac
 done
-EOF
+_ACEOF
 
-cat >>$CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 
 { (exit 0); exit 0; }
-EOF
+_ACEOF
 chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
+
 # configure is writing to config.log, and then calls config.status.
 # config.status does its own redirection, appending to config.log.
 # Unfortunately, on DOS this fails, as config.log is still kept open
@@ -5881,8 +7629,11 @@ ac_clean_files=$ac_clean_files_save
 # need to make the FD available again.
 if test "$no_create" != yes; then
   ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
   exec 5>/dev/null
-  $SHELL $CONFIG_STATUS || ac_cs_success=false
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
index 27ca32b..9b8464a 100644 (file)
@@ -35,7 +35,8 @@
 #if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
 #  include <wchar.h>
 #  include <wctype.h>
-#  if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
+#  if defined (HAVE_MBRTOWC) && defined (HAVE_MBSRTOWCS)
+     /* system is supposed to support XPG5 */
 #    define HANDLE_MULTIBYTE      1
 #  endif
 #endif
index 0cba57e..22748c4 100644 (file)
@@ -103,6 +103,8 @@ SHARED_READLINE = libreadline.$(SHLIB_LIBVERSION)
 SHARED_HISTORY = libhistory.$(SHLIB_LIBVERSION)
 SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY)
 
+WCWIDTH_OBJ = @WCWIDTH_OBJ@
+
 # The C code source files for this library.
 CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
           $(topdir)/vi_mode.c $(topdir)/parens.c $(topdir)/rltty.c \
@@ -115,7 +117,7 @@ CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
           $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \
           $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c \
           $(topdir)/text.c $(topdir)/misc.c $(topdir)/compat.c \
-          $(topdir)/mbutil.c
+          $(topdir)/mbutil.c $(WCWIDTH_SRC)
 
 # The header files for this library.
 HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
@@ -129,7 +131,7 @@ SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
          rltty.so complete.so bind.so isearch.so display.so signals.so \
          util.so kill.so undo.so macro.so input.so callback.so terminal.so \
          text.so nls.so misc.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \
-         compat.so
+         compat.so $(WCWIDTH_OBJ)
 
 ##########################################################################
 
@@ -153,6 +155,10 @@ $(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so
        $(RM) $@
        $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so $(SHLIB_LIBS)
 
+wcwidth.o: $(srcdir)/support/wcwidth.c
+       $(RM) $@
+       $(SHOBJ_CC) -c $(CCFLAGS) $(SHOBJ_FLAGS) $(srcdir)/support/wcwidth.c
+
 # Since tilde.c is shared between readline and bash, make sure we compile 
 # it with the right flags when it's built as part of readline
 tilde.so:        tilde.c
index 35bcfb5..f3bc71d 100644 (file)
@@ -1,3 +1,11 @@
+2003-01-23  Nick Clifton  <nickc@redhat.com>
+
+       * Add sh2e support:
+
+       2002-04-02  Alexandre Oliva  <aoliva@redhat.com>
+
+               * sh/gencode.c: Replace sh3e with sh2e except in fsqrt.
+
 2002-08-24  Geoffrey Keating  <geoffk@redhat.com>
 
        * MAINTAINERS: Update my email address.
index ca21f15..5e4b316 100644 (file)
@@ -1,3 +1,12 @@
+2003-03-02  Nick Clifton  <nickc@redhat.com>
+
+       * armos.c (SWIWrite0): Catch big-endian bug when printing
+       characters.
+
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * wrapper.c (sim_create_inferior, sim_open): Rename _bfd to bfd.
+       
 2003-01-10  Ben Elliston  <bje@redhat.com>
 
        * README.Cygnus: Rename from this ..
index c4cb051..04916d6 100644 (file)
@@ -274,7 +274,13 @@ SWIWrite0 (ARMul_State * state, ARMword addr)
   struct OSblock *OSptr = (struct OSblock *) state->OSptr;
 
   while ((temp = ARMul_SafeReadByte (state, addr++)) != 0)
-    (void) sim_callback->write_stdout (sim_callback, (char *) &temp, 1);
+    {
+      char buffer = temp;
+      /* Note - we cannot just cast 'temp' to a (char *) here,
+        since on a big-endian host the byte value will end
+        up in the wrong place and a nul character will be printed.  */
+      (void) sim_callback->write_stdout (sim_callback, & buffer, 1);
+    }
 
   OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
 }
index 262e2e7..244c475 100644 (file)
@@ -204,7 +204,7 @@ sim_resume (sd, step, siggnal)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd ATTRIBUTE_UNUSED;
-     struct _bfd * abfd;
+     struct bfd * abfd;
      char ** argv;
      char ** env;
 {
@@ -610,7 +610,7 @@ SIM_DESC
 sim_open (kind, ptr, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *ptr;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   sim_kind = kind;
index 46a2cc8..a7c8f4f 100644 (file)
@@ -1,3 +1,33 @@
+2003-03-01  Andrew Cagney  <cagney@redhat.com>
+
+       * sim-engine.c (sim_engine_halt): If jmpbuf is invalid, abort.
+       (sim_engine_vabort): Ditto.
+
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * sim-utils.h (sim_analyze_program, sim_load_file): Rename _bfd to bfd.
+       * sim-hload.c (sim_load), sim-base.h (sim_state_base): Ditto.
+       * nrun.c (main): Ditto.
+
+2003-02-26  Andrew Cagney  <cagney@redhat.com>
+
+       * sim-engine.h (sim_engine_abort): Add noreturn attribute.
+       (sim_engine_vabort): Ditto.
+       (sim_engine_halt, sim_engine_restart): Ditto.
+
+2003-02-20  Andrew Cagney  <ac131313@redhat.com>
+
+       * Make-common.in (SIM_NEW_COMMON_OBJS): Remove sim-break.o
+       (sim-break_h): Delete macro.
+       (sim-break.o): Delete rule.
+       * sim-break.c: Delete file.
+       * sim-break.h: Delete file.
+       * sim-base.h [SIM_HAVE_BREAKPOINTS]: Don't include "sim-break.h".
+       (STATE_BREAKPOINTS): Delete macro.
+       (sim_state_base): Delete field breakpoints.
+       * sim-module.c (modules) [SIM_HAVE_BREAKPOINTS]: Don't add
+       sim_break_install to array.
+
 2003-01-08  Kazu Hirata  <kazu@cs.umass.edu>
 
        * run.c (usage): Fix typos.
index e3e1239..9e2c7c4 100644 (file)
@@ -161,7 +161,6 @@ SIM_COMMON_HW_OBJS = \
 SIM_NEW_COMMON_OBJS = \
        sim-arange.o \
        sim-bits.o \
-       sim-break.o \
        sim-config.o \
        sim-core.o \
        sim-endian.o \
@@ -335,7 +334,6 @@ sim-events_h = $(srccom)/sim-events.h
 sim-fpu_h = $(srccom)/sim-fpu.h
 sim-io_h = $(srccom)/sim-io.h
 sim-options_h = $(srccom)/sim-options.h
-sim-break_h = $(srccom)/sim-break.h
 sim-signal_h = $(srccom)/sim-signal.h
 
 hw-alloc_h = $(srccom)/hw-alloc.h
@@ -477,10 +475,6 @@ sim-watch.o: $(srccom)/sim-watch.c $(sim_main_headers)
 sim-load.o: $(srccom)/sim-load.c $(callback_h)
        $(CC) -c $(srccom)/sim-load.c $(ALL_CFLAGS)
 
-sim-break.o: $(srccom)/sim-break.c $(sim_main_headers) \
-         $(sim_break_h)
-       $(CC) -c $(srccom)/sim-break.c $(ALL_CFLAGS)
-
 
 # FIXME This is one very simple-minded way of generating the file hw-config.h
 hw-config.h: Makefile.in $(srccom)/Make-common.in config.status Makefile
index ef25d68..7c77f5c 100644 (file)
@@ -47,7 +47,7 @@ main (int argc, char **argv)
 {
   char *name;
   char **prog_argv = NULL;
-  struct _bfd *prog_bfd;
+  struct bfd *prog_bfd;
   enum sim_stop reason;
   int sigrc = 0;
   int single_step = 0;
index 420b137..3f702f6 100644 (file)
@@ -1,5 +1,7 @@
 /* Simulator pseudo baseclass.
-   Copyright (C) 1997-1998 Free Software Foundation, Inc.
+
+   Copyright 1997, 1998, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
@@ -90,9 +92,6 @@ typedef struct _sim_cpu sim_cpu;
 #include "sim-engine.h"
 #include "sim-watch.h"
 #include "sim-memopt.h"
-#ifdef SIM_HAVE_BREAKPOINTS
-#include "sim-break.h"
-#endif
 #include "sim-cpu.h"
 
 /* Global pointer to current state while sim_resume is running.
@@ -172,7 +171,7 @@ typedef struct {
 #define STATE_PROG_ARGV(sd) ((sd)->base.prog_argv)
 
   /* The program's bfd.  */
-  struct _bfd *prog_bfd;
+  struct bfd *prog_bfd;
 #define STATE_PROG_BFD(sd) ((sd)->base.prog_bfd)
 
   /* Symbol table for prog_bfd */
@@ -227,10 +226,6 @@ typedef struct {
   sim_watchpoints watchpoints;
 #define STATE_WATCHPOINTS(sd) (&(sd)->base.watchpoints)
 
-  /* Pointer to list of breakpoints */
-  struct sim_breakpoint *breakpoints;
-#define STATE_BREAKPOINTS(sd) ((sd)->base.breakpoints)
-
 #if WITH_HW
   struct sim_hw *hw;
 #define STATE_HW(sd) ((sd)->base.hw)
diff --git a/sim/common/sim-break.c b/sim/common/sim-break.c
deleted file mode 100644 (file)
index 3b89560..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/* Simulator breakpoint support.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   Contributed by Cygnus Support.
-
-This file is part of GDB, the GNU debugger.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-#include <stdio.h>
-
-#include "sim-main.h"
-#include "sim-assert.h"
-#include "sim-break.h"
-
-#ifndef SIM_BREAKPOINT
-#define SIM_BREAKPOINT {0x00}
-#define SIM_BREAKPOINT_SIZE (1)
-#endif
-
-struct
-sim_breakpoint
-{
-  struct sim_breakpoint *next;
-  SIM_ADDR addr;               /* Address of this breakpoint */
-  int flags;
-  unsigned char loc_contents[SIM_BREAKPOINT_SIZE]; /* Contents of addr while
-                                                     BP is enabled */
-};
-
-#define SIM_BREAK_INSERTED 0x1 /* Breakpoint has been inserted */
-#define SIM_BREAK_DISABLED 0x2 /* Breakpoint is disabled */
-
-static unsigned char sim_breakpoint [] = SIM_BREAKPOINT;
-
-static void insert_breakpoint PARAMS ((SIM_DESC sd,
-                                      struct sim_breakpoint *bp));
-static void remove_breakpoint PARAMS ((SIM_DESC sd,
-                                      struct sim_breakpoint *bp));
-static SIM_RC resume_handler PARAMS ((SIM_DESC sd));
-static SIM_RC suspend_handler PARAMS ((SIM_DESC sd));
-
-
-/* Do the actual work of inserting a breakpoint into the instruction
-   stream. */
-
-static void
-insert_breakpoint (sd, bp)
-     SIM_DESC sd;
-     struct sim_breakpoint *bp;
-{
-  if (bp->flags & (SIM_BREAK_INSERTED | SIM_BREAK_DISABLED))
-    return;
-
-  sim_core_read_buffer (sd, NULL, exec_map, bp->loc_contents,
-                       bp->addr, SIM_BREAKPOINT_SIZE);
-  sim_core_write_buffer (sd, NULL, exec_map, sim_breakpoint,
-                        bp->addr, SIM_BREAKPOINT_SIZE);
-  bp->flags |= SIM_BREAK_INSERTED;
-}
-
-/* Do the actual work of removing a breakpoint. */
-
-static void
-remove_breakpoint (sd, bp)
-     SIM_DESC sd;
-     struct sim_breakpoint *bp;
-{
-  if (!(bp->flags & SIM_BREAK_INSERTED))
-    return;
-
-  sim_core_write_buffer (sd, NULL, exec_map, bp->loc_contents,
-                        bp->addr, SIM_BREAKPOINT_SIZE);
-  bp->flags &= ~SIM_BREAK_INSERTED;
-}
-
-/* Come here when a breakpoint insn is hit.  If it's really a breakpoint, we
-   halt things, and never return.  If it's a false hit, we return to let the
-   caller handle things.  */
-
-void
-sim_handle_breakpoint (sd, cpu, cia)
-     SIM_DESC sd;
-     sim_cpu *cpu;
-     sim_cia cia;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    if (bp->addr == CIA_ADDR (cia))
-      break;
-
-  if (!bp || !(bp->flags & SIM_BREAK_INSERTED))
-    return;
-
-  sim_engine_halt (sd, STATE_CPU (sd, 0), NULL, cia, sim_stopped, SIM_SIGTRAP);
-}
-
-/* Handler functions for simulator resume and suspend events. */
-
-static SIM_RC
-resume_handler (sd)
-     SIM_DESC sd;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    insert_breakpoint (sd, bp);
-
-  return SIM_RC_OK;
-}
-
-static SIM_RC
-suspend_handler (sd)
-     SIM_DESC sd;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    remove_breakpoint (sd, bp);
-
-  return SIM_RC_OK;
-}
-
-/* Called from simulator module initialization.  */
-
-SIM_RC
-sim_break_install (sd)
-     SIM_DESC sd;
-{
-  sim_module_add_resume_fn (sd, resume_handler);
-  sim_module_add_suspend_fn (sd, suspend_handler);
-
-  return SIM_RC_OK;
-}
-
-/* Install a breakpoint.  This is a user-function.  The breakpoint isn't
-   actually installed here.  We just record it.  Resume_handler does the
-   actual work.
-*/
-
-SIM_RC
-sim_set_breakpoint (sd, addr)
-     SIM_DESC sd;
-     SIM_ADDR addr;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    if (bp->addr == addr)
-      return SIM_RC_DUPLICATE_BREAKPOINT; /* Already there */
-    else
-      break; /* FIXME: why not scan all bp's? */
-
-  bp = ZALLOC (struct sim_breakpoint);
-
-  bp->addr = addr;
-  bp->next = STATE_BREAKPOINTS (sd);
-  bp->flags = 0;
-  STATE_BREAKPOINTS (sd) = bp;
-
-  return SIM_RC_OK;
-}
-
-/* Delete a breakpoint.  All knowlege of the breakpoint is removed from the
-   simulator.
-*/
-
-SIM_RC
-sim_clear_breakpoint (sd, addr)
-     SIM_DESC sd;
-     SIM_ADDR addr;
-{
-  struct sim_breakpoint *bp, *bpprev;
-
-  for (bp = STATE_BREAKPOINTS (sd), bpprev = NULL;
-       bp;
-       bpprev = bp, bp = bp->next)
-    if (bp->addr == addr)
-      break;
-
-  if (!bp)
-    return SIM_RC_UNKNOWN_BREAKPOINT;
-
-  remove_breakpoint (sd, bp);
-
-  if (bpprev)
-    bpprev->next = bp->next;
-  else
-    STATE_BREAKPOINTS (sd) = NULL;
-
-  zfree (bp);
-
-  return SIM_RC_OK;
-}
-
-SIM_RC
-sim_clear_all_breakpoints (sd)
-     SIM_DESC sd;
-{
-  while (STATE_BREAKPOINTS (sd))
-    sim_clear_breakpoint (sd, STATE_BREAKPOINTS (sd)->addr);
-
-  return SIM_RC_OK;
-}
-
-SIM_RC
-sim_enable_breakpoint (sd, addr)
-     SIM_DESC sd;
-     SIM_ADDR addr;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    if (bp->addr == addr)
-      break;
-
-  if (!bp)
-    return SIM_RC_UNKNOWN_BREAKPOINT;
-
-  bp->flags &= ~SIM_BREAK_DISABLED;
-
-  return SIM_RC_OK;
-}
-
-SIM_RC
-sim_disable_breakpoint (sd, addr)
-     SIM_DESC sd;
-     SIM_ADDR addr;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    if (bp->addr == addr)
-      break;
-
-  if (!bp)
-    return SIM_RC_UNKNOWN_BREAKPOINT;
-
-  bp->flags |= SIM_BREAK_DISABLED;
-
-  return SIM_RC_OK;
-}
-
-SIM_RC
-sim_enable_all_breakpoints (sd)
-     SIM_DESC sd;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    bp->flags &= ~SIM_BREAK_DISABLED;
-
-  return SIM_RC_OK;
-}
-
-SIM_RC
-sim_disable_all_breakpoints (sd)
-     SIM_DESC sd;
-{
-  struct sim_breakpoint *bp;
-
-  for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next)
-    bp->flags |= SIM_BREAK_DISABLED;
-
-  return SIM_RC_OK;
-}
diff --git a/sim/common/sim-break.h b/sim/common/sim-break.h
deleted file mode 100644 (file)
index 8b0338f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Simulator breakpoint support.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   Contributed by Cygnus Support.
-
-This file is part of GDB, the GNU debugger.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-
-#ifndef SIM_BREAK_H
-#define SIM_BREAK_H
-
-/* Call this to install the resume and suspend handlers for the breakpoint
-   module.  */
-
-MODULE_INSTALL_FN sim_break_install;
-
-/* Call this inside the simulator when we execute the potential
-   breakpoint insn.  If the breakpoint system knows about it, the
-   breakpoint is handled, and this routine never returns.  If this
-   isn't really a breakpoint, then it returns to allow the caller to
-   handle things.  */
-
-void sim_handle_breakpoint PARAMS ((SIM_DESC sd, sim_cpu *cpu, sim_cia cia));
-
-#endif /* SIM_BREAK_H */
index 9415f63..192b9ac 100644 (file)
@@ -79,7 +79,10 @@ sim_engine_halt (SIM_DESC sd,
       longjmp (*halt_buf, sim_engine_halt_jmpval);
     }
   else
-    sim_io_error (sd, "sim_halt - bad long jump");
+    {
+      sim_io_error (sd, "sim_halt - bad long jump");
+      abort ();
+    }
 }
 
 
@@ -127,6 +130,7 @@ sim_engine_vabort (SIM_DESC sd,
       sim_io_evprintf (sd, fmt, ap);
       sim_io_eprintf (sd, "\n");
       sim_io_error (sd, "Quit Simulator");
+      abort ();
     }
   else
     {
index 41aa51f..18513a6 100644 (file)
@@ -63,7 +63,7 @@ extern void sim_engine_halt
  sim_cpu *next_cpu, /* NULL -> succ (last_cpu) or event-mgr */
  sim_cia cia,
  enum sim_stop reason,
- int sigrc);
+ int sigrc) __attribute__ ((noreturn));
 
 /* Halt hook - allow target specific operation when halting a
    simulator */
@@ -116,14 +116,14 @@ extern void sim_engine_abort
  sim_cpu *cpu,
  sim_cia cia,
  const char *fmt,
- ...) __attribute__ ((format (printf, 4, 5)));
+ ...) __attribute__ ((format (printf, 4, 5))) __attribute__ ((noreturn));
 
 extern void sim_engine_vabort
 (SIM_DESC sd,
  sim_cpu *cpu,
  sim_cia cia,
  const char *fmt,
- va_list ap);
+ va_list ap) __attribute__ ((noreturn));
 
 /* No abort hook - when possible this function exits using the
    engine_halt function (and SIM_ENGINE_HALT_HOOK). */
index b8726ba..07a608b 100644 (file)
@@ -31,7 +31,7 @@ SIM_RC
 sim_load (sd, prog_name, prog_bfd, from_tty)
      SIM_DESC sd;
      char *prog_name;
-     struct _bfd *prog_bfd;
+     struct bfd *prog_bfd;
      int from_tty;
 {
   bfd *result_bfd;
index 35eb32a..8f01723 100644 (file)
@@ -1,5 +1,7 @@
 /* Module support.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+
+   Copyright 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
@@ -56,9 +58,6 @@ static MODULE_INSTALL_FN * const modules[] = {
 #if WITH_SCACHE
   scache_install,
 #endif
-#ifdef SIM_HAVE_BREAKPOINTS
-  sim_break_install,
-#endif
 #if WITH_HW
   sim_hw_install,
 #endif
index 8e80e6a..661ac70 100644 (file)
@@ -49,7 +49,7 @@ unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start);
 /* Utilities for manipulating the load image.  */
 
 SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name,
-                           struct _bfd *prog_bfd);
+                           struct bfd *prog_bfd);
 
 /* Load program PROG into the simulator using the function DO_LOAD.
    If PROG_BFD is non-NULL, the file has already been opened.
@@ -65,10 +65,10 @@ SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name,
 
 typedef int sim_write_fn PARAMS ((SIM_DESC sd, SIM_ADDR mem,
                                      unsigned char *buf, int length));
-struct _bfd *sim_load_file (SIM_DESC sd, const char *myname,
-                           host_callback *callback, char *prog,
-                           struct _bfd *prog_bfd, int verbose_p,
-                           int lma_p, sim_write_fn do_load);
+struct bfd *sim_load_file (SIM_DESC sd, const char *myname,
+                          host_callback *callback, char *prog,
+                          struct bfd *prog_bfd, int verbose_p,
+                          int lma_p, sim_write_fn do_load);
 
 /* Internal version of sim_do_command, include formatting */
 void sim_do_commandf (SIM_DESC sd, const char *fmt, ...);
index 9c42d35..54d84e6 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-11-13  Andrew Cagney  <cagney@redhat.com>
 
        * simops.c: Include <string.h>.
index 0f7295d..718acca 100644 (file)
@@ -788,7 +788,7 @@ SIM_DESC
 sim_open (kind, callback, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *callback;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   struct simops *s;
@@ -1194,7 +1194,7 @@ sim_info (sd, verbose)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
index 92b2950..5bf54d7 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interf.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-06-16  Andrew Cagney  <ac131313@redhat.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 1931886..9d59471 100644 (file)
@@ -184,7 +184,7 @@ SIM_DESC
 sim_open (kind, callback, abfd, argv)
      SIM_OPEN_KIND kind;
      struct host_callback_struct *callback;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
 
@@ -304,7 +304,7 @@ sim_load(sd, prog, abfd, from_tty)
 SIM_RC
 sim_create_inferior(sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
index 62fd073..0e62569 100644 (file)
@@ -1,3 +1,12 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * compile.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
+2003-02-05  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * compile.c (init_pointers): Abort if wreg never gets initialized.
+       (sim_resume): Fix the handling of exts.w and extu.w.
+
 2003-01-31  Kazu Hirata  <kazu@cs.umass.edu>
 
        * compile.c (sim_resume): Fix the handling of bxor.
index e845899..cd60b86 100644 (file)
@@ -753,6 +753,7 @@ init_pointers (void)
                }
              p++;
            }
+         wreg[i] = wreg[i + 8] = 0;
          while (q < u)
            {
              if (*q == 0x2233)
@@ -765,6 +766,8 @@ init_pointers (void)
                }
              q++;
            }
+         if (wreg[i] == 0 || wreg[i + 8] == 0)
+           abort ();
          cpu.regs[i] = 0;
          lreg[i] = &cpu.regs[i];
        }
@@ -1606,7 +1609,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
            goto next;
          }
        case O (O_EXTS, SW):
-         rd = GET_B_REG (code->src.reg + 8) & 0xff; /* Yes, src, not dst.  */
+         rd = GET_W_REG (code->src.reg) & 0xff; /* Yes, src, not dst.  */
          ea = rd & 0x80 ? -256 : 0;
          res = rd + ea;
          goto log16;
@@ -1616,7 +1619,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
          res = rd + ea;
          goto log32;
        case O (O_EXTU, SW):
-         rd = GET_B_REG (code->src.reg + 8) & 0xff;
+         rd = GET_W_REG (code->src.reg) & 0xff;
          ea = 0;
          res = rd + ea;
          goto log16;
@@ -2122,7 +2125,7 @@ set_h8300h (int h_flag, int s_flag)
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind, 
          struct host_callback_struct *ptr, 
-         struct _bfd *abfd, 
+         struct bfd *abfd, 
          char **argv)
 {
   /* FIXME: Much of the code in sim_load can be moved here.  */
@@ -2225,7 +2228,7 @@ sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty)
 }
 
 SIM_RC
-sim_create_inferior (SIM_DESC sd, struct _bfd *abfd, char **argv, char **env)
+sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
 {
   if (abfd != NULL)
     cpu.pc = bfd_get_start_address (abfd);
index d42834c..fe72e49 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * compile.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-06-16  Andrew Cagney  <ac131313@redhat.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index aec8ce9..5db2bee 100644 (file)
@@ -2443,7 +2443,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   sim_kind = kind;
@@ -2484,7 +2484,7 @@ sim_load (sd, prog, abfd, from_tty)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
index 6a727fe..1f61c31 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * sim-if.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-06-16  Andrew Cagney  <ac131313@redhat.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 6179739..423dac0 100644 (file)
@@ -52,7 +52,7 @@ SIM_DESC
 sim_open (kind, callback, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *callback;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   char c;
@@ -178,7 +178,7 @@ sim_close (sd, quitting)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, envp)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **envp;
 {
index 532e024..b4097db 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * sim-if.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-12-19  Doug Evans  <dje@sebabeach.org>
 
        * arch.c,arch.h,cpuall.h: Regenerate.
index a7cbe1c..95568cc 100644 (file)
@@ -56,7 +56,7 @@ SIM_DESC
 sim_open (kind, callback, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *callback;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   SIM_DESC sd = sim_state_alloc (kind, callback);
@@ -199,7 +199,7 @@ sim_close (sd, quitting)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, envp)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **envp;
 {
index abe5f55..9c34d47 100644 (file)
@@ -1,3 +1,19 @@
+2003-03-02  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * Makefile.in (SIM_EXTRA_CFLAGS): Set WITH_TARGET_ADDRESS_BITSIZE
+       to 32 to support memory bank switching; temporarily use 32-bit for
+       WORD_BITSIZE to avoid a bug in sim-common.
+
+2003-03-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+       * interp.c (sim_fetch_register): Only store a single byte for
+       1 byte registers.
+
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_prepare_for_program, sim_open)
+       (sim_create_inferior): Rename _bfd to bfd.
+
 2002-08-13  Stephane Carrez  <stcarrez@nerim.fr>
 
        * dv-m68hc11eepr.c (struct m68hc11eepr ): Use const char* for filename.
index a054a32..604c3a7 100644 (file)
@@ -35,9 +35,15 @@ SIM_OBJS = $(M68HC11_OBJS) \
         $(SIM_EXTRA_OBJS)
 
 SIM_PROFILE= -DPROFILE=1 -DWITH_PROFILE=-1
-SIM_EXTRA_CFLAGS = -DWITH_TARGET_WORD_BITSIZE=16 \
+# We must use 32-bit addresses to support memory bank switching.
+# The WORD_BITSIZE is normally 16 but must be switched (temporarily)
+# to 32 to avoid a bug in the sim-common which uses 'unsigned_word'
+# instead of 'address_word' in some places (the result is a truncation
+# of the 32-bit address to 16-bit; and this breaks the simulator).
+SIM_EXTRA_CFLAGS = -DWITH_TARGET_WORD_BITSIZE=32 \
                   -DWITH_TARGET_CELL_BITSIZE=32 \
-                  -DWITH_TARGET_WORD_MSB=15
+                  -DWITH_TARGET_ADDRESS_BITSIZE=32 \
+                  -DWITH_TARGET_WORD_MSB=31
 SIM_EXTRA_CLEAN = clean-extra
 
 SIM_EXTRA_OBJS = @m68hc11_extra_objs@
index 74674ce..3da382d 100644 (file)
@@ -295,7 +295,7 @@ sim_hw_configure (SIM_DESC sd)
 }
 
 static int
-sim_prepare_for_program (SIM_DESC sd, struct _bfd* abfd)
+sim_prepare_for_program (SIM_DESC sd, struct bfd* abfd)
 {
   sim_cpu *cpu;
 
@@ -341,7 +341,7 @@ sim_prepare_for_program (SIM_DESC sd, struct _bfd* abfd)
 
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind, host_callback *callback,
-          struct _bfd *abfd, char **argv)
+          struct bfd *abfd, char **argv)
 {
   SIM_DESC sd;
   sim_cpu *cpu;
@@ -486,7 +486,7 @@ sim_info (SIM_DESC sd, int verbose)
 }
 
 SIM_RC
-sim_create_inferior (SIM_DESC sd, struct _bfd *abfd,
+sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
                      char **argv, char **env)
 {
   return sim_prepare_for_program (sd, abfd);
@@ -554,8 +554,15 @@ sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
       val = 0;
       break;
     }
-  memory[0] = val >> 8;
-  memory[1] = val & 0x0FF;
+  if (size == 1)
+    {
+      memory[0] = val;
+    }
+  else
+    {
+      memory[0] = val >> 8;
+      memory[1] = val & 0x0FF;
+    }
   return size;
 }
 
index afa841f..be79bec 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-06-16  Andrew Cagney  <ac131313@redhat.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 79c7d2e..bf04ed9 100644 (file)
@@ -1901,7 +1901,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback * cb;
-     struct _bfd * abfd;
+     struct bfd * abfd;
      char ** argv;
 {
   int osize = sim_memory_size;
@@ -2009,7 +2009,7 @@ sim_load (sd, prog, abfd, from_tty)
 SIM_RC
 sim_create_inferior (sd, prog_bfd, argv, env)
      SIM_DESC sd;
-     struct _bfd * prog_bfd;
+     struct bfd * prog_bfd;
      char ** argv;
      char ** env;
 {
index 0482ab2..76c676c 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_open): 
+       (sim_create_inferior): 
+
 2003-01-14  Chris Demetriou  <cgd@broadcom.com>
 
        * mips.igen (LUXC1, SUXC1): New, for mipsV and mips64.
index b2828e0..f8c14c8 100644 (file)
@@ -326,7 +326,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   SIM_DESC sd = sim_state_alloc (kind, cb);
@@ -971,7 +971,7 @@ sim_fetch_register (sd,rn,memory,length)
 SIM_RC
 sim_create_inferior (sd, abfd, argv,env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
index 8a539c5..090b05c 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-06-16  Andrew Cagney  <ac131313@redhat.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index 43a8750..ea4e04f 100644 (file)
@@ -211,7 +211,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   struct simops *s;
@@ -717,7 +717,7 @@ sim_info (sd, verbose)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
index a53c8eb..9a5b602 100644 (file)
@@ -1,3 +1,19 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_open, sim_create_inferior, sim_open)
+       (sim_create_inferior): Rename _bfd to bfd.
+
+2003-02-26  Andrew Cagney  <cagney@redhat.com>
+
+       * am33.igen: Call sim_engine_abort instead of abort.
+
+2003-02-26  David Carlton  <carlton@math.stanford.edu>
+
+       * dv-mn103tim.c (read_special_timer6_reg): Add break after
+       empty default: label.
+       (write_special_timer6_reg): Ditto.
+       Update copyright.
+
 2002-11-28  Andrew Cagney  <cagney@redhat.com>
 
        * sim-main.h: Only include "idecode.h" once.
index a5745e2..db41889 100644 (file)
@@ -34,7 +34,7 @@
     case 4:
       return REG_MCVF;
     default:
-      abort ();
+      sim_engine_abort (SD, CPU, cia, "%s:%d: bad switch\n", __FILE__, __LINE__);
     }
 }
 
index cd79f91..9b1e0d2 100644 (file)
@@ -1,6 +1,6 @@
 /*  This file is part of the program GDB, the GNU debugger.
     
-    Copyright (C) 1998 Free Software Foundation, Inc.
+    Copyright (C) 1998, 2003 Free Software Foundation, Inc.
     Contributed by Cygnus Solutions.
     
     This program is free software; you can redistribute it and/or modify
@@ -495,6 +495,7 @@ read_special_timer6_reg (struct hw *me,
        break;
       
       default:
+       break;
       }
       break;
     }
@@ -950,6 +951,7 @@ write_special_timer6_reg (struct hw *me,
        break;
       
       default:
+       break;
       }
       break;
     }
index 2003c2d..fd93b6d 100644 (file)
@@ -312,7 +312,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   struct simops *s;
@@ -852,7 +852,7 @@ sim_info (sd, verbose)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {
@@ -946,7 +946,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   SIM_DESC sd = sim_state_alloc (kind, cb);
@@ -1170,7 +1170,7 @@ sim_close (sd, quitting)
 SIM_RC
 sim_create_inferior (sd, prog_bfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *prog_bfd;
+     struct bfd *prog_bfd;
      char **argv;
      char **env;
 {
index 26d0431..b625ac9 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * sim_calls.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-09-27  Andrew Cagney  <ac131313@redhat.com>
 
        * hw_disk.c (hw_disk_init_address): Set device type to "block",
index f2c2d19..22aa21b 100644 (file)
@@ -85,7 +85,7 @@ static host_callback *callbacks;
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind,
          host_callback *callback,
-         struct _bfd *abfd,
+         struct bfd *abfd,
          char **argv)
 {
   callbacks = callback;
@@ -244,7 +244,7 @@ sim_info (SIM_DESC sd, int verbose)
 
 SIM_RC
 sim_create_inferior (SIM_DESC sd,
-                    struct _bfd *abfd,
+                    struct bfd *abfd,
                     char **argv,
                     char **envp)
 {
index 60b41f7..007bf46 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (init_dsp, sim_open, sim_create_inferior): Rename _bfd
+       to bfd.
+
 Fri Oct 11 16:22:28 2002  J"orn Rennecke <joern.rennecke@superh.com>
 
        * interp.c (trap): Return int.  Take extra parameter for address
index 8e2445a..167fdd1 100644 (file)
@@ -226,22 +226,22 @@ op tab[] =
     "R[n] = (R[m] & 0xffff);",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fabs <FREG_N>", "1111nnnn01011101",
     "FP_UNARY (n, fabs);",
     "/* FIXME: FR(n) &= 0x7fffffff; */",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fadd <FREG_M>,<FREG_N>", "1111nnnnmmmm0000",
     "FP_OP (n, +, m);",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fcmp/eq <FREG_M>,<FREG_N>", "1111nnnnmmmm0100",
     "FP_CMP (n, ==, m);",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fcmp/gt <FREG_M>,<FREG_N>", "1111nnnnmmmm0101",
     "FP_CMP (n, >, m);",
   },
@@ -278,7 +278,7 @@ op tab[] =
     "}",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fdiv <FREG_M>,<FREG_N>", "1111nnnnmmmm0011",
     "FP_OP (n, /, m);",
     "/* FIXME: check for DP and (n & 1) == 0? */",
@@ -291,19 +291,19 @@ op tab[] =
     "/* FIXME: check for DP and (n & 1) == 0? */",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fldi0 <FREG_N>", "1111nnnn10001101",
     "SET_FR (n, (float)0.0);",
     "/* FIXME: check for DP and (n & 1) == 0? */",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fldi1 <FREG_N>", "1111nnnn10011101",
     "SET_FR (n, (float)1.0);",
     "/* FIXME: check for DP and (n & 1) == 0? */",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "flds <FREG_N>,FPUL", "1111nnnn00011101",
     "  union",
     "  {",
@@ -314,7 +314,7 @@ op tab[] =
     "  FPUL = u.i;",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "float FPUL,<FREG_N>", "1111nnnn00101101",
     /* sh4 */
     "if (FPSCR_PR)",
@@ -325,13 +325,13 @@ op tab[] =
     "}",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmac <FREG_0>,<FREG_M>,<FREG_N>", "1111nnnnmmmm1110",
     "SET_FR (n, FR(m) * FR(0) + FR(n));",
     "/* FIXME: check for DP and (n & 1) == 0? */",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov <FREG_M>,<FREG_N>", "1111nnnnmmmm1100",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -345,7 +345,7 @@ op tab[] =
     "  SET_FR (n, FR (m));",
     "}",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov.s <FREG_M>,@<REG_N>", "1111nnnnmmmm1010",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -358,7 +358,7 @@ op tab[] =
     "  WLAT (R[n], FI(m));",
     "}",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov.s @<REG_M>,<FREG_N>", "1111nnnnmmmm1000",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -371,7 +371,7 @@ op tab[] =
     "  SET_FI(n, RLAT(R[m]));",
     "}",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov.s @<REG_M>+,<FREG_N>", "1111nnnnmmmm1001",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -386,7 +386,7 @@ op tab[] =
     "  R[m] += 4;",
     "}",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov.s <FREG_M>,@-<REG_N>", "1111nnnnmmmm1011",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -401,7 +401,7 @@ op tab[] =
     "  WLAT (R[n], FI(m));",
     "}",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov.s @(R0,<REG_M>),<FREG_N>", "1111nnnnmmmm0110",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -414,7 +414,7 @@ op tab[] =
     "  SET_FI(n, RLAT(R[0] + R[m]));",
     "}",
   },
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmov.s <FREG_M>,@(R0,<REG_N>)", "1111nnnnmmmm0111",
     /* sh4 */
     "if (FPSCR_SZ) {",
@@ -430,12 +430,12 @@ op tab[] =
 
   /* sh4: See fmov instructions above for move to/from extended fp registers */
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fmul <FREG_M>,<FREG_N>", "1111nnnnmmmm0010",
     "FP_OP(n, *, m);",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fneg <FREG_N>", "1111nnnn01001101",
     "FP_UNARY(n, -);",
   },
@@ -455,12 +455,12 @@ op tab[] =
     "FP_UNARY(n, sqrt);",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fsub <FREG_M>,<FREG_N>", "1111nnnnmmmm0001",
     "FP_OP(n, -, m);",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "ftrc <FREG_N>, FPUL", "1111nnnn00111101",
     /* sh4 */
     "if (FPSCR_PR) {",
@@ -476,7 +476,7 @@ op tab[] =
     "  FPUL = (int)FR(n);",
   },
 
-  /* sh3e */
+  /* sh2e */
   { "", "", "fsts FPUL,<FREG_N>", "1111nnnn00001101",
     "  union",
     "  {",
@@ -561,11 +561,11 @@ op tab[] =
     "SREG (m) = RLAT(R[n]);",
     "R[n] += 4;",
   },
-  /* sh3e / sh-dsp (lds <REG_N>,DSR) */
+  /* sh2e / sh-dsp (lds <REG_N>,DSR) */
   { "", "n", "lds <REG_N>,FPSCR", "0100nnnn01101010",
     "SET_FPSCR(R[n]);",
   },
-  /* sh3e / sh-dsp (lds.l @<REG_N>+,DSR) */
+  /* sh2e / sh-dsp (lds.l @<REG_N>+,DSR) */
   { "", "n", "lds.l @<REG_N>+,FPSCR", "0100nnnn01100110",
     "MA (1);",
     "SET_FPSCR (RLAT(R[n]));",
index 8c2f359..887b7a6 100644 (file)
@@ -1424,7 +1424,7 @@ sim_size (power)
 
 static void
 init_dsp (abfd)
-     struct _bfd *abfd;
+     struct bfd *abfd;
 {
   int was_dsp = target_dsp;
   unsigned long mach = bfd_get_mach (abfd);
@@ -2140,7 +2140,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   char **p;
@@ -2239,7 +2239,7 @@ sim_load (sd, prog, abfd, from_tty)
 SIM_RC
 sim_create_inferior (sd, prog_bfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *prog_bfd;
+     struct bfd *prog_bfd;
      char **argv;
      char **env;
 {
index 5510497..9dcfd05 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * interp.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-11-30  Andrew Cagney  <cagney@redhat.com>
 
        * simops.c: Use int, 1, 0 instead of boolean, true and false.
index 85b1795..62a4616 100644 (file)
@@ -192,7 +192,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   SIM_DESC sd = sim_state_alloc (kind, cb);
@@ -297,7 +297,7 @@ sim_close (sd, quitting)
 SIM_RC
 sim_create_inferior (sd, prog_bfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *prog_bfd;
+     struct bfd *prog_bfd;
      char **argv;
      char **env;
 {
index 11e2a45..1bc783b 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-27  Andrew Cagney  <cagney@redhat.com>
+
+       * iface.c (sim_open, sim_create_inferior): Rename _bfd to bfd.
+
 2002-06-16  Andrew Cagney  <ac131313@redhat.com>
 
        * configure: Regenerated to track ../common/aclocal.m4 changes.
index c76d63f..5104172 100644 (file)
@@ -183,7 +183,7 @@ SIM_DESC
 sim_open (kind, cb, abfd, argv)
      SIM_OPEN_KIND kind;
      host_callback *cb;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
 {
   /* FIXME: The code in sim_load that determines the exact z8k arch
@@ -237,7 +237,7 @@ sim_load (sd, prog, abfd, from_tty)
 SIM_RC
 sim_create_inferior (sd, abfd, argv, env)
      SIM_DESC sd;
-     struct _bfd *abfd;
+     struct bfd *abfd;
      char **argv;
      char **env;
 {