This commit was manufactured by cvs2svn to create tag
'carlton_dictionary-20020927-merge'.

Sprout from carlton_dictionary-branch 2002-09-20 15:44:24 UTC nobody 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from carlton_dictionary-branch 2002-09-26 17:46:05 UTC nobody 'This commit was manufactured by cvs2svn to create branch':
    gdb/gdb.c
    gdb/main.h
    gdb/testsuite/gdb.base/pc-fp.c
    gdb/testsuite/gdb.base/pc-fp.exp
    gdb/testsuite/gdb.mi/config.in
    gdb/testsuite/gdb.mi/gdb669.exp
    gdb/testsuite/gdb.mi/mi-pthreads.exp
    gdb/testsuite/gdb.mi/pthreads.c
Cherrypick from master 2002-09-27 19:33:48 UTC David Carlton <carlton@bactrian.org> '2002-09-27  David Carlton  <carlton@math.stanford.edu>':
    ChangeLog
    Makefile.in
    bfd/ChangeLog
    bfd/Makefile.am
    bfd/Makefile.in
    bfd/bfd-in2.h
    bfd/config.bfd
    bfd/configure
    bfd/dwarf2.c
    bfd/elf-eh-frame.c
    bfd/elf32-i386.c
    bfd/elf32-ppc.c
    bfd/elf32-sparc.c
    bfd/elf64-alpha.c
    bfd/elf64-ppc.c
    bfd/elf64-sparc.c
    bfd/elf64-x86-64.c
    bfd/elfcode.h
    bfd/elflink.h
    bfd/elfxx-mips.c
    bfd/libbfd.h
    bfd/po/SRC-POTFILES.in
    bfd/reloc.c
    bfd/version.h
    configure
    configure.in
    gdb/ChangeLog
    gdb/MAINTAINERS
    gdb/Makefile.in
    gdb/NEWS
    gdb/breakpoint.c
    gdb/builtin-regs.c
    gdb/builtin-regs.h
    gdb/c-lang.c
    gdb/cli/cli-cmds.c
    gdb/complaints.c
    gdb/config/djgpp/fnchange.lst
    gdb/cris-tdep.c
    gdb/doc/ChangeLog
    gdb/doc/all-cfg.texi
    gdb/doc/gdb.texinfo
    gdb/eval.c
    gdb/expprint.c
    gdb/frame.c
    gdb/frame.h
    gdb/infcmd.c
    gdb/linespec.c
    gdb/main.c
    gdb/mcore-tdep.c
    gdb/mi/ChangeLog
    gdb/mi/gdbmi.texinfo
    gdb/mi/mi-cmd-disas.c
    gdb/mips-tdep.c
    gdb/ns32k-tdep.c
    gdb/ns32knbsd-tdep.c
    gdb/parse.c
    gdb/parser-defs.h
    gdb/rs6000-tdep.c
    gdb/scm-lang.c
    gdb/sh3-rom.c
    gdb/source.c
    gdb/source.h
    gdb/stack.c
    gdb/testsuite/ChangeLog
    gdb/testsuite/gdb.gdb/complaints.exp
    gdb/testsuite/gdb.mi/ChangeLog
    gdb/testsuite/gdb.mi/configure
    gdb/testsuite/gdb.mi/configure.in
    gdb/testsuite/lib/insight-support.exp
    gdb/top.c
    gdb/v850-tdep.c
    gdb/varobj.c
    gdb/vax-tdep.c
    gdb/version.in
    include/ChangeLog
    include/elf/x86-64.h
    libiberty/ChangeLog
    libiberty/Makefile.in
    opcodes/ChangeLog
    opcodes/Makefile.am
    opcodes/Makefile.in
    opcodes/mips-dis.c
    opcodes/po/POTFILES.in
    opcodes/po/de.po
    sim/v850/ChangeLog
    sim/v850/simops.c
Delete:
    include/regs/ChangeLog
diff --git a/ChangeLog b/ChangeLog
index d7043ca..a970f0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2002-09-25  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+	* Makefile.tpl: Make subsituted variables more autoconfy.
+	* Makefile.in: Regenerate.
+	* configure: Make seds more autoconfy.
+
+2002-09-25  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+	* Makefile.tpl: Rewrite substituted lines to look autoconfy.
+	* Makefile.in: Regenerate.
+	* configure.in: Rewrite sed statements to look autoconfy.
+
+	* Makefile.tpl: Autogenerate *-target-* lists, dependencies of
+	all-target-foo on configure-target-foo.
+	* Makefile.def: Ditto.
+	* Makefile.in: Rebuild.
+
+2002-09-22  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+	* Makefile.def: New file.
+	* Makefile.tpl: New file.
+	* Makefile.in: Generate from Makefile.tpl with 'autogen Makefile.def'.
+
+	* configure.in: Minor rearrangement.  Simplify tests.
+
+2002-09-23  Jason Thorpe  <thorpej@wasabisystems.com>
+
+	* configure.in (with_headers): Skip copy if value is "yes".
+	(with_libs): Likewise.
+
+2002-09-20  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+	* configure.in (*-*-netbsd*): Use noconfigdirs, not skipdirs.
+	* configure.in (sh*-*-pe*): Ditto.
+	* configure.in (mips*-*-pe*): Ditto.
+	* configure.in (*arm-wince-pe): Ditto.
+
+	* configure.in: Rearrange.
+
 2002-09-12  Nick Clifton  <nickc@redhat.com>
 
 	* Import these changes from the config master repository:
diff --git a/Makefile.in b/Makefile.in
index c37a505..d90547d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,3 +1,5 @@
+
+# Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
 #
 # Makefile for directory with subdirs to build.
 #   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
@@ -24,29 +26,29 @@
 NOTPARALLEL = .NOTPARALLEL
 $(NOTPARALLEL):
 
-srcdir = .
+srcdir = @srcdir@
 
-prefix = /usr/local
-exec_prefix = $(prefix)
+prefix = @prefix@
+exec_prefix = @exec_prefix@
 
-bindir=${exec_prefix}/bin
-sbindir=${exec_prefix}/sbin
-libexecdir=${exec_prefix}/libexec
-datadir=${prefix}/share
-sysconfdir=${prefix}/etc
-sharedstatedir=${prefix}/com
-localstatedir=${prefix}/var
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-oldincludedir=/usr/include
-infodir=${prefix}/info
-mandir=${prefix}/man
-gxx_include_dir=${includedir}/g++
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+includedir = @includedir@
+oldincludedir = @oldincludedir@
+infodir = @infodir@
+mandir = @mandir@
+gxx_include_dir=@gxx_include_dir@
 
-tooldir = $(exec_prefix)/$(target_alias)
-build_tooldir = $(exec_prefix)/$(target_alias)
+tooldir = @tooldir@
+build_tooldir = @build_tooldir@
 
-program_transform_name =
+program_transform_name = @program_transform_name@
 
 man1dir = $(mandir)/man1
 man2dir = $(mandir)/man2
@@ -57,13 +59,11 @@
 man7dir = $(mandir)/man7
 man8dir = $(mandir)/man8
 man9dir = $(mandir)/man9
-infodir = $(prefix)/info
-includedir = $(prefix)/include
 # Directory in which the compiler finds executables, libraries, etc.
 libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
 GDB_NLM_DEPS = 
 
-SHELL = /bin/sh
+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
@@ -128,9 +128,9 @@
 MD5PROG = md5sum
 
 # These values are substituted by configure.
-DEFAULT_YACC = yacc
-DEFAULT_LEX = lex
-DEFAULT_M4 = m4
+DEFAULT_YACC = @DEFAULT_YACC@
+DEFAULT_LEX = @DEFAULT_LEX@
+DEFAULT_M4 = @DEFAULT_M4@
 
 BISON = `if [ -f $$r/bison/bison ] ; then \
 	    echo $$r/bison/bison -L $$s/bison/ ; \
@@ -186,22 +186,22 @@
 
 # This is set by the configure script to the list of directories which
 # should be built using the target tools.
-TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib winsup opcodes libf2c libobjc
+TARGET_CONFIGDIRS = @target_configdirs@
 
 # Target libraries are put under this directory:
 # Changed by configure to $(target_alias) if cross.
-TARGET_SUBDIR = .
+TARGET_SUBDIR = @target_subdir@
 
 BUILD_CONFIGDIRS = libiberty
-BUILD_SUBDIR = .
+BUILD_SUBDIR = @build_subdir@
 
 # This is set by the configure script to the arguments to use when configuring
 # directories built for the target.
-TARGET_CONFIGARGS = 
+TARGET_CONFIGARGS = @target_configargs@
 
 # This is set by the configure script to the arguments to use when configuring
 # directories built for the build system.
-BUILD_CONFIGARGS =
+BUILD_CONFIGARGS = @build_configargs@
 
 # This is set by configure to REALLY_SET_LIB_PATH if --enable-shared
 # was used.
@@ -241,11 +241,11 @@
 	$(INSTALL_DOSREL)
 
 # Should be substed by configure.in
-FLAGS_FOR_TARGET =
-CC_FOR_TARGET =
-CXX_FOR_TARGET =
-CXX_FOR_TARGET_FOR_RECURSIVE_MAKE =
-GCJ_FOR_TARGET =
+FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
+CC_FOR_TARGET = @CC_FOR_TARGET@
+CXX_FOR_TARGET = @CXX_FOR_TARGET@
+CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @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
@@ -514,7 +514,7 @@
 # macro for build!=host builds.
 ALL_BUILD_MODULES_LIST = \
 	all-build-libiberty
-ALL_BUILD_MODULES = 
+ALL_BUILD_MODULES = @all_build_modules@
 
 # This is a list of the configure targets for all of the modules which
 # are compiled using the native tools.
@@ -529,6 +529,7 @@
 	all-automake \
 	all-bash \
 	all-bfd \
+	all-opcodes \
 	all-binutils \
 	all-bison \
 	all-byacc \
@@ -553,6 +554,7 @@
 	all-hello \
 	all-indent \
 	all-intl \
+	all-tcl \
 	all-itcl \
 	all-ld \
 	all-libgui \
@@ -561,7 +563,6 @@
 	all-m4 \
 	all-make \
 	all-mmalloc \
-	all-opcodes \
 	all-patch \
 	all-perl \
 	all-prms \
@@ -576,7 +577,6 @@
 	all-sim \
 	all-snavigator \
 	all-tar \
-	all-tcl \
 	all-texinfo \
 	all-textutils \
 	all-time \
@@ -605,6 +605,7 @@
 	check-automake \
 	check-bash \
 	check-bfd \
+	check-opcodes \
 	check-binutils \
 	check-bzip2 \
 	check-db \
@@ -624,6 +625,7 @@
 	check-hello \
 	check-indent \
 	check-intl \
+	check-tcl \
 	check-itcl \
 	check-ld \
 	check-libgui \
@@ -631,8 +633,6 @@
 	check-libtool \
 	check-m4 \
 	check-make \
-	check-mmcheckoc \
-	check-opcodes \
 	check-patch \
 	check-perl \
 	check-prms \
@@ -642,11 +642,10 @@
 	check-sed \
 	check-send-pr \
 	check-shellutils \
-	check-snavigator \
 	check-sid \
 	check-sim \
+	check-snavigator \
 	check-tar \
-	check-tcl \
 	check-texinfo \
 	check-textutils \
 	check-time \
@@ -669,11 +668,11 @@
 	install-automake \
 	install-bash \
 	install-bfd \
-	install-bzip2 \
 	install-opcodes \
 	install-binutils \
 	install-bison \
 	install-byacc \
+	install-bzip2 \
 	install-db \
 	install-dejagnu \
 	install-diff \
@@ -770,7 +769,7 @@
 	all-target-libjava \
 	all-target-zlib \
 	all-target-boehm-gc \
-	all-target-qthreads
+	all-target-qthreads 
 
 # This is a list of the configure targets for all of the modules which
 # are compiled using the target tools.
@@ -789,7 +788,7 @@
 	configure-target-libjava \
 	configure-target-zlib \
 	configure-target-boehm-gc \
-	configure-target-qthreads
+	configure-target-qthreads 
 
 # This is a list of the check targets for all of the modules which are
 # compiled using $(TARGET_FLAGS_TO_PASS).
@@ -800,12 +799,12 @@
 	check-target-libobjc \
 	check-target-winsup \
 	check-target-libiberty \
+	check-target-gperf \
 	check-target-libffi \
 	check-target-libjava \
 	check-target-zlib \
 	check-target-boehm-gc \
-	check-target-qthreads \
-	check-target-gperf
+	check-target-qthreads 
 
 # This is a list of the install targets for all of the modules which are
 # compiled using $(TARGET_FLAGS_TO_PASS).
@@ -818,11 +817,11 @@
 	install-target-winsup \
 	install-target-libgloss \
 	install-target-libiberty \
+	install-target-gperf \
 	install-target-libjava \
 	install-target-zlib \
 	install-target-boehm-gc \
-	install-target-qthreads \
-	install-target-gperf
+	install-target-qthreads 
 
 # This is a list of the targets for which we can do a clean-{target}.
 CLEAN_MODULES = \
@@ -831,6 +830,7 @@
 	clean-automake \
 	clean-bash \
 	clean-bfd \
+	clean-opcodes \
 	clean-binutils \
 	clean-bison \
 	clean-byacc \
@@ -855,6 +855,7 @@
 	clean-hello \
 	clean-indent \
 	clean-intl \
+	clean-tcl \
 	clean-itcl \
 	clean-ld \
 	clean-libgui \
@@ -863,7 +864,6 @@
 	clean-m4 \
 	clean-make \
 	clean-mmalloc \
-	clean-opcodes \
 	clean-patch \
 	clean-perl \
 	clean-prms \
@@ -878,14 +878,13 @@
 	clean-sim \
 	clean-snavigator \
 	clean-tar \
-	clean-tcl \
 	clean-texinfo \
 	clean-textutils \
 	clean-time \
 	clean-uudecode \
 	clean-wdiff \
 	clean-zip \
-	clean-zlib
+	clean-zlib 
 
 # All of the target modules that can be cleaned
 CLEAN_TARGET_MODULES = \
@@ -902,7 +901,7 @@
 	clean-target-libjava \
 	clean-target-zlib \
 	clean-target-boehm-gc \
-	clean-target-qthreads
+	clean-target-qthreads 
 
 # All of the x11 modules that can be cleaned
 CLEAN_X11_MODULES = \
@@ -1658,7 +1657,6 @@
 all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc all-intl
 all-bison: all-texinfo
 configure-target-boehm-gc: $(ALL_GCC_C) configure-target-qthreads
-all-target-boehm-gc: configure-target-boehm-gc
 all-byacc:
 all-bzip2:
 all-db:
@@ -1666,7 +1664,6 @@
 all-diff: all-libiberty
 all-etc:
 configure-target-examples: $(ALL_GCC_C)
-all-target-examples: configure-target-examples
 all-expect: all-tcl all-tk
 all-fileutils: all-libiberty
 all-findutils:
@@ -1676,12 +1673,12 @@
 all-gawk:
 all-gcc: all-bison all-byacc all-binutils all-gas all-ld all-zlib
 all-bootstrap: all-libiberty all-texinfo all-bison all-byacc all-binutils all-gas all-ld all-zlib
-GDB_TK = all-tk all-tcl all-itcl all-tix all-libgui
+GDB_TK = @GDB_TK@
 all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-bison all-byacc all-sim $(gdbnlmrequirements) $(GDB_TK)
 all-gettext:
 all-gnuserv:
 configure-target-gperf: $(ALL_GCC_CXX)
-all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++-v3
+all-target-gperf: all-target-libiberty all-target-libstdc++-v3
 all-gprof: all-libiberty all-bfd all-opcodes all-intl
 all-grep: all-libiberty
 all-gui: all-gdb all-libproc
@@ -1693,36 +1690,32 @@
 all-itcl: all-tcl all-tk
 all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex all-intl
 configure-target-libgloss: $(ALL_GCC)
-all-target-libgloss: configure-target-libgloss configure-target-newlib
+all-target-libgloss: configure-target-newlib
 all-libgui: all-tcl all-tk all-itcl
 all-libiberty:
 
 all-build-libiberty: configure-build-libiberty
 
 configure-target-libffi: $(ALL_GCC_C) 
-all-target-libffi: configure-target-libffi
 configure-target-libjava: $(ALL_GCC_C) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-libffi
-all-target-libjava: configure-target-libjava all-fastjar all-target-zlib all-target-boehm-gc all-target-qthreads all-target-libffi
+all-target-libjava: all-fastjar all-target-zlib all-target-boehm-gc all-target-qthreads all-target-libffi
 configure-target-libstdc++-v3: $(ALL_GCC_C)
-all-target-libstdc++-v3: configure-target-libstdc++-v3 all-target-libiberty
+all-target-libstdc++-v3: all-target-libiberty
 all-libtool:
 configure-target-libf2c: $(ALL_GCC_C)
-all-target-libf2c: configure-target-libf2c all-target-libiberty
+all-target-libf2c: all-target-libiberty
 configure-target-libobjc: $(ALL_GCC_C)
-all-target-libobjc: configure-target-libobjc all-target-libiberty
+all-target-libobjc: all-target-libiberty
 all-m4: all-libiberty all-texinfo
 all-make: all-libiberty
 all-mmalloc:
 configure-target-newlib: $(ALL_GCC)
-all-target-newlib: configure-target-newlib
 configure-target-libtermcap: $(ALL_GCC_C)
-all-target-libtermcap: configure-target-libtermcap
 all-opcodes: all-bfd all-libiberty
 all-patch: all-libiberty
 all-perl:
 all-prms: all-libiberty
 configure-target-qthreads: $(ALL_GCC_C)
-all-target-qthreads: configure-target-qthreads
 all-rcs:
 all-readline:
 all-recode: all-libiberty
@@ -1742,21 +1735,38 @@
 all-tix: all-tcl all-tk
 all-wdiff:
 configure-target-winsup: $(ALL_GCC_C)
-all-target-winsup: all-target-libiberty all-target-libtermcap configure-target-winsup
+all-target-winsup: all-target-libiberty all-target-libtermcap
 all-uudecode: all-libiberty
 all-zip:
 all-zlib:
 configure-target-zlib: $(ALL_GCC_C)
-all-target-zlib: configure-target-zlib
 all-fastjar: all-zlib all-libiberty
 configure-target-fastjar: configure-target-zlib
 all-target-fastjar: configure-target-fastjar all-target-zlib all-target-libiberty
 configure-target-libiberty: $(ALL_GCC_C)
-all-target-libiberty: configure-target-libiberty
 all-target: $(ALL_TARGET_MODULES)
 install-target: $(INSTALL_TARGET_MODULES)
 install-gdb: install-tcl install-tk install-itcl install-tix install-libgui
 install-sid: install-tcl install-tk
+
+# Dependencies of all-target-foo on configure-target-foo.
+all-target-libstdc++-v3: configure-target-libstdc++-v3
+all-target-newlib: configure-target-newlib
+all-target-libf2c: configure-target-libf2c
+all-target-libobjc: configure-target-libobjc
+all-target-libtermcap: configure-target-libtermcap
+all-target-winsup: configure-target-winsup
+all-target-libgloss: configure-target-libgloss
+all-target-libiberty: configure-target-libiberty
+all-target-gperf: configure-target-gperf
+all-target-examples: configure-target-examples
+all-target-libffi: configure-target-libffi
+all-target-libjava: configure-target-libjava
+all-target-zlib: configure-target-zlib
+all-target-boehm-gc: configure-target-boehm-gc
+all-target-qthreads: configure-target-qthreads
+
+
 ### other supporting targets
 
 MAKEDIRS= \
@@ -1787,6 +1797,10 @@
 # built are.
 TAGS: do-TAGS
 
+# Rebuilding Makefile.in, using autogen.
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def
+	cd $(srcdir) && autogen Makefile.def
+
 # with the gnu make, this is done automatically.
 
 Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag) $(gcc_version_trigger)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1bb5aa5..27bff18 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,90 @@
+2002-09-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* reloc.c: Add x86-64 TLS relocs.
+	* bfd-in2.h, libbfd.h: Rebuilt.
+	* elf64-x86-64.c (x86_64_elf_howto): Fix size fields for 32-bit
+	relocs.  Add TLS relocs.
+	(x86_64_reloc_map): Add TLS relocs.
+	(elf64_x86_64_info_to_howto): Adjust for added TLS relocs.
+	(struct elf64_x86_64_link_hash_entry): Add tls_type field.
+	(GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE): Define.
+	(elf64_x86_64_hash_entry): Define.
+	(struct elf64_x86_64_obj_tdata): New.
+	(elf64_x86_64_tdata, elf64_x86_64_local_got_tls_type): Define.
+	(struct elf64_x86_64_link_hash_table): Add tls_ld_got.
+	(link_hash_newfunc): Initialize tls_type.
+	(elf64_x86_64_link_hash_table_create): Initialize tls_ld_got.
+	(elf64_x86_64_copy_indirect_symbol): Swap tls_type if necessary.
+	(elf64_x86_64_mkobject): New.
+	(elf64_x86_64_elf_object_p): Allocate struct elf64_x86_64_obj_tdata.
+	(elf64_x86_64_tls_transition): New.
+	(elf64_x86_64_check_relocs): Add r_type variable and use it.
+	Handle TLS relocs.
+	(elf64_x86_64_gc_sweep_hook): Handle TLS relocs.
+	(allocate_dynrelocs): Allocate GOT space for TLS relocs.
+	(elf64_x86_64_size_dynamic_sections): Likewise.
+	(dtpoff_base, tpoff): New.
+	(elf64_x86_64_relocate_section): Handle TLS relocs.
+	(elf64_x86_64_finish_dynamic_symbol): Only handle non-TLS GOT
+	entries.
+	(bfd_elf64_mkobject): Define.
+
+	* elf32-i386.c (elf_i386_check_relocs) [R_386_TLS_LE]: Set
+	DF_STATIC_TLS if shared.
+
+2002-09-26  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+	* elfxx-mips.c (_bfd_mips_elf_fake_sections): Don't emit unneeded
+	empty relocation sections.
+
+2002-09-26  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf64-ppc.c (ppc_build_one_stub): Don't build glink stubs here.
+	(ppc64_elf_build_stubs): Build them here instead.
+
+2002-09-24  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE
+	addend into r_addend, not *r_offset.
+	(elf32_sparc_finish_dynamic_symbol): Likewise.
+	* elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
+	R_SPARC_RELATIVE's r_offset.
+
+2002-09-23  Nathan Tallent  <eraxxon@alumni.rice.edu>
+
+	* dwarf2.c (decode_line_info): Update to correctly decode
+	the (non-standard DWARF2) out-of-order address sequences
+	generated by the Intel C++ 6.0 compiler for ia64-Linux.
+
+2002-09-23  Mark Elbrecht  <snowball3@softhome.net>
+
+	* config.bfd: For DJGPP targets, match with any cpu and any machine.
+
+2002-09-23  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
+	for discarded FDEs.  Remove redundant assignment.
+	* elflink.h (elf_bfd_discard_info): Save edited relocs.
+
+2002-09-22  H.J. Lu <hjl@gnu.org>
+
+	* elf64-alpha.c (elf64_alpha_merge_ind_symbols): Don't merge
+	the relocation count between different .reloc sections.
+
+2002-09-21  Alan Modra  <amodra@bigpond.net.au>
+
+	* elf32-ppc.c (ppc_elf_relocate_section): Allow ".sbss.*" and
+	".sdata.*" for R_PPC_SDAREL16, ".sbss2*" and ".sdata2*" for
+	R_PPC_EMB_SDA2REL.  Similarly for R_PPC_EMB_SDA21 and
+	R_PPC_EMB_RELSDA.
+
+	* elfcode.h (elf_slurp_reloc_table_from_section): Make "symcount"
+	unsigned.  Move "symcount" assignment out of loop.
+	* Makefile.am: Run "make dep-am".
+	* Makefile.in: Regenerate.
+	* configure: Regenerate.
+	* po/SRC-POTFILES.in: Regnerate.
+
 2002-09-19  Nathan Tallent  <eraxxon@alumni.rice.edu>
 
 	* dwarf2.c (_bfd_dwarf2_find_nearest_line): If address length is
@@ -137,6 +224,10 @@
 	* elf32-arm.h (elf32_arm_final_link_relocate): Fix handling of
 	R_ARM_THM_PC11.
 
+2002-09-11  Jeffrey Law  <law@redhat.com>
+
+	* elf32-h8300.c (elf32_h8_relax_section): Fix typo.
+
 2002-09-11  Andrew Haley  <aph@cambridge.redhat.com>
 
 	* elf.c (_bfd_elf_find_nearest_line): Check functionname_ptr and
@@ -1776,7 +1867,7 @@
 	* elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved
 	relocs in opd for non-shared too.
 
-2002-06-06  Jeffrey Law <law@redhat.com
+2002-06-06  Jeffrey Law  <law@redhat.com>
 
 	* elf32-h8300.c (elf32_h8_relax_section): Ignore uninteresting
 	relocations.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index cb57074..0aa98e3 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -1168,10 +1168,10 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
-elf32-i386-fbsd.lo: elf32-i386-fbsd.c elf32-i386.c $(INCDIR)/filenames.h \
-  $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
-  $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
-  $(INCDIR)/elf/reloc-macros.h elf32-target.h
+elf32-i386-fbsd.lo: elf32-i386-fbsd.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-i386.c \
+  $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
@@ -1533,13 +1533,13 @@
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
   libecoff.h ecoffswap.h elf64-target.h
-elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c elf64-alpha.c $(INCDIR)/filenames.h \
+elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c $(INCDIR)/filenames.h \
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
-  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/alpha.h \
-  $(INCDIR)/elf/reloc-macros.h $(INCDIR)/coff/internal.h \
-  $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
-  $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
-  libecoff.h ecoffswap.h elf64-target.h
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf64-alpha.c \
+  $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
+  $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
+  libcoff.h libecoff.h ecoffswap.h elf64-target.h
 elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
   $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 2da51c8..4816c17 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -344,6 +344,7 @@
 	elf32-hppa.lo \
 	elf32-i370.lo \
 	elf32-i386.lo \
+	elf32-i386-fbsd.lo \
 	elf32-i386qnx.lo \
 	elf32-i860.lo \
 	elf32-i960.lo \
@@ -507,6 +508,7 @@
 	elf32-hppa.c \
 	elf32-i370.c \
 	elf32-i386.c \
+	elf32-i386-fbsd.c \
 	elf32-i386qnx.c \
 	elf32-i860.c \
 	elf32-i960.c \
@@ -617,6 +619,7 @@
 	efi-app-ia64.lo \
 	elf64-x86-64.lo \
 	elf64-alpha.lo \
+	elf64-alpha-fbsd.lo \
 	elf64-hppa.lo \
 	elf64-ia64.lo \
 	elf64-gen.lo \
@@ -644,6 +647,7 @@
 	efi-app-ia64.c \
 	elf64-x86-64.c \
 	elf64-alpha.c \
+	elf64-alpha-fbsd.c \
 	elf64-hppa.c \
 	elf64-gen.c \
 	elfn32-mips.c \
@@ -1694,6 +1698,10 @@
   elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
   $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h \
   elf32-target.h
+elf32-i386-fbsd.lo: elf32-i386-fbsd.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-i386.c \
+  $(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
 elf32-i386qnx.lo: elf32-i386qnx.c elf32-i386.c $(INCDIR)/filenames.h \
   $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/i386.h \
@@ -2055,6 +2063,13 @@
   $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \
   $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h libcoff.h \
   libecoff.h ecoffswap.h elf64-target.h
+elf64-alpha-fbsd.lo: elf64-alpha-fbsd.c $(INCDIR)/filenames.h \
+  elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
+  $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf64-alpha.c \
+  $(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
+  $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
+  $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
+  libcoff.h libecoff.h ecoffswap.h elf64-target.h
 elf64-hppa.lo: elf64-hppa.c $(INCDIR)/alloca-conf.h \
   $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
   $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 0525594..c7dfe33 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2286,6 +2286,14 @@
   BFD_RELOC_X86_64_RELATIVE,
   BFD_RELOC_X86_64_GOTPCREL,
   BFD_RELOC_X86_64_32S,
+  BFD_RELOC_X86_64_DTPMOD64,
+  BFD_RELOC_X86_64_DTPOFF64,
+  BFD_RELOC_X86_64_TPOFF64,
+  BFD_RELOC_X86_64_TLSGD,
+  BFD_RELOC_X86_64_TLSLD,
+  BFD_RELOC_X86_64_DTPOFF32,
+  BFD_RELOC_X86_64_GOTTPOFF,
+  BFD_RELOC_X86_64_TPOFF32,
 
 /* ns32k relocations  */
   BFD_RELOC_NS32K_IMM_8,
diff --git a/bfd/config.bfd b/bfd/config.bfd
index c76157f..4aabfed 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -377,7 +377,7 @@
   i[3456]86-*-chorus*)
     targ_defvec=bfd_elf32_i386_vec
     ;;
-  i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
+  *-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
     targ_defvec=go32coff_vec
     targ_selvecs="go32stubbedcoff_vec i386aout_vec"
     ;;
diff --git a/bfd/configure b/bfd/configure
index f41efc7..2ca10f7 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -6075,6 +6075,7 @@
     bfd_elf32_hppa_linux_vec)	tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_hppa_vec)		tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
     bfd_elf32_i370_vec)		tb="$tb elf32-i370.lo elf32.lo $elf" ;;
+    bfd_elf32_i386_freebsd_vec)	tb="$tb elf32-i386-fbsd.lo elf32.lo $elf" ;;
     bfd_elf32_i386_vec)		tb="$tb elf32-i386.lo elf32.lo $elf" ;;
     bfd_elf32_i386qnx_vec)	tb="$tb elf32-i386qnx.lo elf32.lo $elf" ;;
     bfd_elf32_i860_little_vec)	tb="$tb elf32-i860.lo elf32.lo $elf" ;;
@@ -6133,6 +6134,7 @@
     bfd_elf32_v850_vec)		tb="$tb elf32-v850.lo elf32.lo $elf" ;;
     bfd_elf32_vax_vec)		tb="$tb elf32-vax.lo elf32.lo $elf" ;;
     bfd_elf32_xstormy16_vec)	tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
+    bfd_elf64_alpha_freebsd_vec) tb="$tb elf64-alpha-fbsd.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_alpha_vec)	tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_big_generic_vec) 	tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_bigmips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
@@ -6338,10 +6340,10 @@
     if test -n "$GCC" ; then
        bad_64bit_gcc=no;
        echo $ac_n "checking for gcc version with buggy 64-bit support""... $ac_c" 1>&6
-echo "configure:6342: checking for gcc version with buggy 64-bit support" >&5
+echo "configure:6344: checking for gcc version with buggy 64-bit support" >&5
        # Add more tests for gcc versions with non-working 64-bit support here.
        cat > conftest.$ac_ext <<EOF
-#line 6345 "configure"
+#line 6347 "configure"
 #include "confdefs.h"
 :__GNUC__:__GNUC_MINOR__:__i386__:
 EOF
@@ -6386,17 +6388,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6390: checking for $ac_hdr" >&5
+echo "configure:6392: 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 6395 "configure"
+#line 6397 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6402: \"$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*
@@ -6425,12 +6427,12 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6429: checking for $ac_func" >&5
+echo "configure:6431: 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 6434 "configure"
+#line 6436 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6453,7 +6455,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6459: \"$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
@@ -6478,7 +6480,7 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:6482: checking for working mmap" >&5
+echo "configure:6484: 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
@@ -6486,7 +6488,7 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 6490 "configure"
+#line 6492 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -6639,7 +6641,7 @@
 }
 
 EOF
-if { (eval echo configure:6643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6645: \"$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
@@ -6664,12 +6666,12 @@
 for ac_func in madvise mprotect
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6668: checking for $ac_func" >&5
+echo "configure:6670: 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 6673 "configure"
+#line 6675 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6692,7 +6694,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6698: \"$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
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 1cdd461..7c000b9 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -13,21 +13,21 @@
    based on Fred Fish's (Cygnus Support) implementation of DWARF 1
    support in dwarfread.c
 
-This file is part of BFD.
+   This file is part of BFD.
 
-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"
@@ -1084,13 +1084,19 @@
     {
       /* State machine registers.  */
       bfd_vma address = 0;
-      char* filename = concat_filename (table, 1);
+      char * filename = concat_filename (table, 1);
       unsigned int line = 1;
       unsigned int column = 0;
       int is_stmt = lh.default_is_stmt;
       int basic_block = 0;
-      int end_sequence = 0, need_low_pc = 1;
-      bfd_vma low_pc = 0;
+      int end_sequence = 0;
+      /* eraxxon@alumni.rice.edu: Against the DWARF2 specs, some
+         compilers generate address sequences that are wildly out of
+         order using DW_LNE_set_address (e.g. Intel C++ 6.0 compiler
+         for ia64-Linux).  Thus, to determine the low and high
+         address, we must compare on every DW_LNS_copy, etc.  */
+      bfd_vma low_pc  = 0;
+      bfd_vma high_pc = 0;
 
       /* Decode the table.  */
       while (! end_sequence)
@@ -1099,7 +1105,8 @@
 	  line_ptr += 1;
 
 	  if (op_code >= lh.opcode_base)
-	    {		/* Special operand.  */
+	    {
+	      /* Special operand.  */
 	      adj_opcode = op_code - lh.opcode_base;
 	      address += (adj_opcode / lh.line_range)
 		* lh.minimum_instruction_length;
@@ -1107,30 +1114,30 @@
 	      /* Append row to matrix using current values.  */
 	      add_line_info (table, address, filename, line, column, 0);
 	      basic_block = 1;
-	      if (need_low_pc)
-		{
-		  need_low_pc = 0;
-		  low_pc = address;
-		}
+	      if (low_pc == 0 || address < low_pc)
+		low_pc = address;
+	      if (address > high_pc)
+		high_pc = address;
 	    }
 	  else switch (op_code)
 	    {
 	    case DW_LNS_extended_op:
-	      line_ptr += 1;	/* Ignore length.  */
+	      /* Ignore length.  */
+	      line_ptr += 1;
 	      extended_op = read_1_byte (abfd, line_ptr);
 	      line_ptr += 1;
+
 	      switch (extended_op)
 		{
 		case DW_LNE_end_sequence:
 		  end_sequence = 1;
 		  add_line_info (table, address, filename, line, column,
 				 end_sequence);
-		  if (need_low_pc)
-		    {
-		      need_low_pc = 0;
-		      low_pc = address;
-		    }
-		  arange_add (unit, low_pc, address);
+		  if (low_pc == 0 || address < low_pc)
+		    low_pc = address;
+		  if (address > high_pc)
+		    high_pc = address;
+		  arange_add (unit, low_pc, high_pc);
 		  break;
 		case DW_LNE_set_address:
 		  address = read_address (unit, line_ptr);
@@ -1169,11 +1176,10 @@
 	    case DW_LNS_copy:
 	      add_line_info (table, address, filename, line, column, 0);
 	      basic_block = 0;
-	      if (need_low_pc)
-		{
-		  need_low_pc = 0;
-		  low_pc = address;
-		}
+	      if (low_pc == 0 || address < low_pc)
+		low_pc = address;
+	      if (address > high_pc)
+		high_pc = address;
 	      break;
 	    case DW_LNS_advance_pc:
 	      address += lh.minimum_instruction_length
@@ -1188,8 +1194,8 @@
 	      {
 		unsigned int file;
 
-		/* The file and directory tables are 0 based, the references
-		   are 1 based.  */
+		/* The file and directory tables are 0
+		   based, the references are 1 based.  */
 		file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
 		line_ptr += bytes_read;
 		filename = concat_filename (table, file);
@@ -1214,8 +1220,9 @@
 	      line_ptr += 2;
 	      break;
 	    default:
-	      {  /* Unknown standard opcode, ignore it.  */
+	      {
 		int i;
+		/* Unknown standard opcode, ignore it.  */
 		for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
 		  {
 		    (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
@@ -1234,10 +1241,7 @@
    LINENUMBER_PTR, are pointers to the objects to be filled in.  */
 
 static boolean
-lookup_address_in_line_info_table (table,
-				   addr,
-				   function,
-				   filename_ptr,
+lookup_address_in_line_info_table (table, addr, function, filename_ptr,
 				   linenumber_ptr)
      struct line_info_table* table;
      bfd_vma addr;
@@ -1298,9 +1302,7 @@
 /* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true.  */
 
 static boolean
-lookup_address_in_function_table (table,
-				  addr,
-				  function_ptr,
+lookup_address_in_function_table (table, addr, function_ptr,
 				  functionname_ptr)
      struct funcinfo* table;
      bfd_vma addr;
@@ -1666,9 +1668,8 @@
    false otherwise.  */
 
 static boolean
-comp_unit_find_nearest_line (unit, addr,
-			     filename_ptr, functionname_ptr, linenumber_ptr,
-			     stash)
+comp_unit_find_nearest_line (unit, addr, filename_ptr, functionname_ptr,
+			     linenumber_ptr, stash)
      struct comp_unit* unit;
      bfd_vma addr;
      const char **filename_ptr;
@@ -1708,26 +1709,23 @@
     }
 
   function = NULL;
-  func_p = lookup_address_in_function_table (unit->function_table,
-					     addr,
-					     &function,
-					     functionname_ptr);
-  line_p = lookup_address_in_line_info_table (unit->line_table,
-					      addr,
-					      function,
-					      filename_ptr,
+  func_p = lookup_address_in_function_table (unit->function_table, addr,
+					     &function, functionname_ptr);
+  line_p = lookup_address_in_line_info_table (unit->line_table, addr,
+					      function, filename_ptr,
 					      linenumber_ptr);
   return line_p || func_p;
 }
 
-/* Locate a section in a BFD containing debugging info.  The search starts from the
-   section after AFTER_SEC, or from the first section in the BFD if AFTER_SEC is
-   NULL.  The search works by examining the names of the sections.  There are two
-   permissiable names.  The first is .debug_info.  This is the standard DWARF2 name.
-   The second is a prefix .gnu.linkonce.wi.  This is a variation on the .debug_info
-   section which has a checksum describing the contents appended onto the name.  This
-   allows the linker to identify and discard duplicate debugging sections for
-   different compilation units.  */
+/* Locate a section in a BFD containing debugging info.  The search starts
+   from the section after AFTER_SEC, or from the first section in the BFD if
+   AFTER_SEC is NULL.  The search works by examining the names of the
+   sections.  There are two permissiable names.  The first is .debug_info.
+   This is the standard DWARF2 name.  The second is a prefix .gnu.linkonce.wi.
+   This is a variation on the .debug_info section which has a checksum
+   describing the contents appended onto the name.  This allows the linker to
+   identify and discard duplicate debugging sections for different
+   compilation units.  */
 #define DWARF2_DEBUG_INFO ".debug_info"
 #define GNU_LINKONCE_INFO ".gnu.linkonce.wi."
 
@@ -1766,8 +1764,7 @@
 boolean
 _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
 			       filename_ptr, functionname_ptr,
-			       linenumber_ptr,
-			       addr_size, pinfo)
+			       linenumber_ptr, addr_size, pinfo)
      bfd *abfd;
      asection *section;
      asymbol **symbols;
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index eb4a69b..e80fc6c 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -632,11 +632,11 @@
 	    goto free_no_table;
 	  if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
 	    {
-	      cookie->rel = rel;
 	      /* This is a FDE against discarded section, it should
 		 be deleted.  */
 	      new_size -= hdr.length + 4;
 	      sec_info->entry[sec_info->count].removed = 1;
+	      memset (rel, 0, sizeof (*rel));
 	    }
 	  else
 	    {
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index d52d5a7..b71d78e 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1057,6 +1057,7 @@
 	case R_386_TLS_LE:
 	  if (!info->shared)
 	    break;
+	  info->flags |= DF_STATIC_TLS;
 	  /* Fall through */	    
 
 	case R_386_32:
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index a2a0a6d..6faffd20 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -3483,8 +3483,10 @@
 
 	    BFD_ASSERT (sec != (asection *) 0);
 	    name = bfd_get_section_name (abfd, sec->output_section);
-	    if (strcmp (name, ".sdata") != 0
-		&& strcmp (name, ".sbss") != 0)
+	    if (! ((strncmp (name, ".sdata", 6) == 0
+		    && (name[6] == 0 || name[6] == '.'))
+		   || (strncmp (name, ".sbss", 5) == 0
+		       && (name[5] == 0 || name[5] == '.'))))
 	      {
 		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
 				       bfd_archive_filename (input_bfd),
@@ -3505,7 +3507,8 @@
 
 	    BFD_ASSERT (sec != (asection *) 0);
 	    name = bfd_get_section_name (abfd, sec->output_section);
-	    if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
+	    if (! (strncmp (name, ".sdata2", 7) == 0
+		   || strncmp (name, ".sbss2", 6) == 0))
 	      {
 		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
 				       bfd_archive_filename (input_bfd),
@@ -3532,7 +3535,10 @@
 
 	    BFD_ASSERT (sec != (asection *) 0);
 	    name = bfd_get_section_name (abfd, sec->output_section);
-	    if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)
+	    if (((strncmp (name, ".sdata", 6) == 0	
+		  && (name[6] == 0 || name[6] == '.'))
+		 || (strncmp (name, ".sbss", 5) == 0
+		     && (name[5] == 0 || name[5] == '.'))))
 	      {
 		reg = 13;
 		addend -= (sdata->sym_hash->root.u.def.value
@@ -3540,8 +3546,8 @@
 			   + sdata->sym_hash->root.u.def.section->output_offset);
 	      }
 
-	    else if (strcmp (name, ".sdata2") == 0
-		     || strcmp (name, ".sbss2") == 0)
+	    else if (strncmp (name, ".sdata2", 7) == 0
+		     || strncmp (name, ".sbss2", 6) == 0)
 	      {
 		reg = 2;
 		addend -= (sdata2->sym_hash->root.u.def.value
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 4c9b3d4..be2733d 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1281,7 +1281,6 @@
 		off &= ~1;
 	      else
 		{
-		  bfd_put_32 (output_bfd, relocation, sgot->contents + off);
 
 		  if (info->shared)
 		    {
@@ -1297,7 +1296,8 @@
 					 + sgot->output_offset
 					 + off);
 		      outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
-		      outrel.r_addend = 0;
+		      outrel.r_addend = relocation;
+		      relocation = 0;
 		      bfd_elf32_swap_reloca_out (output_bfd, &outrel,
 						 (((Elf32_External_Rela *)
 						   srelgot->contents)
@@ -1305,6 +1305,7 @@
 		      ++srelgot->reloc_count;
 		    }
 
+		  bfd_put_32 (output_bfd, relocation, sgot->contents + off);
 		  local_got_offsets[r_symndx] |= 1;
 		}
 	    }
@@ -1810,14 +1811,21 @@
       if (info->shared
 	  && (info->symbolic || h->dynindx == -1)
 	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
-	rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
+	{
+	  asection *sec = h->root.u.def.section;
+	  rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
+	  rela.r_addend = (h->root.u.def.value
+			   + sec->output_section->vma
+			   + sec->output_offset);
+	}
       else
 	{
-	  bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
 	  rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
+	  rela.r_addend = 0;
 	}
 
-      rela.r_addend = 0;
+      bfd_put_32 (output_bfd, (bfd_vma) 0,
+		  sgot->contents + (h->got.offset &~ (bfd_vma) 1));
       bfd_elf32_swap_reloca_out (output_bfd, &rela,
 				 ((Elf32_External_Rela *) srela->contents
 				  + srela->reloc_count));
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index af99b35..e1d095d 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -3403,7 +3403,7 @@
 	{
 	  rin = ri->next;
 	  for (rs = rsh; rs ; rs = rs->next)
-	    if (ri->rtype == rs->rtype)
+	    if (ri->rtype == rs->rtype && ri->srel == rs->srel)
 	      {
 		rs->count += ri->count;
 		goto found_reloc;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index d9f8626..91610aa 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4464,27 +4464,6 @@
       break;
 
     case ppc_stub_plt_call:
-      /* Build the .glink lazy link call stub.  */
-      p = htab->sglink->contents + htab->sglink->_cooked_size;
-      indx = htab->sglink->reloc_count;
-      if (indx < 0x8000)
-	{
-	  bfd_put_32 (htab->sglink->owner, LI_R0_0 | indx, p);
-	  p += 4;
-	}
-      else
-	{
-	  bfd_put_32 (htab->sglink->owner, LIS_R0_0 | PPC_HI (indx), p);
-	  p += 4;
-	  bfd_put_32 (htab->sglink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
-	  p += 4;
-	}
-      bfd_put_32 (htab->sglink->owner,
-		  B_DOT | ((htab->sglink->contents - p) & 0x3fffffc), p);
-      p += 4;
-      htab->sglink->_cooked_size = p - htab->sglink->contents;
-      htab->sglink->reloc_count += 1;
-
       /* Do the best we can for shared libraries built without
 	 exporting ".foo" for each "foo".  This can happen when symbol
 	 versioning scripts strip all bar a subset of symbols.  */
@@ -5149,6 +5128,8 @@
 
   if (htab->splt != NULL)
     {
+      unsigned int indx;
+
       /* Build the .glink plt call stub.  */
       plt_r2 = (htab->splt->output_offset
 		+ htab->splt->output_section->vma
@@ -5156,15 +5137,33 @@
 		- TOC_BASE_OFF);
       p = htab->sglink->contents;
       p = build_plt_stub (htab->sglink->owner, p, (int) plt_r2, 1);
-      while (p - htab->sglink->contents < GLINK_CALL_STUB_SIZE)
+      while (p < htab->sglink->contents + GLINK_CALL_STUB_SIZE)
 	{
 	  bfd_put_32 (htab->sglink->owner, NOP, p);
 	  p += 4;
 	}
-      htab->sglink->_cooked_size = p - htab->sglink->contents;
 
-      /* Use reloc_count to count entries.  */
-      htab->sglink->reloc_count = 0;
+      /* Build the .glink lazy link call stubs.  */
+      indx = 0;
+      while (p < htab->sglink->contents + htab->sglink->_raw_size)
+	{
+	  if (indx < 0x8000)
+	    {
+	      bfd_put_32 (htab->sglink->owner, LI_R0_0 | indx, p);
+	      p += 4;
+	    }
+	  else
+	    {
+	      bfd_put_32 (htab->sglink->owner, LIS_R0_0 | PPC_HI (indx), p);
+	      p += 4;
+	      bfd_put_32 (htab->sglink->owner, ORI_R0_R0_0 | PPC_LO (indx), p);
+	      p += 4;
+	    }
+	  bfd_put_32 (htab->sglink->owner,
+		      B_DOT | ((htab->sglink->contents - p) & 0x3fffffc), p);
+	  p += 4;
+	}
+      htab->sglink->_cooked_size = p - htab->sglink->contents;
     }
 
   if (htab->sbrlt->_raw_size != 0)
@@ -5177,7 +5176,6 @@
 
   /* Build the stubs as directed by the stub hash table.  */
   bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info);
-  htab->sglink->reloc_count = 0;
 
   for (stub_sec = htab->stub_bfd->sections;
        stub_sec != NULL;
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 764b0d7..f79d76c 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -2727,11 +2727,12 @@
 	}
       else
 	{
-	  bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
 	  rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
 	  rela.r_addend = 0;
 	}
 
+      bfd_put_64 (output_bfd, (bfd_vma) 0,
+		  sgot->contents + (h->got.offset &~ (bfd_vma) 1));
       bfd_elf64_swap_reloca_out (output_bfd, &rela,
 				 ((Elf64_External_Rela *) srela->contents
 				  + srela->reloc_count));
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 9c4a9d4..fa2f2ee 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -40,16 +40,16 @@
   HOWTO(R_X86_64_64, 0, 4, 64, false, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_64", false, MINUS_ONE, MINUS_ONE,
 	false),
-  HOWTO(R_X86_64_PC32, 0, 4, 32, true, 0, complain_overflow_signed,
+  HOWTO(R_X86_64_PC32, 0, 2, 32, true, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_PC32", false, 0xffffffff, 0xffffffff,
 	true),
-  HOWTO(R_X86_64_GOT32, 0, 4, 32, false, 0, complain_overflow_signed,
+  HOWTO(R_X86_64_GOT32, 0, 2, 32, false, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_GOT32", false, 0xffffffff, 0xffffffff,
 	false),
-  HOWTO(R_X86_64_PLT32, 0, 4, 32, true, 0, complain_overflow_signed,
+  HOWTO(R_X86_64_PLT32, 0, 2, 32, true, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_PLT32", false, 0xffffffff, 0xffffffff,
 	true),
-  HOWTO(R_X86_64_COPY, 0, 4, 32, false, 0, complain_overflow_bitfield,
+  HOWTO(R_X86_64_COPY, 0, 2, 32, false, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_COPY", false, 0xffffffff, 0xffffffff,
 	false),
   HOWTO(R_X86_64_GLOB_DAT, 0, 4, 64, false, 0, complain_overflow_bitfield,
@@ -61,13 +61,13 @@
   HOWTO(R_X86_64_RELATIVE, 0, 4, 64, false, 0, complain_overflow_bitfield,
 	bfd_elf_generic_reloc, "R_X86_64_RELATIVE", false, MINUS_ONE,
 	MINUS_ONE, false),
-  HOWTO(R_X86_64_GOTPCREL, 0, 4, 32, true,0 , complain_overflow_signed,
+  HOWTO(R_X86_64_GOTPCREL, 0, 2, 32, true, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_GOTPCREL", false, 0xffffffff,
 	0xffffffff, true),
-  HOWTO(R_X86_64_32, 0, 4, 32, false, 0, complain_overflow_unsigned,
+  HOWTO(R_X86_64_32, 0, 2, 32, false, 0, complain_overflow_unsigned,
 	bfd_elf_generic_reloc, "R_X86_64_32", false, 0xffffffff, 0xffffffff,
 	false),
-  HOWTO(R_X86_64_32S, 0, 4, 32, false, 0, complain_overflow_signed,
+  HOWTO(R_X86_64_32S, 0, 2, 32, false, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_32S", false, 0xffffffff, 0xffffffff,
 	false),
   HOWTO(R_X86_64_16, 0, 1, 16, false, 0, complain_overflow_bitfield,
@@ -78,6 +78,30 @@
 	bfd_elf_generic_reloc, "R_X86_64_8", false, 0xff, 0xff, false),
   HOWTO(R_X86_64_PC8, 0, 0, 8, true, 0, complain_overflow_signed,
 	bfd_elf_generic_reloc, "R_X86_64_PC8", false, 0xff, 0xff, true),
+  HOWTO(R_X86_64_DTPMOD64, 0, 4, 64, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_X86_64_DTPMOD64", false, MINUS_ONE,
+	MINUS_ONE, false),
+  HOWTO(R_X86_64_DTPOFF64, 0, 4, 64, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_X86_64_DTPOFF64", false, MINUS_ONE,
+	MINUS_ONE, false),
+  HOWTO(R_X86_64_TPOFF64, 0, 4, 64, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_X86_64_TPOFF64", false, MINUS_ONE,
+	MINUS_ONE, false),
+  HOWTO(R_X86_64_TLSGD, 0, 2, 32, true, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_X86_64_TLSGD", false, 0xffffffff,
+	0xffffffff, true),
+  HOWTO(R_X86_64_TLSLD, 0, 2, 32, true, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_X86_64_TLSLD", false, 0xffffffff,
+	0xffffffff, true),
+  HOWTO(R_X86_64_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield,
+	bfd_elf_generic_reloc, "R_X86_64_DTPOFF32", false, 0xffffffff,
+	0xffffffff, false),
+  HOWTO(R_X86_64_GOTTPOFF, 0, 2, 32, true, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_X86_64_GOTTPOFF", false, 0xffffffff,
+	0xffffffff, true),
+  HOWTO(R_X86_64_TPOFF32, 0, 2, 32, false, 0, complain_overflow_signed,
+	bfd_elf_generic_reloc, "R_X86_64_TPOFF32", false, 0xffffffff,
+	0xffffffff, false),
 
 /* GNU extension to record C++ vtable hierarchy.  */
   HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, false, 0, complain_overflow_dont,
@@ -114,6 +138,14 @@
   { BFD_RELOC_16_PCREL,		R_X86_64_PC16, },
   { BFD_RELOC_8,		R_X86_64_8, },
   { BFD_RELOC_8_PCREL,		R_X86_64_PC8, },
+  { BFD_RELOC_X86_64_DTPMOD64,	R_X86_64_DTPMOD64, },
+  { BFD_RELOC_X86_64_DTPOFF64,	R_X86_64_DTPOFF64, },
+  { BFD_RELOC_X86_64_TPOFF64,	R_X86_64_TPOFF64, },
+  { BFD_RELOC_X86_64_TLSGD,	R_X86_64_TLSGD, },
+  { BFD_RELOC_X86_64_TLSLD,	R_X86_64_TLSLD, },
+  { BFD_RELOC_X86_64_DTPOFF32,	R_X86_64_DTPOFF32, },
+  { BFD_RELOC_X86_64_GOTTPOFF,	R_X86_64_GOTTPOFF, },
+  { BFD_RELOC_X86_64_TPOFF32,	R_X86_64_TPOFF32, },
   { BFD_RELOC_VTABLE_INHERIT,	R_X86_64_GNU_VTINHERIT, },
   { BFD_RELOC_VTABLE_ENTRY,	R_X86_64_GNU_VTENTRY, },
 };
@@ -128,6 +160,10 @@
   PARAMS ((bfd *, Elf_Internal_Note *));
 static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
   PARAMS ((bfd *));
+static int elf64_x86_64_tls_transition
+  PARAMS ((struct bfd_link_info *, int, int));
+static boolean elf64_x86_64_mkobject
+  PARAMS((bfd *));
 static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd));
 static boolean create_got_section
   PARAMS((bfd *, struct bfd_link_info *));
@@ -158,6 +194,10 @@
   PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf64_x86_64_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
+static bfd_vma dtpoff_base
+  PARAMS ((struct bfd_link_info *));
+static bfd_vma tpoff
+  PARAMS ((struct bfd_link_info *, bfd_vma));
 static boolean elf64_x86_64_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
 	 Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
@@ -198,13 +238,13 @@
   r_type = ELF64_R_TYPE (dst->r_info);
   if (r_type < (unsigned int) R_X86_64_GNU_VTINHERIT)
     {
-      BFD_ASSERT (r_type <= (unsigned int) R_X86_64_PC8);
+      BFD_ASSERT (r_type <= (unsigned int) R_X86_64_TPOFF32);
       i = r_type;
     }
   else
     {
       BFD_ASSERT (r_type < (unsigned int) R_X86_64_max);
-      i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_PC8 - 1);
+      i = r_type - ((unsigned int) R_X86_64_GNU_VTINHERIT - R_X86_64_TPOFF32 - 1);
     }
   cache_ptr->howto = &x86_64_elf_howto_table[i];
   BFD_ASSERT (r_type == cache_ptr->howto->type);
@@ -343,8 +383,32 @@
 
   /* Track dynamic relocs copied for this symbol.  */
   struct elf64_x86_64_dyn_relocs *dyn_relocs;
+
+#define GOT_UNKNOWN	0
+#define GOT_NORMAL	1
+#define GOT_TLS_GD	2
+#define GOT_TLS_IE	3
+  unsigned char tls_type;
 };
 
+#define elf64_x86_64_hash_entry(ent) \
+  ((struct elf64_x86_64_link_hash_entry *)(ent))
+
+struct elf64_x86_64_obj_tdata
+{
+  struct elf_obj_tdata root;
+
+  /* tls_type for each local got entry.  */
+  char *local_got_tls_type;
+};
+
+#define elf64_x86_64_tdata(abfd) \
+  ((struct elf64_x86_64_obj_tdata *) (abfd)->tdata.any)
+
+#define elf64_x86_64_local_got_tls_type(abfd) \
+  (elf64_x86_64_tdata (abfd)->local_got_tls_type)
+
+
 /* x86-64 ELF linker hash table.  */
 
 struct elf64_x86_64_link_hash_table
@@ -360,6 +424,11 @@
   asection *sdynbss;
   asection *srelbss;
 
+  union {
+    bfd_signed_vma refcount;
+    bfd_vma offset;
+  } tls_ld_got;
+
   /* Small local sym to section mapping cache.  */
   struct sym_sec_cache sym_sec;
 };
@@ -395,6 +464,7 @@
 
       eh = (struct elf64_x86_64_link_hash_entry *) entry;
       eh->dyn_relocs = NULL;
+      eh->tls_type = GOT_UNKNOWN;
     }
 
   return entry;
@@ -427,6 +497,7 @@
   ret->sdynbss = NULL;
   ret->srelbss = NULL;
   ret->sym_sec.abfd = NULL;
+  ret->tls_ld_got.refcount = 0;
 
   return &ret->elf.root;
 }
@@ -538,18 +609,67 @@
       eind->dyn_relocs = NULL;
     }
 
+  if (ind->root.type == bfd_link_hash_indirect
+      && dir->got.refcount <= 0)
+    {
+      edir->tls_type = eind->tls_type;
+      eind->tls_type = GOT_UNKNOWN;
+    }
+
   _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
 }
 
 static boolean
-elf64_x86_64_elf_object_p (abfd)
+elf64_x86_64_mkobject (abfd)
      bfd *abfd;
 {
+  bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
+  abfd->tdata.any = bfd_zalloc (abfd, amt);
+  if (abfd->tdata.any == NULL)
+    return false;
+  return true;
+}
+
+static boolean
+elf64_x86_64_elf_object_p (abfd)
+  bfd *abfd;
+{
+  /* Allocate our special target data.  */
+  struct elf64_x86_64_obj_tdata *new_tdata;
+  bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
+  new_tdata = bfd_zalloc (abfd, amt);
+  if (new_tdata == NULL)
+    return false;
+  new_tdata->root = *abfd->tdata.elf_obj_data;
+  abfd->tdata.any = new_tdata;
   /* Set the right machine number for an x86-64 elf64 file.  */
   bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
   return true;
 }
 
+static int
+elf64_x86_64_tls_transition (info, r_type, is_local)
+     struct bfd_link_info *info;
+     int r_type;
+     int is_local;
+{
+  if (info->shared)
+    return r_type;
+
+  switch (r_type)
+    {
+    case R_X86_64_TLSGD:
+    case R_X86_64_GOTTPOFF:
+      if (is_local)
+	return R_X86_64_TPOFF32;
+      return R_X86_64_GOTTPOFF;
+    case R_X86_64_TLSLD:
+      return R_X86_64_TPOFF32;
+    }
+
+   return r_type;
+}
+
 /* 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.  */
@@ -580,10 +700,12 @@
   rel_end = relocs + sec->reloc_count;
   for (rel = relocs; rel < rel_end; rel++)
     {
+      unsigned int r_type;
       unsigned long r_symndx;
       struct elf_link_hash_entry *h;
 
       r_symndx = ELF64_R_SYM (rel->r_info);
+      r_type = ELF64_R_TYPE (rel->r_info);
 
       if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
 	{
@@ -598,38 +720,103 @@
       else
 	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
 
-      switch (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:
+	  htab->tls_ld_got.refcount += 1;
+	  goto create_got;
+
+	case R_X86_64_TPOFF32:
+	  if (info->shared)
+	    {
+	      (*_bfd_error_handler)
+		(_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
+		 bfd_archive_filename (abfd),
+		 x86_64_elf_howto_table[r_type].name);
+	      bfd_set_error (bfd_error_bad_value);
+	      return false;
+	    }
+	  break;
+
+	case R_X86_64_GOTTPOFF:
+	  if (info->shared)
+	    info->flags |= DF_STATIC_TLS;
+	  /* Fall through */
+
 	case R_X86_64_GOT32:
 	case R_X86_64_GOTPCREL:
+	case R_X86_64_TLSGD:
 	  /* This symbol requires a global offset table entry.	*/
-	  if (h != NULL)
-	    {
-	      h->got.refcount += 1;
-	    }
-	  else
-	    {
-	      bfd_signed_vma *local_got_refcounts;
+	  {
+	    int tls_type, old_tls_type;
 
-	      /* This is a global offset table entry for a local symbol.  */
-	      local_got_refcounts = elf_local_got_refcounts (abfd);
-	      if (local_got_refcounts == NULL)
-		{
-		  bfd_size_type size;
+	    switch (r_type)
+	      {
+	      default: tls_type = GOT_NORMAL; break;
+	      case R_X86_64_TLSGD: tls_type = GOT_TLS_GD; break;
+	      case R_X86_64_GOTTPOFF: tls_type = GOT_TLS_IE; break;
+	      }
 
-		  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)
+	    if (h != NULL)
+	      {
+		h->got.refcount += 1;
+		old_tls_type = elf64_x86_64_hash_entry (h)->tls_type;
+	      }
+	    else
+	      {
+		bfd_signed_vma *local_got_refcounts;
+
+		/* This is a global offset table entry for a local symbol.  */
+		local_got_refcounts = elf_local_got_refcounts (abfd);
+		if (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 *)
+					   bfd_zalloc (abfd, size));
+		    if (local_got_refcounts == NULL)
+		      return false;
+		    elf_local_got_refcounts (abfd) = local_got_refcounts;
+		    elf64_x86_64_local_got_tls_type (abfd)
+		      = (char *) (local_got_refcounts + symtab_hdr->sh_info);
+		  }
+		local_got_refcounts[r_symndx] += 1;
+		old_tls_type
+		  = elf64_x86_64_local_got_tls_type (abfd) [r_symndx];
+	      }
+
+	    /* If a TLS symbol is accessed using IE at least once,
+	       there is no point to use dynamic model for it.  */
+	    if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
+		&& (old_tls_type != GOT_TLS_GD || tls_type != GOT_TLS_IE))
+	      {
+		if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
+		  tls_type = old_tls_type;
+		else
+		  {
+		    (*_bfd_error_handler)
+		      (_("%s: %s' accessed both as normal and thread local symbol"),
+		       bfd_archive_filename (abfd),
+		       h ? h->root.root.string : "<local>");
 		    return false;
-		  elf_local_got_refcounts (abfd) = local_got_refcounts;
-		}
-	      local_got_refcounts[r_symndx] += 1;
-	    }
+		  }
+	      }
+
+	    if (old_tls_type != tls_type)
+	      {
+		if (h != NULL)
+		  elf64_x86_64_hash_entry (h)->tls_type = tls_type;
+		else
+		  elf64_x86_64_local_got_tls_type (abfd) [r_symndx] = tls_type;
+	      }
+	  }
 	  /* Fall through */
 
 	  //case R_X86_64_GOTPCREL:
+	create_got:
 	  if (htab->sgot == NULL)
 	    {
 	      if (htab->elf.dynobj == NULL)
@@ -671,7 +858,7 @@
 	      (*_bfd_error_handler)
 		(_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"),
 		 bfd_archive_filename (abfd),
-		 x86_64_elf_howto_table[ELF64_R_TYPE (rel->r_info)].name);
+		 x86_64_elf_howto_table[r_type].name);
 	      bfd_set_error (bfd_error_bad_value);
 	      return false;
 	    }
@@ -719,9 +906,9 @@
 	     symbol.  */
 	  if ((info->shared
 	       && (sec->flags & SEC_ALLOC) != 0
-	       && (((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))
+	       && (((r_type != R_X86_64_PC8)
+		    && (r_type != R_X86_64_PC16)
+		    && (r_type != R_X86_64_PC32))
 		   || (h != NULL
 		       && (! info->symbolic
 			   || h->root.type == bfd_link_hash_defweak
@@ -822,9 +1009,9 @@
 		}
 
 	      p->count += 1;
-	      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)
+	      if (r_type == R_X86_64_PC8
+		  || r_type == R_X86_64_PC16
+		  || r_type == R_X86_64_PC32)
 		p->pc_count += 1;
 	    }
 	  break;
@@ -905,6 +1092,7 @@
   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;
@@ -915,8 +1103,18 @@
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
-    switch (ELF64_R_TYPE (rel->r_info))
+    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);
@@ -1226,10 +1424,18 @@
       h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
     }
 
-  if (h->got.refcount > 0)
+  /* If R_X86_64_GOTTPOFF symbol is now local to the binary,
+     make it a R_X86_64_TPOFF32 requiring no GOT entry.  */
+  if (h->got.refcount > 0
+      && !info->shared
+      && h->dynindx == -1
+      && elf64_x86_64_hash_entry (h)->tls_type == GOT_TLS_IE)
+    h->got.offset = (bfd_vma) -1;
+  else if (h->got.refcount > 0)
     {
       asection *s;
       boolean dyn;
+      int tls_type = elf64_x86_64_hash_entry (h)->tls_type;
 
       /* Make sure this symbol is output as a dynamic symbol.
 	 Undefined weak syms won't yet be marked as dynamic.  */
@@ -1243,8 +1449,19 @@
       s = htab->sgot;
       h->got.offset = s->_raw_size;
       s->_raw_size += GOT_ENTRY_SIZE;
+      /* R_X86_64_TLSGD needs 2 consecutive GOT slots.  */
+      if (tls_type == GOT_TLS_GD)
+	s->_raw_size += GOT_ENTRY_SIZE;
       dyn = htab->elf.dynamic_sections_created;
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+      /* R_X86_64_TLSGD needs one dynamic relocation if local symbol
+	 and two if global.
+	 R_X86_64_GOTTPOFF needs one dynamic relocation.  */
+      if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
+	  || tls_type == GOT_TLS_IE)
+	htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+      else if (tls_type == GOT_TLS_GD)
+	htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
+      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
 	htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
     }
   else
@@ -1390,6 +1607,7 @@
     {
       bfd_signed_vma *local_got;
       bfd_signed_vma *end_local_got;
+      char *local_tls_type;
       bfd_size_type locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
       asection *srel;
@@ -1432,15 +1650,20 @@
       symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
       locsymcount = symtab_hdr->sh_info;
       end_local_got = local_got + locsymcount;
+      local_tls_type = elf64_x86_64_local_got_tls_type (ibfd);
       s = htab->sgot;
       srel = htab->srelgot;
-      for (; local_got < end_local_got; ++local_got)
+      for (; local_got < end_local_got; ++local_got, ++local_tls_type)
 	{
 	  if (*local_got > 0)
 	    {
 	      *local_got = s->_raw_size;
 	      s->_raw_size += GOT_ENTRY_SIZE;
-	      if (info->shared)
+	      if (*local_tls_type == GOT_TLS_GD)
+		s->_raw_size += GOT_ENTRY_SIZE;
+	      if (info->shared
+		  || *local_tls_type == GOT_TLS_GD
+		  || *local_tls_type == GOT_TLS_IE)
 		srel->_raw_size += sizeof (Elf64_External_Rela);
 	    }
 	  else
@@ -1448,6 +1671,17 @@
 	}
     }
 
+  if (htab->tls_ld_got.refcount > 0)
+    {
+      /* Allocate 2 got entries and 1 dynamic reloc for R_X86_64_TLSLD
+	 relocs.  */
+      htab->tls_ld_got.offset = htab->sgot->_raw_size;
+      htab->sgot->_raw_size += 2 * GOT_ENTRY_SIZE;
+      htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
+    }
+  else
+    htab->tls_ld_got.offset = -1;
+
   /* Allocate global sym .plt and .got entries, and space for global
      sym dynamic relocs.  */
   elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
@@ -1558,6 +1792,38 @@
   return true;
 }
 
+/* Return the base VMA address which should be subtracted from real addresses
+   when resolving @dtpoff relocation.
+   This is PT_TLS segment p_vaddr.  */
+
+static bfd_vma
+dtpoff_base (info)
+     struct bfd_link_info *info;
+{
+  /* If tls_segment is NULL, we should have signalled an error already.  */
+  if (elf_hash_table (info)->tls_segment == NULL)
+    return 0;
+  return elf_hash_table (info)->tls_segment->start;
+}
+
+/* Return the relocation value for @tpoff relocation
+   if STT_TLS virtual address is ADDRESS.  */
+
+static bfd_vma
+tpoff (info, address)
+     struct bfd_link_info *info;
+     bfd_vma address;
+{
+  struct elf_link_tls_segment *tls_segment
+    = elf_hash_table (info)->tls_segment;
+
+  /* If tls_segment is NULL, we should have signalled an error already.  */
+  if (tls_segment == NULL)
+    return 0;
+  return address - align_power (tls_segment->size, tls_segment->align)
+	 - tls_segment->start;
+}
+
 /* Relocate an x86_64 ELF section.  */
 
 static boolean
@@ -1591,7 +1857,7 @@
   relend = relocs + input_section->reloc_count;
   for (; rel < relend; rel++)
     {
-      int r_type;
+      unsigned int r_type;
       reloc_howto_type *howto;
       unsigned long r_symndx;
       struct elf_link_hash_entry *h;
@@ -1601,13 +1867,14 @@
       bfd_vma relocation;
       boolean unresolved_reloc;
       bfd_reloc_status_type r;
+      int tls_type;
 
       r_type = ELF64_R_TYPE (rel->r_info);
       if (r_type == (int) R_X86_64_GNU_VTINHERIT
 	  || r_type == (int) R_X86_64_GNU_VTENTRY)
 	continue;
 
-      if (r_type < 0 || r_type >= R_X86_64_max)
+      if (r_type >= R_X86_64_max)
 	{
 	  bfd_set_error (bfd_error_bad_value);
 	  return false;
@@ -1933,6 +2200,313 @@
 
 	  break;
 
+	case R_X86_64_TLSGD:
+	case R_X86_64_GOTTPOFF:
+	  r_type = elf64_x86_64_tls_transition (info, r_type, h == NULL);
+	  tls_type = GOT_UNKNOWN;
+	  if (h == NULL && local_got_offsets)
+	    tls_type = elf64_x86_64_local_got_tls_type (input_bfd) [r_symndx];
+	  else if (h != NULL)
+	    {
+	      tls_type = elf64_x86_64_hash_entry (h)->tls_type;
+	      if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
+		r_type = R_X86_64_TPOFF32;
+	    }
+	  if (r_type == R_X86_64_TLSGD)
+	    {
+	      if (tls_type == GOT_TLS_IE)
+		r_type = R_X86_64_GOTTPOFF;
+	    }
+
+	  if (r_type == R_X86_64_TPOFF32)
+	    {
+	      BFD_ASSERT (! unresolved_reloc);
+	      if (ELF64_R_TYPE (rel->r_info) == R_X86_64_TLSGD)
+		{
+		  unsigned int i;
+		  static unsigned char tlsgd[7]
+		    = { 0x66, 0x66, 0x66, 0x66, 0x48, 0x8d, 0x3d };
+
+		  /* GD->LE transition.
+		     .long 0x66666666; leaq foo@tlsgd(%rip), %rdi
+		     callq __tls_get_addr@plt
+		     Change it into:
+		     movq %fs:0, %rax
+		     leaq foo@tpoff(%rax), %rax */
+		  BFD_ASSERT (rel->r_offset >= 7);
+		  for (i = 0; i < 7; i++)
+		    BFD_ASSERT (bfd_get_8 (input_bfd,
+					   contents + rel->r_offset - 7 + i)
+				== tlsgd[i]);
+		  BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+		  BFD_ASSERT (bfd_get_8 (input_bfd,
+					 contents + rel->r_offset + 4)
+			      == 0xe8);
+		  BFD_ASSERT (rel + 1 < relend);
+		  BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+		  memcpy (contents + rel->r_offset - 7,
+			  "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x8d\x80\0\0\0",
+			  16);
+		  bfd_put_32 (output_bfd, tpoff (info, relocation),
+			      contents + rel->r_offset + 5);
+		  /* Skip R_X86_64_PLT32.  */
+		  rel++;
+		  continue;
+		}
+	      else
+		{
+		  unsigned int val, type, reg;
+
+		  /* IE->LE transition:
+		     Originally it can be one of:
+		     movq foo@gottpoff(%rip), %reg
+		     addq foo@gottpoff(%rip), %reg
+		     We change it into:
+		     movq $foo, %reg
+		     leaq foo(%reg), %reg
+		     addq $foo, %reg.  */
+		  BFD_ASSERT (rel->r_offset >= 3);
+		  val = bfd_get_8 (input_bfd, contents + rel->r_offset - 3);
+		  BFD_ASSERT (val == 0x48 || val == 0x4c);
+		  type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+		  BFD_ASSERT (type == 0x8b || type == 0x03);
+		  reg = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
+		  BFD_ASSERT ((reg & 0xc7) == 5);
+		  reg >>= 3;
+		  BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
+		  if (type == 0x8b)
+		    {
+		      /* movq */
+		      if (val == 0x4c)
+			bfd_put_8 (output_bfd, 0x49,
+				   contents + rel->r_offset - 3);
+		      bfd_put_8 (output_bfd, 0xc7,
+				 contents + rel->r_offset - 2);
+		      bfd_put_8 (output_bfd, 0xc0 | reg,
+				 contents + rel->r_offset - 1);
+		    }
+		  else if (reg == 4)
+		    {
+		      /* addq -> addq - addressing with %rsp/%r12 is
+			 special  */
+		      if (val == 0x4c)
+			bfd_put_8 (output_bfd, 0x49,
+				   contents + rel->r_offset - 3);
+		      bfd_put_8 (output_bfd, 0x81,
+				 contents + rel->r_offset - 2);
+		      bfd_put_8 (output_bfd, 0xc0 | reg,
+				 contents + rel->r_offset - 1);
+		    }
+		  else
+		    {
+		      /* addq -> leaq */
+		      if (val == 0x4c)
+			bfd_put_8 (output_bfd, 0x4d,
+				   contents + rel->r_offset - 3);
+		      bfd_put_8 (output_bfd, 0x8d,
+				 contents + rel->r_offset - 2);
+		      bfd_put_8 (output_bfd, 0x80 | reg | (reg << 3),
+				 contents + rel->r_offset - 1);
+		    }
+		  bfd_put_32 (output_bfd, tpoff (info, relocation),
+			      contents + rel->r_offset);
+		  continue;
+		}
+	    }
+
+	  if (htab->sgot == NULL)
+	    abort ();
+
+	  if (h != NULL)
+	    off = h->got.offset;
+	  else
+	    {
+	      if (local_got_offsets == NULL)
+		abort ();
+
+	      off = local_got_offsets[r_symndx];
+	    }
+
+	  if ((off & 1) != 0)
+	    off &= ~1;
+          else
+	    {
+	      Elf_Internal_Rela outrel;
+	      Elf64_External_Rela *loc;
+	      int dr_type, indx;
+
+	      if (htab->srelgot == NULL)
+		abort ();
+
+	      outrel.r_offset = (htab->sgot->output_section->vma
+				 + htab->sgot->output_offset + off);
+
+	      indx = h && h->dynindx != -1 ? h->dynindx : 0;
+	      if (r_type == R_X86_64_TLSGD)
+		dr_type = R_X86_64_DTPMOD64;
+	      else
+		dr_type = R_X86_64_TPOFF64;
+
+	      bfd_put_64 (output_bfd, 0, htab->sgot->contents + off);
+	      outrel.r_addend = 0;
+	      if (dr_type == R_X86_64_TPOFF64 && indx == 0)
+		outrel.r_addend = relocation - dtpoff_base (info);
+	      outrel.r_info = ELF64_R_INFO (indx, dr_type);
+
+	      loc = (Elf64_External_Rela *) htab->srelgot->contents;
+	      loc += htab->srelgot->reloc_count++;
+	      bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+
+	      if (r_type == R_X86_64_TLSGD)
+		{
+		  if (indx == 0)
+		    {
+	    	      BFD_ASSERT (! unresolved_reloc);
+		      bfd_put_64 (output_bfd,
+				  relocation - dtpoff_base (info),
+				  htab->sgot->contents + off + GOT_ENTRY_SIZE);
+		    }
+		  else
+		    {
+		      bfd_put_64 (output_bfd, 0,
+				  htab->sgot->contents + off + GOT_ENTRY_SIZE);
+		      outrel.r_info = ELF64_R_INFO (indx,
+						    R_X86_64_DTPOFF64);
+		      outrel.r_offset += GOT_ENTRY_SIZE;
+		      htab->srelgot->reloc_count++;
+		      loc++;
+		      bfd_elf64_swap_reloca_out (output_bfd, &outrel,
+						 loc);
+		    }
+		}
+
+	      if (h != NULL)
+		h->got.offset |= 1;
+	      else
+		local_got_offsets[r_symndx] |= 1;
+	    }
+
+	  if (off >= (bfd_vma) -2)
+	    abort ();
+	  if (r_type == ELF64_R_TYPE (rel->r_info))
+	    {
+	      relocation = htab->sgot->output_section->vma
+			   + htab->sgot->output_offset + off;
+	      unresolved_reloc = false;
+	    }
+	  else
+	    {
+	      unsigned int i;
+	      static unsigned char tlsgd[7]
+		= { 0x66, 0x66, 0x66, 0x66, 0x48, 0x8d, 0x3d };
+
+	      /* GD->IE transition.
+		 .long 0x66666666; leaq foo@tlsgd(%rip), %rdi
+		 callq __tls_get_addr@plt
+		 Change it into:
+		 movq %fs:0, %rax
+		 addq foo@gottpoff(%rip), %rax */
+	      BFD_ASSERT (rel->r_offset >= 7);
+	      for (i = 0; i < 7; i++)
+	        BFD_ASSERT (bfd_get_8 (input_bfd,
+				       contents + rel->r_offset - 7 + i)
+			    == tlsgd[i]);
+	      BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+	      BFD_ASSERT (bfd_get_8 (input_bfd,
+				     contents + rel->r_offset + 4)
+			  == 0xe8);
+	      BFD_ASSERT (rel + 1 < relend);
+	      BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+	      memcpy (contents + rel->r_offset - 7,
+		      "\x64\x48\x8b\x04\x25\0\0\0\0\x48\x03\x05\0\0\0",
+		      16);
+
+	      relocation = (htab->sgot->output_section->vma
+			    + htab->sgot->output_offset + off
+			    - rel->r_offset
+			    - input_section->output_section->vma
+			    - input_section->output_offset
+			    - 9);
+	      bfd_put_32 (output_bfd, relocation,
+			  contents + rel->r_offset + 5);
+	      /* Skip R_X86_64_PLT32.  */
+	      rel++;
+	      continue;
+	    }
+	  break;
+
+	case R_X86_64_TLSLD:
+	  if (! info->shared)
+	    {
+	      /* LD->LE transition:
+		 Ensure it is:
+		 leaq foo@tlsld(%rip), %rdi; call __tls_get_addr@plt.
+		 We change it into:
+		 .word 0x6666; .byte 0x66; movl %fs:0, %rax.  */
+	      BFD_ASSERT (rel->r_offset >= 3);
+	      BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 3)
+			  == 0x48);
+	      BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2)
+			  == 0x8d);
+	      BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 1)
+			  == 0x3d);
+	      BFD_ASSERT (rel->r_offset + 9 <= input_section->_raw_size);
+	      BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset + 4)
+			  == 0xe8);
+	      BFD_ASSERT (rel + 1 < relend);
+	      BFD_ASSERT (ELF64_R_TYPE (rel[1].r_info) == R_X86_64_PLT32);
+	      memcpy (contents + rel->r_offset - 3,
+		      "\x66\x66\x66\x64\x48\x8b\x04\x25\0\0\0", 12);
+	      /* Skip R_X86_64_PLT32.  */
+	      rel++;
+	      continue;
+	    }
+
+	  if (htab->sgot == NULL)
+	    abort ();
+
+	  off = htab->tls_ld_got.offset;
+	  if (off & 1)
+	    off &= ~1;
+	  else
+	    {
+	      Elf_Internal_Rela outrel;
+	      Elf64_External_Rela *loc;
+
+	      if (htab->srelgot == NULL)
+		abort ();
+
+	      outrel.r_offset = (htab->sgot->output_section->vma
+				 + htab->sgot->output_offset + off);
+
+	      bfd_put_64 (output_bfd, 0,
+			  htab->sgot->contents + off);
+	      bfd_put_64 (output_bfd, 0,
+			  htab->sgot->contents + off + GOT_ENTRY_SIZE);
+	      outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64);
+	      outrel.r_addend = 0;
+	      loc = (Elf64_External_Rela *) htab->srelgot->contents;
+	      loc += htab->srelgot->reloc_count++;
+	      bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+	      htab->tls_ld_got.offset |= 1;
+	    }
+	  relocation = htab->sgot->output_section->vma
+		       + htab->sgot->output_offset + off;
+	  unresolved_reloc = false;
+	  break;
+
+	case R_X86_64_DTPOFF32:
+	  if (info->shared)
+	    relocation -= dtpoff_base (info);
+	  else
+	    relocation = tpoff (info, relocation);
+	  break;
+
+	case R_X86_64_TPOFF32:
+	  BFD_ASSERT (! info->shared);
+	  relocation = tpoff (info, relocation);
+	  break;
+
 	default:
 	  break;
 	}
@@ -2087,13 +2661,15 @@
 	}
     }
 
-  if (h->got.offset != (bfd_vma) -1)
+  if (h->got.offset != (bfd_vma) -1
+      && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_GD
+      && elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE)
     {
       Elf_Internal_Rela rela;
       Elf64_External_Rela *loc;
 
       /* This symbol has an entry in the global offset table.  Set it
-         up.  */
+	 up.  */
 
       if (htab->sgot == NULL || htab->srelgot == NULL)
 	abort ();
@@ -2351,5 +2927,6 @@
 #define elf_backend_relocate_section	    elf64_x86_64_relocate_section
 #define elf_backend_size_dynamic_sections   elf64_x86_64_size_dynamic_sections
 #define elf_backend_object_p		    elf64_x86_64_elf_object_p
+#define bfd_elf64_mkobject		    elf64_x86_64_mkobject
 
 #include "elf64-target.h"
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index ca72307..4f54cd3 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1377,7 +1377,7 @@
   arelent *relent;
   unsigned int i;
   int entsize;
-  long symcount;
+  unsigned int symcount;
 
   allocated = (PTR) bfd_malloc (rel_hdr->sh_size);
   if (allocated == NULL)
@@ -1394,6 +1394,11 @@
   BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
 	      || entsize == sizeof (Elf_External_Rela));
 
+  if (dynamic)
+    symcount = bfd_get_dynamic_symcount (abfd);
+  else
+    symcount = bfd_get_symcount (abfd);
+
   for (i = 0, relent = relents;
        i < reloc_count;
        i++, relent++, native_relocs += entsize)
@@ -1420,11 +1425,6 @@
       else
 	relent->address = rela.r_offset - asect->vma;
 
-      if (dynamic)
-	symcount = bfd_get_dynamic_symcount (abfd);
-      else
-	symcount = bfd_get_symcount (abfd);
-
       if (ELF_R_SYM (rela.r_info) == 0)
 	relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
       else if (ELF_R_SYM (rela.r_info) > symcount)
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 2df334b..85160e9 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -8482,7 +8482,12 @@
 	  if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr,
 						 elf_reloc_symbol_deleted_p,
 						 &cookie))
-	    ret = true;
+	    {
+	      /* Relocs have been edited.  Ensure edited version is
+		 used later in relocate_section.  */
+	      elf_section_data (eh)->relocs = cookie.rels;
+	      ret = true;
+	    }
 	  if (cookie.rels && elf_section_data (eh)->relocs != cookie.rels)
 	    free (cookie.rels);
 	}
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 8da904b..72f9a6b 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -3644,7 +3644,7 @@
      sh_offset == object size, and ld doesn't allow that.  While the check
      is arguably bogus for empty or SHT_NOBITS sections, it can easily be
      avoided by not emitting those useless sections in the first place.  */
-  if ((IRIX_COMPAT (abfd) != ict_irix5 && (IRIX_COMPAT (abfd) != ict_irix6))
+  if (! SGI_COMPAT (abfd) && ! NEWABI_P(abfd)
       && (sec->flags & SEC_RELOC) != 0)
     {
       struct bfd_elf_section_data *esd;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 3971ea6..96e55d7 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -819,6 +819,14 @@
   "BFD_RELOC_X86_64_RELATIVE",
   "BFD_RELOC_X86_64_GOTPCREL",
   "BFD_RELOC_X86_64_32S",
+  "BFD_RELOC_X86_64_DTPMOD64",
+  "BFD_RELOC_X86_64_DTPOFF64",
+  "BFD_RELOC_X86_64_TPOFF64",
+  "BFD_RELOC_X86_64_TLSGD",
+  "BFD_RELOC_X86_64_TLSLD",
+  "BFD_RELOC_X86_64_DTPOFF32",
+  "BFD_RELOC_X86_64_GOTTPOFF",
+  "BFD_RELOC_X86_64_TPOFF32",
   "BFD_RELOC_NS32K_IMM_8",
   "BFD_RELOC_NS32K_IMM_16",
   "BFD_RELOC_NS32K_IMM_32",
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index 4c32ca0..27ce9a9 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -45,6 +45,7 @@
 coff-stgo32.c
 coff-svm68k.c
 coff-tic30.c
+coff-tic4x.c
 coff-tic54x.c
 coff-tic80.c
 coff-u68k.c
@@ -98,6 +99,7 @@
 cpu-sh.c
 cpu-sparc.c
 cpu-tic30.c
+cpu-tic4x.c
 cpu-tic54x.c
 cpu-tic80.c
 cpu-v850.c
@@ -135,6 +137,7 @@
 elf32-hppa.c
 elf32-hppa.h
 elf32-i370.c
+elf32-i386-fbsd.c
 elf32-i386.c
 elf32-i386qnx.c
 elf32-i860.c
@@ -151,6 +154,7 @@
 elf32-or32.c
 elf32-pj.c
 elf32-ppc.c
+elf32-ppcqnx.c
 elf32-s390.c
 elf32-sh-lin.c
 elf32-sh-nbsd.c
@@ -158,11 +162,13 @@
 elf32-sh64-com.c
 elf32-sh64-nbsd.c
 elf32-sh64.c
+elf32-shqnx.c
 elf32-sparc.c
 elf32-v850.c
 elf32-vax.c
 elf32-xstormy16.c
 elf32.c
+elf64-alpha-fbsd.c
 elf64-alpha.c
 elf64-gen.c
 elf64-hppa.c
@@ -178,10 +184,12 @@
 elf64.c
 elfarm-nabi.c
 elfarm-oabi.c
+elfarmqnx-nabi.c
 elfcode.h
 elfcore.h
 elflink.c
 elflink.h
+elfn32-mips.c
 elfxx-mips.c
 epoc-pe-arm.c
 epoc-pei-arm.c
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 504359f..71f1740 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2165,6 +2165,22 @@
   BFD_RELOC_X86_64_GOTPCREL
 ENUMX
   BFD_RELOC_X86_64_32S
+ENUMX
+  BFD_RELOC_X86_64_DTPMOD64
+ENUMX
+  BFD_RELOC_X86_64_DTPOFF64
+ENUMX
+  BFD_RELOC_X86_64_TPOFF64
+ENUMX
+  BFD_RELOC_X86_64_TLSGD
+ENUMX
+  BFD_RELOC_X86_64_TLSLD
+ENUMX
+  BFD_RELOC_X86_64_DTPOFF32
+ENUMX
+  BFD_RELOC_X86_64_GOTTPOFF
+ENUMX
+  BFD_RELOC_X86_64_TPOFF32
 ENUMDOC
   x86-64/elf relocations
 
diff --git a/bfd/version.h b/bfd/version.h
index 1a7a14d..5a98d1c 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1 +1 @@
-#define BFD_VERSION_DATE 20020920
+#define BFD_VERSION_DATE 20020927
diff --git a/configure b/configure
index 339b23d..6d4b7fa 100755
--- a/configure
+++ b/configure
@@ -1365,21 +1365,21 @@
                 rm -f ${subdir}/Makefile.tem
                 mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
 	    fi
-	    sed     -e "s|^prefix[ 	]*=.*$|prefix = ${prefix}|" \
-                    -e "s|^exec_prefix[ 	]*=.*$|exec_prefix = ${exec_prefix}|" \
-                    -e "s|^bindir[ 	]*=.*$|bindir = ${bindir}|" \
-                    -e "s|^sbindir[ 	]*=.*$|sbindir = ${sbindir}|" \
-                    -e "s|^libexecdir[ 	]*=.*$|libexecdir = ${libexecdir}|" \
-                    -e "s|^datadir[ 	]*=.*$|datadir = ${datadir}|" \
-                    -e "s|^sysconfdir[ 	]*=.*$|sysconfdir = ${sysconfdir}|" \
-                    -e "s|^sharedstatedir[ 	]*=.*$|sharedstatedir = ${sharedstatedir}|" \
-                    -e "s|^localstatedir[ 	]*=.*$|localstatedir = ${localstatedir}|" \
-                    -e "s|^libdir[ 	]*=.*$|libdir = ${libdir}|" \
-                    -e "s|^includedir[ 	]*=.*$|includedir = ${includedir}|" \
-                    -e "s|^oldincludedir[ 	]*=.*$|oldincludedir = ${oldincludedir}|" \
-                    -e "s|^infodir[ 	]*=.*$|infodir = ${infodir}|" \
-                    -e "s|^mandir[ 	]*=.*$|mandir = ${mandir}|" \
-		    -e "s|^ALL_BUILD_MODULES =.*|ALL_BUILD_MODULES =${all_build_modules}|" \
+	    sed     -e "s|@prefix@|${prefix}|" \
+                    -e "s|@exec_prefix@|${exec_prefix}|" \
+                    -e "s|@bindir@|${bindir}|" \
+                    -e "s|@sbindir@|${sbindir}|" \
+                    -e "s|@libexecdir@|${libexecdir}|" \
+                    -e "s|@datadir@|${datadir}|" \
+                    -e "s|@sysconfdir@|${sysconfdir}|" \
+                    -e "s|@sharedstatedir@|${sharedstatedir}|" \
+                    -e "s|@localstatedir@|${localstatedir}|" \
+                    -e "s|@libdir@|${libdir}|" \
+                    -e "s|@includedir@|${includedir}|" \
+                    -e "s|@oldincludedir@|${oldincludedir}|" \
+                    -e "s|@infodir@|${infodir}|" \
+                    -e "s|@mandir@|${mandir}|" \
+		    -e "s|@all_build_modules@|${all_build_modules}|" \
 		    -e "/^CC[ 	]*=/{
 			:loop1
 			/\\\\$/ N
@@ -1408,20 +1408,18 @@
 			t loop4
 			s%^CXXFLAGS[ 	]*=.*$%CXXFLAGS = ${CXXFLAGS}%
 			}" \
-		    -e "s|^SHELL[	 ]*=.*$|SHELL = ${config_shell}|" \
-                    -e "s|^srcdir[ 	]*=.*$|srcdir = ${makesrcdir}|" \
+		    -e "s|@config_shell@|${config_shell}|" \
+                    -e "s|@srcdir@|${makesrcdir}|" \
                     -e "s///" \
-                    -e "s:^program_prefix[ 	]*=.*$:program_prefix = ${program_prefix}:" \
-                    -e "s:^program_suffix[ 	]*=.*$:program_suffix = ${program_suffix}:" \
-                    -e "s:^program_transform_name[ 	]*=.*$:program_transform_name = ${program_transform_name}:" \
-                    -e "s|^tooldir[ 	]*=.*$|tooldir = ${tooldir}|" \
-                    -e "s|^build_tooldir[ 	]*=.*$|build_tooldir = ${tooldir}|" \
-		    -e "s:^DEFAULT_YACC[	 ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
-		    -e "s:^DEFAULT_LEX[	 ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
-		    -e "s:^DEFAULT_M4[  ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
+                    -e "s:@program_transform_name@:${program_transform_name}:" \
+                    -e "s|@tooldir@|${tooldir}|" \
+                    -e "s|@build_tooldir@|${tooldir}|" \
+		    -e "s:@DEFAULT_YACC@:${DEFAULT_YACC}:" \
+		    -e "s:@DEFAULT_LEX@:${DEFAULT_LEX}:" \
+		    -e "s:@DEFAULT_M4@:${DEFAULT_M4}:" \
                     ${subdir}/Makefile.tem >> ${Makefile}
   
-	    sed -e "s:^GDB_TK[	 ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
+	    sed -e "s:@GDB_TK@:${GDB_TK}:" ${Makefile} >${Makefile}.tem
 	    mv -f ${Makefile}.tem ${Makefile}
 
 	    # If this is a Canadian Cross, preset the values of many more
diff --git a/configure.in b/configure.in
index a945dcb..e4a3ae5 100644
--- a/configure.in
+++ b/configure.in
@@ -80,22 +80,6 @@
 
 ################################################################################
 
-## These two lists are of directories that are to be removed from the
-## ${configdirs} list for either cross-compilations or for native-
-## compilations.  For example, it doesn't make that much sense to
-## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
-## a native environment.  
-
-# directories to be built in the native environment only
-#
-# This must be a single line because of the way it is searched by grep in
-# the code below.
-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"
-
-# directories to be built in a cross environment only
-#
-cross_only="target-libgloss target-newlib target-opcodes"
-
 ## All tools belong in one of the four categories, and are assigned above
 ## We assign ${configdirs} this way to remove all embedded newlines.  This
 ## is important because configure will choke if they ever get through.
@@ -184,8 +168,12 @@
 esac
 
 # Some tools are only suitable for building in a "native" situation.
-# Remove these if host!=target.  Similarly, some are only suitable
-# for cross toolchains; remove if host=target.
+# 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"
+
+# Similarly, some are only suitable for cross toolchains.
+# Remove these if host=target.
+cross_only="target-libgloss target-newlib target-opcodes"
 
 case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;
@@ -277,7 +265,7 @@
     ;;
   *-*-netbsd*)
     # Skip some stuff on all NetBSD configurations.
-    skipdirs="$skipdirs target-newlib target-libiberty target-libgloss"
+    noconfigdirs="$noconfigdirs target-newlib target-libiberty target-libgloss"
 
     # Skip some stuff that's unsupported on some NetBSD configurations.
     case "${target}" in
@@ -333,7 +321,7 @@
     noconfigdirs="$noconfigdirs expect dejagnu"
     # the C++ libraries don't build on top of CE's C libraries
     noconfigdirs="$noconfigdirs ${libstdcxx_version}"
-    skipdirs="$skipdirs target-newlib"
+    noconfigdirs="$noconfigdirs target-newlib"
     case "${host}" in
       *-*-cygwin*) ;; # keep gdb and readline
       *) noconfigdirs="$noconfigdirs gdb readline ${libstdcxx_version}"
@@ -755,8 +743,7 @@
   dirname=`echo $dir | sed -e s/target-//g`
   if test $dir != .  && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
     configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
-    if test -r $srcdir/$dirname/configure \
-	|| test -r $srcdir/$dirname/configure.in ; then
+    if test -r $srcdir/$dirname/configure ; then
       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
 	true
       else
@@ -766,8 +753,7 @@
   fi
   if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
     target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
-    if test -r $srcdir/$dirname/configure \
-	|| test -r $srcdir/$dirname/configure.in ; then
+    if test -r $srcdir/$dirname/configure ; then
       if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
 	true
       else
@@ -783,7 +769,7 @@
   others=
   for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
     if test "$i" != "libiberty" ; then
-      if test -r $srcdir/$i/configure || test -r $srcdir/$i/configure.in ; then
+      if test -r $srcdir/$i/configure ; then
 	others=yes;
 	break;
       fi
@@ -876,36 +862,41 @@
 
 copy_dirs=
 
-# Handle --with-headers=XXX.  The contents of the named directory are
-# copied to $(tooldir)/sys-include.
+# Handle --with-headers=XXX.  If the value is not "yes", the contents of
+# the named directory are copied to $(tooldir)/sys-include.
 if test x"${with_headers}" != x ; then
   if test x${is_cross_compiler} = xno ; then
     echo 1>&2 '***' --with-headers is only supported when cross compiling
     exit 1
   fi
-  case "${exec_prefixoption}" in
-  "") x=${prefix} ;;
-  *) x=${exec_prefix} ;;
-  esac
-  copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
+  if test x"${with_headers}" != xyes ; then
+    case "${exec_prefixoption}" in
+    "") x=${prefix} ;;
+    *) x=${exec_prefix} ;;
+    esac
+    copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
+  fi
 fi
 
-# Handle --with-libs=XXX.  Multiple directories are permitted.  The
-# contents are copied to $(tooldir)/lib.
+# Handle --with-libs=XXX.  If the value is not "yes", the contents of
+# the name directories are copied to $(tooldir)/lib.  Multiple directories
+# are permitted.
 if test x"${with_libs}" != x ; then
   if test x${is_cross_compiler} = xno ; then
     echo 1>&2 '***' --with-libs is only supported when cross compiling
     exit 1
   fi
-  # Copy the libraries in reverse order, so that files in the first named
-  # library override files in subsequent libraries.
-  case "${exec_prefixoption}" in
-  "") x=${prefix} ;;
-  *) x=${exec_prefix} ;;
-  esac
-  for l in ${with_libs}; do
-    copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
-  done
+  if test x"${with_libs}" != xyes ; then
+    # Copy the libraries in reverse order, so that files in the first named
+    # library override files in subsequent libraries.
+    case "${exec_prefixoption}" in
+    "") x=${prefix} ;;
+    *) x=${exec_prefix} ;;
+    esac
+    for l in ${with_libs}; do
+      copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
+    done
+  fi
 fi
 
 # Handle ${copy_dirs}
@@ -1127,25 +1118,6 @@
   host_makefile_frag=mh-frag
 fi
 
-# If we aren't going to be using gcc, see if we can extract a definition
-# of CC from the fragment.
-# Actually, use the 'pre-extracted' version above.
-if test -z "${CC}" && test "${build}" = "${host}" ; then
-  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
-  found=
-  for dir in $PATH; do
-    test -z "$dir" && dir=.
-    if test -f $dir/gcc; then
-      found=yes
-      break
-    fi
-  done
-  IFS="$save_ifs"
-  if test -z "${found}" && test -n "${tentative_cc}" ; then
-    CC=$tentative_cc
-  fi
-fi
-
 case "${target}" in
   v810*)
     target_makefile_frag="config/mt-v810"
@@ -1282,6 +1254,25 @@
     ;;
 esac
 
+# If we aren't going to be using gcc, see if we can extract a definition
+# of CC from the fragment.
+# Actually, use the 'pre-extracted' version above.
+if test -z "${CC}" && test "${build}" = "${host}" ; then
+  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
+  found=
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/gcc; then
+      found=yes
+      break
+    fi
+  done
+  IFS="$save_ifs"
+  if test -z "${found}" && test -n "${tentative_cc}" ; then
+    CC=$tentative_cc
+  fi
+fi
+
 # post-target:
 
 # Make sure that the compiler is able to generate an executable.  If it
@@ -1551,17 +1542,17 @@
 
 sedtemp=sed.$$
 cat >$sedtemp <<EOF
-s:^TARGET_CONFIGDIRS[ 	]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:
-s%^TARGET_CONFIGARGS[ 	]*=.*$%TARGET_CONFIGARGS = ${targargs}%
-s%^FLAGS_FOR_TARGET[ 	]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}%
-s%^CC_FOR_TARGET[ 	]*=.*$%CC_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}%
-s%^GCJ_FOR_TARGET[      ]*=.*$%GCJ_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}%
-s%^CXX_FOR_TARGET[ 	]*=.*$%CXX_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}%
-s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[ 	]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = \$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}%
-s%^TARGET_SUBDIR[ 	]*=.*$%TARGET_SUBDIR = ${target_subdir}%
-s%^BUILD_SUBDIR[ 	]*=.*$%BUILD_SUBDIR = ${build_subdir}%
-s%^BUILD_CONFIGARGS[ 	]*=.*$%BUILD_CONFIGARGS = ${buildargs}%
-s%^gxx_include_dir[ 	]*=.*$%gxx_include_dir=${gxx_include_dir}%
+s:@target_configdirs@:${target_configdirs}:
+s%@target_configargs@%${targargs}%
+s%@FLAGS_FOR_TARGET@%${FLAGS_FOR_TARGET}%
+s%@CC_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}%
+s%@GCJ_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}%
+s%@CXX_FOR_TARGET@%\$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}%
+s%@CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@%\$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}%
+s%@target_subdir@%${target_subdir}%
+s%@build_subdir@%${build_subdir}%
+s%@build_configargs@%${buildargs}%
+s%@gxx_include_dir@%${gxx_include_dir}%
 EOF
 sed -f $sedtemp Makefile > Makefile.tem
 rm -f Makefile $sedtemp
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ec776f7..27c39a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,148 @@
+2002-09-27  David Carlton  <carlton@math.stanford.edu>
+
+	* Makefile.in (cris-tdep.o): Depend on gdb_string_h.
+	(mcore-tdep.o): Ditto.
+	(ns32k-tdep.o): Ditto.
+	(ns32knbsd-tdep.o): Ditto.
+	(sh3-rom.o): Ditto.
+	(vax-tdep.o): Ditto.
+	* cris-tdep.c: #include "gdb_string.h"
+	* mcore-tdep.c: Ditto.
+	* ns32k-tdep.c: Ditto.
+	* ns32knbsd-tdep.c: Ditto.
+	* sh3-rom.c: Ditto.
+	* vax-tdep.c: Ditto.
+
+2002-09-27  David Carlton  <carlton@math.stanford.edu>
+
+	* config/djgpp/fnchange.lst: Add entries for
+	gdb/testsuite/gdb.c++/m-static files.
+
+2002-09-27  Jim Wilson  <wilson@redhat.com>
+
+	* MAINTAINERS: Add myself to the Write After Approval list.
+
+2002-09-26  Martin M. Hunt  <hunt@redhat.com>
+
+	* mips-tdep.c (find_proc_desc): Initialize startaddr.
+
+
+2002-09-26  Andrew Cagney  <ac131313@redhat.com>
+
+	* rs6000-tdep.c (rs6000_frame_chain): Don't chain past the dummy
+	frame.
+
+2002-09-26  Andrew Cagney  <ac131313@redhat.com>
+
+	* rs6000-tdep.c (rs6000_extract_struct_value_address): Return 0.
+	(rs6000_struct_return_address): Delete variable.
+	(rs6000_store_struct_return): Update.
+	(rs6000_gdbarch_init): Set extract_struct_value_address instead of
+	deprecated_extract_struct_value_address.
+	(rs6000_frame_align): New function.
+	(rs6000_gdbarch_init): Set frame_align.
+
+2002-09-26  Andrew Cagney  <ac131313@redhat.com>
+
+	From Grace Sainsbury <graces@redhat.com>:
+	* Makefile.in (gdbtk-main.o): New target.
+	(gdb.o): New target.
+	(main_h): Define.
+	(main.o): Update dependencies.
+	(gdb$(EXEEXT)): Add gdb.o.
+	(SUBDIR_GDBTK_SRCS): Add gdbtk-main.c.
+	(SUBDIR_GDBTK_ALL, SUBDIR_GDBTK_UNINSTALL): Set.
+	(SUBDIR_GDBTK_CLEAN): Set.
+	(install-gdbtk): Install the insight binary.
+	(uninstall-gdbtk): New target.
+	(all-gdbtk, clean-gdbtk): New rule.
+	* top.c (use_windows): Default to zero.
+	* main.c: Include "main.h".
+	(main): Delete.
+	(struct captured_main_args): Delete.
+	(gdb_main): New function.
+	* main.h: New file.
+	* gdb.c: New File.
+
+2002-09-25  Andrew Cagney  <cagney@redhat.com>
+
+	* frame.c: Include "gdb_string.h" and "builtin-regs.h".
+	(frame_map_regnum_to_name): New function.
+	(frame_map_name_to_regnum): New function.
+	* frame.h (frame_map_name_to_regnum): Declare.
+	(frame_map_regnum_to_name): Declare.
+	* builtin-regs.c (builtin_reg_map_regnum_to_name): New function.
+	* builtin-regs.h (builtin_reg_map_regnum_to_name): Declare.
+	* parse.c: Do not include "builtin-regs.h".
+	(target_map_name_to_register): Delete function.
+	(write_dollar_variable): Use frame_map_name_to_regnum.
+	* parser-defs.h (target_map_name_to_register): Delete declaration.
+	* expprint.c: Include "frame.h".
+	(print_subexp): Use frame_map_regnum_to_name.
+	* eval.c (evaluate_subexp_standard): Use frame_map_regnum_to_name.
+	* infcmd.c (registers_info): Use frame_map_name_to_regnum.
+
+2002-09-25  Andrew Cagney  <ac131313@redhat.com>
+
+	* rs6000-tdep.c (rs6000_frame_saved_pc): If the link register
+	wasn't saved, and the next innermost frame is a dummy, return the
+	dummy frame's link register.
+
+2002-09-24  Jim Blandy  <jimb@redhat.com>
+
+	Fix from Paul Breed:
+	* main.c (captured_main): Add a `break' after the case for 'b'.
+
+2002-09-24  Keith Seitz  <keiths@redhat.com>
+
+	* varobj.c (c_type_of_child): Use get_target_type instead
+	of TYPE_TARGET_TYPE.
+
+2002-09-22  Fernando Nasser  <fnasser@redhat.com>
+
+	* source.c (get_current_or_default_source_symtab_and_line): Remove
+	function.
+	(set_default_source_symtab_and_line): New function. Attempts to
+	determine a source file to list lines from if one is not currently
+	defined.
+	(get_current_source_symtab_and_line): Initialize sal.pc and
+        sal.end fields.
+	(set_current_source_symtab_and_line): Mark argument as const.
+	* source.h: Update declarations and comments.
+	* linespec.c (decode_line_1): Replace call to removed routine above.
+	* stack.c (print_frame_info_base): Ditto.
+	* cli/cli-cmds.c (edit_command): Ditto.
+	(list_command): Ditto.
+
+2002-09-22  Fernando Nasser  <fnasser@redhat.com>
+
+	* source.c (get_current__or_default_source_symtab_and_line): Initialize
+	sal.pc and sal.end fields.
+	(get_current_or_default_source_symtab_and_line): Ditto.
+	* breakpoint.c (parse_breakpoint_sals): Use correct accessor function
+	so we do not cause a new source symtab to be searched for (reverting an
+	unintentional change from the 2002-09-20 patch).
+	* scm-lang.c (scm_unpac): Ditto.
+
+2002-09-21  Andrew Cagney  <cagney@redhat.com>
+
+	* complaints.c (symfile_explanations): Remove new-line from
+	``isolated_message''.
+	(vcomplaint): When ISOLATED_MESSAGE, force a line break.
+	(clear_complaints): When a SUBSEQUENT_MESSAGE, force a line break.
+
+2002-09-20  Nick Clifton  <nickc@redhat.com>
+	
+	* NEWS: Announce that V850EA ISA is no longer supported.
+        * v850-tdep.c: Remove reference to bfd_mach_v850ea.
+
+2002-09-20  David Carlton  <carlton@math.stanford.edu>
+
+	* Makefile.in (c-lang.o): Correct dependencies.
+	(utils.o): Gather dependencies.
+	(charset.o): Move.
+	* c-lang.c: #include "gdb_string.h"
+
 2002-09-20  Fernando Nasser  <fnasser@redhat.com>
 
 	From 2002-07-02  George Helffrich <george@gly.bris.ac.uk>
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 94f1bb1..710609d 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -430,6 +430,7 @@
 Tom Tromey					tromey@redhat.com
 Corinna Vinschen				vinschen@redhat.com
 Keith Walker					keith.walker@arm.com
+Jim Wilson					wilson@redhat.com
 Elena Zannoni					ezannoni@redhat.com
 Eli Zaretskii					eliz@gnu.org
 
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index ca17a2b..b56732d 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -290,16 +290,17 @@
 	gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-bp.c \
 	gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c \
 	gdbtk/generic/gdbtk-register.c gdbtk/generic/gdbtk-stack.c \
-	gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c
+	gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c \
+	gdbtk/generic/gdbtk-main.c
 SUBDIR_GDBTK_DEPS = \
 	$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)
 SUBDIR_GDBTK_INITS = gdbtk/generic/gdbtk.c
 SUBDIR_GDBTK_LDFLAGS=
 SUBDIR_GDBTK_CFLAGS= -DGDBTK
-SUBDIR_GDBTK_ALL=
-SUBDIR_GDBTK_CLEAN=
+SUBDIR_GDBTK_ALL= all-gdbtk
+SUBDIR_GDBTK_CLEAN= clean-gdbtk
 SUBDIR_GDBTK_INSTALL= install-gdbtk
-SUBDIR_GDBTK_UNINSTALL= 
+SUBDIR_GDBTK_UNINSTALL= uninstall-gdbtk
 
 CONFIG_OBS= @CONFIG_OBS@
 CONFIG_LIB_OBS= @CONFIG_LIB_OBS@
@@ -679,6 +680,7 @@
 macroexp_h = macroexp.h
 macroscope_h = macroscope.h $(macrotab_h) $(symtab_h)
 macrotab_h = macrotab.h
+main_h = main.h
 memattr_h = memattr.h
 minimon_h = minimon.h
 mipsnbsd_tdep_h = mipsnbsd-tdep.h
@@ -929,25 +931,8 @@
 		  true ; \
 		fi ; \
 		rm -f $(bindir)/$$transformed_name$(EXEEXT) $(man1dir)/$$transformed_name.1
-	rm -rf $(GDBTK_LIBRARY)
 	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do 
 
-install-gdbtk:
-	$(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY) ; \
-	$(SHELL) $(srcdir)/../mkinstalldirs $(libdir)/insight$(GDBTK_VERSION) ; \
-	$(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl $(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \
-	$(SHELL) $(srcdir)/../mkinstalldirs \
-		$(GDBTK_LIBRARY)/images \
-		$(GDBTK_LIBRARY)/images2 ; \
-	$(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY)/help \
-		$(GDBTK_LIBRARY)/help/images \
-		$(GDBTK_LIBRARY)/help/trace ; \
-	cd $(srcdir)/gdbtk/library ; \
-	for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html  help/trace/*.html help/trace/index.toc help/images/*.gif; \
-	  do \
-		$(INSTALL_DATA) $$i $(GDBTK_LIBRARY)/$$i ; \
-	  done ;
-
 # We do this by grepping through sources.  If that turns out to be too slow,
 # maybe we could just require every .o file to have an initialization routine
 # of a given name (top.o -> _initialize_top, etc.).
@@ -1017,11 +1002,11 @@
 init.o: init.c $(defs_h) $(call_cmds_h)
 
 # Removing the old gdb first works better if it is running, at least on SunOS.
-gdb$(EXEEXT): main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
+gdb$(EXEEXT): gdb.o main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
 	rm -f gdb$(EXEEXT)
-	$(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) -o gdb$(EXEEXT) \
-	main.o libgdb.a $(CONFIG_OBS) $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS)\
-	$(LOADLIBES)
+	$(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
+		-o gdb$(EXEEXT) gdb.o main.o $(CONFIG_OBS) libgdb.a \
+		$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
 
 nlm:	force
 	rootme=`pwd`; export rootme; $(MAKE) $(TARGET_FLAGS_TO_PASS) DO=all DODIRS=nlm subdir_do
@@ -1560,7 +1545,7 @@
 	$(gdb_string_h) $(gdb_assert_h)
 c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
 	$(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \
-	$(macroscope_h) $(gdb_assert_h)
+	$(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h)
 c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
 	$(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \
 	$(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \
@@ -1572,6 +1557,7 @@
 # OBSOLETE ch-lang.o: ch-lang.c
 # OBSOLETE ch-typeprint.o: ch-typeprint.c
 # OBSOLETE ch-valprint.o: ch-valprint.c
+charset.o: charset.c $(defs_h) $(charset_h) $(gdbcmd_h) gdb_assert.h
 cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h) $(gdb_string_h) \
 	$(gdb_assert_h)
 coff-solib.o: coff-solib.c $(defs_h) $(frame_h) $(bfd_h) $(gdbcore_h) \
@@ -1609,7 +1595,7 @@
 cris-tdep.o: cris-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(inferior_h) \
 	$(gdbtypes_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(value_h) \
 	$(opcode_cris_h) $(arch_utils_h) $(regcache_h) $(symfile_h) \
-	$(solib_h) $(solib_svr4_h)
+	$(solib_h) $(solib_svr4_h) $(gdb_string_h)
 # OBSOLETE cxux-nat.o: cxux-nat.c
 d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbtypes_h) \
 	$(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) $(inferior_h) \
@@ -1690,6 +1676,7 @@
 	$(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-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) \
@@ -1883,7 +1870,7 @@
 	$(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)
+	$(event_loop_h) $(ui_out_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)
@@ -1891,7 +1878,7 @@
 	$(gdb_string_h) $(regcache_h) $(serial_h)
 mcore-tdep.o: mcore-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(value_h) \
 	$(gdbcmd_h) $(regcache_h) $(symfile_h) $(gdbcore_h) $(inferior_h) \
-	$(arch_utils_h)
+	$(arch_utils_h) $(gdb_string_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) \
@@ -1944,10 +1931,10 @@
 	$(objfiles_h) $(buildsym_h) $(stabsread_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)
+	$(ns32k_tdep_h) $(gdb_string_h)
 ns32knbsd-nat.o: ns32knbsd-nat.c $(defs_h) $(inferior_h) $(target_h) \
 	$(gdbcore_h) $(regcache_h)
-ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h)
+ns32knbsd-tdep.o: ns32knbsd-tdep.c $(defs_h) $(ns32k_tdep_h) $(gdb_string_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)
@@ -2121,7 +2108,8 @@
 	$(regcache_h) $(doublest_h) $(sh_tdep_h) $(elf_bfd_h) \
 	$(solib_svr4_h) $(elf_sh_h) $(gdb_sim_sh_h)
 sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
-	$(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(sh_tdep_h)
+	$(serial_h) $(srec_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h) \
+	$(sh_tdep_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)
@@ -2242,7 +2230,7 @@
 utils.o: utils.c $(config_h) $(defs_h) $(gdb_assert_h) $(gdb_string_h) \
 	$(event_top_h) $(gdbcmd_h) $(serial_h) $(bfd_h) $(target_h) \
 	$(demangle_h) $(expression_h) $(language_h) $(annotate_h) \
-	$(filenames_h) $(inferior_h) $(mmalloc_h)
+	$(filenames_h) $(inferior_h) $(mmalloc_h) $(charset_h)
 uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
 	$(regcache_h) $(gregset_h)
 v850-tdep.o: v850-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
@@ -2269,7 +2257,7 @@
 	$(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) \
 	$(inferior_h) $(regcache_h) $(frame_h) $(value_h) $(arch_utils_h) \
-	$(vax_tdep_h)
+	$(gdb_string_h) $(vax_tdep_h)
 w89k-rom.o: w89k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
 	$(serial_h) $(xmodem_h) $(regcache_h)
 win32-nat.o: win32-nat.c $(defs_h) $(tm_h) $(frame_h) $(inferior_h) \
@@ -2340,6 +2328,55 @@
 # Need to explicitly specify the compile rule as make will do nothing
 # or try to compile the object file into the mi directory.
 
+all-gdbtk: insight$(EXEEXT)
+
+install-gdbtk:
+	transformed_name=`t='$(program_transform_name)'; \
+		  echo insight | sed -e $$t` ; \
+	if test "x$$transformed_name" = x; then \
+	  transformed_name=insight ; \
+	else \
+	  true ; \
+	fi ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(bindir)
+	$(INSTALL_PROGRAM) insight$(EXEEXT) $(bindir)/$$transformed_name$(EXEEXT) ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY) ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(libdir)/insight$(GDBTK_VERSION) ; \
+	$(INSTALL_DATA) $(srcdir)/gdbtk/plugins/plugins.tcl $(libdir)/insight$(GDBTK_VERSION)/plugins.tcl ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs \
+		$(GDBTK_LIBRARY)/images \
+		$(GDBTK_LIBRARY)/images2 ; \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(GDBTK_LIBRARY)/help \
+		$(GDBTK_LIBRARY)/help/images \
+		$(GDBTK_LIBRARY)/help/trace ; \
+	cd $(srcdir)/gdbtk/library ; \
+	for i in *.tcl *.itcl *.ith *.itb images/*.gif images2/*.gif images/icons.txt images2/icons.txt tclIndex help/*.html  help/trace/*.html help/trace/index.toc help/images/*.gif; \
+	  do \
+		$(INSTALL_DATA) $$i $(GDBTK_LIBRARY)/$$i ; \
+	  done ;
+
+uninstall-gdbtk:
+	transformed_name=`t='$(program_transform_name)'; \
+		  echo insight | sed -e $$t` ; \
+	if test "x$$transformed_name" = x; then \
+		transformed_name=insight ; \
+	else \
+		true ; \
+	fi ; \
+	rm -f $(bindir)/$$transformed_name$(EXEEXT) ; \
+	rm -rf $(GDBTK_LIBRARY)
+
+clean-gdbtk:
+	rm -f insight$(EXEEXT)
+
+# Removing the old gdb first works better if it is running, at least on SunOS.
+insight$(EXEEXT): gdbtk-main.o main.o libgdb.a $(CONFIG_OBS) $(ADD_DEPS) \
+		$(CDEPS) $(TDEPLIBS)
+	rm -f insight$(EXEEXT)
+	$(HLDENV) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
+		-o insight$(EXEEXT) gdbtk-main.o main.o libgdb.a $(CONFIG_OBS)\
+		$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
+
 gdbres.o: $(srcdir)/gdbtk/gdb.rc $(srcdir)/gdbtk/gdbtool.ico
 	$(WINDRES) --include $(srcdir)/gdbtk $(srcdir)/gdbtk/gdb.rc gdbres.o
 
@@ -2383,6 +2420,12 @@
 	$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
 		$(srcdir)/gdbtk/generic/gdbtk-hooks.c -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\"
 
+gdbtk-main.o: $(srcdir)/gdbtk/generic/gdbtk-main.c $(defs_h) $(main_h) \
+	$(gdb_string_h)
+	$(CC) -c $(INTERNAL_CFLAGS) $(IDE_CFLAGS) $(ITCL_CFLAGS) $(TIX_CFLAGS) \
+	$(TCL_CFLAGS) $(TK_CFLAGS) $(X11_CFLAGS) $(GDBTK_CFLAGS)\
+		$(srcdir)/gdbtk/generic/gdbtk-main.c -DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\"
+
 gdbtk-register.o: $(srcdir)/gdbtk/generic/gdbtk-register.c \
 		$(srcdir)/gdbtk/generic/gdbtk.h \
 		$(srcdir)/gdbtk/generic/gdbtk-cmds.h \
@@ -2588,8 +2631,4 @@
 	vx-share/vxWorks.h vx-share/xdr_rdb.h
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/vx-share/xdr_rdb.c
 
-charset.o: charset.c $(defs_h) $(charset_h) $(gdbcmd_h) gdb_assert.h
-
-c-lang.o: $(charset_h)
-utils.o: $(charset_h)
 ### end of the gdb Makefile.in.
diff --git a/gdb/NEWS b/gdb/NEWS
index bbd70c4..8dfa54c 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,10 @@
 
 *** Changes since GDB 5.3:
 
+* REMOVED configurations and files
+
+V850EA ISA				
+
 * MIPS $fp behavior changed
 
 The convenience variable $fp, for the MIPS, now consistently returns
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index caa8f1c..a77bff4 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4620,8 +4620,7 @@
          should produce the results we want almost all of the time while
          leaving default_breakpoint_* alone.  */
 	 
-      struct symtab_and_line cursal = 
-      			get_current_or_default_source_symtab_and_line ();
+      struct symtab_and_line cursal = get_current_source_symtab_and_line ();
 			
       if (default_breakpoint_valid
 	  && (!cursal.symtab
diff --git a/gdb/builtin-regs.c b/gdb/builtin-regs.c
index 8c488e3..07e5fcc 100644
--- a/gdb/builtin-regs.c
+++ b/gdb/builtin-regs.c
@@ -68,6 +68,15 @@
   return -1;
 }
 
+const char *
+builtin_reg_map_regnum_to_name (int regnum)
+{
+  int reg = regnum - (NUM_REGS + NUM_PSEUDO_REGS);
+  if (reg < 0 || reg >= nr_builtin_regs)
+    return NULL;
+  return builtin_regs[reg].name;
+}
+
 struct value *
 value_of_builtin_reg (int regnum, struct frame_info *frame)
 {
diff --git a/gdb/builtin-regs.h b/gdb/builtin-regs.h
index b35c4e9..fb9fbcf 100644
--- a/gdb/builtin-regs.h
+++ b/gdb/builtin-regs.h
@@ -26,6 +26,8 @@
 
 extern int builtin_reg_map_name_to_regnum (const char *str, int len);
 
+extern const char *builtin_reg_map_regnum_to_name (int regnum);
+
 extern struct value *value_of_builtin_reg (int regnum,
 					   struct frame_info *frame);
 
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 6bbd6d9..4b4af16 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -30,6 +30,7 @@
 #include "macroscope.h"
 #include "gdb_assert.h"
 #include "charset.h"
+#include "gdb_string.h"
 
 extern void _initialize_c_language (void);
 static void c_emit_char (int c, struct ui_file * stream, int quoter);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 0b5b857..c44975a 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -552,7 +552,10 @@
 
   /* Pull in the current default source line if necessary */
   if (arg == 0)
-    sal = get_current_or_default_source_symtab_and_line ();
+    {
+      set_default_source_symtab_and_line ();
+      sal = get_current_source_symtab_and_line ();
+    }
 
   /* bare "edit" edits file with present line.  */
 
@@ -655,7 +658,10 @@
 
   /* Pull in the current default source line if necessary */
   if (arg == 0 || arg[0] == '+' || arg[0] == '-')
-    cursal = get_current_or_default_source_symtab_and_line ();
+    {
+      set_default_source_symtab_and_line ();
+      cursal = get_current_source_symtab_and_line ();
+    }
 
   /* "l" or "l +" lists next ten lines.  */
 
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 95ded4c..84cf6a2 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -84,7 +84,7 @@
 /* The symbol table complaint table.  */
 
 static const char *symfile_explanations[] = {
-  "During symbol reading, %s.\n",
+  "During symbol reading, %s.",
   "During symbol reading...%s...",
   "%s...",
   "%s...",
@@ -181,6 +181,7 @@
   else
     {
       if (complaints->explanation == NULL)
+	/* A [v]warning() call always appends a newline.  */
 	vwarning (complaint->fmt, args);
       else
 	{
@@ -194,7 +195,17 @@
 	  fprintf_filtered (gdb_stderr,
 			    complaints->explanation[series],
 			    msg);
-	  wrap_here ("");
+	  /* Force a line-break after any isolated message.  For the
+             other cases, clear_complaints() takes care of any missing
+             trailing newline, the wrap_here() is just a hint.  */
+	  if (series == ISOLATED_MESSAGE)
+	    /* It would be really nice to use begin_line() here.
+	       Unfortunatly that function doesn't track GDB_STDERR and
+	       consequently will sometimes supress a line when it
+	       shouldn't.  */
+	    fputs_filtered ("\n", gdb_stderr);
+	  else
+	    wrap_here ("");
 	  do_cleanups (cleanups);
 	}
     }
@@ -267,10 +278,26 @@
       p->counter = 0;
     }
 
-  if (complaints->series > 1 && !warning_hook)
+  switch (complaints->series)
     {
-      /* Terminate previous series, since caller won't.  */
-      puts_filtered ("\n");
+    case FIRST_MESSAGE:
+      /* Haven't yet printed anything.  */
+      break;
+    case SHORT_FIRST_MESSAGE:
+      /* Haven't yet printed anything.  */
+      break;
+    case ISOLATED_MESSAGE:
+      /* The code above, always forces a line-break.  No need to do it
+         here.  */
+      break;
+    case SUBSEQUENT_MESSAGE:
+      /* It would be really nice to use begin_line() here.
+         Unfortunatly that function doesn't track GDB_STDERR and
+         consequently will sometimes supress a line when it shouldn't.  */
+      fputs_unfiltered ("\n", gdb_stderr);
+      break;
+    default:
+      internal_error (__FILE__, __LINE__, "bad switch");
     }
 
   if (!less_verbose)
diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst
index 0671a12..b8a9eb8 100644
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -209,6 +209,10 @@
 @V@/gdb/testsuite/gdb.c++/inherit.exp @V@/gdb/testsuite/gdb.cxx/inherit.exp
 @V@/gdb/testsuite/gdb.c++/local.cc @V@/gdb/testsuite/gdb.cxx/local.cc
 @V@/gdb/testsuite/gdb.c++/local.exp @V@/gdb/testsuite/gdb.cxx/local.exp
+@V@/gdb/testsuite/gdb.c++/m-static.cc @V@/gdb/testsuite/gdb.cxx/m-static.cc
+@V@/gdb/testsuite/gdb.c++/m-static1.cc @V@/gdb/testsuite/gdb.cxx/m-stat1.cc
+@V@/gdb/testsuite/gdb.c++/m-static.exp @V@/gdb/testsuite/gdb.cxx/m-static.exp
+@V@/gdb/testsuite/gdb.c++/m-static.h @V@/gdb/testsuite/gdb.cxx/m-static.h
 @V@/gdb/testsuite/gdb.c++/member-ptr.cc @V@/gdb/testsuite/gdb.cxx/member-ptr.cc
 @V@/gdb/testsuite/gdb.c++/member-ptr.exp @V@/gdb/testsuite/gdb.cxx/member-ptr.exp
 @V@/gdb/testsuite/gdb.c++/method.cc @V@/gdb/testsuite/gdb.cxx/method.cc
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 0bfb5b3..5d64d43 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -37,6 +37,7 @@
 
 #include "solib.h"              /* Support for shared libraries. */
 #include "solib-svr4.h"         /* For struct link_map_offsets.  */
+#include "gdb_string.h"
 
 
 enum cris_num_regs
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 71df0d0..362e056 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,29 @@
+2002-09-27  Andrew Cagney  <ac131313@redhat.com>
+
+	* all-cfg.texi: Use @sc for GDB and GCC.  Update copyright.
+
+2002-09-25  Kevin Buettner  <kevinb@redhat.com>
+
+	* gdb.texinfo: Use GNU/Linux instead of Linux.
+
+2002-09-25  Andrew Cagney  <ac131313@redhat.com>
+
+	* gdb.texinfo (Packets): Replace @samp{} with ``an empty string''.
+
+2002-09-24  Andrew Cagney  <ac131313@redhat.com>
+
+	* gdb.texinfo: Replace @example with @smallexample.
+
+2002-09-20  Kevin Buettner  <kevinb@redhat.com>
+
+	From Eli Zaretskii  <eliz@is.elta.co.il>:
+	* gdb.texinfo (Character Sets): Use @smallexample instead of
+	@example.  Use GNU/Linux instead of Linux.
+
+2002-09-20  Jim Blandy  <jimb@redhat.com>
+
+	* gdb.texinfo: Add character set documentation.
+
 2002-09-19  Andrew Cagney  <ac131313@redhat.com>
 
 	* gdb.texinfo (Packets): Revise `z' and `Z' packet documentation.
diff --git a/gdb/doc/all-cfg.texi b/gdb/doc/all-cfg.texi
index 6dee4e4..b680ea2 100644
--- a/gdb/doc/all-cfg.texi
+++ b/gdb/doc/all-cfg.texi
@@ -1,5 +1,6 @@
 @c GDB MANUAL configuration file.  
-@c Copyright 1993, 1995, 1999 Free Software Foundation, Inc.
+@c
+@c Copyright 1993, 1995, 1999, 2002 Free Software Foundation, Inc.
 @c
 @c NOTE: While the GDB manual is configurable (by changing these
 @c switches), its configuration is ***NOT*** automatically tied in to
@@ -31,15 +32,14 @@
 @set GDBP gdb
 @c 
 @c Name of GDB product.  Used in running text.
-@set GDBN GDB
+@set GDBN @sc{gdb}
 @c
 @c Name of host.  Should not be used in generic configs, but generic
 @c value may catch some flubs.
 @set HOST machine specific
 @c
 @c Name of GCC product
-@set NGCC GCC
+@set NGCC @sc{gcc}
 @c 
 @c Name of GCC program
 @set GCC gcc
-
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index ceaa21a..7e93c22 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -395,7 +395,7 @@
 Pace Willison contributed Intel 386 support.
 Jay Vosburgh contributed Symmetry support.
 
-Andreas Schwab contributed M68K Linux support.
+Andreas Schwab contributed M68K @sc{gnu}/Linux support.
 
 Rich Schaefer and Peter Schauer helped with support of SunOS shared
 libraries.
@@ -2622,7 +2622,7 @@
 catch errors where you have no clue what part of your program is the
 culprit.)
 
-On some systems, such as HP-UX, Linux and some other x86-based targets,
+On some systems, such as HP-UX, @sc{gnu}/Linux and some other x86-based targets,
 @value{GDBN} includes support for
 hardware watchpoints, which do not slow down the running of your
 program.
@@ -4206,26 +4206,24 @@
 @footnote{
 The only restriction is that your editor (say @code{ex}), recognizes the
 following command-line syntax:
-@example
+@smallexample
 ex +@var{number} file
-@end example
-The optional numeric value +@var{number} designates the active line in the file.
-}.
-By default, it is @value{EDITOR}, but you can change this by setting the
-environment variable @code{EDITOR} before using
-@value{GDBN}.
-For example, to configure @value{GDBN} to use the @code{vi} editor, you
-could use these commands with the @code{sh} shell:
-@example
+@end smallexample
+The optional numeric value +@var{number} designates the active line in
+the file.}.  By default, it is @value{EDITOR}, but you can change this
+by setting the environment variable @code{EDITOR} before using
+@value{GDBN}.  For example, to configure @value{GDBN} to use the
+@code{vi} editor, you could use these commands with the @code{sh} shell:
+@smallexample
 EDITOR=/usr/bin/vi
 export EDITOR
 gdb ...
-@end example
+@end smallexample
 or in the @code{csh} shell,
-@example
+@smallexample
 setenv EDITOR /usr/bin/vi
 gdb ...
-@end example
+@end smallexample
 
 @node Search
 @section Searching source files
@@ -4493,6 +4491,8 @@
 * Vector Unit::                 Vector Unit
 * Memory Region Attributes::    Memory region attributes
 * Dump/Restore Files::          Copy between memory and a file
+* Character Sets::              Debugging programs that use a different
+                                character set than GDB does
 @end menu
 
 @node Expressions
@@ -5879,6 +5879,254 @@
 
 @end table
 
+@node Character Sets
+@section Character Sets
+@cindex character sets
+@cindex charset
+@cindex translating between character sets
+@cindex host character set
+@cindex target character set
+
+If the program you are debugging uses a different character set to
+represent characters and strings than the one @value{GDBN} uses itself,
+@value{GDBN} can automatically translate between the character sets for
+you.  The character set @value{GDBN} uses we call the @dfn{host
+character set}; the one the inferior program uses we call the
+@dfn{target character set}.
+
+For example, if you are running @value{GDBN} on a @sc{gnu}/Linux system, which
+uses the ISO Latin 1 character set, but you are using @value{GDBN}'s
+remote protocol (@pxref{Remote,Remote Debugging}) to debug a program
+running on an IBM mainframe, which uses the @sc{ebcdic} character set,
+then the host character set is Latin-1, and the target character set is
+@sc{ebcdic}.  If you give @value{GDBN} the command @code{set
+target-charset ebcdic-us}, then @value{GDBN} translates between
+@sc{ebcdic} and Latin 1 as you print character or string values, or use
+character and string literals in expressions.
+
+@value{GDBN} has no way to automatically recognize which character set
+the inferior program uses; you must tell it, using the @code{set
+target-charset} command, described below.
+
+Here are the commands for controlling @value{GDBN}'s character set
+support:
+
+@table @code
+@item set target-charset @var{charset}
+@kindex set target-charset
+Set the current target character set to @var{charset}.  We list the
+character set names @value{GDBN} recognizes below, but if you invoke the
+@code{set target-charset} command with no argument, @value{GDBN} lists
+the character sets it supports.
+@end table
+
+@table @code
+@item set host-charset @var{charset}
+@kindex set host-charset
+Set the current host character set to @var{charset}.
+
+By default, @value{GDBN} uses a host character set appropriate to the
+system it is running on; you can override that default using the
+@code{set host-charset} command.
+
+@value{GDBN} can only use certain character sets as its host character
+set.  We list the character set names @value{GDBN} recognizes below, and
+indicate which can be host character sets, but if you invoke the
+@code{set host-charset} command with no argument, @value{GDBN} lists the
+character sets it supports, placing an asterisk (@samp{*}) after those
+it can use as a host character set.
+
+@item set charset @var{charset}
+@kindex set charset
+Set the current host and target character sets to @var{charset}.  If you
+invoke the @code{set charset} command with no argument, it lists the
+character sets it supports.  @value{GDBN} can only use certain character
+sets as its host character set; it marks those in the list with an
+asterisk (@samp{*}).
+
+@item show charset
+@itemx show host-charset
+@itemx show target-charset
+@kindex show charset
+@kindex show host-charset
+@kindex show target-charset
+Show the current host and target charsets.  The @code{show host-charset}
+and @code{show target-charset} commands are synonyms for @code{show
+charset}.
+
+@end table
+
+@value{GDBN} currently includes support for the following character
+sets:
+
+@table @code
+
+@item ASCII
+@cindex ASCII character set
+Seven-bit U.S. @sc{ascii}.  @value{GDBN} can use this as its host
+character set.
+
+@item ISO-8859-1
+@cindex ISO 8859-1 character set
+@cindex ISO Latin 1 character set
+The ISO Latin 1 character set.  This extends ASCII with accented
+characters needed for French, German, and Spanish.  @value{GDBN} can use
+this as its host character set.
+
+@item EBCDIC-US
+@itemx IBM1047
+@cindex EBCDIC character set
+@cindex IBM1047 character set
+Variants of the @sc{ebcdic} character set, used on some of IBM's
+mainframe operating systems.  (@sc{gnu}/Linux on the S/390 uses U.S. @sc{ascii}.)
+@value{GDBN} cannot use these as its host character set.
+
+@end table
+
+Note that these are all single-byte character sets.  More work inside
+GDB is needed to support multi-byte or variable-width character
+encodings, like the UTF-8 and UCS-2 encodings of Unicode.
+
+Here is an example of @value{GDBN}'s character set support in action.
+Assume that the following source code has been placed in the file
+@file{charset-test.c}:
+
+@smallexample
+#include <stdio.h>
+
+char ascii_hello[]
+  = @{72, 101, 108, 108, 111, 44, 32, 119,
+     111, 114, 108, 100, 33, 10, 0@};
+char ibm1047_hello[]
+  = @{200, 133, 147, 147, 150, 107, 64, 166,
+     150, 153, 147, 132, 90, 37, 0@};
+
+main ()
+@{
+  printf ("Hello, world!\n");
+@}
+@end smallexample
+
+In this program, @code{ascii_hello} and @code{ibm1047_hello} are arrays
+containing the string @samp{Hello, world!} followed by a newline,
+encoded in the @sc{ascii} and @sc{ibm1047} character sets.
+
+We compile the program, and invoke the debugger on it:
+
+@smallexample
+$ gcc -g charset-test.c -o charset-test
+$ gdb -nw charset-test
+GNU gdb 2001-12-19-cvs
+Copyright 2001 Free Software Foundation, Inc.
+@dots{}
+(gdb) 
+@end smallexample
+
+We can use the @code{show charset} command to see what character sets
+@value{GDBN} is currently using to interpret and display characters and
+strings:
+
+@smallexample
+(gdb) show charset
+The current host and target character set is `iso-8859-1'.
+(gdb) 
+@end smallexample
+
+For the sake of printing this manual, let's use @sc{ascii} as our
+initial character set:
+@smallexample
+(gdb) set charset ascii
+(gdb) show charset
+The current host and target character set is `ascii'.
+(gdb) 
+@end smallexample
+
+Let's assume that @sc{ascii} is indeed the correct character set for our
+host system --- in other words, let's assume that if @value{GDBN} prints
+characters using the @sc{ascii} character set, our terminal will display
+them properly.  Since our current target character set is also
+@sc{ascii}, the contents of @code{ascii_hello} print legibly:
+
+@smallexample
+(gdb) print ascii_hello
+$1 = 0x401698 "Hello, world!\n"
+(gdb) print ascii_hello[0]
+$2 = 72 'H'
+(gdb) 
+@end smallexample
+
+@value{GDBN} uses the target character set for character and string
+literals you use in expressions:
+
+@smallexample
+(gdb) print '+'
+$3 = 43 '+'
+(gdb) 
+@end smallexample
+
+The @sc{ascii} character set uses the number 43 to encode the @samp{+}
+character.
+
+@value{GDBN} relies on the user to tell it which character set the
+target program uses.  If we print @code{ibm1047_hello} while our target
+character set is still @sc{ascii}, we get jibberish:
+
+@smallexample
+(gdb) print ibm1047_hello
+$4 = 0x4016a8 "\310\205\223\223\226k@@\246\226\231\223\204Z%"
+(gdb) print ibm1047_hello[0]
+$5 = 200 '\310'
+(gdb) 
+@end smallexample
+
+If we invoke the @code{set target-charset} command without an argument,
+@value{GDBN} tells us the character sets it supports:
+
+@smallexample
+(gdb) set target-charset
+Valid character sets are:
+  ascii *
+  iso-8859-1 *
+  ebcdic-us  
+  ibm1047  
+* - can be used as a host character set
+@end smallexample
+
+We can select @sc{ibm1047} as our target character set, and examine the
+program's strings again.  Now the @sc{ascii} string is wrong, but
+@value{GDBN} translates the contents of @code{ibm1047_hello} from the
+target character set, @sc{ibm1047}, to the host character set,
+@sc{ascii}, and they display correctly:
+
+@smallexample
+(gdb) set target-charset ibm1047
+(gdb) show charset
+The current host character set is `ascii'.
+The current target character set is `ibm1047'.
+(gdb) print ascii_hello
+$6 = 0x401698 "\110\145%%?\054\040\167?\162%\144\041\012"
+(gdb) print ascii_hello[0]
+$7 = 72 '\110'
+(gdb) print ibm1047_hello
+$8 = 0x4016a8 "Hello, world!\n"
+(gdb) print ibm1047_hello[0]
+$9 = 200 'H'
+(gdb)
+@end smallexample
+
+As above, @value{GDBN} uses the target character set for character and
+string literals you use in expressions:
+
+@smallexample
+(gdb) print '+'
+$10 = 78 '+'
+(gdb) 
+@end smallexample
+
+The IBM1047 character set uses the number 78 to encode the @samp{+}
+character.
+
+
 @node Macros
 @chapter C Preprocessor Macros
 
@@ -10946,7 +11194,7 @@
 several kinds of information about the process running your program.
 @code{info proc} works only on SVR4 systems that include the
 @code{procfs} code.  This includes OSF/1 (Digital Unix), Solaris, Irix,
-and Unixware, but not HP-UX or Linux, for example.
+and Unixware, but not HP-UX or @sc{gnu}/Linux, for example.
 
 @table @code
 @kindex info proc
@@ -15023,9 +15271,9 @@
 Each breakpoint and watchpoint packet @var{type} is documented
 separately.
 
-@emph{Implementation notes: A remote target shall return @samp{} for an
-unrecognized breakpoint or watchpoint packet @var{type}.  A remote
-target shall support either both or neither of a given
+@emph{Implementation notes: A remote target shall return an empty string
+for an unrecognized breakpoint or watchpoint packet @var{type}.  A
+remote target shall support either both or neither of a given
 @code{Z}@var{type}@dots{} and @code{z}@var{type}@dots{} packet pair.  To
 avoid potential problems with duplicate packets, the operations should
 be implemented in an idempotent way.}
diff --git a/gdb/eval.c b/gdb/eval.c
index 33ec943..cbcf862 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -448,7 +448,8 @@
 	struct value *val = value_of_register (regno, selected_frame);
 	(*pos) += 2;
 	if (val == NULL)
-	  error ("Value of register %s not available.", REGISTER_NAME (regno));
+	  error ("Value of register %s not available.",
+		 frame_map_regnum_to_name (regno));
 	else
 	  return val;
       }
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 9f3f171..aa8b876 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -26,6 +26,7 @@
 #include "value.h"
 #include "language.h"
 #include "parser-defs.h"
+#include "frame.h"		/* For frame_map_regnum_to_name.  */
 
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
@@ -119,10 +120,12 @@
       return;
 
     case OP_REGISTER:
-      (*pos) += 2;
-      fprintf_filtered (stream, "$%s",
-	      REGISTER_NAME (longest_to_int (exp->elts[pc + 1].longconst)));
-      return;
+      {
+	int regnum = longest_to_int (exp->elts[pc + 1].longconst);
+	(*pos) += 2;
+	fprintf_filtered (stream, "$%s", frame_map_regnum_to_name (regnum));
+	return;
+      }
 
     case OP_BOOL:
       (*pos) += 2;
diff --git a/gdb/frame.c b/gdb/frame.c
index 82754ef..1ad3b09 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -27,6 +27,8 @@
 #include "inferior.h"	/* for inferior_ptid */
 #include "regcache.h"
 #include "gdb_assert.h"
+#include "gdb_string.h"
+#include "builtin-regs.h"
 
 /* Return a frame uniq ID that can be used to, later re-find the
    frame.  */
@@ -233,3 +235,44 @@
 
   return !optim;
 }
+
+
+/* Map between a frame register number and its name.  A frame register
+   space is a superset of the cooked register space --- it also
+   includes builtin registers.  */
+
+int
+frame_map_name_to_regnum (const char *name, int len)
+{
+  int i;
+
+  /* Search register name space. */
+  for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
+    if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
+	&& strncmp (name, REGISTER_NAME (i), len) == 0)
+      {
+	return i;
+      }
+
+  /* Try builtin registers.  */
+  i = builtin_reg_map_name_to_regnum (name, len);
+  if (i >= 0)
+    {
+      /* A builtin register doesn't fall into the architecture's
+         register range.  */
+      gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS);
+      return i;
+    }
+
+  return -1;
+}
+
+const char *
+frame_map_regnum_to_name (int regnum)
+{
+  if (regnum < 0)
+    return NULL;
+  if (regnum < NUM_REGS + NUM_PSEUDO_REGS)
+    return REGISTER_NAME (regnum);
+  return builtin_reg_map_regnum_to_name (regnum);
+}
diff --git a/gdb/frame.h b/gdb/frame.h
index df2a021..79bb3d9 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -366,4 +366,11 @@
 extern int frame_register_read (struct frame_info *frame, int regnum,
 				void *buf);
 
+/* Map between a frame register number and its name.  A frame register
+   space is a superset of the cooked register space --- it also
+   includes builtin registers.  */
+
+extern int frame_map_name_to_regnum (const char *name, int strlen);
+extern const char *frame_map_regnum_to_name (int regnum);
+
 #endif /* !defined (FRAME_H)  */
diff --git a/gdb/gdb.c b/gdb/gdb.c
new file mode 100644
index 0000000..c0bc487
--- /dev/null
+++ b/gdb/gdb.c
@@ -0,0 +1,34 @@
+/* Main function for CLI gdb.  
+   Copyright 2002 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "defs.h"
+#include "main.h"
+#include "gdb_string.h"
+
+int
+main (int argc, char **argv)
+{
+  struct captured_main_args args;
+  memset (&args, 0, sizeof args);
+  args.argc = argc;
+  args.argv = argv;
+  args.use_windows = 0;
+  return gdb_main (&args);
+}
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 95636ca..a1d030b 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1701,7 +1701,7 @@
 	++end;
       numregs = NUM_REGS + NUM_PSEUDO_REGS;
 
-      regnum = target_map_name_to_register (addr_exp, end - addr_exp);
+      regnum = frame_map_name_to_regnum (addr_exp, end - addr_exp);
       if (regnum >= 0)
 	goto found;
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index d1bb4e3..5631fd3 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1027,13 +1027,16 @@
       /* This is where we need to make sure that we have good defaults.
          We must guarantee that this section of code is never executed
          when we are called with just a function name, since
-	 get_current_or_default_source_symtab_and_line uses
+	 set_default_source_symtab_and_line uses
          select_source_symtab that calls us with such an argument  */
 
       if (s == 0 && default_symtab == 0)
 	{
-          struct symtab_and_line cursal =
-		  get_current_or_default_source_symtab_and_line ();
+          struct symtab_and_line cursal;
+
+	  /* Make sure we have at least a default source file. */
+	  set_default_source_symtab_and_line ();
+          cursal = get_current_source_symtab_and_line ();
       
           default_symtab = cursal.symtab;
           default_line = cursal.line;
diff --git a/gdb/main.c b/gdb/main.c
index 61479e8..eb88747 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -37,6 +37,8 @@
 #include "event-loop.h"
 #include "ui-out.h"
 
+#include "main.h"
+
 /* If nonzero, display time usage both at startup and for each command.  */
 
 int display_time;
@@ -108,12 +110,6 @@
   return 1;
 }
 
-struct captured_main_args
-  {
-    int argc;
-    char **argv;
-  };
-
 static int
 captured_main (void *data)
 {
@@ -397,6 +393,7 @@
 	      else
 		baud_rate = i;
 	    }
+            break;
 	  case 'l':
 	    {
 	      int i;
@@ -735,12 +732,10 @@
 }
 
 int
-main (int argc, char **argv)
+gdb_main (struct captured_main_args *args)
 {
-  struct captured_main_args args;
-  args.argc = argc;
-  args.argv = argv;
-  catch_errors (captured_main, &args, "", RETURN_MASK_ALL);
+  use_windows = args->use_windows;
+  catch_errors (captured_main, args, "", RETURN_MASK_ALL);
   return 0;
 }
 
diff --git a/gdb/main.h b/gdb/main.h
new file mode 100644
index 0000000..8ee189e
--- /dev/null
+++ b/gdb/main.h
@@ -0,0 +1,34 @@
+/* Main interface for GDB, the GNU debugger.
+
+   Copyright 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.  */
+
+#ifndef MAIN_H
+#define MAIN_H
+
+struct captured_main_args
+{
+  int argc;
+  char **argv;
+  int use_windows;
+};
+
+extern int gdb_main (struct captured_main_args *);
+
+#endif
diff --git a/gdb/mcore-tdep.c b/gdb/mcore-tdep.c
index 395bb44..41114b4 100644
--- a/gdb/mcore-tdep.c
+++ b/gdb/mcore-tdep.c
@@ -27,6 +27,7 @@
 #include "gdbcore.h"
 #include "inferior.h"
 #include "arch-utils.h"
+#include "gdb_string.h"
 
 /* Functions declared and used only in this file */
 
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index 51d9973..86bec4a 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,15 @@
+2002-09-27  Andrew Cagney  <ac131313@redhat.com>
+
+	From 2002-07-12 Mo DeJong <supermo@bayarea.net>
+	* gdbmi.texinfo (var-evaluate-expression): Note that
+	var-list-children must be invoked before child variable
+	values can be evaluated.
+
+2002-09-26  Elena Zannoni  <ezannoni@redhat.com>
+
+        * mi-cmd-disas.c (dump_insns): Add text only output for CLI.
+        (do_mixed_source_and_assembly): Ditto.
+
 2002-09-11  Keith Seitz  <keiths@redhat.com>
 
 	* mi-main.c (mi_cmd_data_list_register_names): Use cleanups
diff --git a/gdb/mi/gdbmi.texinfo b/gdb/mi/gdbmi.texinfo
index a71b702..6145dcf 100644
--- a/gdb/mi/gdbmi.texinfo
+++ b/gdb/mi/gdbmi.texinfo
@@ -3786,6 +3786,9 @@
  value=@var{value}
 @end example
 
+Note that one must invoke @code{-var-list-children} for a variable
+before the value of a child variable can be evaluated.
+
 @subheading The @code{-var-assign} Command
 @findex -var-assign
 
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index 028dc07..85328d7 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -115,8 +115,11 @@
 	{
 	  /* We don't care now about line, filename and
 	     unmapped. But we might in the future. */
+	  ui_out_text (uiout, " <");
 	  ui_out_field_string (uiout, "func-name", name);
+	  ui_out_text (uiout, "+");
 	  ui_out_field_int (uiout, "offset", offset);
+	  ui_out_text (uiout, ">:\t");
 	}
       if (filename != NULL)
 	xfree (filename);
@@ -128,6 +131,7 @@
       ui_out_field_stream (uiout, "inst", stb);
       ui_file_rewind (stb->stream);
       ui_out_tuple_end (uiout);
+      ui_out_text (uiout, "\n");
     }
   return num_displayed;
 }
@@ -257,6 +261,7 @@
 	{
 	  ui_out_list_end (uiout);
 	  ui_out_tuple_end (uiout);
+	  ui_out_text (uiout, "\n");
 	  close_list = 0;
 	}
       if (how_many >= 0)
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index f54f19c..95b288c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -2336,7 +2336,7 @@
 find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int cur_frame)
 {
   mips_extra_func_info_t proc_desc;
-  CORE_ADDR startaddr;
+  CORE_ADDR startaddr = 0;
 
   proc_desc = non_heuristic_proc_desc (pc, &startaddr);
 
diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c
index 58c2e13..e60b1c0 100644
--- a/gdb/ns32k-tdep.c
+++ b/gdb/ns32k-tdep.c
@@ -30,6 +30,7 @@
 #include "arch-utils.h"
 
 #include "ns32k-tdep.h"
+#include "gdb_string.h"
 
 static int sign_extend (int value, int bits);
 static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR);
diff --git a/gdb/ns32knbsd-tdep.c b/gdb/ns32knbsd-tdep.c
index 1ca0b3b..d5ec828 100644
--- a/gdb/ns32knbsd-tdep.c
+++ b/gdb/ns32knbsd-tdep.c
@@ -22,6 +22,7 @@
 #include "defs.h"
 
 #include "ns32k-tdep.h"
+#include "gdb_string.h"
 
 static int
 ns32knbsd_aout_in_solib_call_trampoline (CORE_ADDR pc, char *name)
diff --git a/gdb/parse.c b/gdb/parse.c
index c5de0af..29b8e3c 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -47,7 +47,6 @@
 #include "inferior.h"		/* for NUM_PSEUDO_REGS.  NOTE: replace 
 				   with "gdbarch.h" when appropriate.  */
 #include "doublest.h"
-#include "builtin-regs.h"
 #include "gdb_assert.h"
 
 
@@ -106,42 +105,6 @@
 
 static struct funcall *funcall_chain;
 
-/* The generic method for targets to specify how their registers are
-   named.  The mapping can be derived from two sources: REGISTER_NAME;
-   or builtin regs.  */
-
-int
-target_map_name_to_register (char *str, int len)
-{
-  int i;
-
-  /* Search register name space. */
-  for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
-    if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
-	&& STREQN (str, REGISTER_NAME (i), len))
-      {
-	return i;
-      }
-
-  /* Try builtin registers.  */
-  i = builtin_reg_map_name_to_regnum (str, len);
-  if (i >= 0)
-    {
-      gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS);
-      return i;
-    }
-
-  /* Try builtin registers.  */
-  i = builtin_reg_map_name_to_regnum (str, len);
-  if (i >= 0)
-    {
-      gdb_assert (i >= NUM_REGS + NUM_PSEUDO_REGS);
-      return i;
-    }
-
-  return -1;
-}
-
 /* Begin counting arguments for a function call,
    saving the data about any containing call.  */
 
@@ -491,7 +454,7 @@
 
   /* Handle tokens that refer to machine registers:
      $ followed by a register name.  */
-  i = target_map_name_to_register (str.ptr + 1, str.length - 1);
+  i = frame_map_name_to_regnum (str.ptr + 1, str.length - 1);
   if (i >= 0)
     goto handle_register;
 
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 748208a..b522241 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -210,12 +210,6 @@
     int right_assoc;
   };
 
-/* The generic method for targets to specify how their registers are
-   named.  The mapping can be derived from two sources: REGISTER_NAME;
-   and builtin regs. */
-
-extern int target_map_name_to_register (char *, int);
-
 /* Function used to avoid direct calls to fprintf
    in the code generated by the bison parser.  */
 
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 2df49e1..e6a68ef 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1032,6 +1032,13 @@
     }
 }
 
+/* All the ABI's require 16 byte alignment.  */
+static CORE_ADDR
+rs6000_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+  return (addr & -16);
+}
+
 /* Pass the arguments in either registers, or in the stack. In RS/6000,
    the first eight words of the argument list (that might be less than
    eight parameters if some parameters occupy more than one word) are
@@ -1363,13 +1370,6 @@
     }
 }
 
-/* Keep structure return address in this variable.
-   FIXME:  This is a horrid kludge which should not be allowed to continue
-   living.  This only allows a single nested call to a structure-returning
-   function.  Come on, guys!  -- gnu@cygnus.com, Aug 92  */
-
-static CORE_ADDR rs6000_struct_return_address;
-
 /* Return whether handle_inferior_event() should proceed through code
    starting at PC in function NAME when stepping.
 
@@ -1527,6 +1527,16 @@
       if (fi->next->signal_handler_caller)
 	return read_memory_addr (fi->next->frame + SIG_FRAME_LR_OFFSET,
 				 wordsize);
+      else if (PC_IN_CALL_DUMMY (get_next_frame (fi)->pc, 0, 0))
+	/* The link register wasn't saved by this frame and the next
+           (inner, newer) frame is a dummy.  Get the link register
+           value by unwinding it from that [dummy] frame.  */
+	{
+	  ULONGEST lr;
+	  frame_unwind_unsigned_register (get_next_frame (fi),
+					  tdep->ppc_lr_regnum, &lr);
+	  return lr;
+	}
       else
 	return read_memory_addr (FRAME_CHAIN (fi) + tdep->lr_frame_offset,
 				 wordsize);
@@ -1731,7 +1741,9 @@
   int wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
 
   if (PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame))
-    return thisframe->frame;	/* dummy frame same as caller's frame */
+    /* A dummy frame always correctly chains back to the previous
+       frame.  */
+    return read_memory_addr ((thisframe)->frame, wordsize);
 
   if (inside_entry_file (thisframe->pc) ||
       thisframe->pc == entry_point_address ())
@@ -1748,13 +1760,6 @@
     fp = FRAME_FP (thisframe);
   else
     fp = read_memory_addr ((thisframe)->frame, wordsize);
-
-  lr = read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
-  if (lr == entry_point_address ())
-    if (fp != 0 && (fpp = read_memory_addr (fp, wordsize)) != 0)
-      if (PC_IN_CALL_DUMMY (lr, fpp, fpp))
-	return fpp;
-
   return fp;
 }
 
@@ -1979,18 +1984,12 @@
 }
 
 /* Store the address of the place in which to copy the structure the
-   subroutine will return.  This is called from call_function.
-
-   In RS/6000, struct return addresses are passed as an extra parameter in r3.
-   In function return, callee is not responsible of returning this address
-   back.  Since gdb needs to find it, we will store in a designated variable
-   `rs6000_struct_return_address'.  */
+   subroutine will return.  */
 
 static void
 rs6000_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   write_register (3, addr);
-  rs6000_struct_return_address = addr;
 }
 
 /* Write into appropriate registers a function return value
@@ -2048,9 +2047,20 @@
    as a CORE_ADDR (or an expression that can be used as one).  */
 
 static CORE_ADDR
-rs6000_extract_struct_value_address (char *regbuf)
+rs6000_extract_struct_value_address (struct regcache *regcache)
 {
-  return rs6000_struct_return_address;
+  /* FIXME: cagney/2002-09-26: PR gdb/724: When making an inferior
+     function call GDB knows the address of the struct return value
+     and hence, should not need to call this function.  Unfortunately,
+     the current hand_function_call() code only saves the most recent
+     struct address leading to occasional calls.  The code should
+     instead maintain a stack of such addresses (in the dummy frame
+     object).  */
+  /* NOTE: cagney/2002-09-26: Return 0 which indicates that we've
+     really got no idea where the return value is being stored.  While
+     r3, on function entry, contained the address it will have since
+     been reused (scratch) and hence wouldn't be valid */
+  return 0;
 }
 
 /* Return whether PC is in a dummy function call.
@@ -2877,6 +2887,7 @@
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
   set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
   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);
@@ -2900,7 +2911,7 @@
     set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments);
 
   set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return);
-  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
+  set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
   set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame);
 
   set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 318a51d..5b2f0c5 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -134,8 +134,7 @@
 static int
 in_eval_c (void)
 {
-  struct symtab_and_line cursal =
-	  get_current_or_default_source_symtab_and_line ();
+  struct symtab_and_line cursal = get_current_source_symtab_and_line ();
   
   if (cursal.symtab && cursal.symtab->filename)
     {
diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c
index f450ac9..7d07fa5 100644
--- a/gdb/sh3-rom.c
+++ b/gdb/sh3-rom.c
@@ -27,6 +27,7 @@
 #include "srec.h"
 #include "arch-utils.h"
 #include "regcache.h"
+#include "gdb_string.h"
 
 #include "sh-tdep.h"
 
diff --git a/gdb/source.c b/gdb/source.c
index e5d99d3..5c88a55 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -152,21 +152,22 @@
 
   cursal.symtab = current_source_symtab;
   cursal.line = current_source_line;
+  cursal.pc = 0;
+  cursal.end = 0;
   
   return cursal;
 }
 
-/* Return the current source file for listing and next line to list.
-   If a file is not set, try and get a default.
+/* If the current source file for listing is not set, try and get a default.
+   Usually called before get_current_source_symtab_and_line() is called.
    It may err out if a default cannot be determined.
-   Depending on where it is called, it can recurse as the process of
-   determining a new default may call the caler!
-   Use get_current_source_symtab_and_line instead to get whatever
-   we have without erroring out or trying to get a default.
-   NOTE: The returned sal pc and end fields are not valid. */
+   We must be cautious about where it is called, as it can recurse as the
+   process of determining a new default may call the caller!
+   Use get_current_source_symtab_and_line only to get whatever
+   we have without erroring out or trying to get a default. */
    
-struct symtab_and_line
-get_current_or_default_source_symtab_and_line (void)
+void
+set_default_source_symtab_and_line (void)
 {
   struct symtab_and_line cursal;
 
@@ -176,19 +177,15 @@
   /* Pull in a current source symtab if necessary */
   if (current_source_symtab == 0)
     select_source_symtab (0);
-  
-  cursal.symtab = current_source_symtab;
-  cursal.line = current_source_line;
-  
-  return cursal;
 }
 
 /* Return the current default file for listing and next line to list
    (the returned sal pc and end fields are not valid.)
-   and set the surrent default to whatever is in SAL */
+   and set the current default to whatever is in SAL.
+   NOTE: The returned sal pc and end fields are not valid. */
    
 struct symtab_and_line
-set_current_source_symtab_and_line (struct symtab_and_line *sal)
+set_current_source_symtab_and_line (const struct symtab_and_line *sal)
 {
   struct symtab_and_line cursal;
   
@@ -197,6 +194,8 @@
 
   current_source_symtab = sal->symtab;
   current_source_line = sal->line;
+  cursal.pc = 0;
+  cursal.end = 0;
   
   return cursal;
 }
diff --git a/gdb/source.h b/gdb/source.h
index 84cd0ff..ba7d45f 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -44,23 +44,23 @@
 
 /* Return the current source file for listing and next line to list.
    NOTE: The returned sal pc and end fields are not valid. */
-extern void clear_current_source_symtab_and_line (void);
-
-/* Return the current source file for listing and next line to list.
-   If a file is not set, try and get a default.
-   It may err out if a default cannot be determined.
-   Depending on where it is called, it can recurse as the process of
-   determining a new default may call the caler!
-   Use get_current_source_symtab_and_line instead to get whatever
-   we have without erroring out or trying to get a default.
-   NOTE: The returned sal pc and end fields are not valid. */
 extern struct symtab_and_line get_current_source_symtab_and_line (void);
 
+/* If the current source file for listing is not set, try and get a default.
+   Usually called before get_current_source_symtab_and_line() is called.
+   It may err out if a default cannot be determined.
+   We must be cautious about where it is called, as it can recurse as the
+   process of determining a new default may call the caller!
+   Use get_current_source_symtab_and_line only to get whatever
+   we have without erroring out or trying to get a default. */
+extern void set_default_source_symtab_and_line (void);
+
 /* Return the current default file for listing and next line to list
    (the returned sal pc and end fields are not valid.)
-   and set the surrent default to whatever is in SAL */
-extern struct symtab_and_line get_current_or_default_source_symtab_and_line (void);
+   and set the current default to whatever is in SAL.
+   NOTE: The returned sal pc and end fields are not valid. */
+extern struct symtab_and_line set_current_source_symtab_and_line (const struct symtab_and_line *);
 
 /* Reset any information stored about a default file and line to print. */
-extern struct symtab_and_line set_current_source_symtab_and_line (struct symtab_and_line *);
+extern void clear_current_source_symtab_and_line (void);
 #endif
diff --git a/gdb/stack.c b/gdb/stack.c
index 4f41531..83fd26e 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -434,7 +434,9 @@
 	      print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
 	    }
 	}
-      cursal = get_current_or_default_source_symtab_and_line ();
+      /* Make sure we have at least a default source file */
+      set_default_source_symtab_and_line ();
+      cursal = get_current_source_symtab_and_line ();
       cursal.line = max (sal.line - get_lines_to_list () / 2, 1);
       set_current_source_symtab_and_line (&cursal);
     }
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 37d3d6b..6cc897b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2002-09-26  Keith Seitz  <keiths@redhat.com>
+
+	* lib/insight-support.exp (gdbtk_start): Figure out where
+	the insight executable is based on where gdb is. Use this
+	executable to start insight instead of gdb.
+
+2002-09-25  Andrew Cagney  <cagney@redhat.com>
+
+	* gdb.base/pc-fp.exp, gdb.base/pc-fp.c: New test.
+
+2002-09-24  Andrew Cagney  <ac131313@redhat.com>
+
+	* gdb.gdb/complaints.exp (test_initial_complaints): Rename
+	test_isolated_complaints.
+	(test_empty_complaint): New function.
+	(test_empty_complaints): New function.  Check no output when no
+	complaints.
+	
 2002-09-19  Jim Blandy  <jimb@redhat.com>
 
         * gdb.base/charset.exp, gdb.base/charset.c: New files.
diff --git a/gdb/testsuite/gdb.base/pc-fp.c b/gdb/testsuite/gdb.base/pc-fp.c
new file mode 100644
index 0000000..8c89a0f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/pc-fp.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+void
+foo (int i)
+{
+  i++;
+  printf ("In foo %d\n", i);
+}
+
+int
+main ()
+{
+  foo (1);
+}
diff --git a/gdb/testsuite/gdb.base/pc-fp.exp b/gdb/testsuite/gdb.base/pc-fp.exp
new file mode 100644
index 0000000..f94e331
--- /dev/null
+++ b/gdb/testsuite/gdb.base/pc-fp.exp
@@ -0,0 +1,94 @@
+#   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
+# 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
+
+# The doco makes reference to built-in registers -- $pc and $fp.  If
+# the ISA contains registers by that name then they should be
+# displayed.  If the ISA contains registers identified as being
+# equivalent, but have different names, then GDB will provide these as
+# aliases.  If the ISA doesn't provide any equivalent registers, then
+# GDB will provide registers that map onto the frame's PC and FP.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "pc-fp"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [get_compiler_info ${binfile}] {
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    perror "couldn't run to breakpoint"
+    continue
+}
+
+proc get_valueofx { fmt exp default } {
+    global gdb_prompt
+    send_gdb "print${fmt} ${exp}\n"
+    gdb_expect {
+	-re "\\$\[0-9\]* = (0x\[0-9a-zA-Z\]+).*$gdb_prompt $" {
+	    set val $expect_out(1,string)
+	    pass "get value of ${exp} ($val)"
+	}
+	timeout {
+	    set size ${default}
+	    fail "get value of ${exp} (timeout)"
+	}
+    }
+    return ${val}
+}
+
+# Get the value of PC and FP
+
+set valueof_pc [get_valueofx "/x" "\$pc" "0"]
+set valueof_fp [get_valueofx "/x" "\$fp" "0"]
+
+# Check that the sequence $REGNAME -> REGNUM -> $REGNAME works.  Use
+# display since that encodes and then decodes the expression parameter
+# (and hence uses the mechanisms we're trying to test).
+
+gdb_test "display/i \$pc" "1: x/i +\\\$pc +${valueof_pc}.*"
+gdb_test "display/w \$fp" "2: x/xw +\\\$fp +${valueof_fp}.*"
+
+# FIXME: cagney/2002-09-04: Should also check that ``info registers
+# $pc'' et.al.'' come back with the same value as the above displays
+# and a print --- assuming that is that people agree to such behavour.
+# Need to re-write default_print_registers_info() for it to work (and
+# such a rewrite is on the reggroups branch).
+
+# gdb_test "info registers \$pc" "${valueof_pc}"
+# gdb_test "info registers \$fp" "${valueof_fp}"
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 159a8ca..3d3426f 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -101,7 +101,7 @@
     return 0
 }
 
-proc test_isolated_complaints { } {
+proc test_initial_complaints { } {
 
     global gdb_prompt
 
@@ -233,6 +233,41 @@
     return 0
 }
 
+# Check that nothing comes out when there haven't been any real
+# complaints.  Note that each test is really checking the previous
+# command.
+
+proc test_empty_complaint { cmd msg } {
+    global gdb_prompt
+    send_gdb $cmd
+    gdb_expect {
+	-re "\r\n\r\n$gdb_prompt " {
+	    fail $msg
+	}
+	"\r\n$gdb_prompt" {
+	    pass $msg
+	}
+	timeout {
+	    fail "$msg (timeout)"
+	}
+    }
+  
+}
+
+proc test_empty_complaints { } {
+
+    test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)\n" \
+	    "empty non-verbose non-noisy clear"
+    test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)\n" \
+	    "empty verbose non-noisy clear"
+    test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)\n" \
+	    "empty verbose noisy clear"
+    test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)\n" \
+	    "empty non-verbose noisy clear"
+
+    return 0
+}
+
 # Find a pathname to a file that we would execute if the shell was asked
 # to run $arg using the current PATH.
 
@@ -274,9 +309,10 @@
     return -1
 }
 
-test_isolated_complaints
+test_initial_complaints
 test_serial_complaints
 test_short_complaints
+test_empty_complaints
 
 gdb_exit;
 catch "remote_file host delete $file";
diff --git a/gdb/testsuite/gdb.mi/ChangeLog b/gdb/testsuite/gdb.mi/ChangeLog
index 5feba8d..eb9420b 100644
--- a/gdb/testsuite/gdb.mi/ChangeLog
+++ b/gdb/testsuite/gdb.mi/ChangeLog
@@ -1,3 +1,21 @@
+2002-09-25  Keith Seitz  <keiths@redhat.com>
+
+	* mi-pthreads.exp (get_mi_thread_list): Check if expect_out
+	exists before using it.
+	(check_mi_and_console_threads): Likewise.
+	* gdb669.exp (get_mi_thread_list): Likewise.
+	(check_mi_and_console_threads): Likewise.
+
+2002-09-24  Keith Seitz  <keiths@redhat.com>
+
+	* configure.in: Add config header.
+	Check for pthread.h.
+	* configure: Regenerate.
+	* config.in: New file.
+	* pthreads.c: New file.
+	* mi-pthreads.exp: New file to test thread functionality.
+	* gdb669.exp: New file.
+
 2002-09-17  Keith Seitz  <keiths@redhat.com>
 
 	* mi-var-cmd.exp: Add tests to check when varobj pinned to a
diff --git a/gdb/testsuite/gdb.mi/config.in b/gdb/testsuite/gdb.mi/config.in
new file mode 100644
index 0000000..d8418ba
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/config.in
@@ -0,0 +1,4 @@
+/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define if you have the <pthread.h> header file.  */
+#undef HAVE_PTHREAD_H
diff --git a/gdb/testsuite/gdb.mi/configure b/gdb/testsuite/gdb.mi/configure
index fd5d146..48628f5 100755
--- a/gdb/testsuite/gdb.mi/configure
+++ b/gdb/testsuite/gdb.mi/configure
@@ -522,6 +522,7 @@
 
 
 
+
 CC=${CC-cc}
 
 ac_aux_dir=
@@ -571,7 +572,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:575: checking host system type" >&5
+echo "configure:576: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -592,7 +593,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:596: checking target system type" >&5
+echo "configure:597: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -610,7 +611,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:614: checking build system type" >&5
+echo "configure:615: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -633,6 +634,128 @@
   program_prefix=${target_alias}-
 
 
+# Check for pthread.h
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:640: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 655 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 672 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 689 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in pthread.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:723: 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 728 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
@@ -696,19 +819,7 @@
 
 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
 
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
+DEFS=-DHAVE_CONFIG_H
 
 # Without the "./", some shells look in PATH for config.status.
 : ${CONFIG_STATUS=./config.status}
@@ -745,7 +856,7 @@
 
 ac_given_srcdir=$srcdir
 
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -793,6 +904,7 @@
 s%@build_cpu@%$build_cpu%g
 s%@build_vendor@%$build_vendor%g
 s%@build_os@%$build_os%g
+s%@CPP@%$CPP%g
 
 CEOF
 EOF
@@ -888,6 +1000,113 @@
 fi; done
 rm -f conftest.s*
 
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='\([ 	]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+  CONFIG_HEADERS="config.h:config.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
+  esac
+
+  echo creating $ac_file
+
+  rm -f conftest.frag conftest.in conftest.out
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h.  And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+  ac_lines=`grep -c . conftest.vals`
+  # grep -c gives empty output for an empty file on some AIX systems.
+  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+  # Write a limited-size here document to conftest.frag.
+  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  echo 'CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+  rm -f conftest.vals
+  mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+  rm -f conftest.frag conftest.h
+  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
+  cat conftest.in >> conftest.h
+  rm -f conftest.in
+  if cmp -s $ac_file conftest.h 2>/dev/null; then
+    echo "$ac_file is unchanged"
+    rm -f conftest.h
+  else
+    # Remove last slash and all that follows it.  Not all systems have dirname.
+      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+      # The file is in a subdirectory.
+      test ! -d "$ac_dir" && mkdir "$ac_dir"
+    fi
+    rm -f $ac_file
+    mv conftest.h $ac_file
+  fi
+fi; done
+
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
diff --git a/gdb/testsuite/gdb.mi/configure.in b/gdb/testsuite/gdb.mi/configure.in
index 9427827..3204867 100644
--- a/gdb/testsuite/gdb.mi/configure.in
+++ b/gdb/testsuite/gdb.mi/configure.in
@@ -6,10 +6,14 @@
 
 AC_PREREQ(2.5)
 AC_INIT(mi-basics.exp)
+AC_CONFIG_HEADER(config.h:config.in)
 
 CC=${CC-cc}
 AC_SUBST(CC)
 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
 AC_CANONICAL_SYSTEM
 
+# Check for pthread.h
+AC_CHECK_HEADERS(pthread.h)
+
 AC_OUTPUT(Makefile)
diff --git a/gdb/testsuite/gdb.mi/gdb669.exp b/gdb/testsuite/gdb.mi/gdb669.exp
new file mode 100644
index 0000000..4f294b9
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/gdb669.exp
@@ -0,0 +1,200 @@
+# 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
+# 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 checks for the bug gdb/669, where the console
+# command "info threads" and the MI command "-thread-list-ids"
+# return different threads in the system.
+
+# This only works with native configurations
+if {![isnative]} {
+  return
+}
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if {[mi_gdb_start]} {
+    continue
+}
+
+# The procs below are all stolen from mi-pthreads.exp. Any updates
+# should also be made to the procs there.
+
+proc get_mi_thread_list {name} {
+  global expect_out
+
+  # MI will return a list of thread ids:
+  #
+  # -thread-list-ids
+  # ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N"
+  # (gdb)
+  mi_gdb_test "-thread-list-ids" \
+    {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
+    "-thread_list_ids ($name)"
+
+  set output {}
+  if {[info exists expect_out(buffer)]} {
+    set output $expect_out(buffer)
+  }
+  set thread_list {}
+  if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
+    fail "finding threads in MI output ($name)"
+  } else {
+    pass "finding threads in MI output ($name)"
+
+    # Make list of console threads
+    set start [expr {[string first \{ $threads] + 1}]
+    set end   [expr {[string first \} $threads] - 1}]
+    set threads [string range $threads $start $end]
+    foreach thread [split $threads ,] {
+      if {[scan $thread {thread-id="%d"} num]} {
+	lappend thread_list $num
+      }
+    }
+  }
+
+  return $thread_list
+}
+
+# Check that MI and the console know of the same threads.
+# Appends NAME to all test names.
+proc check_mi_and_console_threads {name} {
+  global expect_out
+
+  mi_gdb_test "-thread-list-ids" \
+    {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
+    "-thread-list-ids ($name)"
+  set mi_output {}
+  if {[info exists expect_out(buffer)]} {
+    set mi_output $expect_out(buffer)
+  }
+
+  # GDB will return a list of thread ids and some more info:
+  #
+  # (gdb) 
+  # -interpreter-exec console "info threads"
+  # ~"  4 Thread 2051 (LWP 7734)  0x401166b1 in __libc_nanosleep () at __libc_nanosleep:-1"
+  # ~"  3 Thread 1026 (LWP 7733)   () at __libc_nanosleep:-1"
+  # ~"  2 Thread 2049 (LWP 7732)  0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63"
+  # ~"* 1 Thread 1024 (LWP 7731)  main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160"
+  # FIXME: kseitz/2002-09-05: Don't use the hack-cli method.
+  mi_gdb_test "info threads" \
+    {.*(~".*"[\r\n]*)+.*} \
+    "info threads ($name)"
+  set console_output {}
+  if {[info exists expect_out(buffer)]} {
+    set console_output $expect_out(buffer)
+  }
+
+  # Make a list of all known threads to console (gdb's thread IDs)
+  set console_thread_list {}
+  foreach line [split $console_output \n] {
+    if {[string index $line 0] == "~"} {
+      # This is a line from the console; trim off "~", " ", "*", and "\""
+      set line [string trim $line ~\ \"\*]
+      if {[scan $line "%d" id] == 1} {
+	lappend console_thread_list $id
+      }
+    }
+  }
+
+  # Now find the result string from MI
+  set mi_result ""
+  foreach line [split $mi_output \n] {
+    if {[string range $line 0 4] == "^done"} {
+      set mi_result $line
+    }
+  }
+  if {$mi_result == ""} {
+    fail "finding MI result string ($name)"
+  } else {
+    pass "finding MI result string ($name)"
+  }
+
+  # Finally, extract the thread ids and compare them to the console
+  set num_mi_threads_str ""
+  if {![regexp {number-of-threads="[0-9]+"} $mi_result num_mi_threads_str]} {
+    fail "finding number of threads in MI output ($name)"
+  } else {
+    pass "finding number of threads in MI output ($name)"
+
+    # Extract the number of threads from the MI result
+    if {![scan $num_mi_threads_str {number-of-threads="%d"} num_mi_threads]} {
+      fail "got number of threads from MI ($name)"
+    } else {
+      pass "got number of threads from MI ($name)"
+
+      # Check if MI and console have same number of threads
+      if {$num_mi_threads != [llength $console_thread_list]} {
+	fail "console and MI have same number of threads ($name)"
+      } else {
+	pass "console and MI have same number of threads ($name)"
+
+	# Get MI thread list
+	set mi_thread_list [get_mi_thread_list $name]
+
+	# Check if MI and console have the same threads
+	set fails 0
+	foreach ct [lsort $console_thread_list] mt [lsort $mi_thread_list] {
+	  if {$ct != $mt} {
+	    incr fails
+	  }
+	}
+	if {$fails > 0} {
+	  fail "MI and console have same threads ($name)"
+
+	  # Send a list of failures to the log
+	  send_log "Console has thread ids: $console_thread_list\n"
+	  send_log "MI has thread ids: $mi_thread_list\n"
+	} else {
+	  pass "MI and console have same threads ($name)"
+	}
+      }
+    }
+  }
+}
+
+#
+# Start here
+#
+set testfile "pthreads"
+set srcfile "$testfile.c"
+set binfile "$objdir/$subdir/$testfile"
+
+set options [list debug incdir=$subdir]
+if  {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options]
+     != "" } {
+  gdb_suppress_entire_file \
+    "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load $binfile
+
+mi_run_to_main
+check_mi_and_console_threads "at main"
+
+for {set i 0} {$i < 4} {incr i} {
+  mi_next "next, try $i"
+  check_mi_and_console_threads "try $i"
+}
+
+mi_gdb_exit
+
diff --git a/gdb/testsuite/gdb.mi/mi-pthreads.exp b/gdb/testsuite/gdb.mi/mi-pthreads.exp
new file mode 100644
index 0000000..a26d434
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-pthreads.exp
@@ -0,0 +1,220 @@
+# 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
+# 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 MI thread commands.
+# Specifically, we are testing the MI command set and the console (in MI)
+# command set ("interpreter-exec") and that the commands that are executed
+# via these command pathways are properly executed. Console commands
+# executed via MI should use MI output wrappers, MI event handlers, etc.
+
+# This only works with native configurations
+if {![isnative]} {
+  return
+}
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if {[mi_gdb_start]} {
+    continue
+}
+
+# The procs below dealing with parsing cli/mi output for the threadlist
+# is duplicated in gdb669.exp. Any changes here will probably need to
+# be made there as well.
+
+proc get_mi_thread_list {name} {
+  global expect_out
+
+  # MI will return a list of thread ids:
+  #
+  # -thread-list-ids
+  # ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N"
+  # (gdb)
+  mi_gdb_test "-thread-list-ids" \
+    {\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
+    "-thread_list_ids ($name)"
+
+  set output {}
+  if {[info exists expect_out(buffer)]} {
+    set output $expect_out(buffer)
+  }
+
+  set thread_list {}
+  if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
+    fail "finding threads in MI output ($name)"
+  } else {
+    pass "finding threads in MI output ($name)"
+
+    # Make list of console threads
+    set start [expr {[string first \{ $threads] + 1}]
+    set end   [expr {[string first \} $threads] - 1}]
+    set threads [string range $threads $start $end]
+    foreach thread [split $threads ,] {
+      if {[scan $thread {thread-id="%d"} num]} {
+	lappend thread_list $num
+      }
+    }
+  }
+
+  return $thread_list
+}
+
+# Check that MI and the console know of the same threads.
+# Appends NAME to all test names.
+proc check_mi_and_console_threads {name} {
+  global expect_out
+
+  mi_gdb_test "-thread-list-ids" \
+    {\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
+    "-thread-list-ids ($name)"
+  set mi_output {}
+  if {[info exists expect_out(buffer)]} {
+    set mi_output $expect_out(buffer)
+  }
+
+  # GDB will return a list of thread ids and some more info:
+  #
+  # (gdb) 
+  # -interpreter-exec console "info threads"
+  # ~"  4 Thread 2051 (LWP 7734)  0x401166b1 in __libc_nanosleep () at __libc_nanosleep:-1"
+  # ~"  3 Thread 1026 (LWP 7733)   () at __libc_nanosleep:-1"
+  # ~"  2 Thread 2049 (LWP 7732)  0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63"
+  # ~"* 1 Thread 1024 (LWP 7731)  main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160"
+  # FIXME: kseitz/2002-09-05: Don't use the hack-cli method.
+  mi_gdb_test "info threads" \
+    {.*(~".*"[\r\n]*)+.*} \
+    "info threads ($name)"
+  set console_output {}
+  if {[info exists $expect_out(buffer)]} {
+    set console_output $expect_out(buffer)
+  }
+
+  # Make a list of all known threads to console (gdb's thread IDs)
+  set console_thread_list {}
+  foreach line [split $console_output \n] {
+    if {[string index $line 0] == "~"} {
+      # This is a line from the console; trim off "~", " ", "*", and "\""
+      set line [string trim $line ~\ \"\*]
+      if {[scan $line "%d" id] == 1} {
+	lappend console_thread_list $id
+      }
+    }
+  }
+
+  # Now find the result string from MI
+  set mi_result ""
+  foreach line [split $mi_output \n] {
+    if {[string range $line 0 4] == "^done"} {
+      set mi_result $line
+    }
+  }
+  if {$mi_result == ""} {
+    fail "finding MI result string ($name)"
+  } else {
+    pass "finding MI result string ($name)"
+  }
+
+  # Finally, extract the thread ids and compare them to the console
+  set num_mi_threads_str ""
+  if {![regexp {number-of-threads="[0-9]+"} $mi_result num_mi_threads_str]} {
+    fail "finding number of threads in MI output ($name)"
+  } else {
+    pass "finding number of threads in MI output ($name)"
+
+    # Extract the number of threads from the MI result
+    if {![scan $num_mi_threads_str {number-of-threads="%d"} num_mi_threads]} {
+      fail "got number of threads from MI ($name)"
+    } else {
+      pass "got number of threads from MI ($name)"
+
+      # Check if MI and console have same number of threads
+      if {$num_mi_threads != [llength $console_thread_list]} {
+	fail "console and MI have same number of threads ($name)"
+      } else {
+	pass "console and MI have same number of threads ($name)"
+
+	# Get MI thread list
+	set mi_thread_list [get_mi_thread_list $name]
+
+	# Check if MI and console have the same threads
+	set fails 0
+	foreach ct [lsort $console_thread_list] mt [lsort $mi_thread_list] {
+	  if {$ct != $mt} {
+	    incr fails
+	  }
+	}
+	if {$fails > 0} {
+	  fail "MI and console have same threads ($name)"
+
+	  # Send a list of failures to the log
+	  send_log "Console has thread ids: $console_thread_list\n"
+	  send_log "MI has thread ids: $mi_thread_list\n"
+	} else {
+	  pass "MI and console have same threads ($name)"
+	}
+      }
+    }
+  }
+}
+
+# This procedure tests the various thread commands in MI.
+proc check_mi_thread_command_set {} {
+
+  mi_runto done_making_threads
+
+  set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
+  
+  mi_gdb_test "-thread-select" \
+    {\^error,msg="mi_cmd_thread_select: USAGE: threadnum."} \
+    "check_mi_thread_command_set: -thread-select"
+
+  mi_gdb_test "-thread-select 123456789" \
+    {\^error,msg="Thread ID 123456789 not known\."} \
+    "check_mi_thread_command_set: -thread-select 123456789"
+
+  foreach thread $thread_list {
+    mi_gdb_test "-thread-select $thread" \
+      "\\^done,new-thread-id=\"$thread\",frame={.*},line=\"(-)?\[0-9\]+\",file=\".*\"" \
+      "check_mi_thread_command_set: -thread-select $thread"
+  }
+}
+
+#
+# Start here
+#
+set testfile "pthreads"
+set srcfile "$testfile.c"
+set binfile "$objdir/$subdir/$testfile"
+
+set options [list debug incdir=$subdir]
+if  {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options]
+     != "" } {
+  gdb_suppress_entire_file \
+    "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load $binfile
+
+check_mi_thread_command_set
+
+mi_gdb_exit
+
diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c
new file mode 100644
index 0000000..c3e17bc
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/pthreads.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+
+#include "config.h"
+
+#ifndef HAVE_PTHREAD_H
+
+/* Don't even try to compile.  In fact, cause a syntax error that we can
+   look for as a compiler error message and know that we have no pthread
+   support.  In that case we can just suppress the test completely. */
+
+#error "no posix threads support"
+
+#else
+
+/* OK.  We have the right header.  If we try to compile this and fail, then
+   there is something wrong and the user should know about it so the testsuite
+   should issue an ERROR result.. */
+
+#ifdef __linux__
+#define  _MIT_POSIX_THREADS 1	/* GNU/Linux (or at least RedHat 4.0)
+                                   needs this */
+#endif
+
+#include <pthread.h>
+
+/* Under OSF 2.0 & 3.0 and HPUX 10, the second arg of pthread_create
+   is prototyped to be just a "pthread_attr_t", while under Solaris it
+   is a "pthread_attr_t *".  Arg! */
+
+#if defined (__osf__) || defined (__hpux__)
+#define PTHREAD_CREATE_ARG2(arg) arg
+#define PTHREAD_CREATE_NULL_ARG2 null_attr
+static pthread_attr_t null_attr;
+#else
+#define PTHREAD_CREATE_ARG2(arg) &arg
+#define PTHREAD_CREATE_NULL_ARG2 NULL
+#endif
+
+void *
+routine (void *arg)
+{
+  sleep (9);
+  printf ("hello thread\n");
+}
+
+/* Marker function for the testsuite */
+void
+done_making_threads (void)
+{
+  /* Nothing */
+};
+
+void
+create_thread (void)
+{
+  pthread_t tid;
+
+  if (pthread_create (&tid, PTHREAD_CREATE_NULL_ARG2, routine, (void *) 0xfeedface))
+    {
+      perror ("pthread_create 1");
+      exit (1);
+    }
+}
+
+int
+main (int argc, char *argv[])
+{
+  int i;
+
+  /* Create a few threads */
+  for (i = 0; i < 5; i++)
+    create_thread ();
+  done_making_threads ();
+
+  printf ("hello\n");
+  printf ("hello\n");
+  return 0;
+}
+
+#endif /* ifndef HAVE_PTHREAD_H */
diff --git a/gdb/testsuite/lib/insight-support.exp b/gdb/testsuite/lib/insight-support.exp
index 42d14a9..cbdf163 100644
--- a/gdb/testsuite/lib/insight-support.exp
+++ b/gdb/testsuite/lib/insight-support.exp
@@ -54,7 +54,15 @@
 
   gdb_stop_suppressing_tests;
 
-  verbose "Starting $GDB -nx -q --tclcommand=$test"
+  # Need to convert ::GDB to use (-)?insight...
+  if {[regsub {gdb$} $GDB insight newGDB]} {
+    set INSIGHT $newGDB
+  } else {
+    perror "Cannot find Insight executable"
+    exit 1
+  }
+
+  verbose "Starting $INSIGHT -nx -q --tclcommand=$test"
 
   set real_test [which $test]
   if {$real_test == 0} {
@@ -63,8 +71,8 @@
   }
 
   if {![is_remote host]} {
-    if { [which $GDB] == 0 } {
-      perror "$GDB does not exist."
+    if { [which $INSIGHT] == 0 } {
+      perror "$INSIGHT does not exist."
       exit 1
     }
   }
@@ -91,9 +99,9 @@
   set env(GDBTK_VERBOSE) 1
   set env(GDBTK_LOGFILE) [to_tcl_path [file join $objdir gdb.log]]
 
-  set err [catch {exec $GDB -nx -q --tclcommand=$test} res]
+  set err [catch {exec $INSIGHT -nx -q --tclcommand=$test} res]
   if { $err } {
-    perror "Execing $GDB failed: $res"
+    perror "Execing $INSIGHT failed: $res"
     append res "\nERROR gdb-crash"
   }
   return $res
diff --git a/gdb/top.c b/gdb/top.c
index 60c1bf9..3d5783f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -82,7 +82,7 @@
 /* If nonzero, and GDB has been configured to be able to use windows,
    attempt to open them upon startup.  */
 
-int use_windows = 1;
+int use_windows = 0;
 
 extern char lang_frame_mismatch_warn[];		/* language.c */
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 03ae161..6aea886 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -173,10 +173,6 @@
   }
   ,
   {
-    v850e_reg_names, bfd_mach_v850ea
-  }
-  ,
-  {
     NULL, 0
   }
 };
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 4ae046a..16ba528 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1345,7 +1345,10 @@
 
 /* This returns the type of the variable. This skips past typedefs
    and returns the real type of the variable. It also dereferences
-   pointers and references. */
+   pointers and references.
+
+   NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file
+   except within get_target_type and get_type. */
 static struct type *
 get_type (struct varobj *var)
 {
@@ -1374,7 +1377,10 @@
 }
 
 /* This returns the target type (or NULL) of TYPE, also skipping
-   past typedefs, just like get_type (). */
+   past typedefs, just like get_type ().
+
+   NOTE: TYPE_TARGET_TYPE should NOT be used anywhere in this file
+   except within get_target_type and get_type. */
 static struct type *
 get_target_type (struct type *type)
 {
@@ -1959,7 +1965,7 @@
   switch (TYPE_CODE (parent->type))
     {
     case TYPE_CODE_ARRAY:
-      type = TYPE_TARGET_TYPE (parent->type);
+      type = get_target_type (parent->type);
       break;
 
     case TYPE_CODE_STRUCT:
@@ -1968,7 +1974,7 @@
       break;
 
     case TYPE_CODE_PTR:
-      switch (TYPE_CODE (TYPE_TARGET_TYPE (parent->type)))
+      switch (TYPE_CODE (get_target_type (parent->type)))
 	{
 	case TYPE_CODE_STRUCT:
 	case TYPE_CODE_UNION:
@@ -1976,7 +1982,7 @@
 	  break;
 
 	default:
-	  type = TYPE_TARGET_TYPE (parent->type);
+	  type = get_target_type (parent->type);
 	  break;
 	}
       break;
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 709ef38..2f517ed 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -28,6 +28,7 @@
 #include "frame.h"
 #include "value.h"
 #include "arch-utils.h"
+#include "gdb_string.h"
 
 #include "vax-tdep.h"
 
diff --git a/gdb/version.in b/gdb/version.in
index 6980726..6d40e8b 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-2002-09-20-cvs
+2002-09-27-cvs
diff --git a/include/ChangeLog b/include/ChangeLog
index 148c9bd..257e381 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,11 @@
+2002-09-26  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/x86-64.h: Add TLS relocs.
+
+2002-09-26  Andrew Cagney  <ac131313@redhat.com>
+
+	* regs/: Delete directory.
+
 2002-09-19  Alexandre Oliva  <aoliva@redhat.com>
 
 	* libiberty.h (asprintf, vasprintf): Don't declare them if the
diff --git a/include/elf/x86-64.h b/include/elf/x86-64.h
index 74febc2..7e9100d 100644
--- a/include/elf/x86-64.h
+++ b/include/elf/x86-64.h
@@ -1,5 +1,5 @@
 /* x86_64 ELF support for BFD.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
    Contributed by Jan Hubicka <jh@suse.cz>
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -25,22 +25,30 @@
 
 START_RELOC_NUMBERS (elf_x86_64_reloc_type)
      RELOC_NUMBER (R_X86_64_NONE,     0)      /* No reloc */
-     RELOC_NUMBER (R_X86_64_64,               1)      /* Direct 64 bit  */
+     RELOC_NUMBER (R_X86_64_64,       1)      /* Direct 64 bit  */
      RELOC_NUMBER (R_X86_64_PC32,     2)      /* PC relative 32 bit signed */
      RELOC_NUMBER (R_X86_64_GOT32,    3)      /* 32 bit GOT entry */
      RELOC_NUMBER (R_X86_64_PLT32,    4)      /* 32 bit PLT address */
      RELOC_NUMBER (R_X86_64_COPY,     5)      /* Copy symbol at runtime */
      RELOC_NUMBER (R_X86_64_GLOB_DAT, 6)      /* Create GOT entry */
-     RELOC_NUMBER (R_X86_64_JUMP_SLOT,        7)      /* Create PLT entry */
+     RELOC_NUMBER (R_X86_64_JUMP_SLOT,7)      /* Create PLT entry */
      RELOC_NUMBER (R_X86_64_RELATIVE, 8)      /* Adjust by program base */
      RELOC_NUMBER (R_X86_64_GOTPCREL, 9)      /* 32 bit signed pc relative
                                                  offset to GOT */
-     RELOC_NUMBER (R_X86_64_32,               10)     /* Direct 32 bit zero extended */
-     RELOC_NUMBER (R_X86_64_32S,              11)     /* Direct 32 bit sign extended */
-     RELOC_NUMBER (R_X86_64_16,               12)     /* Direct 16 bit zero extended */
+     RELOC_NUMBER (R_X86_64_32,       10)     /* Direct 32 bit zero extended */
+     RELOC_NUMBER (R_X86_64_32S,      11)     /* Direct 32 bit sign extended */
+     RELOC_NUMBER (R_X86_64_16,       12)     /* Direct 16 bit zero extended */
      RELOC_NUMBER (R_X86_64_PC16,     13)     /* 16 bit sign extended pc relative*/
-     RELOC_NUMBER (R_X86_64_8,                14)     /* Direct 8 bit sign extended */
-     RELOC_NUMBER (R_X86_64_PC8,              15)     /* 8 bit sign extended pc relative*/
+     RELOC_NUMBER (R_X86_64_8,        14)     /* Direct 8 bit sign extended */
+     RELOC_NUMBER (R_X86_64_PC8,      15)     /* 8 bit sign extended pc relative*/
+     RELOC_NUMBER (R_X86_64_DTPMOD64, 16)     /* ID of module containing symbol */
+     RELOC_NUMBER (R_X86_64_DTPOFF64, 17)     /* Offset in TLS block */
+     RELOC_NUMBER (R_X86_64_TPOFF64,  18)     /* Offset in initial TLS block */
+     RELOC_NUMBER (R_X86_64_TLSGD,    19)     /* PC relative offset to GD GOT block */
+     RELOC_NUMBER (R_X86_64_TLSLD,    20)     /* PC relative offset to LD GOT block */
+     RELOC_NUMBER (R_X86_64_DTPOFF32, 21)     /* Offset in TLS block */
+     RELOC_NUMBER (R_X86_64_GOTTPOFF, 22)     /* PC relative offset to IE GOT entry */
+     RELOC_NUMBER (R_X86_64_TPOFF32,  23)     /* Offset in initial TLS block */
      RELOC_NUMBER (R_X86_64_GNU_VTINHERIT, 250)       /* GNU C++ hack  */
      RELOC_NUMBER (R_X86_64_GNU_VTENTRY, 251)         /* GNU C++ hack  */
 END_RELOC_NUMBERS (R_X86_64_max)
diff --git a/include/regs/ChangeLog b/include/regs/ChangeLog
deleted file mode 100644
index e69de29..0000000
--- a/include/regs/ChangeLog
+++ /dev/null
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index df6f33f..bde129c 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* Makefile.in (all): Fix multilib parallel build.
+
 2002-09-19  John David Anglin  <dave@hiuly1.hia.nrc.ca>
 
 	* cp-demangle.c (demangling_new): Cast 0 to enum.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 5a25987..e0bb15a 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -105,7 +105,7 @@
 
 # FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
 all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
-	@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
+	@: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
 
 .PHONY: check installcheck
 check: check-subdir
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 01cec21..487530a 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,18 @@
+2002-09-26  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+	* mips-dis.c (print_insn_mips): Always allow disassembly of
+	32-bit jalx opcode.
+
+2002-09-24  Nick Clifton  <nickc@redhat.com>
+
+	* po/de.po: Updated German translation.
+
+2002-09-21  Alan Modra  <amodra@bigpond.net.au>
+
+	* Makefile.am: Run "make dep-am".
+	* Makefile.in: Regenerate.
+	* po/POTFILES.in: Regenerate.
+
 2002-09-20  Nick Clifton  <nickc@redhat.com>
 
 	* ppc-opc.c (CRFD, CRFS): Add PPC_OPERAND_CR flag so that cr
@@ -11,31 +26,31 @@
 2002-09-13  Nick Clifton  <nickc@redhat.com>
 
 	* ppc-opc.c (MFDEC2): Include Book-E.
-        (PPCCHLK64): New opcode mask.
-        (evsubw, evsubiw, evmr, evnot, isellt, iselgt, iseleq, mfpid,
-        mfcsrr0, mfcsrr1, mfdear, mfesr, mfivpr, mfusprg0, mftbl,
-        mftbu, mfpir, mfdbsr, mfdbcr0, mfdbcr1, mfdbcr2, mfiac1,
-        mfiac2, mfiac3, mfiac4, mfdac1, mfdac2, mfdvc1, mfdvc2, mftsr,
-        mftcr, mfivor0, mfivor1, mfivor2, mfivor3, mfivor4, mfivor5,
-        mfivor6, mfivor7, mfivor8, mfivor9, mfivor10, mfivor11,
-        mfivor12, mfivor13, mfivor14, mfivor15, mfbbear, mfmcsrr0,
-        mfmcsrr1, mfmcsr, mtpid, mtdecar, mtcsrr0, mtcsrr1, mtdear,
-        mtesr, mtivpr, mtusprg0, mtsprg4, mtsprg5, mtsprg6, mtsprg7,
-        mtdbsr, mtdbcr0, mtdbcr1, mtdbcr2, mtiac1, mtiac2, mtiac3,
-        mtiac4, mtdac1, mtdac2, mtdvc1, mtdvc2, mttsr, mttcr, mtivor0,
-        mtivor1, mtivor2, mtivor3, mtivor4, mtivor5, mtivor6, mtivor7,
-        mtivor8, mtivor9, mtivor10, mtivor11, mtivor12, mtivor13,
-        mtivor14, mtivor15, mtbbear, mtmcsrr0, mtmcsrr1, mtmcsr): New
-        Book-E instructions.
-        (evfsneg): Fix opcode value.
-        (dcbtstlse, dcbtlse, icblce, dcblce, icbtsle): Use PPCCHLK64
-        mask.
-        (mcrxr64, tlbivaxe, tlbsxe, tlbsxe.): Restrict to 64-bit
-        Book-E.
-        (extsw): Restrict to 64-bit PPC instruction sets.
-        (extsw.): Does not exist in 64-bit Book-E.
-        (powerpc_macro): Remove mftbl, mftbu and mftb Book-E macros as
-        they are no longer needed.
+	(PPCCHLK64): New opcode mask.
+	(evsubw, evsubiw, evmr, evnot, isellt, iselgt, iseleq, mfpid,
+	mfcsrr0, mfcsrr1, mfdear, mfesr, mfivpr, mfusprg0, mftbl,
+	mftbu, mfpir, mfdbsr, mfdbcr0, mfdbcr1, mfdbcr2, mfiac1,
+	mfiac2, mfiac3, mfiac4, mfdac1, mfdac2, mfdvc1, mfdvc2, mftsr,
+	mftcr, mfivor0, mfivor1, mfivor2, mfivor3, mfivor4, mfivor5,
+	mfivor6, mfivor7, mfivor8, mfivor9, mfivor10, mfivor11,
+	mfivor12, mfivor13, mfivor14, mfivor15, mfbbear, mfmcsrr0,
+	mfmcsrr1, mfmcsr, mtpid, mtdecar, mtcsrr0, mtcsrr1, mtdear,
+	mtesr, mtivpr, mtusprg0, mtsprg4, mtsprg5, mtsprg6, mtsprg7,
+	mtdbsr, mtdbcr0, mtdbcr1, mtdbcr2, mtiac1, mtiac2, mtiac3,
+	mtiac4, mtdac1, mtdac2, mtdvc1, mtdvc2, mttsr, mttcr, mtivor0,
+	mtivor1, mtivor2, mtivor3, mtivor4, mtivor5, mtivor6, mtivor7,
+	mtivor8, mtivor9, mtivor10, mtivor11, mtivor12, mtivor13,
+	mtivor14, mtivor15, mtbbear, mtmcsrr0, mtmcsrr1, mtmcsr): New
+	Book-E instructions.
+	(evfsneg): Fix opcode value.
+	(dcbtstlse, dcbtlse, icblce, dcblce, icbtsle): Use PPCCHLK64
+	mask.
+	(mcrxr64, tlbivaxe, tlbsxe, tlbsxe.): Restrict to 64-bit
+	Book-E.
+	(extsw): Restrict to 64-bit PPC instruction sets.
+	(extsw.): Does not exist in 64-bit Book-E.
+	(powerpc_macro): Remove mftbl, mftbu and mftb Book-E macros as
+	they are no longer needed.
 
 2002-09-12  Gary Hade  <garyhade@us.ibm.com>
 
@@ -53,7 +68,7 @@
 
 	* disassemble.c (disassembler_usage): Add invocation of
 	print_ppc_disassembler_options.
-        * ppc-dis.c (print_ppc_disassembler_options): New function.
+	* ppc-dis.c (print_ppc_disassembler_options): New function.
 
 2002-09-04  Nick Clifton  <nickc@redhat.com>
 
@@ -95,9 +110,9 @@
 	* z8kgen.c (opt): Fix definition of "in rd,imm16" opcode.
 	* z8k-opc.h: Regenerated with new z8kgen.c.
 
-2002-08-19  Elena Zannoni  <ezannoni@redhat.com> 
+2002-08-19  Elena Zannoni  <ezannoni@redhat.com>
 
-        From  matthew green  <mrg@redhat.com>
+	From  matthew green  <mrg@redhat.com>
 
 	* ppc-dis.c (powerpc_dialect): Support `-m500', `-m500x2' and
 	`-mefs'. Turn off AltiVec for E500 and efs.
@@ -130,7 +145,7 @@
 	(efsabs, efsnabs, efsneg, efsadd, efssub, efsmul,
 	efsdiv, efscmpgt, efscmplt, efscmpeq, efststgt, efststlt,
 	efststeq, efscfui, efsctuiz, efscfsi, efscfuf, efscfsf,
-	efsctui, efsctsi, efsctsiz, efsctuf, efsctsf, 
+	efsctui, efsctsi, efsctsiz, efsctuf, efsctsf,
 	evaddw, evaddiw, evsubfw, evsubifw, evabs, evneg, evextsb,
 	evextsh, evrndw, evcntlzw, evcntlsw, brinc, evand, evandc, evor,
 	evorc, evxor, eveqv, evnand, evnor, evrlw, evrlwi, evslw, evslwi,
@@ -314,9 +329,9 @@
 
 	* mips-opc.c: Clean up a few whitespace issues, and sort a
 	few entries understanding that 'x' follows 'w' in the alphabet.
-	
+
 2002-05-31  Chris G. Demetriou  <cgd@broadcom.com>
-            Ed Satterthwaite  <ehs@broadcom.com>
+	    Ed Satterthwaite  <ehs@broadcom.com>
 
 	* mips-opc.c: Add support for SB-1 MDMX subset and extensions.
 
@@ -327,11 +342,11 @@
 	* po/POTFILES.in: Regenerate.
 
 2002-05-30  Chris G. Demetriou  <cgd@broadcom.com>
-            Ed Satterthwaite  <ehs@broadcom.com>
+	    Ed Satterthwaite  <ehs@broadcom.com>
 
 	* mips-dis.c (print_insn_arg): Add support for 'O', 'Q', 'X', 'Y',
 	and 'Z' formats, for MDMX.
-        (mips_isa_type): Add MDMX instructions to the ISA
+	(mips_isa_type): Add MDMX instructions to the ISA
 	bit mask for bfd_mach_mipsisa64.
 	* mips-opc.c: Add support for MDMX instructions.
 	(MX): New definition.
@@ -341,7 +356,7 @@
 2002-05-30  Diego Novillo  <dnovillo@redhat.com>
 
 	* d10v-opc.c (d10v_opcodes): `btsti' does not modify its
-        arguments.
+	arguments.
 
 2002-05-28  Kuang Hwa Lin <kuang@sbcglobal.net>
 
@@ -436,7 +451,7 @@
 
 2002-05-07  Graydon Hoare  <graydon@redhat.com>
 
-	* cgen-dis.in: (print_insn_@arch@): Cache list of opened CPUs rather 
+	* cgen-dis.in: (print_insn_@arch@): Cache list of opened CPUs rather
 	than just most-recently-opened.
 
 2002-05-01  Alan Modra  <amodra@bigpond.net.au>
@@ -521,7 +536,7 @@
 2002-03-16  Nick Clifton  <nickc@cambridge.redhat.com>
 
 	* Makefile.am: Tidy up sh64 rules.
-        * Makefile.in: Regenerate.
+	* Makefile.in: Regenerate.
 
 2002-03-15  Chris G. Demetriou  <cgd@broadcom.com>
 
@@ -639,9 +654,9 @@
 2002-02-12  Graydon Hoare  <graydon@redhat.com>
 
 	* cgen-asm.in (parse_insn_normal): Change call from
-	@arch@_cgen_parse_operand to cd->parse_operand, to 
+	@arch@_cgen_parse_operand to cd->parse_operand, to
 	facilitate CGEN_ASM_INIT_HOOK doing useful work.
-	
+
 2002-02-11  Alexandre Oliva  <aoliva@redhat.com>
 
 	* sparc-dis.c (print_insn_sparc): Make sure 0xFFFFFFFF is not
@@ -1130,7 +1145,7 @@
 	* cgen-asm.in: Include safe-ctype.h in preference to
 	ctype.h.  Fix formatting.  Use ISSPACE instead of isspace and
 	TOLOWER instead of tolower.
-        (@arch@_cgen_build_insn_regex): Remove duplication of syntax
+	(@arch@_cgen_build_insn_regex): Remove duplication of syntax
 	string elements in constructed regular expression.
 	* fr30-asm.c: Regenerate.
 	* fr30-desc.c: Regenerate.
@@ -1197,7 +1212,7 @@
 	* sh-opc.h: Fix encoding of least significant nibble of the
 	DSP single data transfer instructions.
 
-        * sh-dis.c (print_insn_shx): Fix decoding of As opcode in DSP
+	* sh-dis.c (print_insn_shx): Fix decoding of As opcode in DSP
 	instructions.
 
 2001-10-08  Nick Clifton  <nickc@cambridge.redhat.com>
@@ -1206,30 +1221,30 @@
 	C files.
 	* cgen-dis.in: The same.
 	* cgen-ibld.in: The same.
-        * fr30-asm.c: Regenerate.
-        * fr30-desc.c: Regenerate.
-        * fr30-dis.c: Regenerate.
-        * fr30-ibld.c: Regenerate.
-        * fr30-opc.c: Regenerate.
-        * m32r-asm.c: Regenerate.
-        * m32r-desc.c: Regenerate.
-        * m32r-dis.c: Regenerate.
-        * m32r-ibld.c: Regenerate.
-        * m32r-opc.c: Regenerate.
-        * m32r-opinst.c Regenerate.
-        * openrisc-asm.c: Regenerate.
-        * openrisc-desc.c: Regenerate.
-        * openrisc-dis.c: Regenerate.
-        * openrisc-ibld.c: Regenerate.
-        * openrisc-opc.c: Regenerate.
-        * openrisc-opc.h: Regenerate.
+	* fr30-asm.c: Regenerate.
+	* fr30-desc.c: Regenerate.
+	* fr30-dis.c: Regenerate.
+	* fr30-ibld.c: Regenerate.
+	* fr30-opc.c: Regenerate.
+	* m32r-asm.c: Regenerate.
+	* m32r-desc.c: Regenerate.
+	* m32r-dis.c: Regenerate.
+	* m32r-ibld.c: Regenerate.
+	* m32r-opc.c: Regenerate.
+	* m32r-opinst.c Regenerate.
+	* openrisc-asm.c: Regenerate.
+	* openrisc-desc.c: Regenerate.
+	* openrisc-dis.c: Regenerate.
+	* openrisc-ibld.c: Regenerate.
+	* openrisc-opc.c: Regenerate.
+	* openrisc-opc.h: Regenerate.
 	* Makefile.in: Regenerate.
 	* po/POTFILES.in: Regenerate.
 	* po/opcodes.pot: Regenerate.
 
 2001-10-08  Aldy Hernandez  <aldyh@redhat.com>
 
-        * arm-opc.h (arm_opcodes): Add cirrus insns.
+	* arm-opc.h (arm_opcodes): Add cirrus insns.
 
 	* arm-dis.c (print_insn_arm): Add 'I' case.
 
@@ -1246,9 +1261,9 @@
 
 2001-09-30  John Healy  <jhealy@redhat.com>
 
-        * cgen-ibld.in (insert_1): Switched bfd_get_bits and bfd_set_bits
-        calls to cgen_get_insn_value and cgen_put_insn_value calls.
-        (extract_1): Switched bfd_get_bits call to cgen_get_insn_value call.
+	* cgen-ibld.in (insert_1): Switched bfd_get_bits and bfd_set_bits
+	calls to cgen_get_insn_value and cgen_put_insn_value calls.
+	(extract_1): Switched bfd_get_bits call to cgen_get_insn_value call.
 
 2001-09-30  Hans-Peter Nilsson  <hp@bitrange.com>
 
@@ -1552,10 +1567,10 @@
 
 2001-07-12  Jeff Johnston  <jjohnstn@redhat.com>
 
-        * cgen-asm.in: Include "xregex.h" always to enable the libiberty
-        regex support.
-        (@arch@_cgen_build_insn_regex): New routine from Graydon.
-        (@arch@_cgen_assemble_insn): Add Graydon's code to use regex
+	* cgen-asm.in: Include "xregex.h" always to enable the libiberty
+	regex support.
+	(@arch@_cgen_build_insn_regex): New routine from Graydon.
+	(@arch@_cgen_assemble_insn): Add Graydon's code to use regex
 	to verify if it is worth parsing the insn as insn "x".  Also update
 	error message when insn is not a recognized format of the insn vs
 	when the insn is completely unrecognized.
@@ -1684,10 +1699,10 @@
 
 2001-06-06  Christian Groessler <cpg@aladdin.de>
 
-        * z8k-dis.c: Fix formatting.
-        (unpack_instr): Remove unused cases in switch statement. Add
-        safety abort() in default case.
-        (unparse_instr): Add safety abort() in default case.
+	* z8k-dis.c: Fix formatting.
+	(unpack_instr): Remove unused cases in switch statement. Add
+	safety abort() in default case.
+	(unparse_instr): Add safety abort() in default case.
 
 2001-06-06  Peter Jakubek <pjak@snafu.de>
 
@@ -1809,21 +1824,21 @@
 
 2001-04-27  Johan Rydberg  <jrydberg@opencores.org>
 
-        * Makefile.am: Add OpenRISC target.
-        * Makefile.in: Regenerated.
+	* Makefile.am: Add OpenRISC target.
+	* Makefile.in: Regenerated.
 
-        * disassemble.c (disassembler): Recognize the OpenRISC disassembly.
+	* disassemble.c (disassembler): Recognize the OpenRISC disassembly.
 
-        * configure.in (bfd_openrisc_arch): Add target.
-        * configure: Regenerated.
+	* configure.in (bfd_openrisc_arch): Add target.
+	* configure: Regenerated.
 
-        * openrisc-asm.c: New file.
-        * openrisc-desc.c: Likewise.
-        * openrisc-desc.h: Likewise.
-        * openrisc-dis.c: Likewise.
-        * openrisc-ibld.c: Likewise.
-        * openrisc-opc.c: Likewise.
-        * openrisc-opc.h: Likewise.
+	* openrisc-asm.c: New file.
+	* openrisc-desc.c: Likewise.
+	* openrisc-desc.h: Likewise.
+	* openrisc-dis.c: Likewise.
+	* openrisc-ibld.c: Likewise.
+	* openrisc-opc.c: Likewise.
+	* openrisc-opc.h: Likewise.
 
 2001-04-24  Christian Groessler  <cpg@aladdin.de>
 
@@ -1877,8 +1892,8 @@
 
 2001-03-20  Patrick Macdonald  <patrickm@redhat.com>
 
-        * cgen-dis.in (print_insn_@arch@): Add support for target machine
-        determination via CGEN_COMPUTE_MACH.
+	* cgen-dis.in (print_insn_@arch@): Add support for target machine
+	determination via CGEN_COMPUTE_MACH.
 	* fr30-desc.c: Regenerate.
 	* fr30-dis.c: Regenerate.
 	* fr30-opc.h: Regenerate.
@@ -1912,8 +1927,8 @@
 2001-03-06  Nick Clifton  <nickc@redhat.com>
 
 	* arm-dis.c (print_insn_thumb): Compute destination address
-        of BLX(1) instruction by taking bit 1 from PC and not from bit
-        0 of the offset.
+	of BLX(1) instruction by taking bit 1 from PC and not from bit
+	0 of the offset.
 
 2001-03-06  Igor Shevlyakov  <igor@windriver.com>
 
@@ -1976,11 +1991,11 @@
 
 2001-02-18  lars brinkhoff  <lars@nocrew.org>
 
-        * Makefile.am: Add PDP-11 target.
-        * configure.in: Likewise.
-        * disassemble.c: Likewise.
-        * pdp11-dis.c: New file.
-        * pdp11-opc.c: New file.
+	* Makefile.am: Add PDP-11 target.
+	* configure.in: Likewise.
+	* disassemble.c: Likewise.
+	* pdp11-dis.c: New file.
+	* pdp11-opc.c: New file.
 
 2001-02-14  Jim Wilson  <wilson@redhat.com>
 
@@ -1995,7 +2010,7 @@
 
 2001-02-11  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
 
-        * mips-dis.c (print_insn_arg): Use top four bits of the address of
+	* mips-dis.c (print_insn_arg): Use top four bits of the address of
 	the following instruction not of the jump itself for the jump
 	target.
 	(print_mips16_insn_arg): Likewise.
@@ -2200,28 +2215,28 @@
 
 2000-12-03  Chris Demetriou   cgd@sibyte.com
 
-        * mips-opc.c (mips_builtin_opcodes): Use the WR_HILO, RD_HILO,
-        MOD_HILO, and MOD_LO macros.
+	* mips-opc.c (mips_builtin_opcodes): Use the WR_HILO, RD_HILO,
+	MOD_HILO, and MOD_LO macros.
 
-        * mips-opc.c (M1, M2): Delete.
-        (mips_builtin_opcodes): Remove all uses of M1.
+	* mips-opc.c (M1, M2): Delete.
+	(mips_builtin_opcodes): Remove all uses of M1.
 
-        * mips-opc.c (mips_builtin_opcodes): Make the dmfc2 and dmtc2
-        instructions take "G" format second operands and use the
-        correct flags.
-        There are mfc3 and mtc3 opcodes, so add dmfc3 and dmtc3 opcodes to
+	* mips-opc.c (mips_builtin_opcodes): Make the dmfc2 and dmtc2
+	instructions take "G" format second operands and use the
+	correct flags.
+	There are mfc3 and mtc3 opcodes, so add dmfc3 and dmtc3 opcodes to
 	match.
-        Delete "sel" code operands from mfc1 and mtc1.
-        Add MIPS64 opcode changes (dclo, dclz), and "sel" code variants
+	Delete "sel" code operands from mfc1 and mtc1.
+	Add MIPS64 opcode changes (dclo, dclz), and "sel" code variants
 	for dm[ft]c[023].
 
 2000-12-03  Ed Satterthwaite  ehs@sibyte.com  and
-            Chris Demetriou   cgd@sibyte.com
+	    Chris Demetriou   cgd@sibyte.com
 
-        * mips-opc.c (mips_builtin_opcodes): Finish additions
-        for MIPS32 support, and clean up existing entries for
-        aesthetics, consistency with the MIPS32 ISA, and
-        with consistency the rest of the table.
+	* mips-opc.c (mips_builtin_opcodes): Finish additions
+	for MIPS32 support, and clean up existing entries for
+	aesthetics, consistency with the MIPS32 ISA, and
+	with consistency the rest of the table.
 
 2000-12-01  Nick Clifton  <nickc@redhat.com>
 
@@ -2230,32 +2245,32 @@
 
 2000-12-01  Chris Demetriou <cgd@sibyte.com>
 
-        mips-dis.c (print_insn_arg): Handle new 'U' and 'J' argument
-        specifiers.  Update 'B' for new constant names, and remove
-        'm'.
-        mips-opc.c (mips_builtin_opcodes): Place "pref" and "ssnop"
-        near the top of the array, so they are disassembled properly.
-        Enable "ssnop" for MIPS32.  Add "break" variant with 20 bit
-        code for MIPS32.  Update "clo" and "clz" to use 'U' operand
-        specifier.  Add 'H' format specifier variants for "mfc1,"
-        "mfc2," "mfc3," "mtc1," "mtc2," and "mtc3" for MIPS32.  Update
-        MIPS32 "sdbbp" to use 'B' operand specifier.  Add MIPS32
-        "wait" variant which uses 'J' operand specifier.
+	mips-dis.c (print_insn_arg): Handle new 'U' and 'J' argument
+	specifiers.  Update 'B' for new constant names, and remove
+	'm'.
+	mips-opc.c (mips_builtin_opcodes): Place "pref" and "ssnop"
+	near the top of the array, so they are disassembled properly.
+	Enable "ssnop" for MIPS32.  Add "break" variant with 20 bit
+	code for MIPS32.  Update "clo" and "clz" to use 'U' operand
+	specifier.  Add 'H' format specifier variants for "mfc1,"
+	"mfc2," "mfc3," "mtc1," "mtc2," and "mtc3" for MIPS32.  Update
+	MIPS32 "sdbbp" to use 'B' operand specifier.  Add MIPS32
+	"wait" variant which uses 'J' operand specifier.
 
-        * mips-dis.c (set_mips_isa_type): Update to use
-        CPU_UNKNOWN and ISA_* constants.  Add bfd_mach_mips32 case.
-        Replace bfd_mach_mips4K with bfd_mach_mips32_4k case.
-        * mips-opc.c (I32): New constant for instructions added in
-        MIPS32.
-        (P4): Delete.
-        (mips_builtin_opcodes) Replace all uses of P4 with I32.
+	* mips-dis.c (set_mips_isa_type): Update to use
+	CPU_UNKNOWN and ISA_* constants.  Add bfd_mach_mips32 case.
+	Replace bfd_mach_mips4K with bfd_mach_mips32_4k case.
+	* mips-opc.c (I32): New constant for instructions added in
+	MIPS32.
+	(P4): Delete.
+	(mips_builtin_opcodes) Replace all uses of P4 with I32.
 
-        * mips-dis.c (set_mips_isa_type): Add cases for
-        bfd_mach_mips5 and bfd_mach_mips64.
-        * mips-opc.c (I64): New definitions.
+	* mips-dis.c (set_mips_isa_type): Add cases for
+	bfd_mach_mips5 and bfd_mach_mips64.
+	* mips-opc.c (I64): New definitions.
 
-        * mips-dis.c (set_mips_isa_type): Add case for
-        bfd_mach_mips_sb1.
+	* mips-dis.c (set_mips_isa_type): Add case for
+	bfd_mach_mips_sb1.
 
 2000-11-28  Hans-Peter Nilsson  <hp@bitrange.com>
 
@@ -2369,8 +2384,8 @@
 
 2000-09-07  Catherine Moore  <clm@redhat.com>
 
-        * d30v-opc.c (d30v_format_tab): Use format Ra for
-        modinc and moddec.
+	* d30v-opc.c (d30v_format_tab): Use format Ra for
+	modinc and moddec.
 
 2000-09-06  Alexandre Oliva  <aoliva@redhat.com>
 
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index d2c2143..ed6e813 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -477,7 +477,7 @@
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \
   $(INCDIR)/elf/reloc-macros.h opintl.h arc-dis.h arc-ext.h
 arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/opcode/arc.h
+  $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h
 arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(BFD_H) $(INCDIR)/symcat.h arc-ext.h $(INCDIR)/libiberty.h
 arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -723,8 +723,8 @@
   $(INCDIR)/opcode/sparc.h
 tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic30.h
-tic4x-dis.lo: tic4x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic4x.h
+tic4x-dis.lo: tic4x-dis.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic4x.h
 tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic54x.h \
   $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index 6341618..c474230 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -449,7 +449,7 @@
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = gtar
+TAR = tar
 GZIP_ENV = --best
 SOURCES = libopcodes.a.c $(libopcodes_la_SOURCES)
 OBJECTS = libopcodes.a.$(OBJEXT) $(libopcodes_la_OBJECTS)
@@ -973,7 +973,7 @@
   $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/arc.h \
   $(INCDIR)/elf/reloc-macros.h opintl.h arc-dis.h arc-ext.h
 arc-opc.lo: arc-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/opcode/arc.h
+  $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/arc.h
 arc-ext.lo: arc-ext.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(BFD_H) $(INCDIR)/symcat.h arc-ext.h $(INCDIR)/libiberty.h
 arm-dis.lo: arm-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
@@ -1219,8 +1219,8 @@
   $(INCDIR)/opcode/sparc.h
 tic30-dis.lo: tic30-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic30.h
-tic4x-dis.lo: tic4x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
-  $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/opcode/tic4x.h
+tic4x-dis.lo: tic4x-dis.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+  $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic4x.h
 tic54x-dis.lo: tic54x-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/tic54x.h \
   $(INCDIR)/coff/tic54x.h $(INCDIR)/coff/ti.h
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index af44788..4ffdf99 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -526,7 +526,9 @@
 	    {
 	      register const char *d;
 
-	      if (! OPCODE_IS_MEMBER (op, mips_isa, target_processor))
+	      /* We always allow to disassemble the jalx instruction.  */
+	      if (! OPCODE_IS_MEMBER (op, mips_isa, target_processor)
+		  && strcmp (op->name, "jalx"))
 		continue;
 
 	      /* Figure out instruction type and branch delay information.  */
diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in
index 1f85d72..861e410 100644
--- a/opcodes/po/POTFILES.in
+++ b/opcodes/po/POTFILES.in
@@ -113,6 +113,7 @@
 sparc-opc.c
 sysdep.h
 tic30-dis.c
+tic4x-dis.c
 tic54x-dis.c
 tic54x-opc.c
 tic80-dis.c
diff --git a/opcodes/po/de.po b/opcodes/po/de.po
index 6039e3e..2914776 100644
--- a/opcodes/po/de.po
+++ b/opcodes/po/de.po
@@ -4,9 +4,9 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: opcodes 2.12-pre020121\n"
-"POT-Creation-Date: 2002-01-17 13:58+0000\n"
-"PO-Revision-Date: 2002-02-24 13:59+0100\n"
+"Project-Id-Version: opcodes 2.12.91\n"
+"POT-Creation-Date: 2002-07-23 15:55-0400\n"
+"PO-Revision-Date: 2002-09-24 07:13+0200\n"
 "Last-Translator: Martin v. Löwis <martin@v.loewis.de>\n"
 "Language-Team: German <de@li.org>\n"
 "MIME-Version: 1.0\n"
@@ -25,21 +25,21 @@
 msgid "Illegal limm reference in last instruction!\n"
 msgstr "Ungültige limm-Referenz in der letzten Anweisung!\n"
 
-#: arm-dis.c:509
+#: arm-dis.c:507
 msgid "<illegal precision>"
 msgstr "<ungültige Präzision>"
 
-#: arm-dis.c:1019
+#: arm-dis.c:1010
 #, c-format
 msgid "Unrecognised register name set: %s\n"
 msgstr "Unbekannte Registernamensmenge: %s\n"
 
-#: arm-dis.c:1026
+#: arm-dis.c:1017
 #, c-format
 msgid "Unrecognised disassembler option: %s\n"
 msgstr "Unbekannte Disassembler-Option: %s\n"
 
-#: arm-dis.c:1198
+#: arm-dis.c:1191
 msgid ""
 "\n"
 "The following ARM specific disassembler options are supported for use with\n"
@@ -59,7 +59,8 @@
 msgid "unknown constraint `%c'"
 msgstr ""
 
-#: cgen-asm.c:346 fr30-ibld.c:195 m32r-ibld.c:195 openrisc-ibld.c:195
+#: cgen-asm.c:346 fr30-ibld.c:195 frv-ibld.c:195 m32r-ibld.c:195
+#: openrisc-ibld.c:195 xstormy16-ibld.c:195
 #, c-format
 msgid "operand out of range (%ld not between %ld and %ld)"
 msgstr ""
@@ -85,104 +86,126 @@
 msgid "Address 0x%x is out of bounds.\n"
 msgstr ""
 
-#: fr30-asm.c:324 m32r-asm.c:326 openrisc-asm.c:245
+#: fr30-asm.c:323 frv-asm.c:595 m32r-asm.c:325 openrisc-asm.c:244
+#: xstormy16-asm.c:231
 #, c-format
 msgid "Unrecognized field %d while parsing.\n"
 msgstr ""
 
-#: fr30-asm.c:374 m32r-asm.c:376 openrisc-asm.c:295
+#: fr30-asm.c:373 frv-asm.c:645 m32r-asm.c:375 openrisc-asm.c:294
+#: xstormy16-asm.c:281
 msgid "missing mnemonic in syntax string"
 msgstr ""
 
 #. We couldn't parse it.
-#: fr30-asm.c:510 fr30-asm.c:514 fr30-asm.c:601 fr30-asm.c:703 m32r-asm.c:512 m32r-asm.c:516 m32r-asm.c:603 m32r-asm.c:705 openrisc-asm.c:431 openrisc-asm.c:435 openrisc-asm.c:522 openrisc-asm.c:624
+#: fr30-asm.c:509 fr30-asm.c:513 fr30-asm.c:600 fr30-asm.c:702 frv-asm.c:781
+#: frv-asm.c:785 frv-asm.c:872 frv-asm.c:974 m32r-asm.c:511 m32r-asm.c:515
+#: m32r-asm.c:602 m32r-asm.c:704 openrisc-asm.c:430 openrisc-asm.c:434
+#: openrisc-asm.c:521 openrisc-asm.c:623 xstormy16-asm.c:417
+#: xstormy16-asm.c:421 xstormy16-asm.c:508 xstormy16-asm.c:610
 msgid "unrecognized instruction"
 msgstr ""
 
-#: fr30-asm.c:557 m32r-asm.c:559 openrisc-asm.c:478
+#: fr30-asm.c:556 frv-asm.c:828 m32r-asm.c:558 openrisc-asm.c:477
+#: xstormy16-asm.c:464
 #, c-format
 msgid "syntax error (expected char `%c', found `%c')"
 msgstr "Syntaxfehler (erwartetes Zeichen »%c«, gefunden »%c«)"
 
-#: fr30-asm.c:567 m32r-asm.c:569 openrisc-asm.c:488
+#: fr30-asm.c:566 frv-asm.c:838 m32r-asm.c:568 openrisc-asm.c:487
+#: xstormy16-asm.c:474
 #, c-format
 msgid "syntax error (expected char `%c', found end of instruction)"
 msgstr ""
 
-#: fr30-asm.c:595 m32r-asm.c:597 openrisc-asm.c:516
+#: fr30-asm.c:594 frv-asm.c:866 m32r-asm.c:596 openrisc-asm.c:515
+#: xstormy16-asm.c:502
 msgid "junk at end of line"
 msgstr ""
 
-#: fr30-asm.c:702 m32r-asm.c:704 openrisc-asm.c:623
+#: fr30-asm.c:701 frv-asm.c:973 m32r-asm.c:703 openrisc-asm.c:622
+#: xstormy16-asm.c:609
 msgid "unrecognized form of instruction"
 msgstr ""
 
-#: fr30-asm.c:714 m32r-asm.c:716 openrisc-asm.c:635
+#: fr30-asm.c:713 frv-asm.c:985 m32r-asm.c:715 openrisc-asm.c:634
+#: xstormy16-asm.c:621
 #, c-format
 msgid "bad instruction `%.50s...'"
 msgstr ""
 
-#: fr30-asm.c:717 m32r-asm.c:719 openrisc-asm.c:638
+#: fr30-asm.c:716 frv-asm.c:988 m32r-asm.c:718 openrisc-asm.c:637
+#: xstormy16-asm.c:624
 #, c-format
 msgid "bad instruction `%.50s'"
 msgstr ""
 
 #. Default text to print if an instruction isn't recognized.
-#: fr30-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39
+#: fr30-dis.c:39 frv-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39
+#: xstormy16-dis.c:39
 msgid "*unknown*"
 msgstr ""
 
-#: fr30-dis.c:319 m32r-dis.c:250 openrisc-dis.c:137
+#: fr30-dis.c:318 frv-dis.c:360 m32r-dis.c:249 openrisc-dis.c:136
+#: xstormy16-dis.c:169
 #, c-format
 msgid "Unrecognized field %d while printing insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166
+#: fr30-ibld.c:166 frv-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166
+#: xstormy16-ibld.c:166
 #, c-format
 msgid "operand out of range (%ld not between %ld and %lu)"
 msgstr ""
 
-#: fr30-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179
+#: fr30-ibld.c:179 frv-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179
+#: xstormy16-ibld.c:179
 #, c-format
 msgid "operand out of range (%lu not between 0 and %lu)"
 msgstr ""
 
-#: fr30-ibld.c:731 m32r-ibld.c:660 openrisc-ibld.c:634
+#: fr30-ibld.c:730 frv-ibld.c:820 m32r-ibld.c:659 openrisc-ibld.c:633
+#: xstormy16-ibld.c:678
 #, c-format
 msgid "Unrecognized field %d while building insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:939 m32r-ibld.c:794 openrisc-ibld.c:737
+#: fr30-ibld.c:937 frv-ibld.c:1103 m32r-ibld.c:792 openrisc-ibld.c:735
+#: xstormy16-ibld.c:826
 #, c-format
 msgid "Unrecognized field %d while decoding insn.\n"
 msgstr ""
 
-#: fr30-ibld.c:1088 m32r-ibld.c:904 openrisc-ibld.c:817
+#: fr30-ibld.c:1086 frv-ibld.c:1348 m32r-ibld.c:902 openrisc-ibld.c:815
+#: xstormy16-ibld.c:939
 #, c-format
 msgid "Unrecognized field %d while getting int operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1217 m32r-ibld.c:994 openrisc-ibld.c:877
+#: fr30-ibld.c:1215 frv-ibld.c:1573 m32r-ibld.c:992 openrisc-ibld.c:875
+#: xstormy16-ibld.c:1032
 #, c-format
 msgid "Unrecognized field %d while getting vma operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1351 m32r-ibld.c:1092 openrisc-ibld.c:946
+#: fr30-ibld.c:1349 frv-ibld.c:1807 m32r-ibld.c:1090 openrisc-ibld.c:944
+#: xstormy16-ibld.c:1134
 #, c-format
 msgid "Unrecognized field %d while setting int operand.\n"
 msgstr ""
 
-#: fr30-ibld.c:1473 m32r-ibld.c:1178 openrisc-ibld.c:1003
+#: fr30-ibld.c:1471 frv-ibld.c:2029 m32r-ibld.c:1176 openrisc-ibld.c:1001
+#: xstormy16-ibld.c:1224
 #, c-format
 msgid "Unrecognized field %d while setting vma operand.\n"
 msgstr ""
 
-#: h8300-dis.c:384
+#: h8300-dis.c:385
 #, c-format
 msgid "Hmmmm %x"
 msgstr ""
 
-#: h8300-dis.c:395
+#: h8300-dis.c:396
 #, c-format
 msgid "Don't understand %x \n"
 msgstr ""
@@ -232,12 +255,12 @@
 msgid "# <dis error: %08x>"
 msgstr ""
 
-#: mips-dis.c:290
+#: mips-dis.c:337
 #, c-format
 msgid "# internal error, undefined modifier(%c)"
 msgstr ""
 
-#: mips-dis.c:1154
+#: mips-dis.c:1209
 #, c-format
 msgid "# internal disassembler error, unrecognised modifier (%c)"
 msgstr ""
@@ -271,62 +294,62 @@
 msgid "$<undefined>"
 msgstr ""
 
-#: ppc-opc.c:765 ppc-opc.c:798
+#: ppc-opc.c:777 ppc-opc.c:810
 msgid "invalid conditional option"
 msgstr ""
 
-#: ppc-opc.c:800
+#: ppc-opc.c:812
 msgid "attempt to set y bit when using + or - modifier"
 msgstr ""
 
-#: ppc-opc.c:832 ppc-opc.c:884
+#: ppc-opc.c:844 ppc-opc.c:896
 msgid "offset not a multiple of 4"
 msgstr ""
 
-#: ppc-opc.c:857
+#: ppc-opc.c:869
 msgid "offset not between -2048 and 2047"
 msgstr ""
 
-#: ppc-opc.c:882
+#: ppc-opc.c:894
 msgid "offset not between -8192 and 8191"
 msgstr ""
 
-#: ppc-opc.c:910
+#: ppc-opc.c:922
 msgid "ignoring least significant bits in branch offset"
 msgstr ""
 
-#: ppc-opc.c:944 ppc-opc.c:981
+#: ppc-opc.c:956 ppc-opc.c:993
 msgid "illegal bitmask"
 msgstr ""
 
-#: ppc-opc.c:1054
+#: ppc-opc.c:1066
 msgid "value out of range"
 msgstr ""
 
-#: ppc-opc.c:1130
+#: ppc-opc.c:1142
 msgid "index register in load range"
 msgstr ""
 
-#: ppc-opc.c:1146
+#: ppc-opc.c:1158
 msgid "invalid register operand when updating"
 msgstr ""
 
 #. Mark as non-valid instruction
-#: sparc-dis.c:749
+#: sparc-dis.c:750
 msgid "unknown"
 msgstr ""
 
-#: sparc-dis.c:824
+#: sparc-dis.c:825
 #, c-format
 msgid "Internal error:  bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
 msgstr ""
 
-#: sparc-dis.c:835
+#: sparc-dis.c:836
 #, c-format
 msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
 msgstr ""
 
-#: sparc-dis.c:884
+#: sparc-dis.c:885
 #, c-format
 msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n"
 msgstr ""
@@ -389,3 +412,31 @@
 #: v850-opc.c:375
 msgid "immediate value must be even"
 msgstr "Der Direktoperand muss gerade sein."
+
+#: xstormy16-asm.c:74
+msgid "Bad register in preincrement"
+msgstr ""
+
+#: xstormy16-asm.c:79
+msgid "Bad register in postincrement"
+msgstr ""
+
+#: xstormy16-asm.c:81
+msgid "Bad register name"
+msgstr "Falscher Registername."
+
+#: xstormy16-asm.c:85
+msgid "Label conflicts with register name"
+msgstr ""
+
+#: xstormy16-asm.c:89
+msgid "Label conflicts with `Rx'"
+msgstr ""
+
+#: xstormy16-asm.c:91
+msgid "Bad immediate expression"
+msgstr ""
+
+#: xstormy16-asm.c:120
+msgid "Small operand was not an immediate number"
+msgstr ""
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index e10f1da..100ece1 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-26  Jim Wilson  <wilson@redhat.com>
+
+	* simops (OP_10007E0): Don't subtract 4 from PC.
+
 2002-09-19  Nick Clifton  <nickc@redhat.com>
 
 	* interp.c (sim_open): Remove reference to v850ea.
diff --git a/sim/v850/simops.c b/sim/v850/simops.c
index d8a4d58..eba728f 100644
--- a/sim/v850/simops.c
+++ b/sim/v850/simops.c
@@ -1880,7 +1880,7 @@
       ECR |= 0x40 + OP[0];
       /* Flag that we are now doing exception processing.  */
       PSW |= PSW_EP | PSW_ID;
-      PC = ((OP[0] < 0x10) ? 0x40 : 0x50) - 4;
+      PC = (OP[0] < 0x10) ? 0x40 : 0x50;
 
       return 0;
     }