From: Andrew Cagney Date: Sat, 15 Jun 2002 16:43:33 +0000 (+0000) Subject: merge from trunk X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af84bdc79bebea288416bfd9db2d36e4e0484e3b;p=thirdparty%2Fbinutils-gdb.git merge from trunk --- diff --git a/ChangeLog b/ChangeLog index 1f914904c0a..27ac092f6d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,65 @@ +2002-06-12 Kaveh R. Ghazi + + * Makefile.in (CFLAGS_FOR_TARGET): Add -O2. + +2002-06-08 Jason Thorpe + + * configure.in (vax-*-netbsd*): Re-enable gas. + +2002-05-31 Nathanael Nerode + + * Makefile.in: Replace HOST_PREFIX, HOST_PREFIX_1 with BUILD_PREFIX, + BUILD_PREFIX_1, to correct nomenclature. + * configure: Likewise. + + * Makefile.in: Eliminate version-specific references to tcl8.1, tk8.1. + * configure.in: Eliminate version-specific references to tcl8.1, tk8.1. + +2002-05-31 Olaf Hering + + * config-ml.in: Propogate DESTDIR also. + +2002-05-29 Jason Thorpe + + * configure.in (vax-*-netbsd*): Don't build gas for this + platform. + +2002-05-28 Marek Michalkiewicz + + * configure.in (noconfigdirs): Don't compile libiberty, libstdcxx + and libgcj for AVR. + +2002-05-28 Nick Clifton + + * config.sub: Add DLX target. + +2002-05-22 Jason Thorpe + + * config.guess: Update to 2002-05-22 version. + * config.sub: Likewise. + +2002-05-16 Rainer Orth + + * Makefile.in: Allow for PWDCMD to override hardcoded pwd. + * config-ml.in: Likewise. + * configure: Likewise. + * configure.in: Likewise. + + config: + * acinclude.m4: Allow for PWDCMD to override hardcoded pwd. + +2002-05-13 Nathanael Nerode + + * configure.in: Simplify makefile fragment collection. + + * configure.in: Remove code to build emacs. + + * configure.in : Remove --srcdir argument from targargs and buildargs + (it's always overridden in the Makefile anyway). Rearrange a bit. + + * configure: Move some logic to configure.in. + * configure.in: Move some logic from configure. + 2002-05-07 Jeff Johnston * COPYING.LIBGLOSS: New file. diff --git a/Makefile.in b/Makefile.in index 12a69d3d3e6..4a761096539 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for directory with subdirs to build. # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001 Free Software Foundation +# 1999, 2000, 2001, 2002 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,6 +65,12 @@ GDB_NLM_DEPS = SHELL = /bin/sh +# pwd command to use. Allow user to override default by setting PWDCMD in +# the environment to account for automounters. The make variable must not +# be called PWDCMD, otherwise the value set here is passed to make +# subprocesses and overrides the setting from the user's environment. +PWD = $${PWDCMD-pwd} + # INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a # cygwin host. INSTALL_PROGRAM_ARGS = @@ -84,8 +90,8 @@ CC = cc # Special variables passed down in EXTRA_GCC_FLAGS. They are defined # here so that they can be overridden by Makefile fragments. HOST_CC = $(CC_FOR_BUILD) -HOST_PREFIX = -HOST_PREFIX_1 = loser- +BUILD_PREFIX = +BUILD_PREFIX_1 = loser- # These flag values are normally overridden by the configure script. CFLAGS = -g @@ -94,7 +100,11 @@ CXXFLAGS = -g -O2 LDFLAGS = LIBCFLAGS = $(CFLAGS) CFLAGS_FOR_BUILD = $(CFLAGS) -CFLAGS_FOR_TARGET = $(CFLAGS) +# During gcc bootstrap, if we use some random cc for stage1 then +# CFLAGS will be just -g. We want to ensure that TARGET libraries +# (which we know are built with gcc) are built with optimizations so +# prepend -O2 when setting CFLAGS_FOR_TARGET. +CFLAGS_FOR_TARGET = -O2 $(CFLAGS) LDFLAGS_FOR_TARGET = LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) PICFLAG = @@ -480,8 +490,8 @@ EXTRA_GCC_FLAGS = \ 'CXX=$(CXX)' \ 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ 'HOST_CC=$(CC_FOR_BUILD)' \ - 'HOST_PREFIX=$(HOST_PREFIX)' \ - 'HOST_PREFIX_1=$(HOST_PREFIX_1)' \ + 'BUILD_PREFIX=$(BUILD_PREFIX)' \ + 'BUILD_PREFIX_1=$(BUILD_PREFIX_1)' \ 'NM=$(NM)' \ "`echo 'RANLIB=$(RANLIB)' | sed -e s/.*=$$/XFOO=/`" \ 'WINDRES=$$(WINDRES_FOR_TARGET)' \ @@ -574,7 +584,6 @@ ALL_MODULES = \ all-snavigator \ all-tar \ all-tcl \ - all-tcl8.1 \ all-texinfo \ all-textutils \ all-tgas \ @@ -706,7 +715,6 @@ INSTALL_MODULES = \ install-intl \ install-ispell \ install-tcl \ - install-tcl8.1 \ install-itcl \ install-ld \ install-libgui \ @@ -746,7 +754,6 @@ ALL_X11_MODULES = \ all-guile \ all-tclX \ all-tk \ - all-tk8.1 \ all-tix # This is a list of the check targets for all of the modules which are @@ -770,7 +777,6 @@ INSTALL_X11_MODULES = \ install-expect \ install-tclX \ install-tk \ - install-tk8.1 \ install-tix # This is a list of the targets for all of the modules which are compiled @@ -984,8 +990,8 @@ DO_X = \ .PHONY: $(DO_X) $(DO_X): @target=`echo $@ | sed -e 's/^do-//'`; \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ for i in $(SUBDIRS) -dummy-; do \ if [ -f ./$$i/Makefile ]; then \ @@ -1011,8 +1017,8 @@ $(DO_X): else true; fi; \ done @target=`echo $@ | sed -e 's/^do-//'`; \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ for i in $(TARGET_CONFIGDIRS) -dummy-; do \ if [ -f $(TARGET_SUBDIR)/$$i/Makefile ]; then \ @@ -1042,7 +1048,7 @@ dvi: do-dvi do-info: all-texinfo install-info: do-install-info dir.info - s=`cd $(srcdir); pwd`; export s; \ + s=`cd $(srcdir); ${PWD}`; export s; \ if [ -f dir.info ] ; then \ $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \ else true ; fi @@ -1077,8 +1083,8 @@ realclean: maintainer-clean $(CLEAN_MODULES) $(CLEAN_X11_MODULES) clean-gcc: @dir=`echo $@ | sed -e 's/clean-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) clean); \ else \ @@ -1090,8 +1096,8 @@ $(CLEAN_TARGET_MODULES): @dir=`echo $@ | sed -e 's/clean-target-//'`; \ rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \ else \ @@ -1164,7 +1170,7 @@ vault-install: .PHONY: install.all install.all: install-no-fixedincludes @if [ -f ./gcc/Makefile ] ; then \ - r=`pwd` ; export r ; \ + r=`${PWD}` ; export r ; \ $(SET_LIB_PATH) \ (cd ./gcc; \ $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \ @@ -1199,8 +1205,8 @@ gcc-no-fixedincludes: cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \ touch gcc/stmp-fixinc gcc/include/fixed; \ rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd` ; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}` ; export s; \ $(SET_LIB_PATH) \ (cd ./gcc; \ $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ @@ -1214,8 +1220,8 @@ gcc-no-fixedincludes: $(ALL_BUILD_MODULES): dir=`echo $@ | sed -e 's/all-build-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ (cd $(BUILD_SUBDIR)/$${dir} && $(MAKE) all); \ else \ true; \ @@ -1233,8 +1239,8 @@ $(CONFIGURE_BUILD_MODULES): elif echo " $(BUILD_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \ if [ -d $(srcdir)/$${dir} ]; then \ [ -d $(BUILD_SUBDIR)/$${dir} ] || mkdir $(BUILD_SUBDIR)/$${dir};\ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ AR="$(AR_FOR_BUILD)"; export AR; \ AS="$(AS_FOR_BUILD)"; export AS; \ CC="$(CC_FOR_BUILD)"; export CC; \ @@ -1318,8 +1324,8 @@ $(CONFIGURE_BUILD_MODULES): $(ALL_MODULES) all-gui all-libproc: @dir=`echo $@ | sed -e 's/all-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \ else \ @@ -1335,8 +1341,8 @@ $(NATIVE_CHECK_MODULES): @if [ '$(host_canonical)' = '$(target_canonical)' ] ; then \ dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \ else \ @@ -1347,8 +1353,8 @@ $(NATIVE_CHECK_MODULES): $(CROSS_CHECK_MODULES): @dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \ else \ @@ -1361,8 +1367,8 @@ $(CROSS_CHECK_MODULES): $(INSTALL_MODULES): installdirs @dir=`echo $@ | sed -e 's/install-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \ else \ @@ -1375,7 +1381,7 @@ $(INSTALL_MODULES): installdirs $(CONFIGURE_TARGET_MODULES): @dir=`echo $@ | sed -e 's/configure-target-//'`; \ if [ -d $(TARGET_SUBDIR)/$${dir} ]; then \ - r=`pwd`; export r; \ + r=`${PWD}`; export r; \ $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/$${dir}/tmpmulti.out 2> /dev/null; \ if [ -s $(TARGET_SUBDIR)/$${dir}/tmpmulti.out ]; then \ if [ -f $(TARGET_SUBDIR)/$${dir}/multilib.out ]; then \ @@ -1399,8 +1405,8 @@ $(CONFIGURE_TARGET_MODULES): elif echo " $(TARGET_CONFIGDIRS) " | grep " $${dir} " >/dev/null 2>&1; then \ if [ -d $(srcdir)/$${dir} ]; then \ [ -d $(TARGET_SUBDIR)/$${dir} ] || mkdir $(TARGET_SUBDIR)/$${dir};\ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ AR="$(AR_FOR_TARGET)"; export AR; \ AS="$(AS_FOR_TARGET)"; export AS; \ @@ -1481,8 +1487,8 @@ $(CONFIGURE_TARGET_MODULES): $(ALL_TARGET_MODULES): @dir=`echo $@ | sed -e 's/all-target-//'`; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; \ $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \ @@ -1496,8 +1502,8 @@ $(ALL_TARGET_MODULES): $(CHECK_TARGET_MODULES): @dir=`echo $@ | sed -e 's/check-target-//'`; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; \ $(MAKE) $(TARGET_FLAGS_TO_PASS) check);\ @@ -1512,8 +1518,8 @@ $(CHECK_TARGET_MODULES): $(INSTALL_TARGET_MODULES): installdirs @dir=`echo $@ | sed -e 's/install-target-//'`; \ if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $(TARGET_SUBDIR)/$${dir}; \ $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \ @@ -1527,8 +1533,8 @@ $(INSTALL_TARGET_MODULES): installdirs $(ALL_X11_MODULES): @dir=`echo $@ | sed -e 's/all-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; \ $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \ @@ -1542,8 +1548,8 @@ $(ALL_X11_MODULES): $(CHECK_X11_MODULES): @dir=`echo $@ | sed -e 's/check-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; \ $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \ @@ -1557,8 +1563,8 @@ $(CHECK_X11_MODULES): $(INSTALL_X11_MODULES): installdirs @dir=`echo $@ | sed -e 's/install-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; \ $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \ @@ -1570,8 +1576,8 @@ $(INSTALL_X11_MODULES): installdirs .PHONY: all-gcc all-gcc: @if [ -f ./gcc/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \ else \ @@ -1590,13 +1596,13 @@ all-gcc: # .PHONY: bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean bootstrap4 bootstrap4-lean: all-bootstrap - @r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ echo "Bootstrapping the compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $@ - @r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ case "$@" in \ *bootstrap4-lean ) \ msg="Comparing stage3 and stage4 of the compiler"; \ @@ -1611,21 +1617,21 @@ bootstrap bootstrap-lean bootstrap2 bootstrap2-lean bootstrap3 bootstrap3-lean b $(SET_LIB_PATH) \ echo "$$msg"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare - @r=`pwd`; export r; \ - s=`cd $(srcdir); pwd` ; export s; \ + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}` ; export s; \ $(SET_LIB_PATH) \ echo "Building runtime libraries"; \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) all .PHONY: cross cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld - @r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ echo "Building the C and C++ compiler"; \ cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" - @r=`pwd`; export r; \ - s=`cd $(srcdir); pwd` ; export s; \ + @r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}` ; export s; \ $(SET_LIB_PATH) \ echo "Building runtime libraries"; \ $(MAKE) $(BASE_FLAGS_TO_PASS) $(RECURSE_FLAGS) \ @@ -1634,8 +1640,8 @@ cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld .PHONY: check-gcc check-gcc: @if [ -f ./gcc/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \ else \ @@ -1645,8 +1651,8 @@ check-gcc: .PHONY: check-c++ check-c++: @if [ -f ./gcc/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++); \ $(MAKE) check-target-libstdc++-v3; \ @@ -1657,8 +1663,8 @@ check-c++: .PHONY: install-gcc install-gcc: @if [ -f ./gcc/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \ else \ @@ -1668,8 +1674,8 @@ install-gcc: .PHONY: install-gcc-cross install-gcc-cross: @if [ -f ./gcc/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" install); \ else \ @@ -1682,8 +1688,8 @@ install-gcc-cross: install-dosrel: installdirs info @dir=`echo $@ | sed -e 's/install-//'`; \ if [ -f ./$${dir}/Makefile ] ; then \ - r=`pwd`; export r; \ - s=`cd $(srcdir); pwd`; export s; \ + r=`${PWD}`; export r; \ + s=`cd $(srcdir); ${PWD}`; export s; \ $(SET_LIB_PATH) \ (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \ else \ @@ -1749,11 +1755,11 @@ all-indent: all-inet: all-tcl all-send-pr all-perl all-intl: all-ispell: all-emacs19 -all-itcl: all-tcl all-tk all-tcl8.1 all-tk8.1 +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-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl +all-libgui: all-tcl all-tk all-itcl all-libiberty: all-build-libiberty: configure-build-libiberty @@ -1797,15 +1803,13 @@ all-sim: all-libiberty all-bfd all-opcodes all-readline all-cgen all-snavigator: all-tcl all-tk all-itcl all-tix all-db all-grep all-libgui all-tar: all-libiberty all-tcl: -all-tcl8.1: all-tclX: all-tcl all-tk all-tk: all-tcl -all-tk8.1: all-tcl8.1 all-texinfo: all-libiberty all-textutils: all-tgas: all-libiberty all-bfd all-opcodes all-time: -all-tix: all-tcl all-tk all-tcl8.1 all-tk8.1 +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 diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a837ebec983..1a8b4b0fa22 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,940 @@ +2002-06-14 Sergey Grigoriev + + * pei-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Enable 16 byte + alignment for .bss, .data and .text sections so that sse and sse2 + code will work. + * pe-i386.c (COFF_SECTION_ALIGNMENT_ENTRIES): Likewise. + +2002-06013 J"orn Rennecke + + config.bfd: Add support for sh[1234]l*-*-elf* | sh3el*-*-elf*, + sh[1234]*-elf*. + +2002-06-12 John David Anglin + + * elflink.h (elf_bfd_final_link): Improve error handling for missing + dynamic sections. + + * elf64-hppa.c (allocate_global_data_opd): We don't need an opd entry + for a symbol that has no output section. + (allocate_dynrel_entries): Correct comment. + (elf64_hppa_finalize_dynreloc): Likewise. Don't create an opd entry + unless we want one. + (elf64_hppa_finalize_opd): Prevent segfault if dyn_h is NULL. + (elf64_hppa_finalize_dlt): Likewise. Prevent segfault for symbols + with no section. Remove unnecessary parentheses. + +2002-06-11 Tom Rix + + * coffcode.h (coff_compute_section_file_positions): Add data + section to AIX loader alignment check. + + * coff-rs6000.c (_bfd_xcoff_mkobject): Set default text section + alignment to 4 bytes. + (_bfd_xcoff_copy_private_bfd_data): Use text and data alignment + power accessor macro. + (do_shared_object_padding): Remove invalid assertion. + +2002-06-10 Richard Sandiford + + * section.c (_bfd_strip_section_from_output): Set SEC_EXCLUDE + for removed output sections. + +2002-06-10 Geoffrey Keating + + * merge.c (merge_strings): Use htab_create_alloc with calloc, not + htab_alloc. + * elf-strtab.c (_bfd_elf_strtab_finalize): Likewise. + +2002-06-08 H.J. Lu + + * elf.c (copy_private_bfd_data): Don't cast to bfd_size_type to + work around a long long bug in gcc 2.96 on mips. + +2002-06-08 Jason Thorpe + + * Makefile.am (BFD32_BACKENDS): Add vax1knetbsd.lo. + (BFD32_BACKENDS_CFILES): Add vax1knetbsd.c. + Regenerate dependency lists. + * Makefile.in: Regenerate. + * config.bfd (vax-*-netbsdelf*, vax-*-netbsdaout*): Add + vax1knetbsd_vec to targ_selvecs. + * configure.in: Add vax1knetbsd_vec. + * configure: Regenerate. + * targets.c (_bfd_target_vector): Add vax1knetbsd_vec. + * vax1knetbsd.c: New file. + * vaxnetbsd.c: Update copyright years. + (TARGET_PAGE_SIZE): Set to 0x1000. + (DEFAULT_MID): Set to M_VAX4K_NETBSD. + +2002-06-08 Matt Thomas + + * libaout.h (enum machine_type): Add M_VAX4K_NETBSD. + +2002-06-08 Alan Modra + + * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Make static. + +2002-06-08 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + + * armnetbsd.c: Replace CONST with const. + * corefile.c: Likewise. + * elf32-dlx.c: Likewise. + * elf64-mips.c: Likewise. + * mmo.c: Likewise. + * ns32knetbsd.c: Likewise. + + * elf64-sparc.c (sparc64_elf_add_symbol_hook): Check the hash + table is elf64-sparc. + +2002-06-08 Thiemo Seufer + + * elfxx-mips.c (_bfd_mips_elf_relocate_section): Simplify code. + Fix RELA addends to get not shifted in the result. Don't do special + handling of R_MIPS_64 for NewABI. + +2002-06-07 Alan Modra + + * aoutx.h (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc. + (NAME(aout,slurp_reloc_table)): Likewise. + * coff-mips.c (mips_relax_section): Use bfd_zalloc. + * coff-rs6000.c (xcoff_write_armap_big): Use bfd_zmalloc. + (xcoff_write_archive_contents_big): Likewise. + (xcoff_generate_rtinit): Likewise. + (xcoff_generate_rtinit): Likewise, and check error return. + * coff64-rs6000.c (xcoff64_generate_rtinit): Likewise. + * coffgen.c (coff_section_symbol): Use bfd_zalloc. + (coff_get_normalized_symtab): Likewise. + (coff_make_empty_symbol): Likewise. + (bfd_coff_set_symbol_class): Likewise. + * cofflink.c (coff_link_add_symbols): Likewise. + * ecoff.c (_bfd_ecoff_make_empty_symbol): Likewise. + * ecofflink.c (ecoff_write_shuffle): Use bfd_zmalloc. + (bfd_ecoff_write_accumulated_debug): Likewise. + * elf64-alpha.c (get_got_entry): Use bfd_zalloc. + * i386linux.c (bfd_i386linux_size_dynamic_sections): Likewise. + * i386lynx.c (NAME(lynx,slurp_reloc_table)): Use bfd_zmalloc. + * ieee.c (do_with_relocs): Use bfd_zalloc. + * m68klinux.c (bfd_m68klinux_size_dynamic_sections): Likewise. + * pdp11.c (NAME(aout,slurp_symbol_table)): Use bfd_zmalloc. + (NAME(aout,slurp_reloc_table)): Likewise. + (NAME(aout,squirt_out_relocs)): Don't memset when zalloc'd. + * reloc16.c (bfd_coff_reloc16_relax_section): Use bfd_zmalloc. + * som.c (som_build_and_write_symbol_table): Likewise. + (som_slurp_string_table): Likewise. + (som_slurp_symbol_table): Likewise. + (som_bfd_ar_write_symbol_stuff): Likewise. + * sparclinux.c (bfd_sparclinux_size_dynamic_sections): Use bfd_zalloc. + * sunos.c (bfd_sunos_size_dynamic_sections): Likewise. + * tekhex.c (find_chunk): Likewise. Get rid of unused "sname". + * vms-gsd.c (_bfd_vms_slurp_gsd): Use bfd_zmalloc. + * xcofflink.c (xcoff_link_add_symbols): Use bfd_zalloc/bfd_zmalloc. + +2002-06-07 Alan Modra + + * elf-bfd.h (struct bfd_elf_section_data ): Replace with + "group" union. + (elf_group_name): Update. + (elf_group_id): Define. + (bfd_elf_set_group_contents): Declare. + * elf.c (elf_fake_sections): Qualify use of elf_group_name. + (set_group_contents): Rename to bfd_elf_set_group_contents. Remove + ATTRIBUTE_UNUSED from failedptrarg. If elf_group_id is set, use + that sym for the signature. + (_bfd_elf_compute_section_file_positions): Don't call + set_group_contents for "ld -r" case. + (swap_out_syms): Use bfd_zalloc. + * elflink.h (elf_link_add_archive_symbols): Likewise. + (NAME(bfd_elf,size_dynamic_sections)): Likewise. + (elf_bfd_final_link): Call bfd_elf_set_group_contents. + +2002-06-07 Alan Modra + + * elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved + relocs in opd for non-shared too. + +2002-06-06 Jeffrey Law + + * merge.c: Include libiberty.h. + * elf-strtab.c: Include libiberty.h. + +2002-06-06 Elias Athanasopoulos + + * peXXigen.c (pe_print_idata): Remove unused variable. + +2002-06-06 David Heine + + * elf.c (assign_file_positions_for_segments): Remove unallocated + sections from the section to segment mapping for PT_LOAD segments. + Update comment about empty loadable segments. + +2002-06-06 Richard Sandiford + + * stabs.c (_bfd_link_section_stabs): Check that the symbol offset + is within the .stabstr section. + +2002-06-06 Alan Modra + + * elf-bfd.h (struct elf_size_info ): Function args + are "const PTR", not "const PTR *". + (bfd_elf32_swap_symbol_in): Likewise. + (bfd_elf64_swap_symbol_in): Likewise. + * elfcode.h (elf_swap_symbol_in): Change input args to const PTR. + (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in. + * elflink.h (elf_link_is_defined_archive_symbol): Likewise. + (elf_link_add_object_symbols): Likewise. + (elf_link_record_local_dynamic_symbol): Likewise. + (elf_link_input_bfd): Likewise. + (elf_gc_mark): Likewise. + (elf_reloc_symbol_deleted_p): Likewise. + * elf-m10200.c (mn10200_elf_relax_section): Likewise. + (mn10200_elf_relax_delete_bytes): Likewise. + (mn10200_elf_symbol_address_p): Likewise. + (mn10200_elf_get_relocated_section_contents): Likewise. + * elf-m10300.c (mn10300_elf_relax_section): Likewise. + (mn10300_elf_relax_section): Likewise. + (mn10300_elf_relax_delete_bytes): Likewise. + (mn10300_elf_symbol_address_p): Likewise. + (mn10300_elf_get_relocated_section_contents): Likewise. + * elf32-h8300.c (elf32_h8_relax_section): Likewise. + (elf32_h8_relax_delete_bytes): Likewise. + (elf32_h8_symbol_address_p): Likewise. + (elf32_h8_get_relocated_section_contents): Likewise. + * elf32-hppa.c (get_local_syms): Likewise. + * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise. + * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise. + * elf32-sh.c (sh_elf_relax_section): Likewise. + (sh_elf_relax_delete_bytes): Likewise. + (sh_elf_get_relocated_section_contents): Likewise. + * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise. + * elf64-alpha.c (elf64_alpha_relax_section): Likewise. + * elf64-hppa.c (elf64_hppa_check_relocs): Likewise. + * elf64-mmix.c (mmix_elf_relax_section): Likewise. + * elf64-ppc.c (get_local_syms): Likewise. + * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise. + * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise. + +2002-06-05 J"orn Rennecke + + * config.bfd (sh64l*-*-elf*, shl*-*-elf*): New configurations. + +2002-06-05 Alan Modra + + * elf.c (group_signature): Swap in the whole symbol, and handle + extracting section symbol names. + (setup_group): Add comment. + (set_group_contents): When called from objcopy or ld, arrange for + section contents to be written. Write group member output section + indices to allow objcopy to reorganize sections. + (_bfd_elf_copy_private_section_data): Copy group info. + + * elf-bfd.h (struct elf_size_info): Add swap_symbol_in field. + (bfd_elf32_swap_symbol_in): Update prototype. + (bfd_elf64_swap_symbol_in): Likewise. + * elfcode.h (elf_swap_symbol_in): Change input args to const PTR *. + (elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in. + * elflink.h (elf_link_is_defined_archive_symbol): Likewise. + (elf_link_add_object_symbols): Likewise. + (elf_link_record_local_dynamic_symbol): Likewise. + (elf_link_input_bfd): Likewise. + (elf_gc_mark): Likewise. + (elf_reloc_symbol_deleted_p): Likewise. + * elf-m10200.c (mn10200_elf_relax_section): Likewise. + (mn10200_elf_relax_delete_bytes): Likewise. + (mn10200_elf_symbol_address_p): Likewise. + (mn10200_elf_get_relocated_section_contents): Likewise. + * elf-m10300.c (mn10300_elf_relax_section): Likewise. + (mn10300_elf_relax_section): Likewise. + (mn10300_elf_relax_delete_bytes): Likewise. + (mn10300_elf_symbol_address_p): Likewise. + (mn10300_elf_get_relocated_section_contents): Likewise. + * elf32-h8300.c (elf32_h8_relax_section): Likewise. + (elf32_h8_relax_delete_bytes): Likewise. + (elf32_h8_symbol_address_p): Likewise. + (elf32_h8_get_relocated_section_contents): Likewise. + * elf32-hppa.c (get_local_syms): Likewise. + * elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise. + * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise. + * elf32-sh.c (sh_elf_relax_section): Likewise. + (sh_elf_relax_delete_bytes): Likewise. + (sh_elf_get_relocated_section_contents): Likewise. + * elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise. + * elf64-alpha.c (elf64_alpha_relax_section): Likewise. + * elf64-hppa.c (elf64_hppa_check_relocs): Likewise. + * elf64-mmix.c (mmix_elf_relax_section): Likewise. + * elf64-ppc.c (get_local_syms): Likewise. + * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise. + * elfxx-ia64.c (elfNN_ia64_relax_section): Likewise. + * elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser. + * elf64-alpha.c (alpha_elf_size_info): Likewise. + * elf64-hppa.c (hppa64_elf_size_info): Likewise. + * elf64-mips.c (mips_elf64_size_info): Likewise. + * elf64-s390.c (s390_elf64_size_info): Likewise. + * elf64-sparc.c (sparc64_elf_size_info): Likewise. + +2002-06-05 Maciej W. Rozycki + + * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to... + elfxx-mips.c (_bfd_mips_elf_ignore_discarded_relocs): ... here. + elf64-mips.c (elf_backend_ignore_discarded_relocs): Use + _bfd_mips_elf_ignore_discarded_relocs. + elfxx-mips.h (_bfd_mips_elf_ignore_discarded_relocs): Declare. + +2002-06-05 H.J. Lu + + * elfxx-mips.c (mips_elf_calculate_relocation): Call + _bfd_elf_rel_local_sym for STT_SECTION relocations against + the SEC_MERGE section. + +2002-06-05 Alan Modra + + * coff-alpha.c: Update copyright date. + * coff-mips.c: Likewise. + * xcoff-target.h: Likewise. + + * bfd-in.h: Remove "taken from the source" comment. + * libbfd-in.h: Likewise. + * libcoff-in.h: Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + + * elf.c (bfd_elf_discard_group): Return true. + * elf-bfd.h (bfd_elf_discard_group): Declare. + * bfd-in.h (bfd_elf_discard_group): Don't declare here. + * section.c (bfd_discard_group): Rename to bfd_generic_discard_group. + * bfd.c (bfd_discard_group): Define. + * targets.c (struct bfd_target): Add _bfd_discard_group. + (BFD_JUMP_TABLE_LINK): Here too. + * libbfd-in.h (_bfd_nolink_bfd_discard_group): Define. + * aout-adobe.c (aout_32_bfd_discard_group): Define. + * aout-target.h (MY_bfd_discard_group): Define. + * aout-tic30.c (MY_bfd_discard_group): Define. + * binary.c (binary_bfd_discard_group): Define. + * bout.c (b_out_bfd_discard_group): Define. + * coff-alpha.c (_bfd_ecoff_bfd_discard_group): Define. + * coffcode.h (coff_bfd_discard_group): Define. + * coff-mips.c (_bfd_ecoff_bfd_discard_group): Define. + * elfxx-target.h (bfd_elfNN_bfd_discard_group): Define. + * i386msdos.c (msdos_bfd_discard_group): Define. + * i386os9k.c (os9k_bfd_discard_group): Define. + * ieee.c (ieee_bfd_discard_group): Define. + * ihex.c (ihex_bfd_discard_group): Define. + * mmo.c (mmo_bfd_discard_group): Define. + * nlm-target.h (nlm_bfd_discard_group): Define. + * oasys.c (oasys_bfd_discard_group): Define. + * ppcboot.c (ppcboot_bfd_discard_group): Define. + * som.c (som_bfd_discard_group): Define. + * srec.c (srec_bfd_discard_group): Define. + * tekhex.c (tekhex_bfd_discard_group): Define. + * versados.c (versados_bfd_discard_group): Define. + * vms.c (vms_bfd_discard_group): Define. + * xcoff-target.h (_bfd_xcoff_bfd_discard_group): Define. + * coff64-rs6000.c (rs6000coff64_vec): Update initialiser. + (aix5coff64_vec): Likewise. + * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Likewise. + +2002-06-04 Jason Thorpe + + * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo. + (BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c. + (elf32-sh64-com.lo): New dependency list. + * Makefile.in: Regenerate. + * configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec) + (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add + elf32-sh64-com.lo. + * configure: Regenerate. + * elf32-sh64.c (sh64_address_in_cranges) + (sh64_get_contents_type, sh64_address_is_shmedia): Move to... + (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb): + (crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to... + * elf32-sh64-com.c: ...here. New file. + +2002-06-04 Alan Modra + + * elf32-openrisc.c (openrisc_elf_gc_mark_hook): Remove + ATTRIBUTE_UNUSED on used params. + * elf32-vax.c (elf_vax_gc_mark_hook): Remove unnecessary checks + before calling bfd_section_from_elf_index on local syms. + * elf64-sh64.c (sh_elf64_gc_mark_hook): Likewise. + +2002-06-04 Jason Thorpe + + * Makefile.am (BFD32_BACKENDS): Add elf32-sh64-nbsd.lo. + (BFD32_BACKENDS_CFILES): Add elf32-sh64-nbsd.c. + (BFD64_BACKENDS): Add elf64-sh64-nbsd.lo. + (BFD64_BACKENDS_CFILES): Add elf64-sh64-nbsd.c. + (elf32-sh64-nbsd.lo, elf64-sh64-nbsd.lo): New rules. + * Makefile.in: Regenerate. + * config.bfd (sh5le-*-netbsd*, sh5-*-netbsd*, sh64le-*-netbsd*) + (sh64-*-netbsd*): New targets. + * configure.in: Add bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec, + bfd_elf64_sh64nbsd_vec, and bfd_elf64_sh64lnbsd_vec. + * configure: Regenerate. + * elf32-sh64-nbsd.c: New file. + * elf64-sh64-nbsd.c: New file. + * targets.c: Add extern decls for bfd_elf32_sh64nbsd_vec, + bfd_elf32_sh64lnbsd_vec, bfd_elf64_sh64nbsd_vec, and + bfd_elf64_sh64lnbsd_vec. + +2002-06-04 Alan Modra + + * elf.c (setup_group): Set SEC_LINK_ONCE on GRP_COMDAT groups. + (bfd_section_from_shdr): Likewise. Set section name of group + sections from signature. + (group_signature): Split out from setup_group. Ensure symbol table + is available. + (bfd_elf_discard_group): New function. + (_bfd_elf_make_section_from_shdr): Don't set SEC_LINK_ONCE on + .gnu.linkonce* sections if they are members of a group. + (set_group_contents): Set GRP_COMDAT flag. + * section.c (bfd_discard_group): New function. + * bfd-in.h (bfd_elf_discard_group): Declare. + * bfd-in2.h: Regenerate. + * elf-bfd.h (struct bfd_elf_section_data): Add linkonce_p field. + (elf_linkonce_p): Define. + +2002-06-04 Alan Modra + + * elf.c (bfd_section_from_shdr): Make "name" const. + * elf-bfd.h (elf_backend_section_from_shdr): Likewise. + * elf32-i370.c (i370_elf_section_from_shdr): Likewise. + * elf32-ppc.c (ppc_elf_section_from_shdr): Likewise. + * elf32-sh64.c (sh64_backend_section_from_shdr): Likewise. + * elf32-v850.c (v850_elf_section_from_shdr): Likewise. + * elf64-alpha.c (elf64_alpha_section_from_shdr): Likewise. + * elf64-hppa.c (elf64_hppa_section_from_shdr): Likewise. + * elf64-ppc.c (ppc64_elf_section_from_shdr): Likewise. + * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Likewise. + * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Likewise. + * elfxx-mips.h (_bfd_mips_elf_section_from_shdr): Likewise. + +2002-06-03 Maciej W. Rozycki + + * elfxx-mips.c (ABI_64_P): Use backend's data to determine the + ABI. + +2002-06-02 Kazu Hirata + + * elf32-arc.c: Fix formatting. + * elf32-arm.h: Likewise. + * elf32-cris.c: Likewise. + * elf32-dlx.c: Likewise. + * elf32-hppa.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-i386qnx.c: Likewise. + * elf32-or32.c: Likewise. + * elf32-s390.c: Likewise. + * elf32-sh64.c: Likewise. + * elf32-vax.c: Likewise. + * elf32-xstormy16.c: Likewise. + * elf64-alpha.c: Likewise. + * elf64-mmix.c: Likewise. + * elf64-ppc.c: Likewise. + * elf64-s390.c: Likewise. + * elf64-sh64.c: Likewise. + * elf64-x86-64.c: Likewise. + +2002-06-02 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference + null when there are no got entries for a symbol. + (elf64_alpha_relax_find_tls_segment): Rearrange to avoid + uninitialized variable warning. + +2002-06-01 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for + undefined symbols here. + (elf64_alpha_relax_section): Do it here. Also test for not + defined in the current module. + (elf64_alpha_relocate_section_r): Split out of ... + (elf64_alpha_relocate_section): ... here. Don't dereference + NULL when looking up local got entries. + +2002-06-01 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relax_with_lituse): Reject undefined + symbols from JSR relaxation. + (elf64_alpha_size_plt_section_1): New. + (elf64_alpha_calc_dynrel_sizes): Split out .rela.got bits ... + (elf64_alpha_size_rela_got_1): ... here. + (elf64_alpha_size_dynamic_sections): Split out .rela.got bits ... + (elf64_alpha_size_rela_got_section): ... here. + (elf64_alpha_size_plt_section): New. + (elf64_alpha_relax_section): Call them. + (elf64_alpha_size_got_sections): Remove output_bfd arg. + (elf64_alpha_finish_dynamic_symbol): Check gotent use_count. + +2002-06-01 Richard Henderson + + * elf64-alpha.c (alpha_get_dtprel_base, alpha_get_tprel_base): New. + (elf64_alpha_relocate_section): Use them. Reject LE TLS relocs + in shared libraries. Fix DTPRELHI and TPRELHI value. + (INSN_ADDQ, INSN_RDUNIQ): New. + (struct alpha_relax_info): Add symtab_hdr, tls_segment, first_gotent. + (elf64_alpha_relax_with_lituse): Return boolean. Remove irelend + argument. Reject dynamic symbols. Use LITUSE symbolic constants. + (elf64_alpha_relax_got_load): Rename from relax_without_lituse. + Handle GOTDTPREL and GOTTPREL relocations. + (elf64_alpha_relax_gprelhilo): New. + (elf64_alpha_relax_tls_get_addr): New. + (elf64_alpha_relax_find_tls_segment): New. + (elf64_alpha_relax_section): Handle TLS relocations. + (ALPHA_ELF_LINK_HASH_TLS_IE): New. + (elf64_alpha_check_relocs): Set it. + +2002-06-01 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relax_section): Don't store computed gp. + + * elf64-alpha.c (elf64_alpha_check_relocs): Fix typo on maybe_dynamic + check; don't suppress dynamic relocs for non-allocated sections. + + * elf64-alpha.c: Remove dead code. + +2002-05-31 Alan Modra + + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * po/SRC-POTFILES.in: Regenerate. + + * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate + space for bss .plt. + +2002-05-31 Graeme Peterson + + * Makefile.am (BFD32_BACKENDS): Add elf32-i386qnx.lo. + (BFD32_BACKENDS_CFILES): Add elf32-i386qnx.c. + Run "make dep-am". + * Makefile.in: Regenerate. + * config.bfd: Add i[3456]86-*-nto-qnx* support. + * configure.in: Add bfd_elf32_i386qnx_vec support. + * configure: Regenerate. + * elf-bfd.h (struct elf_backend_data): Add set_nonloadable_filepos, + is_contained_by_filepos, and copy_private_bfd_data_p. + * elf.c (assign_file_positions_for_segments): Call backend + set_nonloadable_filepos. Fix non-K&R call to _bfd_error_handler. + (IS_CONTAINED_BY_FILEPOS): Define. + (INCLUDE_SECTION_IN_SEGMENT): Also test IS_CONTAINED_BY_FILEPOS. + (copy_private_bfd_data): Use IS_CONTAINED_BY_FILEPOS. Typo fix. + Fix non-K&R call to _bfd_error_handler. + (_bfd_elf_copy_private_section_data): Use backend + copy_private_bfd_data_p. + * elf32-i386.c: Don't include elfxx-target.h when + ELF32_I386_C_INCLUDED is defined. + * elf32-i386qnx.c: New QNX elf backend file. + * elfxx-target.h: Add elf_backend_set_nonloadable_filepos, + elf_backend_is_contained_by_filepos, and + elf_backend_do_copy_private_bfd_data. + * targets.c: Add bfd_target bfd_elf32_i386qnx_vec. + +2002-05-31 Alan Modra + + * elfarm-oabi.c (bfd_elf32_arm_add_glue_sections_to_bfd): Define. + Move other similar defines to start of file. + +2002-05-30 Tom Rix + + * coff-rs6000.c (xcoff_rtype2howto): Handle 16 bit R_RBA. + * coff64-rs6000.c (xcoff64_rtype2howto): Same. + +2002-05-30 Richard Henderson + + * elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD, + ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New. + (ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove. + (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove. + (struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated. + (struct alpha_elf_obj_tdata): Rename total_got_entries and + n_local_got_entries to total_got_size and local_got_size. + (elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs. + (alpha_got_entry_size): New. + (elf64_alpha_relax_with_lituse): Use it. + (elf64_alpha_relax_without_lituse): Likewise. + (MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES. + (get_got_entry): New. + (elf64_alpha_check_relocs): Handle TLS relocs. Reorganize. + (elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask. + (elf64_alpha_merge_ind_symbols): Check gotent->reloc_type. + (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise. + (elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size. + (elf64_alpha_calc_got_offsets): Likewise. + (alpha_dynamic_entries_for_reloc): New. + (elf64_alpha_calc_dynrel_sizes): Use it. + (elf64_alpha_size_dynamic_sections): Likewise. + (elf64_alpha_relocate_section): Handle TLS relocations. + * reloc.c: Add Alpha TLS relocations. + * bfd-in2.h, libbfd.h: Rebuild. + +2002-05-29 Ralf Habacker + + * peXXigen.c (pe_print_idata): Remove double printed + import table lines; add Bound-To comment. + +2002-05-29 Matt Thomas + + * Makefile.am (BFD32_BACKENDS): Add elf32-vax.lo. + (BFD32_BACKENDS_CFILES): Add elf32-vax.c. + (elf32-vax.lo): New rule. + * Makefile.in: Regenerate. + * configure.in (bfd_elf32_vax_vec) + (vaxnetbsd_vec): New vectors. + * configure: Regenerate. + * config.bfd (vax-*-netbsdelf*) + (vax-*-netbsdaout*) + (vax-*-netbsd*): New targets. + * elf32-vax.c: New file. + * reloc.c: Add VAX relocations. + * bfd-in2.h: Regenerate. + * targets.c (_bfd_target_vector): Add bfd_elf32_vax_vec. + +2002-05-29 Jason Thorpe + + * config.bfd (arm-*-netbsd*): Add bfd_elf32_littlearm_vec + and bfd_elf32_bigarm_vec to targ_selvecs. + +2002-05-29 Ralf Habacker + + * peXXigen.c (pe_print_idata): Fix seg faults on printing import tables + with auto-imported symbols. + +2002-05-29 Adam Nemet + + * elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Don't add glue + sections only record bfd. + (bfd_elf32_arm_add_glue_sections_to_bfd): New function. + * bfd-in.h (bfd_elf32_arm_add_glue_sections_to_bfd): Declare it. + * bfd-in2.h: Regenerate. + +2002-05-28 Nick Clifton + + * syms.c (_bfd_stab_section_find_nearest_line): Move + declaration and initialisation of saw_line and saw_func out of + for loop. + +2002-05-29 Alan Modra + + * elf64-ppc.c (ppc64_elf_get_symbol_info): New function. + (bfd_elf64_get_symbol_info): Define. + * elfxx-target.h (bfd_elfNN_get_symbol_info): Only define if undef. + +2002-05-29 Andrey Volkov + + * cpu-h8300.c: Make default h8300 machine first in machine list. + +2002-05-28 Kuang Hwa Lin + + * config.bfd: Added DLX configuraton. + * Makefile.am: Added DLX configuraton. + * configure.in: Added DLX configuraton. + * archures.c: Add DLX architecure. + * reloc.c: Add DLX relocs. + * targets.c: Added DLX target vector. + * configure: Regenerate. + * Makefile.in: Regenreate. + * bfd-in2.h: Regenreate. + * elf32-dlx.c: New file: Support DLX target. + * cpu-dlx.c: New file: Support DLX target. + +2002-05-25 Alan Modra + + * elf32-m68k.c (elf32_m68k_print_private_bfd_data): Formatting. + + * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Revert last change. + (ppc64_elf_check_relocs): Don't set up function descriptor symbol + strings to point inside function code sym string. + (func_desc_adjust): Likewise. + (ppc64_elf_hide_symbol): Rewrite code to look up function code sym. + +2002-05-24 Michal Ludvig + + * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Added. + (elf64_x86_64_grok_psinfo): Added. + +2002-05-24 TAMURA Kent + + * config.bfd: Add a target for i386-netbsdpe. + +2002-05-24 Alan Modra + + * elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Don't copy is_func + and is_func_descriptor. + (func_desc_adjust): Hide function code sym in shared libs unless + there is a matching exported function descriptor sym. + +2002-05-23 Jakub Jelinek + + * elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL + for symbols from SHF_TLS section. + (_bfd_elf_print_private_bfd_data): Add PT_TLS. + (elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections. + (map_sections_to_segments): Build PT_TLS segment if necessary. + (assign_file_positions_for_segments): Likewise. + (get_program_header_size): Account for PT_TLS segment. + (swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from + SEC_THREAD_LOCAL sections to STT_TLS. + * reloc.c: Add 386 and IA-64 TLS relocs. + * section.c (SEC_THREAD_LOCAL): Define. + (SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS): + Remove. + * elflink.h (elf_link_add_object_symbols): Support .tcommon. + (size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS + unconditionally. + (struct elf_final_link_info): Add first_tls_sec. + (elf_bfd_final_link): Set first_tls_sec. + Compute elf_hash_table (info)->tls_segment. + (elf_link_output_extsym): Handle STT_TLS symbols. + (elf_link_input_bfd): Likewise. + * syms.c (BSF_THREAD_LOCAL): Define. + * bfd-in2.h: Rebuilt. + * libbfd.h: Rebuilt. + * elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff, + elf_i386_mkobject, elf_i386_object_p): New functions. + (elf_howto_table): Add TLS relocs. + (elf_i386_reloc_type_lookup): Support TLS relocs. + (elf_i386_info_to_howto_rel): Likewise. + (struct elf_i386_link_hash_entry): Add tls_type. + (struct elf_i386_obj_tdata): New. + (elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type): + New macros. + (struct elf_i386_link_hash_table): Add tls_ldm_got. + (link_hash_newfunc): Clear tls_type. + (elf_i386_check_relocs): Support TLS relocs. + (elf_i386_gc_sweep_hook): Likewise. + (allocate_dynrelocs): Likewise. + (elf_i386_size_dynamic_sections): Likewise. + (elf_i386_relocate_section): Likewise. + (elf_i386_finish_dynamic_symbol): Likewise. + (bfd_elf32_mkobject, elf_backend_object_p): Define. + * elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset, + dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done, + want_tprel, want_dtpmod, want_dtprel. + (elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions. + (ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to + R_IA64_LTOFF_TPREL22. + (elf_code_to_howto_index): Add TLS relocs. + (elfNN_ia64_check_relocs): Support TLS relocs. + (allocate_global_data_got): Account for TLS .got data. + (allocate_dynrel_entries): Account for TLS dynamic relocations. + (elfNN_ia64_install_value): Supprt TLS relocs. + (set_got_entry): Support TLS relocs. + (elfNN_ia64_relocate_section): Likewise. + +2002-05-23 Nick Clifton + + * elf32-arm.h (elf32_arm_final_link_relocate): For the Thumb + BLX reloc round the relocation up rather than down. + * coff-arm.c (coff_arm_relocate_section): Likewise. + +2002-05-21 H.J. Lu (hjl@gnu.org) + + * linker.c (_bfd_generic_link_add_one_symbol): Allow multiple + definition. + +2002-05-22 Alan Modra + + * elf64-ppc.c (ppc64_elf_size_stubs): Don't strip .branch_lt. + (ppc64_elf_relocate_section): Handle unresolved relocs in opd. + +2002-05-22 Alan Modra + + * elf64-ppc.c (ppc64_elf_relocate_section): Return false for + unresolved relocs. + (ppc64_elf_size_dynamic_sections): Check for splt NULL. + +2002-05-21 Thiemo Seufer + + * bfd/bfd.c (bfd_get_arch_size): Remove bfd_set_error call for + non-ELF targets. + +2002-05-21 Thiemo Seufer + + * elf-bfd.h (elf_backend_emit_relocs): Change prototype to return + an error value. + * elflink.h (elf_link_output_relocs): Likewise. Improve error message. + return with false on error. + (elf_link_input_bfd): Check reloc_emitter return value. + +2002-05-21 Jason Thorpe + + * config.bfd (armeb-*-netbsdelf*): New target. + +2002-05-20 Alan Modra + + * elf64-ppc.c (ppc_build_one_stub): Point undefined function syms + at the plt call stub. + +2002-05-19 Thiemo Seufer + + * cpu-mips.c (mips_compatible): Don't try to check machine + compatibility. + +2002-05-18 Tom Rix + + * coff64-rs6000.c (_bfd_xcoff64_swap_aux_out): Fix C_FILE auxent. + +2002-05-17 Alan Modra + + * elf64-ppc.c (ppc64_elf_info_to_howto): Formatting. + (ppc64_elf_relocate_section): Don't warn about reloc overflow when + we've already warned about an undefined symbol. Report more + detail on reloc errors. + +2002-05-17 Alan Modra + + * acinclude.m4 (AM_INSTALL_LIBBFD): New. + * configure.in: Invoke AM_INSTALL_LIBBFD. + * Makefile.am (install-data-local): Revert 2002-05-13. Move to.. + (install_libbfd): .. New target. + (uninstall_libbfd): Likewise. + (install-bfdlibLTLIBRARIES): Likewise. + (uninstall-bfdlibLTLIBRARIES): Likewise. + (bfdlibdir): New. + (bfdincludedir): New. + (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES. + * aclocal.m4: Regenerate. + * configure: Regenerate. + * Makefile.in: Regenerate. + +2002-05-17 Stuart Balfour + + * hash.c (bfd_hash_lookup): Remove computation of len from inside + hash loop. + +2002-05-16 Nick Clifton + + * config.bfd: Add targets for sh64-linux (little endian and + big endian). + +2002-05-15 Laurent Pinchart + + * peXXigen.c (pe_print_idata): Do not assume that the first thunk + is located in the same section as the import table. Instead + check, and if necessary load the section containing the thunk. + +2002-05-15 Nick Clifton + + * aix5ppc-core.c (xcoff64_core_p): Replace bfd_read with + bfd_bread. + (xcoff64_core_file_matches_executable_p): Replace bfd_read + with bfd_bread. + +2002-05-15 Alan Modra + + * aix5ppc-core.c: Warning fixes. + * aout-adobe.c (aout_32_bfd_link_just_syms): Define. + * aout-target.h (MY_bfd_link_just_syms): Define. + * aout-tic30.c (MY_bfd_link_just_syms): Define. + * bfd.c (bfd_link_just_syms): Define. + * binary.c (binary_bfd_link_just_syms): Define. + * bout.c (b_out_bfd_link_just_syms): Define. + * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Update initializer. + * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise. + * coffcode.h (coff_bfd_link_just_syms): Define. + * elf-bfd.h (enum elf_link_info_type): Add ELF_INFO_TYPE_JUST_SYMS. + (elf_discarded_section): Check for ELF_INFO_TYPE_JUST_SYMS. + (_bfd_elf_link_just_syms): Declare. + * elf.c (_bfd_elf_link_just_syms): New function. + * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Check that + sections haven't already been discarded by the linker. + * elflink.h (elf_link_add_object_symbols): Likewise for stab + sections and SEC_MERGE sections. + (elf_bfd_discard_info): Similarly here. + * elfxx-target.h (bfd_elfNN_bfd_link_just_syms): Define. + * i386msdos.c (msdos_bfd_link_just_syms): Define. + * i386os9k.c (os9k_bfd_link_just_syms): Define. + * ieee.c (ieee_bfd_link_just_syms): Define. + * ihex.c (ihex_bfd_link_just_syms): Define. + * libbfd-in.h (_bfd_nolink_bfd_link_just_syms): Define. + (_bfd_generic_link_just_syms): Declare. + * libecoff.h (_bfd_ecoff_bfd_link_just_syms): Define. + * linker.c (_bfd_generic_link_just_syms): New function. + * mmo.c (mmo_bfd_link_just_syms): Define. + * nlm-target.h (nlm_bfd_link_just_syms): Define. + * oasys.c (oasys_bfd_link_just_syms): Define. + * ppcboot.c (ppcboot_bfd_link_just_syms): Define. + * som.c (som_bfd_link_just_syms): Define. + * srec.c (srec_bfd_link_just_syms): Define. + * targets.c (struct bfd_target): Add _bfd_link_just_syms. + (BFD_JUMP_TABLE_LINK): And here. + * tekhex.c (tekhex_bfd_link_just_syms): Define. + * versados.c (versados_bfd_link_just_syms): Define. + * vms.c (vms_bfd_link_just_syms): Define. + * libbfd.h: Regenerate. + * bfd-in2.h: Regenerate. + +2002-05-15 Thiemo Seufer + + * elf32-mips.c: Remove superfluous definitions copied from + elfxx-mips.c. + (bfd_elf32_bigmips_vec,bfd_elf32_littlemips_vec): Use the + SGIish vectors to check the special case. + (mips_elf_hi16_reloc): Fix comment. + (mips_elf_got16_reloc): Likewise. + (_bfd_mips_elf32_gprel16_reloc): Likewise. + (elf_reloc_map): Code cleanup. + (mips_reloc_map): Add comment. + (bfd_elf23_bfd_reloc_type_lookup): Code cleanup. + (mips_elf32_rtype_to_howto): Likewise. + (mips_elf32_discard_info): Likewise. + (elf32_mips_irix_compat): Invert logic: Only SGIish vectors + lead to IRIX compatibility now. + +2002-05-15 Thiemo Seufer + + * elfxx-mips.c: Call it IRIX, not Irix in comments. + +2002-05-13 Jason Thorpe + + * config.bfd (shle-*-netbsdelf*): Add target which includes + sh64 support. + +2002-05-13 David Edelsohn + + * configure.in: Revert 2002-04-07. Instead, auto-configure + HAVE_ST_C_IMPL. + * configure: Regenerate. + * config.in: Regenerate. + * rs6000-core.c (CNEW_IMPL): Guard use of c_impl with HAVE_ST_C_IMPL + or AIX_5_CORE. + +2002-05-11 Federico G. Schwindt + + * configure.in (sparc*-*-openbsd*): Support sparc64-openbsd + corefiles as well.2 + * configure: Regenerate. + +2002-05-13 Alan Modra + + * Makefile.am (install-data-local): Install headers to + $(exec_prefix)/include. + * Makefile.in: Regenerate. + +2002-05-11 Ralf Corsepius + Daniel Jacobowitz + + * coff-sh.c (sh_reloc_map): Map to R_SH_IMM32 for non-PE. Don't + map BFD_RELOC_RVA. + +2002-05-11 Federico G. Schwindt + + * config.bfd (alpha*-*-openbsd*, sparc64*-*-openbsd*, + hppa*-*-openbsd*): New targets. + * configure.in (alpha*-*-openbsd*): Set COREFILE. + * configure: Regenerate. + 2002-05-10 Tom Rix - * coff64-rs6000.c (xcoff64_reloc_type_br): New function for + * coff64-rs6000.c (xcoff64_reloc_type_br): New function for xcoff64_ppc_relocate_section. * coff-rs6000.c : Extern common xcoff_reloc_type functions. * libxcoff.h: Common xcoff_reloc_type function declaration. @@ -8,7 +942,7 @@ 2002-05-10 Alan Modra * elf32-i386.c (elf_i386_relocate_section): Remove overflow checks - addend in 2002-05-09 commit. + added in 2002-05-09 commit. * elf32-hppa.c (elf32_hppa_size_stubs): Revert part of 2002-05-04, don't look for stubs on all undefined syms. @@ -27,7 +961,7 @@ * elf32-ppc.c (ppc_elf_create_got): New function. (ppc_elf_create_dynamic_sections): Call ppc_elf_create_got before - _bfd_elf_create_dynamic_sections. Correct .plt flags. + _bfd_elf_create_dynamic_sections. Correct .plt flags. (ppc_elf_check_relocs): Use ppc_elf_create_got in place of _bfd_elf_create_got_section. @@ -110,16 +1044,16 @@ (xcoff_rtype2howto): Renamed from _bfd_xcoff_rtype2howto. Special case some 16 bit relocs. Add reloc value to output. (xcoff_howto_table): Remove 64 bit R_POS, add 16 bit - R_RBR. Improve names. + R_RBR. Improve names. (_bfd_xcoff_reloc_type_lookup): Adjust for removal of 64 bit R_POS. (bfd_xcoff_backend_data): Update with new reloc swap names. (bfd_pmac_xcoff_backend_data) : Same. * coff64-rs6000.c: (xcoff64_swap_reloc_in): Moved from coffswap.h. (xcoff64_swap_reloc_out): Same. - (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit + (xcoff64_rtype2howto): Special case some 16 bit relocs and 32 bit R_POS. Add reloc value to output. - (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16 - bit R_RBR. Improve names, masks. + (xcoff64_howto_table): Move 64 bit R_POS to first entry. Add 16 + bit R_RBR. Improve names, masks. (xcoff64_reloc_type_lookup): Adjust for move of 64 bit R_POS. (bfd_xcoff_backend_data): Update with new reloc swap names. (bfd_xcoff_aix5_backend_data) : Same. @@ -152,7 +1086,7 @@ (mips_elf_record_global_got_symbol): Call _bfd_mips_elf_hide_symbol to hide a global symbol. (_bfd_mips_elf_hide_symbol): Return if forced_local is true. Set - forced_local to true. + forced_local to true. 2002-05-02 Richard Henderson @@ -199,7 +1133,7 @@ * elf64-ppc.h (ppc64_elf_set_toc): Delete. (ppc64_elf_toc): Declare. (ppc64_elf_next_input_section): Update. - + 2002-05-01 Alan Modra * syms.c (_bfd_stab_section_find_nearest_line): Don't bomb on NULL @@ -275,11 +1209,11 @@ 2002-04-28 Tom Rix * coff-rs6000.c (xcoff_calculate_relocation) : Function table for - calulating relocations. + calulating relocations. (xcoff_complain_overflow) : Function table for relocation errors. - (xcoff_ppc_relocate_section): Use relocation and complain function - tables. - (xcoff_complain_overflow_unsigned_func): New complain function. + (xcoff_ppc_relocate_section): Use relocation and complain function + tables. + (xcoff_complain_overflow_unsigned_func): New complain function. (xcoff_complain_overflow_signed_func): Same. (xcoff_complain_overflow_bitfield_func): Same. (xcoff_complain_overflow_dont_func): Same. @@ -294,7 +1228,7 @@ (xcoff_reloc_type_noop): Same. * libxcoff.h : Declare common parts for xcoff64. * coff64-rs6000.c (xcoff64_ppc_relocate_section): Use relocation - and complain function tables. + and complain function tables. 2002-04-28 Alan Modra @@ -376,12 +1310,12 @@ insert_thumb_branch, record_thumb_to_arm_glue): Suppress definition of these functions for ARM_WINCE builds as they are not used. - (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define + (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET): Do not define for ARM_WINCE builds. 2002-04-18 Nick Clifton - * coff-arm.c (bfd_arm_process_before_allocation): + * coff-arm.c (bfd_arm_process_before_allocation): 2002-04-17 J"orn Rennecke @@ -777,13 +1711,13 @@ 2002-03-20 Tom Rix - * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from + * coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from _bfd_xcoff_generic_stat_arch_elt. Fix format check. - * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt. + * coff64-rs6000.c : Use _bfd_xcoff_stat_arch_elt. 2002-03-19 Tom Rix - * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all + * xcofflink.c (_bfd_xcoff_bfd_link_add_symbols): Look through all dynamic objects in archives. 2002-03-19 Hans-Peter Nilsson @@ -808,14 +1742,14 @@ (xcoff_write_archive_contents_big) : Use do_shared_object_padding, do_copy and do_pad. * coff64-rs6000.c (xcoff64_write_ojbect_contents) : Use - bfd_xcoff_magic_number. + bfd_xcoff_magic_number. (xcoff64_bad_format_hook) : New function for _bfd_bad_format_hook fop. (xcoff_backend_data_r) : Use xcoff64_bad_format_hook. (bfd_xcoff_aix5_backend_data) : New Aix 5 backend data. (aix5coff64_vec) : New Aix 5 target aix5coff64-rs6000. * rs6000-core.c : Update copyright date. - * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL + * xcofflink.c (bfd_xcoff_size_dynamic_sections): Check for NULL csectpp. * coffcode.h (coff_new_section_hook) : Use new accessor macros. (coff_set_arch_mach_hook) : Add Aix 5 U64_TOCMAGIC magic #. diff --git a/bfd/Makefile.am b/bfd/Makefile.am index d6dd2e689f2..da399788af5 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -9,8 +9,10 @@ MKDEP = gcc -MM SUBDIRS = doc po docdir = doc +bfdlibdir = @bfdlibdir@ +bfdincludedir = @bfdincludedir@ -lib_LTLIBRARIES = libbfd.la +bfdlib_LTLIBRARIES = libbfd.la WARN_CFLAGS = @WARN_CFLAGS@ AM_CFLAGS = $(WARN_CFLAGS) @@ -54,6 +56,7 @@ ALL_MACHINES = \ cpu-cris.lo \ cpu-d10v.lo \ cpu-d30v.lo \ + cpu-dlx.lo \ cpu-fr30.lo \ cpu-h8300.lo \ cpu-h8500.lo \ @@ -102,6 +105,7 @@ ALL_MACHINES_CFILES = \ cpu-cris.c \ cpu-d10v.c \ cpu-d30v.c \ + cpu-dlx.c \ cpu-fr30.c \ cpu-h8300.c \ cpu-h8500.c \ @@ -196,12 +200,14 @@ BFD32_BACKENDS = \ elf32-cris.lo \ elf32-d10v.lo \ elf32-d30v.lo \ + elf32-dlx.lo \ elf32-fr30.lo \ elf32-gen.lo \ elf32-h8300.lo \ elf32-hppa.lo \ elf32-i370.lo \ elf32-i386.lo \ + elf32-i386qnx.lo \ elf32-i860.lo \ elf32-i960.lo \ elf32-ia64.lo \ @@ -223,9 +229,12 @@ BFD32_BACKENDS = \ elf32-sh.lo \ elf32-sh-lin.lo \ elf32-sh64.lo \ + elf32-sh64-com.lo \ elf32-sh-nbsd.lo \ + elf32-sh64-nbsd.lo \ elf32-sparc.lo \ elf32-v850.lo \ + elf32-vax.lo \ elf32-xstormy16.lo \ elf32.lo \ elflink.lo \ @@ -284,6 +293,7 @@ BFD32_BACKENDS = \ sparcnetbsd.lo \ sunos.lo \ vaxnetbsd.lo \ + vax1knetbsd.lo \ versados.lo \ vms.lo \ vms-gsd.lo \ @@ -345,12 +355,14 @@ BFD32_BACKENDS_CFILES = \ elf32-cris.c \ elf32-d10v.c \ elf32-d30v.c \ + elf32-dlx.c \ elf32-fr30.c \ elf32-gen.c \ elf32-h8300.c \ elf32-hppa.c \ elf32-i370.c \ elf32-i386.c \ + elf32-i386qnx.c \ elf32-i860.c \ elf32-i960.c \ elf32-m32r.c \ @@ -368,12 +380,15 @@ BFD32_BACKENDS_CFILES = \ elf32-pj.c \ elf32-ppc.c \ elf32-sh64.c \ + elf32-sh64-com.c \ elf32-s390.c \ elf32-sh.c \ elf32-sh-lin.c \ elf32-sh-nbsd.c \ + elf32-sh64-nbsd.c \ elf32-sparc.c \ elf32-v850.c \ + elf32-vax.c \ elf32-xstormy16.c \ elf32.c \ elflink.c \ @@ -431,6 +446,7 @@ BFD32_BACKENDS_CFILES = \ sparcnetbsd.c \ sunos.c \ vaxnetbsd.c \ + vax1knetbsd.c \ versados.c \ vms.c \ vms-gsd.c \ @@ -457,6 +473,7 @@ BFD64_BACKENDS = \ elf64-mips.lo \ elf64-mmix.lo \ elf64-sh64.lo \ + elf64-sh64-nbsd.lo \ elf64-ppc.lo \ elf64-s390.lo \ elf64-sparc.lo \ @@ -482,6 +499,7 @@ BFD64_BACKENDS_CFILES = \ elf64-ppc.c \ elf64-s390.c \ elf64-sh64.c \ + elf64-sh64-nbsd.c \ elf64-sparc.c \ elf64.c \ mmo.c \ @@ -672,14 +690,35 @@ $(BFD32_LIBS) \ $(BFD64_BACKENDS) \ $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -# Install BFD include file, and others that it needs. -install-data-local: $(BFD_H) +install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h - $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h - $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h - $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h + +uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd + @$(NORMAL_UNINSTALL) + +.PHONY: install_libbfd uninstall_libbfd +install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H) + $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) + $(mkinstalldirs) $(DESTDIR)$(bfdincludedir) + @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \ + else :; fi; \ + done + $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h + $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h + $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h + $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h + +uninstall_libbfd: + list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \ + done + rm -f $(DESTDIR)$(bfdincludedir)/bfd.h + rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h + rm -f $(DESTDIR)$(bfdincludedir)/symcat.h + rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h Makefile: $(srcdir)/configure.in @@ -831,7 +870,8 @@ stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def -merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h @@ -844,6 +884,7 @@ cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h +cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h @@ -1060,6 +1101,10 @@ elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \ @@ -1082,6 +1127,10 @@ elf32-i386.lo: 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-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 \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \ @@ -1153,6 +1202,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1169,6 +1222,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \ + $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1178,6 +1236,10 @@ elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/libiberty.h elf32-target.h +elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ @@ -1192,7 +1254,7 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/external.h elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h @@ -1362,6 +1424,9 @@ sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ vms.h @@ -1438,6 +1503,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf64-target.h +elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \ + $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index e3cc1268912..983ac2f47bc 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -133,8 +133,10 @@ MKDEP = gcc -MM SUBDIRS = doc po docdir = doc +bfdlibdir = @bfdlibdir@ +bfdincludedir = @bfdincludedir@ -lib_LTLIBRARIES = libbfd.la +bfdlib_LTLIBRARIES = libbfd.la WARN_CFLAGS = @WARN_CFLAGS@ AM_CFLAGS = $(WARN_CFLAGS) @@ -149,497 +151,45 @@ BFD_H = bfd.h # for the debugger, so if you are downloading things as S-records you # need two copies of the executable, one to download and one for the # debugger). -BFD32_LIBS = \ - archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo \ - format.lo init.lo libbfd.lo opncls.lo reloc.lo \ - section.lo syms.lo targets.lo hash.lo linker.lo \ - srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo \ - merge.lo dwarf2.lo +BFD32_LIBS = archive.lo archures.lo bfd.lo cache.lo coffgen.lo corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo syms.lo targets.lo hash.lo linker.lo srec.lo binary.lo tekhex.lo ihex.lo stabs.lo stab-syms.lo merge.lo dwarf2.lo BFD64_LIBS = archive64.lo -BFD32_LIBS_CFILES = \ - archive.c archures.c bfd.c cache.c coffgen.c corefile.c \ - format.c init.c libbfd.c opncls.c reloc.c \ - section.c syms.c targets.c hash.c linker.c \ - srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c \ - merge.c dwarf2.c +BFD32_LIBS_CFILES = archive.c archures.c bfd.c cache.c coffgen.c corefile.c format.c init.c libbfd.c opncls.c reloc.c section.c syms.c targets.c hash.c linker.c srec.c binary.c tekhex.c ihex.c stabs.c stab-syms.c merge.c dwarf2.c BFD64_LIBS_CFILES = archive64.c # This list is alphabetized to make it easier to keep in sync # with the decls and initializer in archures.c. -ALL_MACHINES = \ - cpu-a29k.lo \ - cpu-alpha.lo \ - cpu-arc.lo \ - cpu-arm.lo \ - cpu-avr.lo \ - cpu-cris.lo \ - cpu-d10v.lo \ - cpu-d30v.lo \ - cpu-fr30.lo \ - cpu-h8300.lo \ - cpu-h8500.lo \ - cpu-hppa.lo \ - cpu-ia64.lo \ - cpu-i370.lo \ - cpu-i386.lo \ - cpu-i860.lo \ - cpu-i960.lo \ - cpu-m32r.lo \ - cpu-m68hc11.lo \ - cpu-m68hc12.lo \ - cpu-m68k.lo \ - cpu-m88k.lo \ - cpu-m10200.lo \ - cpu-m10300.lo \ - cpu-mcore.lo \ - cpu-mips.lo \ - cpu-mmix.lo \ - cpu-or32.lo \ - cpu-ns32k.lo \ - cpu-openrisc.lo \ - cpu-pdp11.lo \ - cpu-pj.lo \ - cpu-powerpc.lo \ - cpu-rs6000.lo \ - cpu-s390.lo \ - cpu-sh.lo \ - cpu-sparc.lo \ - cpu-tic30.lo \ - cpu-tic54x.lo \ - cpu-tic80.lo \ - cpu-v850.lo \ - cpu-vax.lo \ - cpu-we32k.lo \ - cpu-w65.lo \ - cpu-xstormy16.lo \ - cpu-z8k.lo - - -ALL_MACHINES_CFILES = \ - cpu-a29k.c \ - cpu-alpha.c \ - cpu-arc.c \ - cpu-arm.c \ - cpu-avr.c \ - cpu-cris.c \ - cpu-d10v.c \ - cpu-d30v.c \ - cpu-fr30.c \ - cpu-h8300.c \ - cpu-h8500.c \ - cpu-hppa.c \ - cpu-ia64.c \ - cpu-i370.c \ - cpu-i386.c \ - cpu-i860.c \ - cpu-i960.c \ - cpu-m32r.c \ - cpu-m68hc11.c \ - cpu-m68hc12.c \ - cpu-m68k.c \ - cpu-m88k.c \ - cpu-m10200.c \ - cpu-m10300.c \ - cpu-mcore.c \ - cpu-mips.c \ - cpu-mmix.c \ - cpu-or32.c \ - cpu-ns32k.c \ - cpu-openrisc.c \ - cpu-pdp11.c \ - cpu-pj.c \ - cpu-powerpc.c \ - cpu-rs6000.c \ - cpu-s390.c \ - cpu-sh.c \ - cpu-sparc.c \ - cpu-tic30.c \ - cpu-tic54x.c \ - cpu-tic80.c \ - cpu-v850.c \ - cpu-vax.c \ - cpu-we32k.c \ - cpu-w65.c \ - cpu-xstormy16.c \ - cpu-z8k.c +ALL_MACHINES = cpu-a29k.lo cpu-alpha.lo cpu-arc.lo cpu-arm.lo cpu-avr.lo cpu-cris.lo cpu-d10v.lo cpu-d30v.lo cpu-dlx.lo cpu-fr30.lo cpu-h8300.lo cpu-h8500.lo cpu-hppa.lo cpu-ia64.lo cpu-i370.lo cpu-i386.lo cpu-i860.lo cpu-i960.lo cpu-m32r.lo cpu-m68hc11.lo cpu-m68hc12.lo cpu-m68k.lo cpu-m88k.lo cpu-m10200.lo cpu-m10300.lo cpu-mcore.lo cpu-mips.lo cpu-mmix.lo cpu-or32.lo cpu-ns32k.lo cpu-openrisc.lo cpu-pdp11.lo cpu-pj.lo cpu-powerpc.lo cpu-rs6000.lo cpu-s390.lo cpu-sh.lo cpu-sparc.lo cpu-tic30.lo cpu-tic54x.lo cpu-tic80.lo cpu-v850.lo cpu-vax.lo cpu-we32k.lo cpu-w65.lo cpu-xstormy16.lo cpu-z8k.lo + + +ALL_MACHINES_CFILES = cpu-a29k.c cpu-alpha.c cpu-arc.c cpu-arm.c cpu-avr.c cpu-cris.c cpu-d10v.c cpu-d30v.c cpu-dlx.c cpu-fr30.c cpu-h8300.c cpu-h8500.c cpu-hppa.c cpu-ia64.c cpu-i370.c cpu-i386.c cpu-i860.c cpu-i960.c cpu-m32r.c cpu-m68hc11.c cpu-m68hc12.c cpu-m68k.c cpu-m88k.c cpu-m10200.c cpu-m10300.c cpu-mcore.c cpu-mips.c cpu-mmix.c cpu-or32.c cpu-ns32k.c cpu-openrisc.c cpu-pdp11.c cpu-pj.c cpu-powerpc.c cpu-rs6000.c cpu-s390.c cpu-sh.c cpu-sparc.c cpu-tic30.c cpu-tic54x.c cpu-tic80.c cpu-v850.c cpu-vax.c cpu-we32k.c cpu-w65.c cpu-xstormy16.c cpu-z8k.c # The .o files needed by all of the 32 bit vectors that are configured into # target_vector in targets.c if configured with --enable-targets=all. -BFD32_BACKENDS = \ - aout-adobe.lo \ - aout-arm.lo \ - aout-cris.lo \ - aout-ns32k.lo \ - aout-sparcle.lo \ - aout-tic30.lo \ - aout0.lo \ - aout32.lo \ - armnetbsd.lo \ - bout.lo \ - cf-i386lynx.lo \ - cf-m68klynx.lo \ - cf-sparclynx.lo \ - coff-a29k.lo \ - coff-apollo.lo \ - coff-arm.lo \ - coff-aux.lo \ - coff-h8300.lo \ - coff-h8500.lo \ - coff-i386.lo \ - coff-go32.lo \ - coff-i860.lo \ - coff-i960.lo \ - coff-m68k.lo \ - coff-m88k.lo \ - coff-mips.lo \ - coff-or32.lo \ - coff-rs6000.lo \ - coff-sh.lo \ - coff-sparc.lo \ - coff-stgo32.lo \ - coff-svm68k.lo \ - coff-tic30.lo \ - coff-tic54x.lo \ - coff-tic80.lo \ - coff-u68k.lo \ - coff-we32k.lo \ - coff-w65.lo \ - coff-z8k.lo \ - cofflink.lo \ - dwarf1.lo \ - ecoff.lo \ - ecofflink.lo \ - efi-app-ia32.lo \ - elf.lo \ - elf32-arc.lo \ - elfarm-oabi.lo \ - elfarm-nabi.lo \ - elf32-avr.lo \ - elf32-cris.lo \ - elf32-d10v.lo \ - elf32-d30v.lo \ - elf32-fr30.lo \ - elf32-gen.lo \ - elf32-h8300.lo \ - elf32-hppa.lo \ - elf32-i370.lo \ - elf32-i386.lo \ - elf32-i860.lo \ - elf32-i960.lo \ - elf32-ia64.lo \ - elf32-m32r.lo \ - elf32-m68hc11.lo \ - elf32-m68hc12.lo \ - elf32-m68k.lo \ - elf32-m88k.lo \ - elf-m10200.lo \ - elf-m10300.lo \ - elf32-mcore.lo \ - elfxx-mips.lo \ - elf32-mips.lo \ - elf32-openrisc.lo \ - elf32-or32.lo \ - elf32-pj.lo \ - elf32-ppc.lo \ - elf32-s390.lo \ - elf32-sh.lo \ - elf32-sh-lin.lo \ - elf32-sh64.lo \ - elf32-sh-nbsd.lo \ - elf32-sparc.lo \ - elf32-v850.lo \ - elf32-xstormy16.lo \ - elf32.lo \ - elflink.lo \ - elf-strtab.lo \ - elf-eh-frame.lo \ - epoc-pe-arm.lo \ - epoc-pei-arm.lo \ - hp300bsd.lo \ - hp300hpux.lo \ - som.lo \ - i386aout.lo \ - i386bsd.lo \ - i386dynix.lo \ - i386freebsd.lo \ - i386linux.lo \ - i386lynx.lo \ - i386msdos.lo \ - i386netbsd.lo \ - i386mach3.lo \ - i386os9k.lo \ - ieee.lo \ - m68k4knetbsd.lo \ - m68klinux.lo \ - m68klynx.lo \ - m68knetbsd.lo \ - m88kmach3.lo \ - mipsbsd.lo \ - newsos3.lo \ - nlm.lo \ - nlm32-i386.lo \ - nlm32-sparc.lo \ - nlm32-ppc.lo \ - nlm32.lo \ - ns32knetbsd.lo \ - oasys.lo \ - pc532-mach.lo \ - pdp11.lo \ - pe-arm.lo \ - pei-arm.lo \ - pe-i386.lo \ - pei-i386.lo \ - pe-mcore.lo \ - pei-mcore.lo \ - pe-ppc.lo \ - pei-ppc.lo \ - pe-sh.lo \ - pei-sh.lo \ - pe-mips.lo \ - pei-mips.lo \ - peigen.lo \ - ppcboot.lo \ - reloc16.lo \ - riscix.lo \ - sparclinux.lo \ - sparclynx.lo \ - sparcnetbsd.lo \ - sunos.lo \ - vaxnetbsd.lo \ - versados.lo \ - vms.lo \ - vms-gsd.lo \ - vms-hdr.lo \ - vms-misc.lo \ - vms-tir.lo \ - xcofflink.lo - - -BFD32_BACKENDS_CFILES = \ - aout-adobe.c \ - aout-arm.c \ - aout-cris.c \ - aout-ns32k.c \ - aout-sparcle.c \ - aout-tic30.c \ - aout0.c \ - aout32.c \ - armnetbsd.c \ - bout.c \ - cf-i386lynx.c \ - cf-m68klynx.c \ - cf-sparclynx.c \ - coff-a29k.c \ - coff-apollo.c \ - coff-arm.c \ - coff-aux.c \ - coff-h8300.c \ - coff-h8500.c \ - coff-i386.c \ - coff-i860.c \ - coff-go32.c \ - coff-i960.c \ - coff-m68k.c \ - coff-m88k.c \ - coff-mips.c \ - coff-or32.c \ - coff-rs6000.c \ - coff-sh.c \ - coff-sparc.c \ - coff-stgo32.c \ - coff-svm68k.c \ - coff-tic30.c \ - coff-tic54x.c \ - coff-tic80.c \ - coff-u68k.c \ - coff-we32k.c \ - coff-w65.c \ - coff-z8k.c \ - cofflink.c \ - dwarf1.c \ - ecoff.c \ - ecofflink.c \ - efi-app-ia32.c \ - elf.c \ - elf32-arc.c \ - elfarm-oabi.c \ - elfarm-nabi.c \ - elf32-avr.c \ - elf32-cris.c \ - elf32-d10v.c \ - elf32-d30v.c \ - elf32-fr30.c \ - elf32-gen.c \ - elf32-h8300.c \ - elf32-hppa.c \ - elf32-i370.c \ - elf32-i386.c \ - elf32-i860.c \ - elf32-i960.c \ - elf32-m32r.c \ - elf32-m68k.c \ - elf32-m68hc11.c \ - elf32-m68hc12.c \ - elf32-m88k.c \ - elf-m10200.c \ - elf-m10300.c \ - elf32-mcore.c \ - elfxx-mips.c \ - elf32-mips.c \ - elf32-openrisc.c \ - elf32-or32.c \ - elf32-pj.c \ - elf32-ppc.c \ - elf32-sh64.c \ - elf32-s390.c \ - elf32-sh.c \ - elf32-sh-lin.c \ - elf32-sh-nbsd.c \ - elf32-sparc.c \ - elf32-v850.c \ - elf32-xstormy16.c \ - elf32.c \ - elflink.c \ - elf-strtab.c \ - elf-eh-frame.c \ - epoc-pe-arm.c \ - epoc-pei-arm.c \ - hp300bsd.c \ - hp300hpux.c \ - som.c \ - i386aout.c \ - i386bsd.c \ - i386dynix.c \ - i386freebsd.c \ - i386linux.c \ - i386lynx.c \ - i386msdos.c \ - i386netbsd.c \ - i386mach3.c \ - i386os9k.c \ - ieee.c \ - m68k4knetbsd.c \ - m68klinux.c \ - m68klynx.c \ - m68knetbsd.c \ - m88kmach3.c \ - mipsbsd.c \ - newsos3.c \ - nlm.c \ - nlm32-i386.c \ - nlm32-sparc.c \ - nlm32-ppc.c \ - nlm32.c \ - ns32knetbsd.c \ - oasys.c \ - pc532-mach.c \ - pdp11.c \ - pe-arm.c \ - pei-arm.c \ - pe-i386.c \ - pei-i386.c \ - pe-mcore.c \ - pei-mcore.c \ - pe-ppc.c \ - pei-ppc.c \ - pe-sh.c \ - pei-sh.c \ - pe-mips.c \ - pei-mips.c \ - ppcboot.c \ - reloc16.c \ - riscix.c \ - sparclinux.c \ - sparclynx.c \ - sparcnetbsd.c \ - sunos.c \ - vaxnetbsd.c \ - versados.c \ - vms.c \ - vms-gsd.c \ - vms-hdr.c \ - vms-misc.c \ - vms-tir.c \ - xcofflink.c +BFD32_BACKENDS = aout-adobe.lo aout-arm.lo aout-cris.lo aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo aout32.lo armnetbsd.lo bout.lo cf-i386lynx.lo cf-m68klynx.lo cf-sparclynx.lo coff-a29k.lo coff-apollo.lo coff-arm.lo coff-aux.lo coff-h8300.lo coff-h8500.lo coff-i386.lo coff-go32.lo coff-i860.lo coff-i960.lo coff-m68k.lo coff-m88k.lo coff-mips.lo coff-or32.lo coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo coff-svm68k.lo coff-tic30.lo coff-tic54x.lo coff-tic80.lo coff-u68k.lo coff-we32k.lo coff-w65.lo coff-z8k.lo cofflink.lo dwarf1.lo ecoff.lo ecofflink.lo efi-app-ia32.lo elf.lo elf32-arc.lo elfarm-oabi.lo elfarm-nabi.lo elf32-avr.lo elf32-cris.lo elf32-d10v.lo elf32-d30v.lo elf32-dlx.lo elf32-fr30.lo elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo elf32-i386.lo elf32-i386qnx.lo elf32-i860.lo elf32-i960.lo elf32-ia64.lo elf32-m32r.lo elf32-m68hc11.lo elf32-m68hc12.lo elf32-m68k.lo elf32-m88k.lo elf-m10200.lo elf-m10300.lo elf32-mcore.lo elfxx-mips.lo elf32-mips.lo elf32-openrisc.lo elf32-or32.lo elf32-pj.lo elf32-ppc.lo elf32-s390.lo elf32-sh.lo elf32-sh-lin.lo elf32-sh64.lo elf32-sh64-com.lo elf32-sh-nbsd.lo elf32-sh64-nbsd.lo elf32-sparc.lo elf32-v850.lo elf32-vax.lo elf32-xstormy16.lo elf32.lo elflink.lo elf-strtab.lo elf-eh-frame.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo hp300hpux.lo som.lo i386aout.lo i386bsd.lo i386dynix.lo i386freebsd.lo i386linux.lo i386lynx.lo i386msdos.lo i386netbsd.lo i386mach3.lo i386os9k.lo ieee.lo m68k4knetbsd.lo m68klinux.lo m68klynx.lo m68knetbsd.lo m88kmach3.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo nlm32-sparc.lo nlm32-ppc.lo nlm32.lo ns32knetbsd.lo oasys.lo pc532-mach.lo pdp11.lo pe-arm.lo pei-arm.lo pe-i386.lo pei-i386.lo pe-mcore.lo pei-mcore.lo pe-ppc.lo pei-ppc.lo pe-sh.lo pei-sh.lo pe-mips.lo pei-mips.lo peigen.lo ppcboot.lo reloc16.lo riscix.lo sparclinux.lo sparclynx.lo sparcnetbsd.lo sunos.lo vaxnetbsd.lo vax1knetbsd.lo versados.lo vms.lo vms-gsd.lo vms-hdr.lo vms-misc.lo vms-tir.lo xcofflink.lo + + +BFD32_BACKENDS_CFILES = aout-adobe.c aout-arm.c aout-cris.c aout-ns32k.c aout-sparcle.c aout-tic30.c aout0.c aout32.c armnetbsd.c bout.c cf-i386lynx.c cf-m68klynx.c cf-sparclynx.c coff-a29k.c coff-apollo.c coff-arm.c coff-aux.c coff-h8300.c coff-h8500.c coff-i386.c coff-i860.c coff-go32.c coff-i960.c coff-m68k.c coff-m88k.c coff-mips.c coff-or32.c coff-rs6000.c coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c coff-tic30.c coff-tic54x.c coff-tic80.c coff-u68k.c coff-we32k.c coff-w65.c coff-z8k.c cofflink.c dwarf1.c ecoff.c ecofflink.c efi-app-ia32.c elf.c elf32-arc.c elfarm-oabi.c elfarm-nabi.c elf32-avr.c elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-dlx.c elf32-fr30.c elf32-gen.c elf32-h8300.c elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i386qnx.c elf32-i860.c elf32-i960.c elf32-m32r.c elf32-m68k.c elf32-m68hc11.c elf32-m68hc12.c elf32-m88k.c elf-m10200.c elf-m10300.c elf32-mcore.c elfxx-mips.c elf32-mips.c elf32-openrisc.c elf32-or32.c elf32-pj.c elf32-ppc.c elf32-sh64.c elf32-sh64-com.c elf32-s390.c elf32-sh.c elf32-sh-lin.c elf32-sh-nbsd.c elf32-sh64-nbsd.c elf32-sparc.c elf32-v850.c elf32-vax.c elf32-xstormy16.c elf32.c elflink.c elf-strtab.c elf-eh-frame.c epoc-pe-arm.c epoc-pei-arm.c hp300bsd.c hp300hpux.c som.c i386aout.c i386bsd.c i386dynix.c i386freebsd.c i386linux.c i386lynx.c i386msdos.c i386netbsd.c i386mach3.c i386os9k.c ieee.c m68k4knetbsd.c m68klinux.c m68klynx.c m68knetbsd.c m88kmach3.c mipsbsd.c newsos3.c nlm.c nlm32-i386.c nlm32-sparc.c nlm32-ppc.c nlm32.c ns32knetbsd.c oasys.c pc532-mach.c pdp11.c pe-arm.c pei-arm.c pe-i386.c pei-i386.c pe-mcore.c pei-mcore.c pe-ppc.c pei-ppc.c pe-sh.c pei-sh.c pe-mips.c pei-mips.c ppcboot.c reloc16.c riscix.c sparclinux.c sparclynx.c sparcnetbsd.c sunos.c vaxnetbsd.c vax1knetbsd.c versados.c vms.c vms-gsd.c vms-hdr.c vms-misc.c vms-tir.c xcofflink.c # The .o files needed by all of the 64 bit vectors that are configured into # target_vector in targets.c if configured with --enable-targets=all # and --enable-64-bit-bfd. -BFD64_BACKENDS = \ - aix5ppc-core.lo \ - aout64.lo \ - coff-alpha.lo \ - coff64-rs6000.lo \ - demo64.lo \ - efi-app-ia64.lo \ - elf64-x86-64.lo \ - elf64-alpha.lo \ - elf64-hppa.lo \ - elf64-ia64.lo \ - elf64-gen.lo \ - elf64-mips.lo \ - elf64-mmix.lo \ - elf64-sh64.lo \ - elf64-ppc.lo \ - elf64-s390.lo \ - elf64-sparc.lo \ - elf64.lo \ - mmo.lo \ - nlm32-alpha.lo \ - nlm64.lo \ - pepigen.lo - - -BFD64_BACKENDS_CFILES = \ - aix5ppc-core.c \ - aout64.c \ - coff-alpha.c \ - coff64-rs6000.c \ - demo64.c \ - efi-app-ia64.c \ - elf64-x86-64.c \ - elf64-alpha.c \ - elf64-hppa.c \ - elf64-gen.c \ - elf64-mips.c \ - elf64-mmix.c \ - elf64-ppc.c \ - elf64-s390.c \ - elf64-sh64.c \ - elf64-sparc.c \ - elf64.c \ - mmo.c \ - nlm32-alpha.c \ - nlm64.c - - -OPTIONAL_BACKENDS = \ - aix386-core.lo \ - hpux-core.lo \ - irix-core.lo \ - lynx-core.lo \ - osf-core.lo \ - sco5-core.lo \ - trad-core.lo \ - cisco-core.lo - - -OPTIONAL_BACKENDS_CFILES = \ - aix386-core.c \ - hpux-core.c \ - irix-core.c \ - lynx-core.c \ - osf-core.c \ - sco5-core.c \ - trad-core.c \ - cisco-core.c +BFD64_BACKENDS = aix5ppc-core.lo aout64.lo coff-alpha.lo coff64-rs6000.lo demo64.lo efi-app-ia64.lo elf64-x86-64.lo elf64-alpha.lo elf64-hppa.lo elf64-ia64.lo elf64-gen.lo elf64-mips.lo elf64-mmix.lo elf64-sh64.lo elf64-sh64-nbsd.lo elf64-ppc.lo elf64-s390.lo elf64-sparc.lo elf64.lo mmo.lo nlm32-alpha.lo nlm64.lo pepigen.lo + + +BFD64_BACKENDS_CFILES = aix5ppc-core.c aout64.c coff-alpha.c coff64-rs6000.c demo64.c efi-app-ia64.c elf64-x86-64.c elf64-alpha.c elf64-hppa.c elf64-gen.c elf64-mips.c elf64-mmix.c elf64-ppc.c elf64-s390.c elf64-sh64.c elf64-sh64-nbsd.c elf64-sparc.c elf64.c mmo.c nlm32-alpha.c nlm64.c + + +OPTIONAL_BACKENDS = aix386-core.lo hpux-core.lo irix-core.lo lynx-core.lo osf-core.lo sco5-core.lo trad-core.lo cisco-core.lo + + +OPTIONAL_BACKENDS_CFILES = aix386-core.c hpux-core.c irix-core.c lynx-core.c osf-core.c sco5-core.c trad-core.c cisco-core.c # These are defined by configure.in: @@ -653,33 +203,18 @@ TDEFAULTS = @tdefaults@ INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl # C source files that correspond to .o's. -SOURCE_CFILES = \ - $(BFD32_LIBS_CFILES) \ - $(BFD64_LIBS_CFILES) \ - $(ALL_MACHINES_CFILES) \ - $(BFD32_BACKENDS_CFILES) \ - $(BFD64_BACKENDS_CFILES) \ - $(OPTIONAL_BACKENDS_CFILES) +SOURCE_CFILES = $(BFD32_LIBS_CFILES) $(BFD64_LIBS_CFILES) $(ALL_MACHINES_CFILES) $(BFD32_BACKENDS_CFILES) $(BFD64_BACKENDS_CFILES) $(OPTIONAL_BACKENDS_CFILES) -BUILD_CFILES = \ - elf32-ia64.c elf64-ia64.c peigen.c pepigen.c +BUILD_CFILES = elf32-ia64.c elf64-ia64.c peigen.c pepigen.c CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) -SOURCE_HFILES = \ - aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h \ - elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h \ - elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h \ - libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \ - libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h \ - nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h \ - xcoff-target.h version.h +SOURCE_HFILES = aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h ecoffswap.h elf-bfd.h elf-hppa.h elf32-arm.h elf32-hppa.h elf64-hppa.h elfcode.h elfcore.h elflink.h freebsd.h genlink.h go32stub.h libaout.h libbfd.h libcoff.h libecoff.h libhppa.h libieee.h libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h nlmswap.h ns32k.h peicode.h som.h vms.h libxcoff.h xcoff-target.h version.h -BUILD_HFILES = \ - elf32-target.h elf64-target.h targmatch.h +BUILD_HFILES = elf32-target.h elf64-target.h targmatch.h HFILES = $(SOURCE_HFILES) $(BUILD_HFILES) @@ -709,8 +244,7 @@ libbfd_a_SOURCES = BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h LOCAL_H_DEPS = libbfd.h sysdep.h config.h -BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c \ - reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h +BFD_H_FILES = bfd-in.h init.c opncls.c libbfd.c section.c archures.c reloc.c syms.c bfd.c archive.c corefile.c targets.c format.c version.h BFD64_H_FILES = archive64.c LIBBFD_H_FILES = libbfd-in.h init.c libbfd.c cache.c reloc.c archures.c elf.c @@ -718,8 +252,7 @@ LIBCOFF_H_FILES = libcoff-in.h coffcode.h MOSTLYCLEANFILES = ofiles stamp-ofiles -CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \ - stmp-bin2-h stmp-lbfd-h stmp-lcoff-h +CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib stmp-bin2-h stmp-lbfd-h stmp-lcoff-h DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) @@ -736,7 +269,7 @@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libbfd_a_LIBADD = libbfd_a_OBJECTS = -LTLIBRARIES = $(lib_LTLIBRARIES) +LTLIBRARIES = $(bfdlib_LTLIBRARIES) libbfd_la_OBJECTS = archive.lo archures.lo bfd.lo cache.lo coffgen.lo \ corefile.lo format.lo init.lo libbfd.lo opncls.lo reloc.lo section.lo \ @@ -857,33 +390,17 @@ distclean-libtool: maintainer-clean-libtool: -mostlyclean-libLTLIBRARIES: +mostlyclean-bfdlibLTLIBRARIES: -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) +clean-bfdlibLTLIBRARIES: + -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES) -distclean-libLTLIBRARIES: +distclean-bfdlibLTLIBRARIES: -maintainer-clean-libLTLIBRARIES: - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ - done +maintainer-clean-bfdlibLTLIBRARIES: libbfd.la: $(libbfd_la_OBJECTS) $(libbfd_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS) + $(LINK) -rpath $(bfdlibdir) $(libbfd_la_LDFLAGS) $(libbfd_la_OBJECTS) $(libbfd_la_LIBADD) $(LIBS) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -1045,16 +562,16 @@ install-info: install-info-recursive all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive -install-exec-am: install-libLTLIBRARIES +install-exec-am: install-exec: install-exec-recursive -install-data-am: install-data-local +install-data-am: install-bfdlibLTLIBRARIES install-data: install-data-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-recursive -uninstall-am: uninstall-libLTLIBRARIES +uninstall-am: uninstall-bfdlibLTLIBRARIES uninstall: uninstall-recursive all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h all-redirect: all-recursive-am @@ -1062,7 +579,7 @@ install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: installdirs-recursive installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(libdir) + $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) mostlyclean-generic: @@ -1079,19 +596,19 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \ mostlyclean-compile mostlyclean-libtool \ - mostlyclean-libLTLIBRARIES mostlyclean-tags \ + mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-libLTLIBRARIES clean-tags clean-generic \ + clean-bfdlibLTLIBRARIES clean-tags clean-generic \ mostlyclean-am clean: clean-recursive distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-libLTLIBRARIES \ + distclean-libtool distclean-bfdlibLTLIBRARIES \ distclean-tags distclean-generic clean-am -rm -f libtool @@ -1101,8 +618,9 @@ distclean: distclean-recursive maintainer-clean-am: maintainer-clean-hdr \ maintainer-clean-noinstLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-libLTLIBRARIES maintainer-clean-tags \ - maintainer-clean-generic distclean-am + maintainer-clean-bfdlibLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@ -1114,22 +632,22 @@ mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-libLTLIBRARIES \ -distclean-libLTLIBRARIES clean-libLTLIBRARIES \ -maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \ -install-libLTLIBRARIES install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ +clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \ +distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \ +maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \ +install-bfdlibLTLIBRARIES install-data-recursive \ +uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-info-am \ install-info all-recursive-am install-exec-am install-exec \ -install-data-local install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs-am \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean po/SRC-POTFILES.in: @MAINT@ Makefile $(SRC_POTFILES) @@ -1230,14 +748,35 @@ $(BFD32_LIBS) \ $(BFD64_BACKENDS) \ $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS) -# Install BFD include file, and others that it needs. -install-data-local: $(BFD_H) +install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h - $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h - $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h - $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h + +uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd + @$(NORMAL_UNINSTALL) + +.PHONY: install_libbfd uninstall_libbfd +install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H) + $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) + $(mkinstalldirs) $(DESTDIR)$(bfdincludedir) + @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \ + else :; fi; \ + done + $(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h + $(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h + $(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h + $(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h + +uninstall_libbfd: + list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \ + done + rm -f $(DESTDIR)$(bfdincludedir)/bfd.h + rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h + rm -f $(DESTDIR)$(bfdincludedir)/symcat.h + rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h Makefile: $(srcdir)/configure.in @@ -1375,7 +914,8 @@ stabs.lo: stabs.c $(INCDIR)/filenames.h $(INCDIR)/aout/stab_gnu.h \ $(INCDIR)/aout/stab.def $(INCDIR)/safe-ctype.h stab-syms.lo: stab-syms.c libaout.h $(INCDIR)/bfdlink.h \ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab.def -merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h +merge.lo: merge.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/libiberty.h dwarf2.lo: dwarf2.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h @@ -1388,6 +928,7 @@ cpu-avr.lo: cpu-avr.c $(INCDIR)/filenames.h cpu-cris.lo: cpu-cris.c $(INCDIR)/filenames.h cpu-d10v.lo: cpu-d10v.c $(INCDIR)/filenames.h cpu-d30v.lo: cpu-d30v.c $(INCDIR)/filenames.h +cpu-dlx.lo: cpu-dlx.c $(INCDIR)/filenames.h cpu-fr30.lo: cpu-fr30.c $(INCDIR)/filenames.h cpu-h8300.lo: cpu-h8300.c $(INCDIR)/filenames.h cpu-h8500.lo: cpu-h8500.c $(INCDIR)/filenames.h @@ -1604,6 +1145,10 @@ elf32-d30v.lo: elf32-d30v.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/d30v.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-dlx.lo: elf32-dlx.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-fr30.lo: elf32-fr30.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h \ @@ -1626,6 +1171,10 @@ elf32-i386.lo: 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-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 \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-i860.lo: elf32-i860.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/reloc-macros.h \ @@ -1697,6 +1246,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \ elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf32-target.h +elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \ @@ -1713,6 +1266,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \ $(INCDIR)/elf/reloc-macros.h elf32-target.h +elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \ + $(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + $(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \ + $(INCDIR)/elf/reloc-macros.h elf32-target.h elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \ $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \ @@ -1722,6 +1280,10 @@ elf32-v850.lo: elf32-v850.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h \ $(INCDIR)/libiberty.h elf32-target.h +elf32-vax.lo: elf32-vax.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ + elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ + $(INCDIR)/elf/external.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/reloc-macros.h \ + elf32-target.h elf32-xstormy16.lo: elf32-xstormy16.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/xstormy16.h \ @@ -1736,7 +1298,7 @@ elflink.lo: elflink.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ $(INCDIR)/elf/external.h elf-strtab.lo: elf-strtab.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ - $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h + $(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h elf-eh-frame.lo: elf-eh-frame.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h @@ -1906,6 +1468,9 @@ sunos.lo: sunos.c $(INCDIR)/bfdlink.h libaout.h aoutf1.h \ vaxnetbsd.lo: vaxnetbsd.c netbsd.h $(INCDIR)/filenames.h \ libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h +vax1knetbsd.lo: vax1knetbsd.c netbsd.h $(INCDIR)/filenames.h \ + libaout.h $(INCDIR)/bfdlink.h aout-target.h $(INCDIR)/aout/aout64.h \ + $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h versados.lo: versados.c $(INCDIR)/filenames.h $(INCDIR)/libiberty.h vms.lo: vms.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ vms.h @@ -1982,6 +1547,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \ elf64-target.h +elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \ + $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \ elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \ diff --git a/bfd/acinclude.m4 b/bfd/acinclude.m4 index 53912943d2c..b3c6ccffb6c 100644 --- a/bfd/acinclude.m4 +++ b/bfd/acinclude.m4 @@ -123,3 +123,27 @@ ifelse(yes,no,[ AC_DEFUN([CY_WITH_NLS],) AC_SUBST(INTLLIBS) ]) + +AC_DEFUN([AM_INSTALL_LIBBFD], +[AC_MSG_CHECKING([whether to install libbfd]) + AC_ARG_ENABLE(install-libbfd, +[ --install-libbfd controls installation of libbfd and related headers], + install_libbfd_p=$enableval, + if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then + install_libbfd_p=yes + else + install_libbfd_p=no + fi) + AC_MSG_RESULT($install_libbfd_p) + AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes) + # libbfd.a is a host library containing target dependent code + bfdlibdir='$(libdir)' + bfdincludedir='$(includedir)' + if test "${host}" != "${target}"; then + bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' + bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' + fi + AC_SUBST(bfdlibdir) + AC_SUBST(bfdincludedir) +] +) diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4 index 4446fc1569a..b6dfcbe31d0 100644 --- a/bfd/aclocal.m4 +++ b/bfd/aclocal.m4 @@ -136,6 +136,43 @@ AC_DEFUN([CY_WITH_NLS],) AC_SUBST(INTLLIBS) ]) +AC_DEFUN([AM_INSTALL_LIBBFD], +[AC_MSG_CHECKING([whether to install libbfd]) + AC_ARG_ENABLE(install-libbfd, +[ --install-libbfd controls installation of libbfd and related headers], + install_libbfd_p=$enableval, + if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then + install_libbfd_p=yes + else + install_libbfd_p=no + fi) + AC_MSG_RESULT($install_libbfd_p) + AM_CONDITIONAL(INSTALL_LIBBFD, test $install_libbfd_p = yes) + # libbfd.a is a host library containing target dependent code + bfdlibdir='$(libdir)' + bfdincludedir='$(includedir)' + if test "${host}" != "${target}"; then + bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' + bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' + fi + AC_SUBST(bfdlibdir) + AC_SUBST(bfdincludedir) +] +) + +# Define a conditional. + +AC_DEFUN([AM_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. @@ -271,16 +308,3 @@ AC_DEFUN([AM_MAINTAINER_MODE], ] ) -# Define a conditional. - -AC_DEFUN([AM_CONDITIONAL], -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c index 5ba182f735b..9db4f5468c4 100644 --- a/bfd/aix5ppc-core.c +++ b/bfd/aix5ppc-core.c @@ -63,7 +63,7 @@ xcoff64_core_p (abfd) goto xcoff64_core_p_error; if (sizeof (struct core_dumpxx) - != bfd_read (&core, sizeof (struct core_dumpxx), 1, abfd)) + != bfd_bread (&core, sizeof (struct core_dumpxx), abfd)) goto xcoff64_core_p_error; if (bfd_stat (abfd, &statbuf) < 0) @@ -172,7 +172,7 @@ xcoff64_core_p (abfd) return return_value; if (sizeof (struct __ld_info64) != - bfd_read (&ldinfo, sizeof (struct __ld_info64), 1, abfd)) + bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd)) return return_value; if (ldinfo.ldinfo_core) @@ -200,7 +200,7 @@ xcoff64_core_p (abfd) for (i = 0; i < core.c_vmregions; i++) if (sizeof (struct vm_infox) != - bfd_read (&vminfo, sizeof (struct vm_infox), 1, abfd)) + bfd_bread (&vminfo, sizeof (struct vm_infox), abfd)) return return_value; if (vminfo.vminfo_offset) @@ -243,7 +243,7 @@ xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) return return_value; if (sizeof (struct core_dumpxx) != - bfd_read (&core, sizeof (struct core_dumpxx), 1, core_bfd)) + bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd)) return return_value; if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0) @@ -258,7 +258,7 @@ xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) while (1) { - if (bfd_read (s, 1, 1, core_bfd) != 1) + if (bfd_bread (s, 1, core_bfd) != 1) goto xcoff64_core_file_matches_executable_p_end_1; if (*s == '\0') @@ -328,7 +328,7 @@ int xcoff64_core_file_failing_signal PARAMS ((bfd *)); const bfd_target * xcoff64_core_p (abfd) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; { bfd_set_error (bfd_error_wrong_format); return 0; @@ -336,22 +336,22 @@ xcoff64_core_p (abfd) boolean xcoff64_core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd; - bfd *exec_bfd; + bfd *core_bfd ATTRIBUTE_UNUSED; + bfd *exec_bfd ATTRIBUTE_UNUSED; { return false; } char * xcoff64_core_file_failing_command (abfd) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; { return 0; } int xcoff64_core_file_failing_signal (abfd) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; { return 0; } diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 01f26914d2e..83983398aa7 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -510,11 +510,13 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore) #define aout_32_bfd_relax_section bfd_generic_relax_section #define aout_32_bfd_gc_sections bfd_generic_gc_sections #define aout_32_bfd_merge_sections bfd_generic_merge_sections +#define aout_32_bfd_discard_group bfd_generic_discard_group #define aout_32_bfd_link_hash_table_create \ _bfd_generic_link_hash_table_create #define aout_32_bfd_link_hash_table_free \ _bfd_generic_link_hash_table_free #define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms #define aout_32_bfd_final_link _bfd_generic_final_link #define aout_32_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 30c735a3f8f..75299fa8180 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -513,6 +513,9 @@ MY_bfd_final_link (abfd, info) #ifndef MY_bfd_merge_sections #define MY_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef MY_bfd_discard_group +#define MY_bfd_discard_group bfd_generic_discard_group +#endif #ifndef MY_bfd_reloc_type_lookup #define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup) #endif @@ -534,6 +537,9 @@ MY_bfd_final_link (abfd, info) #ifndef MY_bfd_link_add_symbols #define MY_bfd_link_add_symbols NAME(aout,link_add_symbols) #endif +#ifndef MY_bfd_link_just_syms +#define MY_bfd_link_just_syms _bfd_generic_link_just_syms +#endif #ifndef MY_bfd_link_split_section #define MY_bfd_link_split_section _bfd_generic_link_split_section #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 58ef3ea9f8a..a39a5b1fb88 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -965,6 +965,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #ifndef MY_bfd_merge_sections #define MY_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef MY_bfd_discard_group +#define MY_bfd_discard_group bfd_generic_discard_group +#endif #ifndef MY_bfd_reloc_type_lookup #define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup #endif @@ -986,6 +989,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #ifndef MY_bfd_link_add_symbols #define MY_bfd_link_add_symbols NAME(aout,link_add_symbols) #endif +#ifndef MY_bfd_link_just_syms +#define MY_bfd_link_just_syms _bfd_generic_link_just_syms +#endif #ifndef MY_bfd_link_split_section #define MY_bfd_link_split_section _bfd_generic_link_split_section #endif diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 3c9cd4fafc8..c2448f4a575 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -1837,11 +1837,9 @@ NAME(aout,slurp_symbol_table) (abfd) cached_size = obj_aout_external_sym_count (abfd); cached_size *= sizeof (aout_symbol_type); - cached = (aout_symbol_type *) bfd_malloc (cached_size); + cached = (aout_symbol_type *) bfd_zmalloc (cached_size); if (cached == NULL && cached_size != 0) return false; - if (cached_size != 0) - memset (cached, 0, (size_t) cached_size); /* Convert from external symbol information to internal. */ if (! (NAME(aout,translate_symbol_table) @@ -2411,10 +2409,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) count = reloc_size / each_size; amt = count * sizeof (arelent); - reloc_cache = (arelent *) bfd_malloc (amt); + reloc_cache = (arelent *) bfd_zmalloc (amt); if (reloc_cache == NULL && count != 0) return false; - memset (reloc_cache, 0, (size_t) amt); relocs = bfd_malloc (reloc_size); if (relocs == NULL && reloc_size != 0) diff --git a/bfd/archures.c b/bfd/archures.c index 40102e8b0f1..36fc56873d5 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -193,6 +193,7 @@ DESCRIPTION .#define bfd_mach_d10v_ts2 2 .#define bfd_mach_d10v_ts3 3 . bfd_arch_d30v, {* Mitsubishi D30V *} +. bfd_arch_dlx, {* DLX *} . bfd_arch_m68hc11, {* Motorola 68HC11 *} . bfd_arch_m68hc12, {* Motorola 68HC12 *} . bfd_arch_z8k, {* Zilog Z8000 *} @@ -312,6 +313,7 @@ extern const bfd_arch_info_type bfd_avr_arch; extern const bfd_arch_info_type bfd_cris_arch; extern const bfd_arch_info_type bfd_d10v_arch; extern const bfd_arch_info_type bfd_d30v_arch; +extern const bfd_arch_info_type bfd_dlx_arch; extern const bfd_arch_info_type bfd_fr30_arch; extern const bfd_arch_info_type bfd_h8300_arch; extern const bfd_arch_info_type bfd_h8500_arch; @@ -365,6 +367,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_cris_arch, &bfd_d10v_arch, &bfd_d30v_arch, + &bfd_dlx_arch, &bfd_fr30_arch, &bfd_h8300_arch, &bfd_h8500_arch, diff --git a/bfd/armnetbsd.c b/bfd/armnetbsd.c index e899adbdde5..d82e98f49eb 100644 --- a/bfd/armnetbsd.c +++ b/bfd/armnetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/ARM a.out-ish binaries. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" /* To ensure following declaration is OK */ -CONST struct reloc_howto_struct * +const struct reloc_howto_struct * MY_bfd_reloc_type_lookup PARAMS ((bfd * abfd AND bfd_reloc_code_real_type code)); diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 8c36c67bd15..19fd1072084 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -4,21 +4,21 @@ Free Software Foundation, Inc. Contributed by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ @@ -803,6 +803,9 @@ extern boolean bfd_elf32_arm_process_before_allocation extern boolean bfd_elf32_arm_get_bfd_for_interworking PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean bfd_elf32_arm_add_glue_sections_to_bfd + PARAMS ((bfd *, struct bfd_link_info *)); + /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page PARAMS ((struct sec *, int)); @@ -810,4 +813,3 @@ extern void bfd_ticoff_set_section_load_page extern int bfd_ticoff_get_section_load_page PARAMS ((struct sec *)); -/* And more from the source. */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 774d4391557..e4319ff91d7 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -10,21 +10,21 @@ Free Software Foundation, Inc. Contributed by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ @@ -809,6 +809,9 @@ extern boolean bfd_elf32_arm_process_before_allocation extern boolean bfd_elf32_arm_get_bfd_for_interworking PARAMS ((bfd *, struct bfd_link_info *)); +extern boolean bfd_elf32_arm_add_glue_sections_to_bfd + PARAMS ((bfd *, struct bfd_link_info *)); + /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page PARAMS ((struct sec *, int)); @@ -816,10 +819,11 @@ extern void bfd_ticoff_set_section_load_page extern int bfd_ticoff_get_section_load_page PARAMS ((struct sec *)); -/* And more from the source. */ +/* Extracted from init.c. */ void bfd_init PARAMS ((void)); +/* Extracted from opncls.c. */ bfd * bfd_openr PARAMS ((const char *filename, const char *target)); @@ -847,6 +851,7 @@ bfd_make_writable PARAMS ((bfd *abfd)); boolean bfd_make_readable PARAMS ((bfd *abfd)); +/* Extracted from libbfd.c. */ /* Byte swapping macros for user section data. */ @@ -987,6 +992,7 @@ bfd_make_readable PARAMS ((bfd *abfd)); #define H_GET_S8 bfd_h_get_signed_8 +/* Extracted from section.c. */ /* This structure is used for a comdat section, as in PE. A comdat section is associated with a particular symbol. When the linker sees a comdat section, it keeps only one of the sections with a @@ -1068,12 +1074,6 @@ typedef struct sec standard data. */ #define SEC_CONSTRUCTOR 0x100 - /* The section is a constructor, and should be placed at the - end of the text, data, or bss section(?). */ -#define SEC_CONSTRUCTOR_TEXT 0x1100 -#define SEC_CONSTRUCTOR_DATA 0x2100 -#define SEC_CONSTRUCTOR_BSS 0x3100 - /* The section has contents - a data section could be <> | <>; a debug section could be <> */ @@ -1094,6 +1094,9 @@ typedef struct sec sections. */ #define SEC_COFF_SHARED_LIBRARY 0x800 + /* The section contains thread local data. */ +#define SEC_THREAD_LOCAL 0x1000 + /* The section has GOT references. This flag is only for the linker, and is currently only used by the elf32-hppa back end. It will be set if global offset table references were detected @@ -1450,6 +1453,10 @@ bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, void _bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section)); +boolean +bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group)); + +/* Extracted from archures.c. */ enum bfd_architecture { bfd_arch_unknown, /* File arch not known. */ @@ -1576,6 +1583,7 @@ enum bfd_architecture #define bfd_mach_d10v_ts2 2 #define bfd_mach_d10v_ts3 3 bfd_arch_d30v, /* Mitsubishi D30V */ + bfd_arch_dlx, /* DLX */ bfd_arch_m68hc11, /* Motorola 68HC11 */ bfd_arch_m68hc12, /* Motorola 68HC12 */ bfd_arch_z8k, /* Zilog Z8000 */ @@ -1722,6 +1730,7 @@ unsigned int bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch, unsigned long machine)); +/* Extracted from reloc.c. */ typedef enum bfd_reloc_status { /* No errors detected. */ @@ -2147,6 +2156,21 @@ share a common GP, and the target address is adjusted for STO_ALPHA_STD_GPLOAD. */ BFD_RELOC_ALPHA_BRSGP, +/* Alpha thread-local storage relocations. */ + BFD_RELOC_ALPHA_TLSGD, + BFD_RELOC_ALPHA_TLSLDM, + BFD_RELOC_ALPHA_DTPMOD64, + BFD_RELOC_ALPHA_GOTDTPREL16, + BFD_RELOC_ALPHA_DTPREL64, + BFD_RELOC_ALPHA_DTPREL_HI16, + BFD_RELOC_ALPHA_DTPREL_LO16, + BFD_RELOC_ALPHA_DTPREL16, + BFD_RELOC_ALPHA_GOTTPREL16, + BFD_RELOC_ALPHA_TPREL64, + BFD_RELOC_ALPHA_TPREL_HI16, + BFD_RELOC_ALPHA_TPREL_LO16, + BFD_RELOC_ALPHA_TPREL16, + /* Bits 27..2 of the relocation address shifted right 2 bits; simple reloc otherwise. */ BFD_RELOC_MIPS_JMP, @@ -2211,6 +2235,15 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_386_RELATIVE, BFD_RELOC_386_GOTOFF, BFD_RELOC_386_GOTPC, + BFD_RELOC_386_TLS_LE, + BFD_RELOC_386_TLS_GD, + BFD_RELOC_386_TLS_LDM, + BFD_RELOC_386_TLS_LDO_32, + BFD_RELOC_386_TLS_IE_32, + BFD_RELOC_386_TLS_LE_32, + BFD_RELOC_386_TLS_DTPMOD32, + BFD_RELOC_386_TLS_DTPOFF32, + BFD_RELOC_386_TLS_TPOFF32, /* x86-64/elf relocations */ BFD_RELOC_X86_64_GOT32, @@ -2515,6 +2548,15 @@ of the container. */ /* This is a 32-bit pc-relative reloc. */ BFD_RELOC_D30V_32_PCREL, +/* DLX relocs */ + BFD_RELOC_DLX_HI16_S, + +/* DLX relocs */ + BFD_RELOC_DLX_LO16, + +/* DLX relocs */ + BFD_RELOC_DLX_JMP26, + /* Mitsubishi M32R relocs. This is a 24 bit absolute address. */ BFD_RELOC_M32R_24, @@ -2922,12 +2964,25 @@ this offset in the reloc's section offset. */ BFD_RELOC_IA64_IPLTMSB, BFD_RELOC_IA64_IPLTLSB, BFD_RELOC_IA64_COPY, + BFD_RELOC_IA64_LTOFF22X, + BFD_RELOC_IA64_LDXMOV, + BFD_RELOC_IA64_TPREL14, BFD_RELOC_IA64_TPREL22, + BFD_RELOC_IA64_TPREL64I, BFD_RELOC_IA64_TPREL64MSB, BFD_RELOC_IA64_TPREL64LSB, - BFD_RELOC_IA64_LTOFF_TP22, - BFD_RELOC_IA64_LTOFF22X, - BFD_RELOC_IA64_LDXMOV, + BFD_RELOC_IA64_LTOFF_TPREL22, + BFD_RELOC_IA64_DTPMOD64MSB, + BFD_RELOC_IA64_DTPMOD64LSB, + BFD_RELOC_IA64_LTOFF_DTPMOD22, + BFD_RELOC_IA64_DTPREL14, + BFD_RELOC_IA64_DTPREL22, + BFD_RELOC_IA64_DTPREL64I, + BFD_RELOC_IA64_DTPREL32MSB, + BFD_RELOC_IA64_DTPREL32LSB, + BFD_RELOC_IA64_DTPREL64MSB, + BFD_RELOC_IA64_DTPREL64LSB, + BFD_RELOC_IA64_LTOFF_DTPREL22, /* Motorola 68HC11 reloc. This is the 8 bits high part of an absolute address. */ @@ -3025,6 +3080,11 @@ This is the 3 bits of a value. */ BFD_RELOC_XSTORMY16_REL_12, BFD_RELOC_XSTORMY16_24, BFD_RELOC_XSTORMY16_FPTR16, + +/* Relocations used by VAX ELF. */ + BFD_RELOC_VAX_GLOB_DAT, + BFD_RELOC_VAX_JMP_SLOT, + BFD_RELOC_VAX_RELATIVE, BFD_RELOC_UNUSED }; typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; reloc_howto_type * @@ -3033,6 +3093,7 @@ bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); const char * bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code)); +/* Extracted from syms.c. */ typedef struct symbol_cache_entry { @@ -3138,6 +3199,9 @@ typedef struct symbol_cache_entry as well. */ #define BSF_DEBUGGING_RELOC 0x20000 + /* This symbol is thread local. Used in ELF. */ +#define BSF_THREAD_LOCAL 0x40000 + flagword flags; /* A pointer to the section to which this symbol is @@ -3202,6 +3266,7 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ (ibfd, isymbol, obfd, osymbol)) +/* Extracted from bfd.c. */ struct _bfd { /* The filename the application opened the BFD with. */ @@ -3501,6 +3566,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); #define bfd_merge_sections(abfd, link_info) \ BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) +#define bfd_discard_group(abfd, sec) \ + BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) + #define bfd_link_hash_table_create(abfd) \ BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) @@ -3510,6 +3578,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); #define bfd_link_add_symbols(abfd, info) \ BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) +#define bfd_link_just_syms(sec, info) \ + BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) + #define bfd_final_link(abfd, info) \ BFD_SEND (abfd, _bfd_final_link, (abfd, info)) @@ -3539,6 +3610,7 @@ extern bfd_byte *bfd_get_relocated_section_contents boolean bfd_alt_mach_code PARAMS ((bfd *abfd, int index)); +/* Extracted from archive.c. */ symindex bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym)); @@ -3548,6 +3620,7 @@ bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head)); bfd * bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous)); +/* Extracted from corefile.c. */ const char * bfd_core_file_failing_command PARAMS ((bfd *abfd)); @@ -3557,6 +3630,7 @@ bfd_core_file_failing_signal PARAMS ((bfd *abfd)); boolean core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +/* Extracted from targets.c. */ #define BFD_SEND(bfd, message, arglist) \ ((*((bfd)->xvec->message)) arglist) @@ -3834,10 +3908,12 @@ CONCAT2 (NAME,_bfd_relax_section), \ CONCAT2 (NAME,_bfd_link_hash_table_create), \ CONCAT2 (NAME,_bfd_link_hash_table_free), \ CONCAT2 (NAME,_bfd_link_add_symbols), \ +CONCAT2 (NAME,_bfd_link_just_syms), \ CONCAT2 (NAME,_bfd_final_link), \ CONCAT2 (NAME,_bfd_link_split_section), \ CONCAT2 (NAME,_bfd_gc_sections), \ -CONCAT2 (NAME,_bfd_merge_sections) +CONCAT2 (NAME,_bfd_merge_sections), \ +CONCAT2 (NAME,_bfd_discard_group) int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); bfd_byte *(*_bfd_get_relocated_section_contents) PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, @@ -3856,6 +3932,9 @@ CONCAT2 (NAME,_bfd_merge_sections) /* Add symbols from this object file into the hash table. */ boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); + /* Indicate that we are only retrieving symbol values from this section. */ + void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *)); + /* Do a link based on the link_order structures attached to each section of the BFD. */ boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); @@ -3869,6 +3948,9 @@ CONCAT2 (NAME,_bfd_merge_sections) /* Attempt to merge SEC_MERGE sections. */ boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); + /* Discard members of a group. */ + boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *)); + /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \ @@ -3907,6 +3989,7 @@ bfd_target_list PARAMS ((void)); const bfd_target * bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *)); +/* Extracted from format.c. */ boolean bfd_check_format PARAMS ((bfd *abfd, bfd_format format)); diff --git a/bfd/bfd.c b/bfd/bfd.c index c1135c817dd..d230aac5af6 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -749,7 +749,6 @@ bfd_get_arch_size (abfd) if (abfd->xvec->flavour == bfd_target_elf_flavour) return (get_elf_backend_data (abfd))->s->arch_size; - bfd_set_error (bfd_error_wrong_format); return -1; } @@ -1186,6 +1185,9 @@ DESCRIPTION .#define bfd_merge_sections(abfd, link_info) \ . BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) . +.#define bfd_discard_group(abfd, sec) \ +. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) +. .#define bfd_link_hash_table_create(abfd) \ . BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) . @@ -1195,6 +1197,9 @@ DESCRIPTION .#define bfd_link_add_symbols(abfd, info) \ . BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) . +.#define bfd_link_just_syms(sec, info) \ +. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) +. .#define bfd_final_link(abfd, info) \ . BFD_SEND (abfd, _bfd_final_link, (abfd, info)) . diff --git a/bfd/binary.c b/bfd/binary.c index 3207e89fceb..fc972b22d13 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -337,8 +337,10 @@ binary_sizeof_headers (abfd, exec) #define binary_bfd_relax_section bfd_generic_relax_section #define binary_bfd_gc_sections bfd_generic_gc_sections #define binary_bfd_merge_sections bfd_generic_merge_sections +#define binary_bfd_discard_group bfd_generic_discard_group #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free +#define binary_bfd_link_just_syms _bfd_generic_link_just_syms #define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols #define binary_bfd_final_link _bfd_generic_final_link #define binary_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/bout.c b/bfd/bout.c index 0e070adcbf1..9550956e089 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1451,10 +1451,12 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, #define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms #define b_out_bfd_final_link _bfd_generic_final_link #define b_out_bfd_link_split_section _bfd_generic_link_split_section #define b_out_bfd_gc_sections bfd_generic_gc_sections #define b_out_bfd_merge_sections bfd_generic_merge_sections +#define b_out_bfd_discard_group bfd_generic_discard_group #define aout_32_get_section_contents_in_window \ _bfd_generic_get_section_contents_in_window diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 4056e2ce6e7..4f3ab57ef6c 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1,5 +1,5 @@ /* BFD back-end for ALPHA Extended-Coff files. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain and Ian Lance Taylor . @@ -2356,6 +2356,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections +#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group const bfd_target ecoffalpha_little_vec = { diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 1619e670c3d..5e7f907a959 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1701,21 +1701,23 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, || signed_check < reloc_signed_min) overflow = true; - /* For the BLX(1) instruction remove bit 0 of the adjusted offset. - Bit 0 can only be set if the upper insn is at a half-word boundary, - since the destination address, an ARM instruction, must always be - on a word boundary. The semantics of the BLX (1) instruction, - however, are that bit 0 in the offset must always be 0, and the - corresponding bit 1 in the target address will be set from bit - 1 of the source address. */ - if ((x & 0x18000000) == 0x08000000) - relocation &= ~0x2; - - /* Put the relocation into the correct bits. */ + /* Put the relocation into the correct bits. + For a BLX instruction, make sure that the relocation is rounded up + to a word boundary. This follows the semantics of the instruction + which specifies that bit 1 of the target address will come from bit + 1 of the base address. */ if (bfd_big_endian (input_bfd)) - relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000)); + { + if ((x & 0x1800) == 0x0800 && (relocation & 0x02)) + relocation += 2; + relocation = (((relocation & 0xffe) >> 1) | ((relocation << 4) & 0x07ff0000)); + } else - relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff)); + { + if ((x & 0x18000000) == 0x08000000 && (relocation & 0x02)) + relocation += 2; + relocation = (((relocation & 0xffe) << 15) | ((relocation >> 12) & 0x7ff)); + } /* Add the relocation to the correct bits of X. */ x = ((x & ~howto->dst_mask) | relocation); diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index 672b07f7762..edccd5cbbee 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -2116,10 +2116,9 @@ mips_relax_section (abfd, sec, info, again) bfd_size_type size; size = (bfd_size_type) sec->reloc_count * sizeof (long); - offsets = (long *) bfd_alloc (abfd, size); + offsets = (long *) bfd_zalloc (abfd, size); if (offsets == (long *) NULL) goto error_return; - memset (offsets, 0, (size_t) size); section_tdata->offsets = offsets; } @@ -2602,6 +2601,8 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = /* Merging of sections is not done. */ #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections +#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group + extern const bfd_target ecoff_big_vec; const bfd_target ecoff_little_vec = diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 10ef5dfd777..a18aa5e9054 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -237,7 +237,7 @@ _bfd_xcoff_mkobject (abfd) xcoff_data (abfd)->debug_indices = NULL; /* text section alignment is different than the default */ - /* xcoff_data (abfd)->text_align_power = 5; */ + bfd_xcoff_text_align_power (abfd) = 2; return true; } @@ -278,8 +278,8 @@ _bfd_xcoff_copy_private_bfd_data (ibfd, obfd) else ox->snentry = sec->output_section->target_index; } - ox->text_align_power = ix->text_align_power; - ox->data_align_power = ix->data_align_power; + bfd_xcoff_text_align_power (obfd) = bfd_xcoff_text_align_power (ibfd); + bfd_xcoff_data_align_power (obfd) = bfd_xcoff_data_align_power (ibfd); ox->modtype = ix->modtype; ox->cputype = ix->cputype; ox->maxdata = ix->maxdata; @@ -948,6 +948,21 @@ reloc_howto_type xcoff_howto_table[] = 0xffff, /* dst_mask */ false), /* pcrel_offset */ + /* Modifiable branch relative. */ + HOWTO (R_RBA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "R_RBA_16", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + }; void @@ -968,6 +983,8 @@ xcoff_rtype2howto (relent, internal) relent->howto = &xcoff_howto_table[0x1c]; else if (R_RBR == internal->r_type) relent->howto = &xcoff_howto_table[0x1d]; + else if (R_RBA == internal->r_type) + relent->howto = &xcoff_howto_table[0x1e]; } /* The r_size field of an XCOFF reloc encodes the bitsize of the @@ -1713,7 +1730,6 @@ do_shared_object_padding (out_bfd, in_bfd, offset, ar_header_size) int text_align_power; text_align_power = bfd_xcoff_text_align_power (in_bfd); - BFD_ASSERT (2 < text_align_power); pad = 1 << text_align_power; pad -= (*offset + ar_header_size) & (pad - 1); @@ -1822,10 +1838,9 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + str_32 + (str_32 & 1); symbol_table = NULL; - symbol_table = (bfd_byte *) bfd_malloc (symbol_table_size); + symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size); if (symbol_table == NULL) return false; - memset (symbol_table, 0, symbol_table_size); hdr = (struct xcoff_ar_hdr_big *) symbol_table; @@ -1926,10 +1941,9 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + str_64 + (str_64 & 1); symbol_table = NULL; - symbol_table = (bfd_byte *) bfd_malloc (symbol_table_size); + symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size); if (symbol_table == NULL) return false; - memset (symbol_table, 0, symbol_table_size); hdr = (struct xcoff_ar_hdr_big *) symbol_table; @@ -2440,10 +2454,9 @@ xcoff_write_archive_contents_big (abfd) member_table_size += member_table_size & 1; member_table = NULL; - member_table = (bfd_byte *) bfd_malloc (member_table_size); + member_table = (bfd_byte *) bfd_zmalloc (member_table_size); if (member_table == NULL) return false; - memset (member_table, 0, member_table_size); hdr = (struct xcoff_ar_hdr_big *) member_table; @@ -3702,11 +3715,9 @@ xcoff_generate_rtinit (abfd, init, fini, rtld) data_buffer_size = 0x0040 + initsz + finisz; data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0; data_buffer = NULL; - data_buffer = (bfd_byte *) bfd_malloc (data_buffer_size); + data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size); if (data_buffer == NULL) return false; - - memset (data_buffer, 0, data_buffer_size); if (initsz) { @@ -3740,8 +3751,10 @@ xcoff_generate_rtinit (abfd, init, fini, rtld) if (string_table_size) { string_table_size += 4; - string_table = (bfd_byte *)bfd_malloc (string_table_size); - memset (string_table, 0, string_table_size); + string_table = (bfd_byte *) bfd_zmalloc (string_table_size); + if (string_table_size == NULL) + return false; + val = string_table_size; bfd_h_put_32 (abfd, val, &string_table[0]); st_tmp = string_table + 4; @@ -4167,10 +4180,12 @@ const bfd_target rs6000coff_vec = _bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */ _bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */ _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */ - _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */ + _bfd_generic_link_just_syms, /* _bfd_link_just_syms */ + _bfd_xcoff_bfd_final_link, /* _bfd_final_link */ _bfd_generic_link_split_section, /* _bfd_link_split_section */ bfd_generic_gc_sections, /* _bfd_gc_sections */ bfd_generic_merge_sections, /* _bfd_merge_sections */ + bfd_generic_discard_group, /* _bfd_discard_group */ /* Dynamic */ /* _get_dynamic_symtab_upper_bound */ @@ -4428,10 +4443,12 @@ const bfd_target pmac_xcoff_vec = _bfd_xcoff_bfd_link_hash_table_create, /* _bfd_link_hash_table_create */ _bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */ _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */ - _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */ + _bfd_generic_link_just_syms, /* _bfd_link_just_syms */ + _bfd_xcoff_bfd_final_link, /* _bfd_final_link */ _bfd_generic_link_split_section, /* _bfd_link_split_section */ bfd_generic_gc_sections, /* _bfd_gc_sections */ - bfd_generic_merge_sections, /* _bfd_merge_sections */ + bfd_generic_merge_sections, /* _bfd_merge_sections */ + bfd_generic_discard_group, /* _bfd_discard_group */ /* Dynamic */ /* _get_dynamic_symtab_upper_bound */ diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index ae739968f75..d1dc4fdbcf7 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -473,6 +473,7 @@ struct shcoff_reloc_map unsigned char shcoff_reloc_val; }; +#ifdef COFF_WITH_PE /* An array mapping BFD reloc codes to SH PE relocs. */ static const struct shcoff_reloc_map sh_reloc_map[] = { @@ -480,6 +481,14 @@ static const struct shcoff_reloc_map sh_reloc_map[] = { BFD_RELOC_RVA, R_SH_IMAGEBASE }, { BFD_RELOC_CTOR, R_SH_IMM32CE }, }; +#else +/* An array mapping BFD reloc codes to SH PE relocs. */ +static const struct shcoff_reloc_map sh_reloc_map[] = +{ + { BFD_RELOC_32, R_SH_IMM32 }, + { BFD_RELOC_CTOR, R_SH_IMM32 }, +}; +#endif /* Given a BFD reloc code, return the howto structure for the corresponding SH PE reloc. */ diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 931a914cbf6..c7fe5ac5e73 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -424,7 +424,7 @@ _bfd_xcoff64_swap_aux_out (abfd, inp, type, class, indx, numaux, extp) switch (class) { case C_FILE: - if (ext->x_file.x_n.x_zeroes == 0) + if (in->x_file.x_n.x_zeroes == 0) { H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes); H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset); @@ -1730,6 +1730,22 @@ reloc_howto_type xcoff64_howto_table[] = 0xffff, /* src_mask */ 0xffff, /* dst_mask */ false), /* pcrel_offset */ + + /* Modifiable branch absolute. */ + HOWTO (R_RBA, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "R_RBA_16", /* name */ + true, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + }; void @@ -1750,6 +1766,8 @@ xcoff64_rtype2howto (relent, internal) relent->howto = &xcoff64_howto_table[0x1d]; else if (R_RBR == internal->r_type) relent->howto = &xcoff64_howto_table[0x1e]; + else if (R_RBA == internal->r_type) + relent->howto = &xcoff64_howto_table[0x1f]; } /* Special case 32 bit */ else if (31 == (internal->r_size & 0x3f)) @@ -2246,12 +2264,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) data_buffer_size = 0x0058 + initsz + finisz; data_buffer_size += (data_buffer_size & 7) ? 8 - (data_buffer_size & 7) : 0; data_buffer = NULL; - data_buffer = (bfd_byte *)bfd_malloc (data_buffer_size); + data_buffer = (bfd_byte *) bfd_zmalloc (data_buffer_size); if (data_buffer == NULL) return false; - memset (data_buffer, 0, data_buffer_size); - if (initsz) { val = 0x18; @@ -2284,8 +2300,10 @@ xcoff64_generate_rtinit (abfd, init, fini, rtld) if (true == rtld) string_table_size += strlen (rtld_name) + 1; - string_table = (bfd_byte *)bfd_malloc (string_table_size); - memset (string_table, 0, string_table_size); + string_table = (bfd_byte *) bfd_zmalloc (string_table_size); + if (string_table == NULL) + return false; + val = string_table_size; bfd_put_32 (abfd, val, &string_table[0]); st_tmp = string_table + 4; @@ -2712,10 +2730,12 @@ const bfd_target rs6000coff64_vec = _bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */ _bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */ _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */ - _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */ + _bfd_generic_link_just_syms, /* _bfd_link_just_syms */ + _bfd_xcoff_bfd_final_link, /* _bfd_final_link */ _bfd_generic_link_split_section, /* _bfd_link_split_section */ bfd_generic_gc_sections, /* _bfd_gc_sections */ bfd_generic_merge_sections, /* _bfd_merge_sections */ + bfd_generic_discard_group, /* _bfd_discard_group */ /* Dynamic */ /* _get_dynamic_symtab_upper_bound */ @@ -2964,10 +2984,12 @@ const bfd_target aix5coff64_vec = _bfd_xcoff_bfd_link_hash_table_create,/* _bfd_link_hash_table_create */ _bfd_generic_link_hash_table_free, /* _bfd_link_hash_table_free */ _bfd_xcoff_bfd_link_add_symbols, /* _bfd_link_add_symbols */ - _bfd_xcoff_bfd_final_link, /* _bfd_filnal_link */ + _bfd_generic_link_just_syms, /* _bfd_link_just_syms */ + _bfd_xcoff_bfd_final_link, /* _bfd_final_link */ _bfd_generic_link_split_section, /* _bfd_link_split_section */ bfd_generic_gc_sections, /* _bfd_gc_sections */ bfd_generic_merge_sections, /* _bfd_merge_sections */ + bfd_generic_discard_group, /* _bfd_discard_group */ /* Dynamic */ /* _get_dynamic_symtab_upper_bound */ diff --git a/bfd/coffcode.h b/bfd/coffcode.h index eadb8984be8..0363bb7b364 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1782,8 +1782,8 @@ coff_mkobject_hook (abfd, filehdr, aouthdr) xcoff->toc = internal_a->o_toc; xcoff->sntoc = internal_a->o_sntoc; xcoff->snentry = internal_a->o_snentry; - xcoff->text_align_power = internal_a->o_algntext; - xcoff->data_align_power = internal_a->o_algndata; + bfd_xcoff_text_align_power (abfd) = internal_a->o_algntext; + bfd_xcoff_data_align_power (abfd) = internal_a->o_algndata; xcoff->modtype = internal_a->o_modtype; xcoff->cputype = internal_a->o_cputype; xcoff->maxdata = internal_a->o_maxdata; @@ -3084,8 +3084,10 @@ coff_compute_section_file_positions (abfd) AIX executable is stripped with gnu strip because the default vma of native is 0x10000150 but default for gnu is 0x10000140. Gnu stripped gnu excutable passes this check because the filepos is - 0x0140. */ - if (!strcmp (current->name, _TEXT)) + 0x0140. This problem also show up with 64 bit shared objects. The + data section must also be aligned. */ + if (!strcmp (current->name, _TEXT) + || !strcmp (current->name, _DATA)) { bfd_vma pad; bfd_vma align; @@ -5175,6 +5177,7 @@ dummy_reloc16_extra_cases (abfd, link_info, link_order, reloc, data, src_ptr, #define coff_bfd_final_link _bfd_generic_final_link #endif /* ! defined (coff_relocate_section) */ +#define coff_bfd_link_just_syms _bfd_generic_link_just_syms #define coff_bfd_link_split_section _bfd_generic_link_split_section #ifndef coff_start_final_link @@ -5371,6 +5374,10 @@ static const bfd_coff_backend_data bfd_coff_std_swap_table = #define coff_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef coff_bfd_discard_group +#define coff_bfd_discard_group bfd_generic_discard_group +#endif + #define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE) \ const bfd_target VAR = \ { \ diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 88591f1499d..71179fbb552 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1,6 +1,6 @@ /* Support for the generic parts of COFF, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 + 2000, 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -1438,13 +1438,13 @@ coff_section_symbol (abfd, name) combined_entry_type e[10]; }; struct foo *f; - f = (struct foo *) bfd_alloc (abfd, (bfd_size_type) sizeof (*f)); + + f = (struct foo *) bfd_zalloc (abfd, (bfd_size_type) sizeof (*f)); if (!f) { bfd_set_error (bfd_error_no_error); return NULL; } - memset ((char *) f, 0, sizeof (*f)); coff_symbol_from (abfd, sym)->native = csym = f->e; } csym[0].u.syment.n_sclass = C_STAT; @@ -1835,10 +1835,9 @@ coff_get_normalized_symtab (abfd) if (internal_ptr->u.syment._n._n_name[i] == '\0') break; - newstring = (PTR) bfd_alloc (abfd, (bfd_size_type) (i + 1)); + newstring = (PTR) bfd_zalloc (abfd, (bfd_size_type) (i + 1)); if (newstring == NULL) return (NULL); - memset (newstring, 0, i + 1); strncpy (newstring, internal_ptr->u.syment._n._n_name, i); internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring; internal_ptr->u.syment._n._n_n._n_zeroes = 0; @@ -1897,10 +1896,9 @@ coff_make_empty_symbol (abfd) bfd *abfd; { bfd_size_type amt = sizeof (coff_symbol_type); - coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, amt); + coff_symbol_type *new = (coff_symbol_type *) bfd_zalloc (abfd, amt); if (new == NULL) return (NULL); - memset (new, 0, sizeof *new); new->symbol.section = 0; new->native = 0; new->lineno = (alent *) NULL; @@ -2453,12 +2451,10 @@ bfd_coff_set_symbol_class (abfd, symbol, class) combined_entry_type * native; bfd_size_type amt = sizeof (* native); - native = (combined_entry_type *) bfd_alloc (abfd, amt); + native = (combined_entry_type *) bfd_zalloc (abfd, amt); if (native == NULL) return false; - memset (native, 0, sizeof (* native)); - native->u.syment.n_type = T_NULL; native->u.syment.n_sclass = class; diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 1eac3c58ce8..32200a83a63 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -342,12 +342,10 @@ coff_link_add_symbols (abfd, info) /* We keep a list of the linker hash table entries that correspond to particular symbols. */ amt = symcount * sizeof (struct coff_link_hash_entry *); - sym_hash = (struct coff_link_hash_entry **) bfd_alloc (abfd, amt); + sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt); if (sym_hash == NULL && symcount != 0) goto error_return; obj_coff_sym_hashes (abfd) = sym_hash; - memset (sym_hash, 0, - (size_t) symcount * sizeof (struct coff_link_hash_entry *)); symesz = bfd_coff_symesz (abfd); BFD_ASSERT (symesz == bfd_coff_auxesz (abfd)); diff --git a/bfd/config.bfd b/bfd/config.bfd index 4cc12425a85..520c36bcb4e 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -35,6 +35,7 @@ alpha*) targ_archs=bfd_alpha_arch ;; arm*) targ_archs=bfd_arm_arch ;; c30*) targ_archs=bfd_tic30_arch ;; c54x*) targ_archs=bfd_tic54x_arch ;; +dlx*) targ_archs=bfd_dlx_arch ;; hppa*) targ_archs=bfd_hppa_arch ;; i[3456]86) targ_archs=bfd_i386_arch ;; i370) targ_archs=bfd_i370_arch ;; @@ -57,7 +58,6 @@ v850*) targ_archs=bfd_v850_arch ;; x86_64) targ_archs=bfd_i386_arch ;; xscale*) targ_archs=bfd_arm_arch ;; z8k*) targ_archs=bfd_z8k_arch ;; -sh*) targ_archs=bfd_sh_arch ;; *) targ_archs=bfd_${targ_cpu}_arch ;; esac @@ -70,7 +70,7 @@ esac case "${targ}" in # START OF targmatch.h #ifdef BFD64 - alpha*-*-netbsd* | alpha*-*-freebsd*) + alpha*-*-netbsd* | alpha*-*-freebsd* | alpha*-*-openbsd*) targ_defvec=bfd_elf64_alpha_vec targ_selvecs=ecoffalpha_little_vec ;; @@ -104,7 +104,7 @@ case "${targ}" in targ_defvec=bfd_elf32_ia64_hpux_big_vec targ_selvecs="bfd_elf64_ia64_hpux_big_vec" ;; - sparc64-*-freebsd* | sparc64-*-netbsd*) + sparc64-*-freebsd* | sparc64-*-netbsd* | sparc64-*-openbsd*) targ_defvec=bfd_elf64_sparc_vec targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec" ;; @@ -115,12 +115,17 @@ case "${targ}" in targ_selvecs=bfd_elf32_bigarc_vec ;; + armeb-*-netbsdelf*) + targ_defvec=bfd_elf32_bigarm_vec + targ_selvecs="bfd_elf32_littlearm_vec armnetbsd_vec" + ;; arm-*-netbsdelf*) targ_defvec=bfd_elf32_littlearm_vec targ_selvecs="bfd_elf32_bigarm_vec armnetbsd_vec" ;; arm-*-netbsd* | arm-*-openbsd*) targ_defvec=armnetbsd_vec + targ_selvecs="bfd_elf32_littlearm_vec bfd_elf32_bigarm_vec" targ_underscore=yes ;; arm-*-riscix*) @@ -263,6 +268,11 @@ case "${targ}" in targ_defvec=bfd_elf32_d10v_vec ;; + dlx-*-elf*) + targ_defvec=bfd_elf32_dlx_big_vec + targ_selvecs="bfd_elf32_dlx_big_vec" + ;; + d30v-*-*) targ_defvec=bfd_elf32_d30v_vec ;; @@ -303,7 +313,7 @@ case "${targ}" in targ_defvec=bfd_elf32_hppa_linux_vec targ_selvecs=bfd_elf32_hppa_vec ;; - hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems*) + hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-netbsd* | hppa*-*-sysv4* | hppa*-*-rtems* | hppa*-*-openbsd*) targ_defvec=bfd_elf32_hppa_vec targ_selvecs=bfd_elf32_hppa_linux_vec ;; @@ -336,6 +346,10 @@ case "${targ}" in targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386coff_vec ;; + i[3456]86-*-nto-qnx*) + targ_defvec=bfd_elf32_i386qnx_vec + targ_selvecs=i386coff_vec + ;; i[3456]86-*-chorus*) targ_defvec=bfd_elf32_i386_vec ;; @@ -377,6 +391,10 @@ case "${targ}" in targ_defvec=bfd_elf32_i386_vec targ_selvecs=i386netbsd_vec ;; + i[3456]86-*-netbsdpe*) + targ_defvec=i386pe_vec + targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec" + ;; i[3456]86-*-netbsdaout* | i[3456]86-*-netbsd* | i[3456]86-*-openbsd*) targ_defvec=i386netbsd_vec targ_selvecs="bfd_elf32_i386_vec i386bsd_vec" @@ -858,11 +876,24 @@ case "${targ}" in #endif #ifdef BFD64 + sh64l*-*-elf*) + targ_defvec=bfd_elf32_sh64l_vec + targ_selvecs="bfd_elf32_sh64_vec bfd_elf64_sh64l_vec bfd_elf64_sh64_vec bfd_elf32_shl_vec bfd_elf32_sh_vec" + targ_underscore=yes + ;; sh64-*-elf*) targ_defvec=bfd_elf32_sh64_vec targ_selvecs="bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec bfd_elf32_sh_vec bfd_elf32_shl_vec" targ_underscore=yes ;; + sh64eb-*-linux*) + targ_defvec=bfd_elf32_shblin_vec + targ_selvecs="bfd_elf32_shblin_vec bfd_elf32_sh64_vec bfd_elf64_sh64_vec bfd_elf32_sh_vec" + ;; + sh64-*-linux*) + targ_defvec=bfd_elf32_shlin_vec + targ_selvecs="bfd_elf32_shlin_vec bfd_elf32_sh64l_vec bfd_elf64_sh64l_vec bfd_elf32_shl_vec" + ;; #endif /* BFD64 */ sh-*-linux*) @@ -879,6 +910,33 @@ case "${targ}" in targ_defvec=bfd_elf32_shlin_vec ;; +#ifdef BFD64 + sh5le-*-netbsd*) + targ_defvec=bfd_elf32_sh64lnbsd_vec + targ_selvecs="bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" + ;; + sh5-*-netbsd*) + targ_defvec=bfd_elf32_sh64nbsd_vec + targ_selvecs="bfd_elf32_sh64lnbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec" + ;; + + sh64le-*-netbsd*) + targ_defvec=bfd_elf64_sh64lnbsd_vec + targ_selvecs="bfd_elf64_sh64nbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec" + ;; + sh64-*-netbsd*) + targ_defvec=bfd_elf64_sh64nbsd_vec + targ_selvecs="bfd_elf64_sh64lnbsd_vec bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec" + ;; +#endif + + shle-*-netbsdelf*) + targ_defvec=bfd_elf32_shlnbsd_vec + targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec" +#ifdef BFD64 + targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" +#endif + ;; sh*le-*-netbsdelf*) targ_defvec=bfd_elf32_shlnbsd_vec targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec" @@ -895,7 +953,15 @@ case "${targ}" in targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec" ;; - sh-*-elf* | sh-*-rtemself*) + shl*-*-elf* | sh[1234]l*-*-elf* | sh3el*-*-elf*) + targ_defvec=bfd_elf32_shl_vec + targ_selvecs="bfd_elf32_sh_vec shlcoff_vec shcoff_vec shlcoff_small_vec shcoff_small_vec" +#ifdef BFD64 + targ_selvecs="${targ_selvecs} bfd_elf32_sh64_vec bfd_elf32_sh64l_vec bfd_elf64_sh64_vec bfd_elf64_sh64l_vec" +#endif + targ_underscore=yes + ;; + sh-*-elf* | sh[1234]*-elf* | sh-*-rtemself*) targ_defvec=bfd_elf32_sh_vec targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec" #ifdef BFD64 @@ -1032,6 +1098,17 @@ case "${targ}" in ;; #endif + vax-*-netbsdelf*) + targ_defvec=bfd_elf32_vax_vec + targ_selvecs="vaxnetbsd_vec vax1knetbsd_vec" + ;; + + vax-*-netbsdaout* | vax-*-netbsd*) + targ_defvec=vaxnetbsd_vec + targ_selvecs="bfd_elf32_vax_vec vax1knetbsd_vec" + targ_underscore=yes + ;; + vax*-*-*vms*) targ_defvec=vms_vax_vec ;; diff --git a/bfd/config.in b/bfd/config.in index e0b0c20ccd2..222096e3c02 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -214,6 +214,9 @@ /* Define if getenv is not declared in system header files. */ #undef NEED_DECLARATION_GETENV +/* Define if struct core_dumpx has member c_impl */ +#undef HAVE_ST_C_IMPL + /* Define if has prstatus_t. */ #undef HAVE_PRSTATUS_T diff --git a/bfd/configure b/bfd/configure index 47f3348d2d4..a17601132fa 100755 --- a/bfd/configure +++ b/bfd/configure @@ -36,6 +36,8 @@ ac_help="$ac_help ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --install-libbfd controls installation of libbfd and related headers" ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help @@ -57,7 +59,6 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= -sitefile= srcdir= target=NONE verbose= @@ -172,7 +173,6 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -343,11 +343,6 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -513,16 +508,12 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -else - CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -561,12 +552,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:565: checking for Cygwin environment" >&5 +echo "configure:556: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -594,19 +585,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:598: checking for mingw32 environment" >&5 +echo "configure:589: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:601: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -671,7 +662,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:675: checking host system type" >&5 +echo "configure:666: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -692,7 +683,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:696: checking target system type" >&5 +echo "configure:687: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -710,7 +701,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:714: checking build system type" >&5 +echo "configure:705: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -735,7 +726,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:739: checking for $ac_word" >&5 +echo "configure:730: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -765,7 +756,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:769: checking for $ac_word" >&5 +echo "configure:760: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -816,7 +807,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:820: checking for $ac_word" >&5 +echo "configure:811: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -848,7 +839,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:843: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -859,12 +850,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 863 "configure" +#line 854 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -890,12 +881,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:894: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:885: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:899: checking whether we are using GNU C" >&5 +echo "configure:890: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -904,7 +895,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -923,7 +914,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:927: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:918: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -955,7 +946,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:959: checking for POSIXized ISC" >&5 +echo "configure:950: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -988,7 +979,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:992: checking for a BSD compatible install" >&5 +echo "configure:983: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1041,7 +1032,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:1045: checking whether build environment is sane" >&5 +echo "configure:1036: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -1098,7 +1089,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1102: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1093: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1144,7 +1135,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1148: checking for working aclocal" >&5 +echo "configure:1139: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1157,7 +1148,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1161: checking for working autoconf" >&5 +echo "configure:1152: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1170,7 +1161,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1174: checking for working automake" >&5 +echo "configure:1165: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1183,7 +1174,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1187: checking for working autoheader" >&5 +echo "configure:1178: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1196,7 +1187,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1200: checking for working makeinfo" >&5 +echo "configure:1191: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1232,7 +1223,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1236: checking for $ac_word" >&5 +echo "configure:1227: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1264,7 +1255,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1268: checking for $ac_word" >&5 +echo "configure:1259: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1296,7 +1287,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1300: checking for $ac_word" >&5 +echo "configure:1291: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1411,7 +1402,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1415: checking for ld used by GCC" >&5 +echo "configure:1406: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1441,10 +1432,10 @@ echo "configure:1415: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1445: checking for GNU ld" >&5 +echo "configure:1436: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1448: checking for non-GNU ld" >&5 +echo "configure:1439: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1479,7 +1470,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1483: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1474: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1496,7 +1487,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1500: checking for $LD option to reload object files" >&5 +echo "configure:1491: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1508,7 +1499,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1512: checking for BSD-compatible nm" >&5 +echo "configure:1503: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1546,7 +1537,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1550: checking whether ln -s works" >&5 +echo "configure:1541: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1567,7 +1558,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1571: checking how to recognise dependant libraries" >&5 +echo "configure:1562: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1740,13 +1731,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1744: checking for object suffix" >&5 +echo "configure:1735: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1766,7 +1757,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1770: checking for executable suffix" >&5 +echo "configure:1761: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1776,10 +1767,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *.c | *.o | *.obj) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1803,7 +1794,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1807: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1798: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1865,7 +1856,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1869: checking for file" >&5 +echo "configure:1860: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1936,7 +1927,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1940: checking for $ac_word" >&5 +echo "configure:1931: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1968,7 +1959,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1972: checking for $ac_word" >&5 +echo "configure:1963: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2003,7 +1994,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2007: checking for $ac_word" >&5 +echo "configure:1998: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2035,7 +2026,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2039: checking for $ac_word" >&5 +echo "configure:2030: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2102,8 +2093,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2106 "configure"' > conftest.$ac_ext - if { (eval echo configure:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2097 "configure"' > conftest.$ac_ext + if { (eval echo configure:2098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2122,7 +2113,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2117: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2140,7 +2131,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2144: checking whether the C compiler needs -belf" >&5 +echo "configure:2135: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2153,14 +2144,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2350,7 +2341,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2354: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2345: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2372,10 +2363,45 @@ fi MAINT=$MAINTAINER_MODE_TRUE +echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 +echo "configure:2368: checking whether to install libbfd" >&5 + # Check whether --enable-install-libbfd or --disable-install-libbfd was given. +if test "${enable_install_libbfd+set}" = set; then + enableval="$enable_install_libbfd" + install_libbfd_p=$enableval +else + if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then + install_libbfd_p=yes + else + install_libbfd_p=no + fi +fi + + echo "$ac_t""$install_libbfd_p" 1>&6 + + +if test $install_libbfd_p = yes; then + INSTALL_LIBBFD_TRUE= + INSTALL_LIBBFD_FALSE='#' +else + INSTALL_LIBBFD_TRUE='#' + INSTALL_LIBBFD_FALSE= +fi + # libbfd.a is a host library containing target dependent code + bfdlibdir='$(libdir)' + bfdincludedir='$(includedir)' + if test "${host}" != "${target}"; then + bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' + bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' + fi + + + + echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2379: checking for executable suffix" >&5 +echo "configure:2405: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2385,10 +2411,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *.c | *.o | *.obj) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2415,7 +2441,7 @@ bfd_default_target_size=32 # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2419: checking for $ac_word" >&5 +echo "configure:2445: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2445,7 +2471,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2449: checking for $ac_word" >&5 +echo "configure:2475: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2496,7 +2522,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2500: checking for $ac_word" >&5 +echo "configure:2526: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2528,7 +2554,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2532: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2558: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2539,12 +2565,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2543 "configure" +#line 2569 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2570,12 +2596,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2574: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2600: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2579: checking whether we are using GNU C" >&5 +echo "configure:2605: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2584,7 +2610,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2603,7 +2629,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2607: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2633: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2637,7 +2663,7 @@ fi ALL_LINGUAS="fr tr ja es sv" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2641: checking how to run the C preprocessor" >&5 +echo "configure:2667: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2652,13 +2678,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2662: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2688: \"$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 : @@ -2669,13 +2695,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2679: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2705: \"$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 : @@ -2686,13 +2712,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2722: \"$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 : @@ -2719,7 +2745,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2723: checking for $ac_word" >&5 +echo "configure:2749: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2747,12 +2773,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2751: checking for ANSI C header files" >&5 +echo "configure:2777: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2760,7 +2786,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2790: \"$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* @@ -2777,7 +2803,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2795,7 +2821,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2816,7 +2842,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2827,7 +2853,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2851,12 +2877,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2855: checking for working const" >&5 +echo "configure:2881: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2926,21 +2952,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2930: checking for inline" >&5 +echo "configure:2956: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2966,12 +2992,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2970: checking for off_t" >&5 +echo "configure:2996: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2999,12 +3025,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3003: checking for size_t" >&5 +echo "configure:3029: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3034,19 +3060,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3038: checking for working alloca.h" >&5 +echo "configure:3064: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3067,12 +3093,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3071: checking for alloca" >&5 +echo "configure:3097: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3132,12 +3158,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3136: checking whether alloca needs Cray hooks" >&5 +echo "configure:3162: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3166: checking for $ac_func" >&5 +echo "configure:3192: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3220: \"$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 @@ -3217,7 +3243,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3221: checking stack direction for C alloca" >&5 +echo "configure:3247: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3225,7 +3251,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3269,17 +3295,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3273: checking for $ac_hdr" >&5 +echo "configure:3299: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3309: \"$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* @@ -3308,12 +3334,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3312: checking for $ac_func" >&5 +echo "configure:3338: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3366: \"$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 @@ -3361,7 +3387,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3365: checking for working mmap" >&5 +echo "configure:3391: 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 @@ -3369,7 +3395,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3539: \"$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 @@ -3537,17 +3563,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3541: checking for $ac_hdr" >&5 +echo "configure:3567: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3577: \"$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* @@ -3577,12 +3603,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3581: checking for $ac_func" >&5 +echo "configure:3607: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3635: \"$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 @@ -3634,12 +3660,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3638: checking for $ac_func" >&5 +echo "configure:3664: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3692: \"$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 @@ -3696,19 +3722,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3700: checking for LC_MESSAGES" >&5 +echo "configure:3726: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3729,7 +3755,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3733: checking whether NLS is requested" >&5 +echo "configure:3759: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3749,7 +3775,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3753: checking whether included gettext is requested" >&5 +echo "configure:3779: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3768,17 +3794,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3772: checking for libintl.h" >&5 +echo "configure:3798: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3808: \"$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* @@ -3795,19 +3821,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3799: checking for gettext in libc" >&5 +echo "configure:3825: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3823,7 +3849,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3827: checking for bindtextdomain in -lintl" >&5 +echo "configure:3853: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3831,7 +3857,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3858,19 +3884,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3862: checking for gettext in libintl" >&5 +echo "configure:3888: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3898,7 +3924,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3902: checking for $ac_word" >&5 +echo "configure:3928: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3932,12 +3958,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3936: checking for $ac_func" >&5 +echo "configure:3962: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3990: \"$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 @@ -3987,7 +4013,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3991: checking for $ac_word" >&5 +echo "configure:4017: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4023,7 +4049,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4027: checking for $ac_word" >&5 +echo "configure:4053: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4055,7 +4081,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4095,7 +4121,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4099: checking for $ac_word" >&5 +echo "configure:4125: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4129,7 +4155,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4133: checking for $ac_word" >&5 +echo "configure:4159: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4165,7 +4191,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4169: checking for $ac_word" >&5 +echo "configure:4195: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4255,7 +4281,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4259: checking for catalogs to be installed" >&5 +echo "configure:4285: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4283,17 +4309,17 @@ echo "configure:4259: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4287: checking for linux/version.h" >&5 +echo "configure:4313: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4323: \"$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* @@ -4371,7 +4397,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4375: checking for a BSD compatible install" >&5 +echo "configure:4401: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4454,7 +4480,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4458: checking for build system executable suffix" >&5 +echo "configure:4484: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4482,17 +4508,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4486: checking for $ac_hdr" >&5 +echo "configure:4512: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4522: \"$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* @@ -4522,17 +4548,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4526: checking for $ac_hdr" >&5 +echo "configure:4552: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4562: \"$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* @@ -4559,12 +4585,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4563: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4589: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4573,7 +4599,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4598,12 +4624,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4602: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4628: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -4611,7 +4637,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4615: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4636,7 +4662,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4640: checking for opendir in -ldir" >&5 +echo "configure:4666: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4644,7 +4670,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4677,7 +4703,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4681: checking for opendir in -lx" >&5 +echo "configure:4707: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4685,7 +4711,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4721,12 +4747,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4725: checking for $ac_func" >&5 +echo "configure:4751: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4779: \"$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 @@ -4784,12 +4810,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4788: checking whether strstr must be declared" >&5 +echo "configure:4814: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4810,7 +4836,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4831,12 +4857,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4835: checking whether malloc must be declared" >&5 +echo "configure:4861: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4857,7 +4883,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4861: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4878,12 +4904,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4882: checking whether realloc must be declared" >&5 +echo "configure:4908: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4904,7 +4930,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4908: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4925,12 +4951,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4929: checking whether free must be declared" >&5 +echo "configure:4955: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4951,7 +4977,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -4972,12 +4998,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:4976: checking whether getenv must be declared" >&5 +echo "configure:5002: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4998,7 +5024,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5032,7 +5058,9 @@ if test "${target}" = "${host}"; then COREFILE=trad-core.lo TRAD_HEADER='"hosts/alphalinux.h"' ;; - alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;; + alpha*-*-netbsd* | alpha*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; alpha*-*-*) COREFILE=osf-core.lo ;; arm-*-freebsd*) COREFILE='' ;; arm-*-netbsd*) COREFILE=netbsd-core.lo ;; @@ -5177,10 +5205,35 @@ if test "${target}" = "${host}"; then COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE" ;; - rs6000-*-aix4.[4-9]* | powerpc-*-aix4.[4-9]* | \ - rs6000-*-aix4.3.[3-9]* | powerpc-*-aix4.3.[3-9]*) + rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*) COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE" + # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE + # have c_impl as a member of struct core_dumpx + echo $ac_n "checking for c_impl in struct core_dumpx""... $ac_c" 1>&6 +echo "configure:5215: checking for c_impl in struct core_dumpx" >&5 + cat > conftest.$ac_ext < +int main() { +struct core_dumpx c; c.c_impl = 0; +; return 0; } +EOF +if { (eval echo configure:5224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_ST_C_IMPL 1 +EOF + + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* ;; rs6000-*-aix4*) COREFILE=rs6000-core.lo ;; rs6000-*-*) COREFILE=rs6000-core.lo ;; @@ -5192,7 +5245,7 @@ if test "${target}" = "${host}"; then powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;; s390*-*-*) COREFILE=trad-core.lo ;; sh*-*-netbsd*) COREFILE=netbsd-core.lo ;; - sparc-*-netbsd* | sparc-*-openbsd*) + sparc-*-netbsd* | sparc*-*-openbsd*) COREFILE=netbsd-core.lo ;; tahoe-*-*) @@ -5234,17 +5287,17 @@ if test "${target}" = "${host}"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5238: checking for $ac_hdr" >&5 +echo "configure:5291: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5301: \"$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* @@ -5272,12 +5325,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5276: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5329: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5308,12 +5361,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5312: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5365: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5344,12 +5397,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5348: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5401: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5415: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5380,12 +5433,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5384: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5437: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5451: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5416,12 +5469,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5420: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5473: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5487: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5452,12 +5505,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5456: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5509: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5488,12 +5541,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5492: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5545: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5524,12 +5577,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5528: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5581: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5595: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5560,12 +5613,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5564: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5617: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5596,12 +5649,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5600: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5653: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5632,12 +5685,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5636: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5689: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5703: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5668,12 +5721,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5672: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5725: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5704,12 +5757,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5708: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5761: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5740,12 +5793,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5744: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5797: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5776,12 +5829,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5780: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5833: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -5812,12 +5865,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5816: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5869: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -5999,12 +6052,14 @@ do bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; + bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;; bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;; 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_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" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; @@ -6040,15 +6095,20 @@ do # FIXME: We include cofflink.lo not because it's needed for # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec # which needs it but does not list it. Should be fixed in right place. - bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; + bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;; + bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; 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_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 ;; @@ -6165,6 +6225,8 @@ do tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;; tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;; + vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;; + vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;; versados_vec) tb="$tb versados.lo" ;; vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;; vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;; @@ -6240,10 +6302,10 @@ case ${host64}-${target64}-${want64} in 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:6244: checking for gcc version with buggy 64-bit support" >&5 +echo "configure:6306: 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 <&6 -echo "configure:6292: checking for $ac_hdr" >&5 +echo "configure:6354: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6364: \"$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* @@ -6327,12 +6389,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6331: checking for $ac_func" >&5 +echo "configure:6393: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6421: \"$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 @@ -6380,7 +6442,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6384: checking for working mmap" >&5 +echo "configure:6446: 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 @@ -6388,7 +6450,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6594: \"$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 @@ -6553,12 +6615,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6557: checking for $ac_func" >&5 +echo "configure:6619: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6647: \"$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 @@ -6787,6 +6849,10 @@ s%@WARN_CFLAGS@%$WARN_CFLAGS%g s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g s%@MAINT@%$MAINT%g +s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g +s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g +s%@bfdlibdir@%$bfdlibdir%g +s%@bfdincludedir@%$bfdincludedir%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g s%@USE_NLS@%$USE_NLS%g diff --git a/bfd/configure.in b/bfd/configure.in index 6659fd5d434..040a068a902 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -98,6 +98,7 @@ if test -z "$target" ; then fi AM_MAINTAINER_MODE +AM_INSTALL_LIBBFD AC_EXEEXT host64=false @@ -162,7 +163,9 @@ if test "${target}" = "${host}"; then COREFILE=trad-core.lo TRAD_HEADER='"hosts/alphalinux.h"' ;; - alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;; + alpha*-*-netbsd* | alpha*-*-openbsd*) + COREFILE=netbsd-core.lo + ;; alpha*-*-*) COREFILE=osf-core.lo ;; arm-*-freebsd*) COREFILE='' ;; arm-*-netbsd*) COREFILE=netbsd-core.lo ;; @@ -332,11 +335,18 @@ changequote([,])dnl COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE" ;; changequote(,)dnl - rs6000-*-aix4.[4-9]* | powerpc-*-aix4.[4-9]* | \ - rs6000-*-aix4.3.[3-9]* | powerpc-*-aix4.3.[3-9]*) + rs6000-*-aix4.[3-9]* | powerpc-*-aix4.[3-9]*) changequote([,])dnl COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_CORE_DUMPX_CORE" + # Not all versions of AIX with -DAIX_CORE_DUMPX_CORE + # have c_impl as a member of struct core_dumpx + AC_MSG_CHECKING([for c_impl in struct core_dumpx]) + AC_TRY_COMPILE([#include ], + [struct core_dumpx c; c.c_impl = 0;], + [AC_DEFINE(HAVE_ST_C_IMPL, 1, + [Define if struct core_dumpx has member c_impl]) + AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) ;; rs6000-*-aix4*) COREFILE=rs6000-core.lo ;; rs6000-*-*) COREFILE=rs6000-core.lo ;; @@ -348,7 +358,7 @@ changequote([,])dnl powerpc-*-*bsd*) COREFILE=netbsd-core.lo ;; s390*-*-*) COREFILE=trad-core.lo ;; sh*-*-netbsd*) COREFILE=netbsd-core.lo ;; - sparc-*-netbsd* | sparc-*-openbsd*) + sparc-*-netbsd* | sparc*-*-openbsd*) COREFILE=netbsd-core.lo ;; tahoe-*-*) @@ -556,12 +566,14 @@ do bfd_elf32_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;; bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;; + bfd_elf32_dlx_big_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;; bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;; bfd_elf32_h8300_vec) tb="$tb elf32-h8300.lo elf32.lo $elf" ;; 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_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" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; @@ -597,15 +609,20 @@ do # FIXME: We include cofflink.lo not because it's needed for # bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec # which needs it but does not list it. Should be fixed in right place. - bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; - bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; + bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;; bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;; + bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;; + bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;; + bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;; bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;; bfd_elf32_tradbigmips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_tradlittlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf32.lo $elf ecofflink.lo" ;; bfd_elf32_us_cris_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;; 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_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 ;; @@ -722,6 +739,8 @@ do tic54x_coff2_beh_vec) tb="$tb coff-tic54x.lo" ;; tic54x_coff2_vec) tb="$tb coff-tic54x.lo" ;; tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;; + vaxnetbsd_vec) tb="$tb vaxnetbsd.lo aout32.lo" ;; + vax1knetbsd_vec) tb="$tb vax1knetbsd.lo aout32.lo" ;; versados_vec) tb="$tb versados.lo" ;; vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"; target_size=64 ;; vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;; diff --git a/bfd/corefile.c b/bfd/corefile.c index 609c4e6f68e..24142254eed 100644 --- a/bfd/corefile.c +++ b/bfd/corefile.c @@ -1,5 +1,5 @@ /* Core file generic interface routines for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001 + Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Cygnus Support. @@ -44,7 +44,7 @@ DESCRIPTION */ -CONST char * +const char * bfd_core_file_failing_command (abfd) bfd *abfd; { diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c index 07beae5c1b5..10ca3fdfc2b 100644 --- a/bfd/cpu-h8300.c +++ b/bfd/cpu-h8300.c @@ -97,23 +97,20 @@ compatible (in, out) return in; } -static const bfd_arch_info_type h8300_info_struct = +static const bfd_arch_info_type h8300s_info_struct = { - 16, /* 16 bits in a word */ - 16, /* 16 bits in an address */ + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_h8300, - bfd_mach_h8300, - "h8300", /* arch_name */ - "h8300", /* printable name */ + bfd_mach_h8300s, + "h8300s", /* arch_name */ + "h8300s", /* printable name */ 1, - true, /* the default machine */ + false, /* the default machine */ compatible, h8300_scan, -#if 0 - local_bfd_reloc_type_lookup, -#endif - 0, + 0 }; static const bfd_arch_info_type h8300h_info_struct = @@ -129,27 +126,21 @@ static const bfd_arch_info_type h8300h_info_struct = false, /* the default machine */ compatible, h8300_scan, -#if 0 - local_bfd_reloc_type_lookup, -#endif - &h8300_info_struct, + &h8300s_info_struct }; const bfd_arch_info_type bfd_h8300_arch = { - 32, /* 32 bits in a word */ - 32, /* 32 bits in an address */ + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_h8300, - bfd_mach_h8300s, - "h8300s", /* arch_name */ - "h8300s", /* printable name */ + bfd_mach_h8300, + "h8300", /* arch_name */ + "h8300", /* printable name */ 1, - false, /* the default machine */ + true, /* the default machine */ compatible, h8300_scan, -#if 0 - local_bfd_reloc_type_lookup, -#endif - &h8300h_info_struct, + &h8300h_info_struct }; diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c index d54b0a55891..d5343ff31ef 100644 --- a/bfd/cpu-mips.c +++ b/bfd/cpu-mips.c @@ -37,11 +37,8 @@ mips_compatible (a, b) if (a->arch != b->arch) return NULL; - if (a->mach > b->mach) - return a; - - if (b->mach > a->mach) - return b; + /* Machine compatibility is checked in + _bfd_mips_elf_merge_private_bfd_data. */ return a; } diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog index b71ad5a1da9..2f212bf7b9e 100644 --- a/bfd/doc/ChangeLog +++ b/bfd/doc/ChangeLog @@ -1,3 +1,28 @@ +2002-06-08 Alan Modra + + * Makefile.am: Fix quote style in last change. + * Makefile.in: Regenerate. + +2002-06-07 Alan Modra + + * Makefile.am (libbfd.h): Don't use "echo -n". + (libcoff.h, bfd.h): Likewise. + * Makefile.in: Regenerate. + +2002-06-06 Lars Brinkhoff + + * bfdint.texi: Change registry@sco.com to registry@caldera.com. + +2002-06-05 Alan Modra + + * Makefile.am (libbfd.h): Add "Extracted from.." comment. + (libcoff.h, bfd.h): Likewise. + * Makefile.in: Regenerate. + +2002-05-25 Alan Modra + + * chew.c: Use #include "" instead of <> for local header files. + 2002-04-20 Alan Modra * Makefile.in: Regenerate. diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am index cbfd3427e60..0787143fcd9 100644 --- a/bfd/doc/Makefile.am +++ b/bfd/doc/Makefile.am @@ -209,7 +209,9 @@ libbfd.h: $(LIBBFD_H_DEP) case $$file in \ *-in.h) cat $$file >> $@ ;; \ */header.sed) break ;; \ - *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ + -e 's,$$,. */,' >> $@ ; \ + ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ esac; \ done @@ -226,7 +228,9 @@ libcoff.h: $(LIBCOFF_H_DEP) case $$file in \ *-in.h) cat $$file >> $@ ;; \ */header.sed) break ;; \ - *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ + -e 's,$$,. */,' >> $@ ; \ + ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ esac; \ done @@ -255,7 +259,9 @@ bfd.h: $(BFD_H_DEP) case $$file in \ *-in.h) cat $$file >> $@ ;; \ */header.sed) break ;; \ - *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ + *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ + -e 's,$$,. */,' >> $@ ; \ + ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ esac; \ done echo "#ifdef __cplusplus" >> $@ diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index 0036c0be529..8daf5370af5 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -121,6 +121,8 @@ bfd_machines = @bfd_machines@ bfd_version = @bfd_version@ bfd_version_date = @bfd_version_date@ bfd_version_string = @bfd_version_string@ +bfdincludedir = @bfdincludedir@ +bfdlibdir = @bfdlibdir@ l = @l@ tdefaults = @tdefaults@ wordsize = @wordsize@ @@ -604,7 +606,9 @@ libbfd.h: $(LIBBFD_H_DEP) case $$file in \ *-in.h) cat $$file >> $@ ;; \ */header.sed) break ;; \ - *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ + -e 's,$$,. */,' >> $@ ; \ + ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ esac; \ done @@ -614,7 +618,9 @@ libcoff.h: $(LIBCOFF_H_DEP) case $$file in \ *-in.h) cat $$file >> $@ ;; \ */header.sed) break ;; \ - *) ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ + *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ + -e 's,$$,. */,' >> $@ ; \ + ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \ esac; \ done @@ -624,7 +630,9 @@ bfd.h: $(BFD_H_DEP) case $$file in \ *-in.h) cat $$file >> $@ ;; \ */header.sed) break ;; \ - *) ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ + *) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \ + -e 's,$$,. */,' >> $@ ; \ + ./$(MKDOC) -f $(srcdir)/proto.str < $$file >> $@ ;; \ esac; \ done echo "#ifdef __cplusplus" >> $@ diff --git a/bfd/doc/bfdint.texi b/bfd/doc/bfdint.texi index 76fd83245e7..d2996dcfcb3 100644 --- a/bfd/doc/bfdint.texi +++ b/bfd/doc/bfdint.texi @@ -1545,9 +1545,9 @@ Define @samp{ELF_ARCH} to the BFD architecture (an element of the @item Define @samp{ELF_MACHINE_CODE} to the magic number which should appear in the @samp{e_machine} field of the ELF header. As of this writing, -these magic numbers are assigned by SCO; if you want to get a magic +these magic numbers are assigned by Caldera; if you want to get a magic number for a particular processor, try sending a note to -@email{registry@@sco.com}. In the BFD sources, the magic numbers are +@email{registry@@caldera.com}. In the BFD sources, the magic numbers are found in @file{include/elf/common.h}; they have names beginning with @samp{EM_}. @item diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index 11554ebd2f0..dc6f8110829 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -82,7 +82,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foo. */ -#include +#include "ansidecl.h" #include "sysdep.h" #include #include diff --git a/bfd/ecoff.c b/bfd/ecoff.c index c7230f6aaf8..56165a48cf8 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -661,10 +661,9 @@ _bfd_ecoff_make_empty_symbol (abfd) ecoff_symbol_type *new; bfd_size_type amt = sizeof (ecoff_symbol_type); - new = (ecoff_symbol_type *) bfd_alloc (abfd, amt); + new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt); if (new == (ecoff_symbol_type *) NULL) return (asymbol *) NULL; - memset ((PTR) new, 0, sizeof *new); new->symbol.section = (asection *) NULL; new->fdr = (FDR *) NULL; new->local = false; diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 53d65441dbe..8044f3ab6e6 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1,5 +1,5 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001 + Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, . @@ -1650,11 +1650,10 @@ ecoff_write_shuffle (abfd, swap, shuffle, space) bfd_byte *s; i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_malloc ((bfd_size_type) i); + s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i); if (s == NULL && i != 0) return false; - memset ((PTR) s, 0, i); if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i) { free (s); @@ -1736,10 +1735,10 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where) bfd_byte *s; i = swap->debug_align - (total & (swap->debug_align - 1)); - s = (bfd_byte *) bfd_malloc ((bfd_size_type) i); + s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i); if (s == NULL && i != 0) goto error_return; - memset ((PTR) s, 0, i); + if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i) { free (s); @@ -1761,10 +1760,10 @@ bfd_ecoff_write_accumulated_debug (handle, abfd, debug, swap, info, where) i = (swap->debug_align - (debug->symbolic_header.issExtMax & (swap->debug_align - 1))); - s = (bfd_byte *) bfd_malloc ((bfd_size_type) i); + s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i); if (s == NULL && i != 0) goto error_return; - memset ((PTR) s, 0, i); + if (bfd_bwrite ((PTR) s, (bfd_size_type) i, abfd) != i) { free (s); diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 5959077d536..28dbe83c6a7 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -230,9 +230,18 @@ enum elf_link_info_type ELF_INFO_TYPE_MERGE, ELF_INFO_TYPE_EH_FRAME, ELF_INFO_TYPE_EH_FRAME_HDR, + ELF_INFO_TYPE_JUST_SYMS, ELF_INFO_TYPE_LAST }; +/* Cached start, size and alignment of PT_TLS segment. */ +struct elf_link_tls_segment +{ + bfd_vma start; + bfd_size_type size; + unsigned int align; +}; + /* ELF linker hash table. */ struct elf_link_hash_table @@ -285,6 +294,9 @@ struct elf_link_hash_table /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic objects included in the link. */ struct bfd_link_needed_list *runpath; + + /* Cached start, size and alignment of PT_TLS segment. */ + struct elf_link_tls_segment *tls_segment; }; /* Look up an entry in an ELF linker hash table. */ @@ -341,6 +353,8 @@ struct elf_size_info { PARAMS ((bfd *)); void (*write_relocs) PARAMS ((bfd *, asection *, PTR)); + void (*swap_symbol_in) + PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *)); void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); boolean (*slurp_reloc_table) @@ -478,7 +492,7 @@ struct elf_backend_data /* A function to handle unusual section types when creating BFD sections from ELF sections. */ boolean (*elf_backend_section_from_shdr) - PARAMS ((bfd *, Elf32_Internal_Shdr *, char *)); + PARAMS ((bfd *, Elf32_Internal_Shdr *, const char *)); /* A function to convert machine dependent section header flags to BFD internal section header flags. */ @@ -705,7 +719,7 @@ struct elf_backend_data /* Emit relocations. Overrides default routine for emitting relocs, except during a relocatable link, or if all relocs are being emitted. */ - void (*elf_backend_emit_relocs) + boolean (*elf_backend_emit_relocs) PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); /* Count relocations. Not called for relocatable links @@ -748,6 +762,22 @@ struct elf_backend_data boolean (*elf_backend_write_section) PARAMS ((bfd *, asection *, bfd_byte *)); + /* This function, if defined, sets up the file positions for non PT_LOAD + segments, especially for segments containing non-allocated sections. */ + void (*set_nonloadable_filepos) + PARAMS ((bfd *, Elf_Internal_Phdr *)); + + /* This function, if defined, returns true if the section is contained + within the segment. File positions are compared. */ + boolean (*is_contained_by_filepos) + PARAMS ((asection *, Elf_Internal_Phdr *)); + + /* This function, if defined, returns true if copy_private_bfd_data + should be called. It provides a way of overriding default + test conditions in _bfd_elf_copy_private_section_data. */ + boolean (*copy_private_bfd_data_p) + PARAMS ((bfd *, asection *, bfd *, asection *)); + /* The level of IRIX compatibility we're striving for. MIPS ELF specific function. */ irix_compat_t (*elf_backend_mips_irix_compat) @@ -886,8 +916,13 @@ struct bfd_elf_section_data /* Type of that information. */ enum elf_link_info_type sec_info_type; - /* Group name, if this section is part of a group. */ - const char *group_name; + union { + /* Group name, if this section is a member of a group. */ + const char *name; + + /* Group signature sym, if this is the SHT_GROUP section. */ + struct symbol_cache_entry *id; + } group; /* A linked list of sections in the group. Circular when used by the linker. */ @@ -898,17 +933,23 @@ struct bfd_elf_section_data /* Nonzero if this section uses RELA relocations, rather than REL. */ unsigned int use_rela_p:1; + + /* Nonzero when a group is COMDAT. */ + unsigned int linkonce_p:1; }; #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd) -#define elf_group_name(sec) (elf_section_data(sec)->group_name) +#define elf_group_name(sec) (elf_section_data(sec)->group.name) +#define elf_group_id(sec) (elf_section_data(sec)->group.id) #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group) +#define elf_linkonce_p(sec) (elf_section_data(sec)->linkonce_p) /* Return true if section has been discarded. */ #define elf_discarded_section(sec) \ (!bfd_is_abs_section(sec) \ && bfd_is_abs_section((sec)->output_section) \ - && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE) + && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \ + && elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS) #define get_elf_backend_data(abfd) \ ((struct elf_backend_data *) (abfd)->xvec->backend_data) @@ -1226,10 +1267,14 @@ extern boolean _bfd_elf_link_hash_table_init const char *))); extern boolean _bfd_elf_slurp_version_tables PARAMS ((bfd *)); - extern boolean _bfd_elf_merge_sections PARAMS ((bfd *, struct bfd_link_info *)); - +extern boolean bfd_elf_discard_group + PARAMS ((bfd *, struct sec *)); +extern void bfd_elf_set_group_contents + PARAMS ((bfd *, asection *, PTR)); +extern void _bfd_elf_link_just_syms + PARAMS ((asection *, struct bfd_link_info *)); extern boolean _bfd_elf_copy_private_symbol_data PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); extern boolean _bfd_elf_copy_private_section_data @@ -1406,8 +1451,7 @@ extern boolean bfd_elf32_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); extern void bfd_elf32_swap_symbol_in - PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *, - Elf_Internal_Sym *)); + PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *)); extern void bfd_elf32_swap_symbol_out PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); extern void bfd_elf32_swap_reloc_in @@ -1459,8 +1503,7 @@ extern boolean bfd_elf64_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); extern void bfd_elf64_swap_symbol_in - PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *, - Elf_Internal_Sym *)); + PARAMS ((bfd *, const PTR, const PTR, Elf_Internal_Sym *)); extern void bfd_elf64_swap_symbol_out PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); extern void bfd_elf64_swap_reloc_in diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 6a23edb2c42..6f10cd7aabe 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -787,7 +787,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info) struct eh_frame_hdr_info *hdr_info; sec = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".eh_frame_hdr"); - if (sec == NULL) + if (sec == NULL || bfd_is_abs_section (sec->output_section)) return true; hdr_info @@ -805,7 +805,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (info) /* Count only sections which have at least a single CIE or FDE. There cannot be any CIE or FDE <= 8 bytes. */ o = bfd_get_section_by_name (abfd, ".eh_frame"); - if (o && o->_raw_size > 8) + if (o && o->_raw_size > 8 && !bfd_is_abs_section (o->output_section)) break; } diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 4e8de60df94..e833af6037e 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -630,7 +630,8 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF32_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == SHN_UNDEF) sym_sec = bfd_und_section_ptr; @@ -1317,7 +1318,8 @@ mn10200_elf_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; Elf_External_Sym_Shndx dummy; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value > addr @@ -1378,7 +1380,8 @@ mn10200_elf_symbol_address_p (abfd, sec, addr) { Elf_Internal_Sym isym; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value == addr) @@ -1500,7 +1503,8 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, { asection *isec; - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isymp); if (isymp->st_shndx == SHN_UNDEF) isec = bfd_und_section_ptr; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 40b4ad6368a..56350e59f8d 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -937,7 +937,9 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + r_index; shndx = shndx_buf + (shndx_buf ? r_index : 0); - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, + bfd_elf32_swap_symbol_in (input_bfd, + (const PTR) esym, + (const PTR) shndx, &isym); if (isym.st_shndx == SHN_UNDEF) @@ -1028,7 +1030,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) { Elf_Internal_Sym isym; - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, &isym); if (isym.st_shndx == sec_shndx && ELF_ST_TYPE (isym.st_info) == STT_FUNC) { @@ -1254,7 +1257,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) struct elf_link_hash_table *elftab; bfd_size_type amt; - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, &isym); if (isym.st_shndx != sec_shndx) continue; @@ -1551,7 +1555,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, + (const PTR) shndx, &isym); if (isym.st_shndx == SHN_UNDEF) sym_sec = bfd_und_section_ptr; @@ -2674,7 +2679,8 @@ mn10300_elf_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; Elf_External_Sym_Shndx dummy; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value > addr @@ -2735,7 +2741,8 @@ mn10300_elf_symbol_address_p (abfd, sec, addr) { Elf_Internal_Sym isym; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value == addr) @@ -2857,7 +2864,8 @@ mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order, { asection *isec; - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isymp); if (isymp->st_shndx == SHN_UNDEF) isec = bfd_und_section_ptr; diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index ff7d9a4fafe..7a993c252f5 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -1,28 +1,29 @@ /* ELF strtab with GC and suffix merging support. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. Written by Jakub Jelinek . -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" #include "elf-bfd.h" #include "hashtab.h" +#include "libiberty.h" /* An entry in the strtab hash table. */ @@ -351,7 +352,7 @@ _bfd_elf_strtab_finalize (tab) qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry); - last4tab = htab_create (size * 4, NULL, last4_eq, NULL); + last4tab = htab_create_alloc (size * 4, NULL, last4_eq, NULL, calloc, free); if (last4tab == NULL) goto alloc_failure; diff --git a/bfd/elf.c b/bfd/elf.c index f8fdbd2a9fd..61b9f50b064 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -50,10 +50,10 @@ static boolean prep_headers PARAMS ((bfd *)); static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int)); static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *)); static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type)); +static const char *group_signature PARAMS ((bfd *, Elf_Internal_Shdr *)); static boolean setup_group PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); static void merge_sections_remove_hook PARAMS ((bfd *, asection *)); static void elf_fake_sections PARAMS ((bfd *, asection *, PTR)); -static void set_group_contents PARAMS ((bfd *, asection *, PTR)); static boolean assign_section_numbers PARAMS ((bfd *)); static INLINE int sym_is_global PARAMS ((bfd *, asymbol *)); static boolean elf_map_symbols PARAMS ((bfd *)); @@ -361,6 +361,66 @@ typedef union elf_internal_group { unsigned int flags; } Elf_Internal_Group; +/* Return the name of the group signature symbol. Why isn't the + signature just a string? */ + +static const char * +group_signature (abfd, ghdr) + bfd *abfd; + Elf_Internal_Shdr *ghdr; +{ + struct elf_backend_data *bed; + file_ptr pos; + bfd_size_type amt; + Elf_Internal_Shdr *hdr; + Elf_Internal_Shdr *shndx_hdr; + unsigned char esym[sizeof (Elf64_External_Sym)]; + Elf_External_Sym_Shndx eshndx; + Elf_Internal_Sym isym; + unsigned int iname; + unsigned int shindex; + + /* First we need to ensure the symbol table is available. */ + if (! bfd_section_from_shdr (abfd, ghdr->sh_link)) + return NULL; + + /* Go read the symbol. */ + hdr = &elf_tdata (abfd)->symtab_hdr; + bed = get_elf_backend_data (abfd); + amt = bed->s->sizeof_sym; + pos = hdr->sh_offset + ghdr->sh_info * amt; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bread (esym, amt, abfd) != amt) + return NULL; + + /* And possibly the symbol section index extension. */ + shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; + if (elf_elfsections (abfd) != NULL + && elf_elfsections (abfd)[shndx_hdr->sh_link] == hdr) + { + amt = sizeof (Elf_External_Sym_Shndx); + pos = shndx_hdr->sh_offset + ghdr->sh_info * amt; + if (bfd_seek (abfd, pos, SEEK_SET) != 0 + || bfd_bread ((PTR) &eshndx, amt, abfd) != amt) + return NULL; + } + + /* Convert to internal format. */ + (*bed->s->swap_symbol_in) (abfd, (const PTR *) &esym, (const PTR *) &eshndx, + &isym); + + /* Look up the symbol name. */ + iname = isym.st_name; + shindex = hdr->sh_link; + if (iname == 0 && ELF_ST_TYPE (isym.st_info) == STT_SECTION) + { + iname = elf_elfsections (abfd)[isym.st_shndx]->sh_name; + shindex = elf_elfheader (abfd)->e_shstrndx; + } + + return bfd_elf_string_from_elf_section (abfd, shindex, iname); +} + /* Set next_in_group list pointer, and group name for NEWSECT. */ static boolean @@ -440,6 +500,9 @@ setup_group (abfd, hdr, newsect) if (src == shdr->contents) { dest->flags = idx; + if (shdr->bfd_section != NULL && (idx & GRP_COMDAT)) + shdr->bfd_section->flags + |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; break; } if (idx >= shnum) @@ -492,32 +555,22 @@ setup_group (abfd, hdr, newsect) } else { - struct elf_backend_data *bed; - file_ptr pos; - unsigned char ename[4]; - unsigned long iname; const char *gname; - /* Humbug. Get the name from the group signature - symbol. Why isn't the signature just a string? - Fortunately, the name index is at the same - place in the external symbol for both 32 and 64 - bit ELF. */ - bed = get_elf_backend_data (abfd); - pos = elf_tdata (abfd)->symtab_hdr.sh_offset; - pos += shdr->sh_info * bed->s->sizeof_sym; - if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bread (ename, (bfd_size_type) 4, abfd) != 4) + gname = group_signature (abfd, shdr); + if (gname == NULL) return false; - iname = H_GET_32 (abfd, ename); - gname = elf_string_from_elf_strtab (abfd, iname); elf_group_name (newsect) = gname; /* Start a circular list with one element. */ elf_next_in_group (newsect) = newsect; } + + /* If the group section has been created, point to the + new member. */ if (shdr->bfd_section != NULL) elf_next_in_group (shdr->bfd_section) = newsect; + i = num_group - 1; break; } @@ -532,6 +585,25 @@ setup_group (abfd, hdr, newsect) return true; } +boolean +bfd_elf_discard_group (abfd, group) + bfd *abfd ATTRIBUTE_UNUSED; + asection *group; +{ + asection *first = elf_next_in_group (group); + asection *s = first; + + while (s != NULL) + { + s->output_section = bfd_abs_section_ptr; + s = elf_next_in_group (s); + /* These lists are circular. */ + if (s == first) + break; + } + return true; +} + /* Make a BFD section from an ELF section. We store a pointer to the BFD section in the bfd_section field of the header. */ @@ -591,6 +663,8 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name) if (hdr->sh_flags & SHF_GROUP) if (!setup_group (abfd, hdr, newsect)) return false; + if ((hdr->sh_flags & SHF_TLS) != 0) + flags |= SEC_THREAD_LOCAL; /* The debugging sections appear to be recognized only by name, not any sort of flag. */ @@ -618,7 +692,8 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name) The symbols will be defined as weak, so that multiple definitions are permitted. The GNU linker extension is to actually discard all but one of the sections. */ - if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0) + if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0 + && elf_next_in_group (newsect) == NULL) flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; bed = get_elf_backend_data (abfd); @@ -814,6 +889,19 @@ _bfd_elf_merge_sections (abfd, info) merge_sections_remove_hook); return true; } + +void +_bfd_elf_link_just_syms (sec, info) + asection *sec; + struct bfd_link_info *info; +{ + sec->output_section = bfd_abs_section_ptr; + sec->output_offset = sec->vma; + if (!is_elf_hash_table (info)) + return; + + elf_section_data (sec)->sec_info_type = ELF_INFO_TYPE_JUST_SYMS; +} /* Copy the program header and other data from one object module to another. */ @@ -870,6 +958,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg) case PT_NOTE: pt = "NOTE"; break; case PT_SHLIB: pt = "SHLIB"; break; case PT_PHDR: pt = "PHDR"; break; + case PT_TLS: pt = "TLS"; break; case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break; default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break; } @@ -1560,7 +1649,7 @@ bfd_section_from_shdr (abfd, shindex) Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[shindex]; Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd); struct elf_backend_data *bed = get_elf_backend_data (abfd); - char *name; + const char *name; name = elf_string_from_elf_strtab (abfd, hdr->sh_name); @@ -1804,7 +1893,12 @@ bfd_section_from_shdr (abfd, shindex) return true; case SHT_GROUP: - /* Make a section for objcopy and relocatable links. */ + /* We need a BFD section for objcopy and relocatable linking, + and it's handy to have the signature available as the section + name. */ + name = group_signature (abfd, hdr); + if (name == NULL) + return false; if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name)) return false; if (hdr->contents != NULL) @@ -1813,6 +1907,10 @@ bfd_section_from_shdr (abfd, shindex) unsigned int n_elt = hdr->sh_size / 4; asection *s; + if (idx->flags & GRP_COMDAT) + hdr->bfd_section->flags + |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; + while (--n_elt != 0) if ((s = (++idx)->shdr->bfd_section) != NULL && elf_next_in_group (s) != NULL) @@ -2259,8 +2357,10 @@ elf_fake_sections (abfd, asect, failedptrarg) if ((asect->flags & SEC_STRINGS) != 0) this_hdr->sh_flags |= SHF_STRINGS; } - if (elf_group_name (asect) != NULL) + if ((asect->flags & SEC_GROUP) == 0 && elf_group_name (asect) != NULL) this_hdr->sh_flags |= SHF_GROUP; + if ((asect->flags & SEC_THREAD_LOCAL) != 0) + this_hdr->sh_flags |= SHF_TLS; /* Check for processor-specific section types. */ if (bed->elf_backend_fake_sections @@ -2281,35 +2381,47 @@ elf_fake_sections (abfd, asect, failedptrarg) /* Fill in the contents of a SHT_GROUP section. */ -static void -set_group_contents (abfd, sec, failedptrarg) +void +bfd_elf_set_group_contents (abfd, sec, failedptrarg) bfd *abfd; asection *sec; - PTR failedptrarg ATTRIBUTE_UNUSED; + PTR failedptrarg; { boolean *failedptr = (boolean *) failedptrarg; unsigned long symindx; - asection *elt; + asection *elt, *first; unsigned char *loc; struct bfd_link_order *l; + boolean gas; if (elf_section_data (sec)->this_hdr.sh_type != SHT_GROUP || *failedptr) return; - /* If called from the assembler, swap_out_syms will have set up - elf_section_syms; If called for "ld -r", the symbols won't yet - be mapped, so emulate elf_bfd_final_link. */ - if (elf_section_syms (abfd) != NULL) - symindx = elf_section_syms (abfd)[sec->index]->udata.i; - else - symindx = elf_section_data (sec)->this_idx; + symindx = 0; + if (elf_group_id (sec) != NULL) + symindx = elf_group_id (sec)->udata.i; + + if (symindx == 0) + { + /* If called from the assembler, swap_out_syms will have set up + elf_section_syms; If called for "ld -r", use target_index. */ + if (elf_section_syms (abfd) != NULL) + symindx = elf_section_syms (abfd)[sec->index]->udata.i; + else + symindx = sec->target_index; + } elf_section_data (sec)->this_hdr.sh_info = symindx; - /* Nor will the contents be allocated for "ld -r". */ + /* The contents won't be allocated for "ld -r" or objcopy. */ + gas = true; if (sec->contents == NULL) { + gas = false; sec->contents = bfd_alloc (abfd, sec->_raw_size); + + /* Arrange for the section to be written out. */ + elf_section_data (sec)->this_hdr.contents = sec->contents; if (sec->contents == NULL) { *failedptr = true; @@ -2319,9 +2431,10 @@ set_group_contents (abfd, sec, failedptrarg) loc = sec->contents + sec->_raw_size; - /* Get the pointer to the first section in the group that we - squirreled away here. */ - elt = elf_next_in_group (sec); + /* Get the pointer to the first section in the group that gas + squirreled away here. objcopy arranges for this to be set to the + start of the input section group. */ + first = elt = elf_next_in_group (sec); /* First element is a flag word. Rest of section is elf section indices for all the sections of the group. Write them backwards @@ -2329,9 +2442,20 @@ set_group_contents (abfd, sec, failedptrarg) directives, not that it matters. */ while (elt != NULL) { + asection *s; + unsigned int idx; + loc -= 4; - H_PUT_32 (abfd, elf_section_data (elt)->this_idx, loc); + s = elt; + if (!gas) + s = s->output_section; + idx = 0; + if (s != NULL) + idx = elf_section_data (s)->this_idx; + H_PUT_32 (abfd, idx, loc); elt = elf_next_in_group (elt); + if (elt == first) + break; } /* If this is a relocatable link, then the above did nothing because @@ -2350,10 +2474,16 @@ set_group_contents (abfd, sec, failedptrarg) } while (elt != elf_next_in_group (l->u.indirect.section)); - loc -= 4; - H_PUT_32 (abfd, 0, loc); + /* With ld -r, merging SHT_GROUP sections results in wasted space + due to allowing for the flag word on each input. We may well + duplicate entries too. */ + while ((loc -= 4) > sec->contents) + H_PUT_32 (abfd, 0, loc); - BFD_ASSERT (loc == sec->contents); + if (loc != sec->contents) + abort (); + + H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc); } /* Assign all ELF section numbers. The dummy first section is handled here @@ -2834,9 +2964,9 @@ _bfd_elf_compute_section_file_positions (abfd, link_info) return false; } - if (link_info == NULL || link_info->relocateable) + if (link_info == NULL) { - bfd_map_over_sections (abfd, set_group_contents, &failed); + bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed); if (failed) return false; } @@ -2943,6 +3073,8 @@ map_sections_to_segments (abfd) asection **hdrpp; boolean phdr_in_segment = true; boolean writable; + int tls_count = 0; + asection *first_tls = NULL; asection *dynsec, *eh_frame_hdr; bfd_size_type amt; @@ -3181,6 +3313,39 @@ map_sections_to_segments (abfd) *pm = m; pm = &m->next; } + if (s->flags & SEC_THREAD_LOCAL) + { + if (! tls_count) + first_tls = s; + tls_count++; + } + } + + /* If there are any SHF_TLS output sections, add PT_TLS segment. */ + if (tls_count > 0) + { + int i; + + amt = sizeof (struct elf_segment_map); + amt += (tls_count - 1) * sizeof (asection *); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_TLS; + m->count = tls_count; + /* Mandated PF_R. */ + m->p_flags = PF_R; + m->p_flags_valid = 1; + for (i = 0; i < tls_count; ++i) + { + BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL); + m->sections[i] = first_tls; + first_tls = first_tls->next; + } + + *pm = m; + pm = &m->next; } /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME @@ -3295,6 +3460,37 @@ assign_file_positions_for_segments (abfd) if (! map_sections_to_segments (abfd)) return false; } + else + { + /* The placement algorithm assumes that non allocated sections are + not in PT_LOAD segments. We ensure this here by removing such + sections from the segment map. */ + for (m = elf_tdata (abfd)->segment_map; + m != NULL; + m = m->next) + { + unsigned int new_count; + unsigned int i; + + if (m->p_type != PT_LOAD) + continue; + + new_count = 0; + for (i = 0; i < m->count; i ++) + { + if ((m->sections[i]->flags & SEC_ALLOC) != 0) + { + if (i != new_count) + m->sections[new_count] = m->sections[i]; + + new_count ++; + } + } + + if (new_count != m->count) + m->count = new_count; + } + } if (bed->elf_backend_modify_segment_map) { @@ -3424,8 +3620,9 @@ assign_file_positions_for_segments (abfd) if (p->p_vaddr < (bfd_vma) off) { - _bfd_error_handler (_("%s: Not enough room for program headers, try linking with -N"), - bfd_get_filename (abfd)); + (*_bfd_error_handler) + (_("%s: Not enough room for program headers, try linking with -N"), + bfd_get_filename (abfd)); bfd_set_error (bfd_error_bad_value); return false; } @@ -3605,6 +3802,20 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a if ((flags & SEC_LOAD) != 0) p->p_filesz += sec->_raw_size; + if (p->p_type == PT_TLS + && sec->_raw_size == 0 + && (sec->flags & SEC_HAS_CONTENTS) == 0) + { + struct bfd_link_order *o; + bfd_vma tbss_size = 0; + + for (o = sec->link_order_head; o != NULL; o = o->next) + if (tbss_size < o->offset + o->size) + tbss_size = o->offset + o->size; + + p->p_memsz += tbss_size; + } + if (align > p->p_align && (p->p_type != PT_LOAD || (abfd->flags & D_PAGED) == 0)) p->p_align = align; @@ -3649,6 +3860,11 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a } } + /* If additional nonloadable filepos adjustments are required, + do them now. */ + if (bed->set_nonloadable_filepos) + (*bed->set_nonloadable_filepos) (abfd, phdrs); + /* Clear out any program headers we allocated but did not use. */ for (; count < alloc; count++, p++) { @@ -3739,6 +3955,16 @@ get_program_header_size (abfd) } } + for (s = abfd->sections; s != NULL; s = s->next) + { + if (s->flags & SEC_THREAD_LOCAL) + { + /* We need a PT_TLS segment. */ + ++segs; + break; + } + } + /* Let the backend count up any program headers it might need. */ if (bed->elf_backend_additional_program_headers) { @@ -4197,6 +4423,7 @@ copy_private_bfd_data (ibfd, obfd) bfd_vma maxpagesize; struct elf_segment_map * phdr_adjust_seg = NULL; unsigned int phdr_adjust_num = 0; + struct elf_backend_data * bed; if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour || bfd_get_flavour (obfd) != bfd_target_elf_flavour) @@ -4205,6 +4432,7 @@ copy_private_bfd_data (ibfd, obfd) if (elf_tdata (ibfd)->phdr == NULL) return true; + bed = get_elf_backend_data (ibfd); iehdr = elf_elfheader (ibfd); map_first = NULL; @@ -4232,6 +4460,13 @@ copy_private_bfd_data (ibfd, obfd) && (section->lma + section->_raw_size) \ <= SEGMENT_END (segment, base)) + /* Returns true if the given section is contained within the + given segment. Filepos addresses are compared in an elf + backend function. */ +#define IS_CONTAINED_BY_FILEPOS(sec, seg, bed) \ + (bed->is_contained_by_filepos \ + && (*bed->is_contained_by_filepos) (sec, seg)) + /* Special case: corefile "NOTE" section containing regs, prpsinfo etc. */ #define IS_COREFILE_NOTE(p, s) \ (p->p_type == PT_NOTE \ @@ -4260,13 +4495,15 @@ copy_private_bfd_data (ibfd, obfd) 2. It is an allocated segment, 3. There is an output section associated with it, 4. The section has not already been allocated to a previous segment. */ -#define INCLUDE_SECTION_IN_SEGMENT(section, segment) \ +#define INCLUDE_SECTION_IN_SEGMENT(section, segment, bed) \ (((((segment->p_paddr \ ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr) \ : IS_CONTAINED_BY_VMA (section, segment)) \ || IS_SOLARIS_PT_INTERP (segment, section)) \ && (section->flags & SEC_ALLOC) != 0) \ - || IS_COREFILE_NOTE (segment, section)) \ + || IS_COREFILE_NOTE (segment, section) \ + || (IS_CONTAINED_BY_FILEPOS (section, segment, bed) \ + && (section->flags & SEC_ALLOC) == 0)) \ && section->output_section != NULL \ && section->segment_mark == false) @@ -4366,7 +4603,7 @@ copy_private_bfd_data (ibfd, obfd) /* Compute how many sections might be placed into this segment. */ section_count = 0; for (section = ibfd->sections; section != NULL; section = section->next) - if (INCLUDE_SECTION_IN_SEGMENT (section, segment)) + if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed)) ++section_count; /* Allocate a segment map big enough to contain all of the @@ -4409,11 +4646,12 @@ copy_private_bfd_data (ibfd, obfd) { /* Special segments, such as the PT_PHDR segment, may contain no sections, but ordinary, loadable segments should contain - something. */ + something. They are allowed by the ELF spec however, so only + a warning is produced. */ if (segment->p_type == PT_LOAD) - _bfd_error_handler - (_("%s: warning: Empty loadable segment detected\n"), - bfd_archive_filename (ibfd)); + (*_bfd_error_handler) + (_("%s: warning: Empty loadable segment detected, is this intentional ?\n"), + bfd_archive_filename (ibfd)); map->count = 0; *pointer_to_map = map; @@ -4450,7 +4688,9 @@ copy_private_bfd_data (ibfd, obfd) pointers that we are interested in. As these sections get assigned to a segment, they are removed from this array. */ - amt = (bfd_size_type) section_count * sizeof (asection *); + /* Gcc 2.96 miscompiles this code on mips. Don't do casting here + to work around this long long bug. */ + amt = section_count * sizeof (asection *); sections = (asection **) bfd_malloc (amt); if (sections == NULL) return false; @@ -4469,7 +4709,7 @@ copy_private_bfd_data (ibfd, obfd) section != NULL; section = section->next) { - if (INCLUDE_SECTION_IN_SEGMENT (section, segment)) + if (INCLUDE_SECTION_IN_SEGMENT (section, segment, bed)) { output_section = section->output_section; @@ -4495,6 +4735,7 @@ copy_private_bfd_data (ibfd, obfd) /* Match up the physical address of the segment with the LMA address of the output section. */ if (IS_CONTAINED_BY_LMA (output_section, segment, map->p_paddr) + || IS_CONTAINED_BY_FILEPOS (section, segment, bed) || IS_COREFILE_NOTE (segment, section)) { if (matching_lma == 0) @@ -4564,7 +4805,7 @@ copy_private_bfd_data (ibfd, obfd) } /* Step Three: Loop over the sections again, this time assigning - those that fit to the current segment and remvoing them from the + those that fit to the current segment and removing them from the sections array; but making sure not to leave large gaps. Once all possible sections have been assigned to the current segment it is added to the list of built segments and if sections still remain @@ -4615,7 +4856,7 @@ copy_private_bfd_data (ibfd, obfd) maxpagesize then we need to start a new segment. */ if ((BFD_ALIGN (prev_sec->lma + prev_sec->_raw_size, maxpagesize) - < BFD_ALIGN (output_section->lma, maxpagesize)) + < BFD_ALIGN (output_section->lma, maxpagesize)) || ((prev_sec->lma + prev_sec->_raw_size) > output_section->lma)) { @@ -4728,6 +4969,7 @@ copy_private_bfd_data (ibfd, obfd) #undef SEGMENT_END #undef IS_CONTAINED_BY_VMA #undef IS_CONTAINED_BY_LMA +#undef IS_CONTAINED_BY_FILEPOS #undef IS_COREFILE_NOTE #undef IS_SOLARIS_PT_INTERP #undef INCLUDE_SECTION_IN_SEGMENT @@ -4747,6 +4989,7 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) asection *osec; { Elf_Internal_Shdr *ihdr, *ohdr; + const struct elf_backend_data *bed = get_elf_backend_data (ibfd); if (ibfd->xvec->flavour != bfd_target_elf_flavour || obfd->xvec->flavour != bfd_target_elf_flavour) @@ -4756,24 +4999,31 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) This must be done here, rather than in the copy_private_bfd_data entry point, because the latter is called after the section contents have been set, which means that the program headers have - already been worked out. */ - if (elf_tdata (obfd)->segment_map == NULL - && elf_tdata (ibfd)->phdr != NULL) - { - asection *s; - - /* Only set up the segments if there are no more SEC_ALLOC - sections. FIXME: This won't do the right thing if objcopy is - used to remove the last SEC_ALLOC section, since objcopy - won't call this routine in that case. */ - for (s = isec->next; s != NULL; s = s->next) - if ((s->flags & SEC_ALLOC) != 0) - break; - if (s == NULL) - { - if (! copy_private_bfd_data (ibfd, obfd)) - return false; - } + already been worked out. The backend function provides a way to + override the test conditions and code path for the call to + copy_private_bfd_data. */ + if (bed->copy_private_bfd_data_p) + { + if ((*bed->copy_private_bfd_data_p) (ibfd, isec, obfd, osec)) + if (! copy_private_bfd_data (ibfd, obfd)) + return false; + } + else if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL) + { + asection *s; + + /* Only set up the segments if there are no more SEC_ALLOC + sections. FIXME: This won't do the right thing if objcopy is + used to remove the last SEC_ALLOC section, since objcopy + won't call this routine in that case. */ + for (s = isec->next; s != NULL; s = s->next) + if ((s->flags & SEC_ALLOC) != 0) + break; + if (s == NULL) + { + if (! copy_private_bfd_data (ibfd, obfd)) + return false; + } } ihdr = &elf_section_data (isec)->this_hdr; @@ -4787,6 +5037,12 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) || ihdr->sh_type == SHT_GNU_verdef) ohdr->sh_info = ihdr->sh_info; + /* Set things up for objcopy. The output SHT_GROUP section will + have its elf_next_in_group pointing back to the input group + members. */ + elf_next_in_group (osec) = elf_next_in_group (isec); + elf_group_name (osec) = elf_group_name (isec); + elf_section_data (osec)->use_rela_p = elf_section_data (isec)->use_rela_p; @@ -4895,10 +5151,9 @@ swap_out_syms (abfd, sttp, relocatable_p) if (symtab_shndx_hdr->sh_name != 0) { amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx); - outbound_shndx = bfd_alloc (abfd, amt); + outbound_shndx = bfd_zalloc (abfd, amt); if (outbound_shndx == NULL) return false; - memset (outbound_shndx, 0, (unsigned long) amt); symtab_shndx_hdr->contents = outbound_shndx; symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; symtab_shndx_hdr->sh_size = amt; @@ -5032,13 +5287,18 @@ swap_out_syms (abfd, sttp, relocatable_p) sym.st_shndx = shndx; } - if ((flags & BSF_FUNCTION) != 0) + if ((flags & BSF_THREAD_LOCAL) != 0) + type = STT_TLS; + else if ((flags & BSF_FUNCTION) != 0) type = STT_FUNC; else if ((flags & BSF_OBJECT) != 0) type = STT_OBJECT; else type = STT_NOTYPE; + if (syms[idx]->section->flags & SEC_THREAD_LOCAL) + type = STT_TLS; + /* Processor-specific types */ if (type_ptr != NULL && bed->elf_backend_get_symbol_type) diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index ad7247ac0ff..ff5c5f47189 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -235,7 +235,7 @@ arc_elf_b22_pcrel (abfd, reloc_entry, symbol, data, input_section, return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); } - + #define TARGET_LITTLE_SYM bfd_elf32_littlearc_vec #define TARGET_LITTLE_NAME "elf32-littlearc" #define TARGET_BIG_SYM bfd_elf32_bigarc_vec diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 91ea63b38b0..939eee5f482 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -547,31 +547,22 @@ record_thumb_to_arm_glue (link_info, h) return; } -/* Select a BFD to be used to hold the sections used by the glue code. - This function is called from the linker scripts in ld/emultempl/ - {armelf/pe}.em */ +/* Add the glue sections to ABFD. This function is called from the + linker scripts in ld/emultempl/{armelf}.em. */ boolean -bfd_elf32_arm_get_bfd_for_interworking (abfd, info) +bfd_elf32_arm_add_glue_sections_to_bfd (abfd, info) bfd *abfd; struct bfd_link_info *info; { - struct elf32_arm_link_hash_table *globals; flagword flags; asection *sec; - /* If we are only performing a partial link do not bother - getting a bfd to hold the glue. */ + /* If we are only performing a partial + link do not bother adding the glue. */ if (info->relocateable) return true; - globals = elf32_arm_hash_table (info); - - BFD_ASSERT (globals != NULL); - - if (globals->bfd_of_glue_owner != NULL) - return true; - sec = bfd_get_section_by_name (abfd, ARM2THUMB_GLUE_SECTION_NAME); if (sec == NULL) @@ -609,6 +600,32 @@ bfd_elf32_arm_get_bfd_for_interworking (abfd, info) sec->gc_mark = 1; } + return true; +} + +/* Select a BFD to be used to hold the sections used by the glue code. + This function is called from the linker scripts in ld/emultempl/ + {armelf/pe}.em */ + +boolean +bfd_elf32_arm_get_bfd_for_interworking (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct elf32_arm_link_hash_table *globals; + + /* If we are only performing a partial link + do not bother getting a bfd to hold the glue. */ + if (info->relocateable) + return true; + + globals = elf32_arm_hash_table (info); + + BFD_ASSERT (globals != NULL); + + if (globals->bfd_of_glue_owner != NULL) + return true; + /* Save the bfd for later use. */ globals->bfd_of_glue_owner = abfd; @@ -1471,22 +1488,19 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) overflow = true; - /* Put RELOCATION back into the insn. */ - upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff); - lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff); - #ifndef OLD_ARM_ABI if (r_type == R_ARM_THM_XPC22 && ((lower_insn & 0x1800) == 0x0800)) - /* Remove bit zero of the adjusted offset. Bit zero can only be - set if the upper insn is at a half-word boundary, since the - destination address, an ARM instruction, must always be on a - word boundary. The semantics of the BLX (1) instruction, however, - are that bit zero in the offset must always be zero, and the - corresponding bit one in the target address will be set from bit - one of the source address. */ - lower_insn &= ~1; + /* For a BLX instruction, make sure that the relocation is rounded up + to a word boundary. This follows the semantics of the instruction + which specifies that bit 1 of the target address will come from bit + 1 of the base address. */ + relocation = (relocation + 2) & ~ 3; #endif + /* Put RELOCATION back into the insn. */ + upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff); + lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff); + /* Put the relocated value back in the object file: */ bfd_put_16 (input_bfd, upper_insn, hit_data); bfd_put_16 (input_bfd, lower_insn, hit_data + 2); @@ -1526,7 +1540,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, signed_check = check | ~((bfd_vma) -1 >> howto->rightshift); relocation |= (bfd_get_16 (input_bfd, hit_data) & (~ howto->dst_mask)); - + bfd_put_16 (input_bfd, relocation, hit_data); /* Assumes two's complement. */ @@ -1535,7 +1549,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, return bfd_reloc_ok; } - + case R_ARM_GNU_VTINHERIT: case R_ARM_GNU_VTENTRY: return bfd_reloc_ok; @@ -1560,7 +1574,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, if (sgot == NULL) return bfd_reloc_notsupported; - /* If we are addressing a Thumb function, we need to adjust the + /* If we are addressing a Thumb function, we need to adjust the address by one, so that attempts to call the function pointer will correctly interpret it as Thumb code. */ if (sym_flags == STT_ARM_TFUNC) @@ -2360,7 +2374,7 @@ ERROR: %s uses hardware FP, whereas %s uses software FP"), _bfd_error_handler (_("\ Warning: %s supports interworking, whereas %s does not"), bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + bfd_get_filename (obfd)); } else { diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index ab72483304b..28fecf18aaf 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -547,7 +547,7 @@ cris_elf_grok_psinfo (abfd, note) static const bfd_byte elf_cris_plt0_entry[PLT_ENTRY_SIZE] = { 0xfc, 0xe1, - 0x7e, 0x7e, /* push mof. */ + 0x7e, 0x7e, /* push mof. */ 0x7f, 0x0d, /* (dip [pc+]) */ 0, 0, 0, 0, /* Replaced with address of .got + 4. */ 0x30, 0x7a, /* move [...],mof */ diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 52213ec84ec..1a841a7e74e 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -1,5 +1,6 @@ /* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright 1993, 1995, 1998, 1999, 2001, 2002 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -677,10 +678,7 @@ elf32_h8_merge_private_bfd_data (ibfd, obfd) mov.b:16 -> mov.b:8 2 bytes mov.b:24/32 -> mov.b:8 4 bytes - mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes - - -*/ + mov.[bwl]:24/32 -> mov.[bwl]:16 2 bytes */ static boolean elf32_h8_relax_section (abfd, sec, link_info, again) @@ -747,6 +745,13 @@ elf32_h8_relax_section (abfd, sec, link_info, again) if (irel != internal_relocs) last_reloc = irel - 1; + if (ELF32_R_TYPE (irel->r_info) != R_H8_DIR24R8 + && ELF32_R_TYPE (irel->r_info) != R_H8_PCREL16 + && ELF32_R_TYPE (irel->r_info) != R_H8_DIR16A8 + && ELF32_R_TYPE (irel->r_info) != R_H8_DIR24A8 + && ELF32_R_TYPE (irel->r_info) != R_H8_DIR32A16) + continue; + /* Get the section contents if we haven't done so already. */ if (contents == NULL) { @@ -815,7 +820,8 @@ elf32_h8_relax_section (abfd, sec, link_info, again) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); symval = (isym.st_value @@ -911,7 +917,9 @@ elf32_h8_relax_section (abfd, sec, link_info, again) shndx = shndx_buf; if (shndx != NULL) shndx += ELF32_R_SYM (last_reloc->r_info); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &last_symbol); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, + (const PTR) shndx, + &last_symbol); last_sym_sec = bfd_section_from_elf_index (abfd, last_symbol.st_shndx); @@ -1338,7 +1346,8 @@ elf32_h8_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; Elf_External_Sym_Shndx dummy; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value > addr @@ -1399,7 +1408,8 @@ elf32_h8_symbol_address_p (abfd, sec, addr) { Elf_Internal_Sym isym; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value == addr) @@ -1521,7 +1531,8 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order, { asection *isec; - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isymp); if (isymp->st_shndx == SHN_UNDEF) isec = bfd_und_section_ptr; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 4dc7e9b16d9..684213514cd 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -2558,7 +2558,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info) /* Set up various things so that we can make a list of input sections for each output section included in the link. Returns -1 on error, - 0 when no stubs will be needed, and 1 on success. */ + 0 when no stubs will be needed, and 1 on success. */ int elf32_hppa_setup_section_lists (output_bfd, info) @@ -2827,7 +2827,8 @@ get_local_syms (output_bfd, input_bfd, info) isym = local_syms, shndx = shndx_buf; esym < end_sy; esym++, isym++, shndx = (shndx ? shndx + 1 : NULL)) - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isym); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isym); /* Now we can free the external symbols. */ free (shndx_buf); diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index fc82b47a080..e0ec33c2b8d 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -319,7 +319,7 @@ static boolean i370_elf_create_dynamic_sections PARAMS ((bfd *, static boolean i370_elf_section_from_shdr PARAMS ((bfd *, Elf32_Internal_Shdr *, - char *)); + const char *)); static boolean i370_elf_fake_sections PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); @@ -429,7 +429,7 @@ static boolean i370_elf_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf32_Internal_Shdr *hdr; - char *name; + const char *name; { asection *newsect; flagword flags; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 760762d1723..652fb1a776c 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -46,6 +46,13 @@ static boolean elf_i386_create_dynamic_sections PARAMS((bfd *, struct bfd_link_info *)); static void elf_i386_copy_indirect_symbol PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); +static int elf_i386_tls_transition + PARAMS ((struct bfd_link_info *, int, int)); + +static boolean elf_i386_mkobject + PARAMS((bfd *)); +static boolean elf_i386_object_p + PARAMS((bfd *)); static boolean elf_i386_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -65,6 +72,10 @@ static boolean elf_i386_fake_sections PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); static boolean elf_i386_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 elf_i386_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); @@ -121,9 +132,18 @@ static reloc_howto_type elf_howto_table[]= R_386_ext_offset is the value to subtract from a reloc type of R_386_16 thru R_386_PC8 to form an index into this table. */ #define R_386_standard ((unsigned int) R_386_GOTPC + 1) -#define R_386_ext_offset ((unsigned int) R_386_16 - R_386_standard) +#define R_386_ext_offset ((unsigned int) R_386_TLS_LE - R_386_standard) /* The remaining relocs are a GNU extension. */ + HOWTO(R_386_TLS_LE, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_LE", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_GD, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_GD", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_LDM, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_LDM", + true, 0xffffffff, 0xffffffff, false), HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_386_16", true, 0xffff, 0xffff, false), @@ -137,9 +157,31 @@ static reloc_howto_type elf_howto_table[]= bfd_elf_generic_reloc, "R_386_PC8", true, 0xff, 0xff, true), - /* Another gap. */ #define R_386_ext ((unsigned int) R_386_PC8 + 1 - R_386_ext_offset) -#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_ext) +#define R_386_tls_offset ((unsigned int) R_386_TLS_LDO_32 - R_386_ext) + /* These are common with Solaris TLS implementation. */ + HOWTO(R_386_TLS_LDO_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_LDO_32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_IE_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_IE_32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_LE_32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_LE_32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_DTPMOD32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_DTPMOD32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_DTPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_DTPOFF32", + true, 0xffffffff, 0xffffffff, false), + HOWTO(R_386_TLS_TPOFF32, 0, 2, 32, false, 0, complain_overflow_bitfield, + bfd_elf_generic_reloc, "R_386_TLS_TPOFF32", + true, 0xffffffff, 0xffffffff, false), + + /* Another gap. */ +#define R_386_tls ((unsigned int) R_386_TLS_TPOFF32 + 1 - R_386_tls_offset) +#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_tls) /* GNU extension to record C++ vtable hierarchy. */ HOWTO (R_386_GNU_VTINHERIT, /* type */ @@ -237,6 +279,18 @@ elf_i386_reloc_type_lookup (abfd, code) return &elf_howto_table[(unsigned int) R_386_GOTPC ]; /* The remaining relocs are a GNU extension. */ + case BFD_RELOC_386_TLS_LE: + TRACE ("BFD_RELOC_386_TLS_LE"); + return &elf_howto_table[(unsigned int) R_386_TLS_LE - R_386_ext_offset]; + + case BFD_RELOC_386_TLS_GD: + TRACE ("BFD_RELOC_386_TLS_GD"); + return &elf_howto_table[(unsigned int) R_386_TLS_GD - R_386_ext_offset]; + + case BFD_RELOC_386_TLS_LDM: + TRACE ("BFD_RELOC_386_TLS_LDM"); + return &elf_howto_table[(unsigned int) R_386_TLS_LDM - R_386_ext_offset]; + case BFD_RELOC_16: TRACE ("BFD_RELOC_16"); return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset]; @@ -253,6 +307,31 @@ elf_i386_reloc_type_lookup (abfd, code) TRACE ("BFD_RELOC_8_PCREL"); return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset]; + /* Common with Sun TLS implementation. */ + case BFD_RELOC_386_TLS_LDO_32: + TRACE ("BFD_RELOC_386_TLS_LDO_32"); + return &elf_howto_table[(unsigned int) R_386_TLS_LDO_32 - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_IE_32: + TRACE ("BFD_RELOC_386_TLS_IE_32"); + return &elf_howto_table[(unsigned int) R_386_TLS_IE_32 - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_LE_32: + TRACE ("BFD_RELOC_386_TLS_LE_32"); + return &elf_howto_table[(unsigned int) R_386_TLS_LE_32 - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_DTPMOD32: + TRACE ("BFD_RELOC_386_TLS_DTPMOD32"); + return &elf_howto_table[(unsigned int) R_386_TLS_DTPMOD32 - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_DTPOFF32: + TRACE ("BFD_RELOC_386_TLS_DTPOFF32"); + return &elf_howto_table[(unsigned int) R_386_TLS_DTPOFF32 - R_386_tls_offset]; + + case BFD_RELOC_386_TLS_TPOFF32: + TRACE ("BFD_RELOC_386_TLS_TPOFF32"); + return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF32 - R_386_tls_offset]; + case BFD_RELOC_VTABLE_INHERIT: TRACE ("BFD_RELOC_VTABLE_INHERIT"); return &elf_howto_table[(unsigned int) R_386_GNU_VTINHERIT @@ -292,8 +371,10 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) if ((indx = r_type) >= R_386_standard && ((indx = r_type - R_386_ext_offset) - R_386_standard >= R_386_ext - R_386_standard) - && ((indx = r_type - R_386_vt_offset) - R_386_ext - >= R_386_vt - R_386_ext)) + && ((indx = r_type - R_386_tls_offset) - R_386_ext + >= R_386_tls - R_386_ext) + && ((indx = r_type - R_386_vt_offset) - R_386_tls + >= R_386_vt - R_386_tls)) { (*_bfd_error_handler) (_("%s: invalid relocation type %d"), bfd_archive_filename (abfd), (int) r_type); @@ -481,8 +562,54 @@ struct elf_i386_link_hash_entry /* Track dynamic relocs copied for this symbol. */ struct elf_i386_dyn_relocs *dyn_relocs; + + enum { + GOT_UNKNOWN = 0, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE + } tls_type; }; +#define elf_i386_hash_entry(ent) ((struct elf_i386_link_hash_entry *)(ent)) + +struct elf_i386_obj_tdata +{ + struct elf_obj_tdata root; + + /* tls_type for each local got entry. */ + char *local_got_tls_type; +}; + +#define elf_i386_tdata(abfd) \ + ((struct elf_i386_obj_tdata *) (abfd)->tdata.any) + +#define elf_i386_local_got_tls_type(abfd) \ + (elf_i386_tdata (abfd)->local_got_tls_type) + +static boolean +elf_i386_mkobject (abfd) + bfd *abfd; +{ + bfd_size_type amt = sizeof (struct elf_i386_obj_tdata); + abfd->tdata.any = bfd_zalloc (abfd, amt); + if (abfd->tdata.any == NULL) + return false; + return true; +} + +static boolean +elf_i386_object_p (abfd) + bfd *abfd; +{ + /* Allocate our special target data. */ + struct elf_i386_obj_tdata *new_tdata; + bfd_size_type amt = sizeof (struct elf_i386_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; + return true; +} + /* i386 ELF linker hash table. */ struct elf_i386_link_hash_table @@ -498,6 +625,11 @@ struct elf_i386_link_hash_table asection *sdynbss; asection *srelbss; + union { + bfd_signed_vma refcount; + bfd_vma offset; + } tls_ldm_got; + /* Small local sym to section mapping cache. */ struct sym_sec_cache sym_sec; }; @@ -533,6 +665,7 @@ link_hash_newfunc (entry, table, string) eh = (struct elf_i386_link_hash_entry *) entry; eh->dyn_relocs = NULL; + eh->tls_type = GOT_UNKNOWN; } return entry; @@ -678,6 +811,29 @@ elf_i386_copy_indirect_symbol (dir, ind) _bfd_elf_link_hash_copy_indirect (dir, ind); } +static int +elf_i386_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_386_TLS_GD: + case R_386_TLS_IE_32: + if (is_local) + return R_386_TLS_LE_32; + return R_386_TLS_IE_32; + case R_386_TLS_LDM: + return R_386_TLS_LE_32; + } + + 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. */ @@ -708,10 +864,12 @@ elf_i386_check_relocs (abfd, info, sec, relocs) 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 = ELF32_R_SYM (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { @@ -726,38 +884,86 @@ elf_i386_check_relocs (abfd, info, sec, relocs) else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - switch (ELF32_R_TYPE (rel->r_info)) + r_type = elf_i386_tls_transition (info, r_type, h == NULL); + + switch (r_type) { + case R_386_TLS_IE_32: + if (info->shared) + info->flags |= DF_STATIC_TLS; + /* FALLTHROUGH */ case R_386_GOT32: + case R_386_TLS_GD: /* This symbol requires a global offset table entry. */ - if (h != NULL) - { - h->got.refcount += 1; - } - 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); - local_got_refcounts = ((bfd_signed_vma *) - bfd_zalloc (abfd, size)); - if (local_got_refcounts == NULL) + { + int tls_type, old_tls_type; + + switch (r_type) + { + default: + case R_386_GOT32: tls_type = GOT_NORMAL; break; + case R_386_TLS_GD: tls_type = GOT_TLS_GD; break; + case R_386_TLS_IE_32: tls_type = GOT_TLS_IE; break; + } + + if (h != NULL) + { + h->got.refcount += 1; + old_tls_type = elf_i386_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; + elf_i386_local_got_tls_type (abfd) + = (char *) (local_got_refcounts + symtab_hdr->sh_info); + } + local_got_refcounts[r_symndx] += 1; + old_tls_type = elf_i386_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 = GOT_TLS_IE; + else + { + (*_bfd_error_handler) + (_("%s: `%s' accessed both as normal and thread local symbol"), + bfd_archive_filename (abfd), h->root.root.string); 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) + elf_i386_hash_entry (h)->tls_type = tls_type; + else + elf_i386_local_got_tls_type (abfd) [r_symndx] = tls_type; + } + } /* Fall through */ case R_386_GOTOFF: case R_386_GOTPC: + create_got: if (htab->sgot == NULL) { if (htab->elf.dynobj == NULL) @@ -767,6 +973,10 @@ elf_i386_check_relocs (abfd, info, sec, relocs) } break; + case R_386_TLS_LDM: + htab->tls_ldm_got.refcount += 1; + goto create_got; + case R_386_PLT32: /* This symbol requires a procedure linkage table entry. We actually build the entry in adjust_dynamic_symbol, @@ -824,7 +1034,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs) symbol. */ if ((info->shared && (sec->flags & SEC_ALLOC) != 0 - && (ELF32_R_TYPE (rel->r_info) != R_386_PC32 + && (r_type != R_386_PC32 || (h != NULL && (! info->symbolic || h->root.type == bfd_link_hash_defweak @@ -923,7 +1133,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs) } p->count += 1; - if (ELF32_R_TYPE (rel->r_info) == R_386_PC32) + if (r_type == R_386_PC32) p->pc_count += 1; } break; @@ -942,6 +1152,16 @@ elf_i386_check_relocs (abfd, info, sec, relocs) return false; break; + case R_386_TLS_LE_32: + case R_386_TLS_LE: + if (info->shared) + { + (*_bfd_error_handler) (_("%s: TLS local exec code cannot be linked into shared objects"), + bfd_archive_filename (abfd)); + return false; + } + break; + default: break; } @@ -1016,11 +1236,18 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs) relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; rel++) - switch (ELF32_R_TYPE (rel->r_info)) + switch (elf_i386_tls_transition (info, ELF32_R_TYPE (rel->r_info), + ELF32_R_SYM (rel->r_info) + >= symtab_hdr->sh_info)) { + case R_386_TLS_LDM: + if (elf_i386_hash_table (info)->tls_ldm_got.refcount > 0) + elf_i386_hash_table (info)->tls_ldm_got.refcount -= 1; + break; + + case R_386_TLS_GD: + case R_386_TLS_IE_32: case R_386_GOT32: - case R_386_GOTOFF: - case R_386_GOTPC: r_symndx = ELF32_R_SYM (rel->r_info); if (r_symndx >= symtab_hdr->sh_info) { @@ -1173,7 +1400,7 @@ elf_i386_adjust_dynamic_symbol (info, h) } /* If we didn't find any dynamic relocs in read-only sections, then - we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (p == NULL) { h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; @@ -1319,10 +1546,18 @@ allocate_dynrelocs (h, inf) h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; } - if (h->got.refcount > 0) + /* If R_386_TLS_IE_32 symbol is now local to the binary, + make it a R_386_TLS_LE_32 requiring no TLS entry. */ + if (h->got.refcount > 0 + && !info->shared + && h->dynindx == -1 + && elf_i386_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 = elf_i386_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. */ @@ -1336,8 +1571,18 @@ allocate_dynrelocs (h, inf) s = htab->sgot; h->got.offset = s->_raw_size; s->_raw_size += 4; + /* R_386_TLS_GD needs 2 consecutive GOT slots. */ + if (tls_type == GOT_TLS_GD) + s->_raw_size += 4; dyn = htab->elf.dynamic_sections_created; - if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + /* R_386_TLS_IE_32 needs one dynamic relocation, + R_386_TLS_GD needs one if local symbol and two if global. */ + if ((tls_type == GOT_TLS_GD && h->dynindx == -1) + || tls_type == GOT_TLS_IE) + htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); + else if (tls_type == GOT_TLS_GD) + htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rel); + else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); } else @@ -1483,6 +1728,7 @@ elf_i386_size_dynamic_sections (output_bfd, info) { 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; @@ -1524,15 +1770,20 @@ elf_i386_size_dynamic_sections (output_bfd, info) symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; locsymcount = symtab_hdr->sh_info; end_local_got = local_got + locsymcount; + local_tls_type = elf_i386_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 += 4; - if (info->shared) + if (*local_tls_type == GOT_TLS_GD) + s->_raw_size += 4; + if (info->shared + || *local_tls_type == GOT_TLS_GD + || *local_tls_type == GOT_TLS_IE) srel->_raw_size += sizeof (Elf32_External_Rel); } else @@ -1540,6 +1791,17 @@ elf_i386_size_dynamic_sections (output_bfd, info) } } + if (htab->tls_ldm_got.refcount > 0) + { + /* Allocate 2 got entries and 1 dynamic reloc for R_386_TLS_LDM + relocs. */ + htab->tls_ldm_got.offset = htab->sgot->_raw_size; + htab->sgot->_raw_size += 8; + htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); + } + else + htab->tls_ldm_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); @@ -1685,6 +1947,34 @@ elf_i386_fake_sections (abfd, hdr, sec) 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; +{ + BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL); + 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; + + BFD_ASSERT (tls_segment != NULL); + return (align_power (tls_segment->size, tls_segment->align) + + tls_segment->start - address); +} + /* Relocate an i386 ELF section. */ static boolean @@ -1715,7 +2005,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, 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; @@ -1726,6 +2016,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, boolean unresolved_reloc; bfd_reloc_status_type r; unsigned int indx; + int tls_type; r_type = ELF32_R_TYPE (rel->r_info); if (r_type == (int) R_386_GNU_VTINHERIT @@ -1733,8 +2024,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, continue; if ((indx = (unsigned) r_type) >= R_386_standard - && ((indx = (unsigned) r_type - R_386_ext_offset) - R_386_standard - >= R_386_ext - R_386_standard)) + && ((indx = r_type - R_386_ext_offset) - R_386_standard + >= R_386_ext - R_386_standard) + && ((indx = r_type - R_386_tls_offset) - R_386_ext + >= R_386_tls - R_386_ext)) { bfd_set_error (bfd_error_bad_value); return false; @@ -2118,6 +2411,330 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, } break; + case R_386_TLS_GD: + case R_386_TLS_IE_32: + r_type = elf_i386_tls_transition (info, r_type, h == NULL); + tls_type = GOT_UNKNOWN; + if (h == NULL && local_got_offsets) + tls_type = elf_i386_local_got_tls_type (input_bfd) [r_symndx]; + else if (h != NULL) + { + tls_type = elf_i386_hash_entry(h)->tls_type; + if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE) + r_type = R_386_TLS_LE_32; + } + if (r_type == R_386_TLS_GD && tls_type == GOT_TLS_IE) + r_type = R_386_TLS_IE_32; + + if (r_type == R_386_TLS_LE_32) + { + BFD_ASSERT (unresolved_reloc == false); + if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GD) + { + unsigned int val, type; + bfd_vma roff; + + /* GD->LE transition. */ + BFD_ASSERT (rel->r_offset >= 2); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + BFD_ASSERT (type == 0x8d || type == 0x04); + 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 (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32); + roff = rel->r_offset + 5; + val = bfd_get_8 (input_bfd, + contents + rel->r_offset - 1); + if (type == 0x04) + { + /* leal foo(,%reg,1), %eax; call ___tls_get_addr + Change it into: + movl %gs:0, %eax; subl $foo@tpoff, %eax + (6 byte form of subl). */ + BFD_ASSERT (rel->r_offset >= 3); + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset - 3) + == 0x8d); + BFD_ASSERT ((val & 0xc7) == 0x05 && val != (4 << 3)); + memcpy (contents + rel->r_offset - 3, + "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12); + } + else + { + BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4); + if (rel->r_offset + 10 <= input_section->_raw_size + && bfd_get_8 (input_bfd, + contents + rel->r_offset + 9) == 0x90) + { + /* leal foo(%reg), %eax; call ___tls_get_addr; nop + Change it into: + movl %gs:0, %eax; subl $foo@tpoff, %eax + (6 byte form of subl). */ + memcpy (contents + rel->r_offset - 2, + "\x65\xa1\0\0\0\0\x81\xe8\0\0\0", 12); + roff = rel->r_offset + 6; + } + else + { + /* leal foo(%reg), %eax; call ___tls_get_addr + Change it into: + movl %gs:0, %eax; subl $foo@tpoff, %eax + (5 byte form of subl). */ + memcpy (contents + rel->r_offset - 2, + "\x65\xa1\0\0\0\0\x2d\0\0\0", 11); + } + } + bfd_put_32 (output_bfd, tpoff (info, relocation), + contents + roff); + /* Skip R_386_PLT32. */ + rel++; + continue; + } + else + { + unsigned int val, type; + + /* IE->LE transition: + Originally it can be either: + subl foo(%reg1), %reg2 + or + movl foo(%reg1), %reg2 + We change it into: + subl $foo, %reg2 + or + movl $foo, %reg2 (6 byte form) */ + BFD_ASSERT (rel->r_offset >= 2); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); + BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size); + if (type == 0x8b) + { + /* movl */ + BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4); + bfd_put_8 (output_bfd, 0xc7, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + } + else if (type == 0x2b) + { + /* subl */ + BFD_ASSERT ((val & 0xc0) == 0x80 && (val & 7) != 4); + bfd_put_8 (output_bfd, 0x81, + contents + rel->r_offset - 2); + bfd_put_8 (output_bfd, 0xe8 | ((val >> 3) & 7), + contents + rel->r_offset - 1); + } + else + BFD_FAIL (); + 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_Rel outrel; + Elf32_External_Rel *loc; + int dr_type, indx; + + if (htab->srelgot == NULL) + abort (); + + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); + + bfd_put_32 (output_bfd, 0, + htab->sgot->contents + off); + indx = h && h->dynindx != -1 ? h->dynindx : 0; + if (r_type == R_386_TLS_GD) + dr_type = R_386_TLS_DTPMOD32; + else + dr_type = R_386_TLS_TPOFF32; + outrel.r_info = ELF32_R_INFO (indx, dr_type); + loc = (Elf32_External_Rel *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + + if (r_type == R_386_TLS_GD) + { + if (indx == 0) + { + BFD_ASSERT (unresolved_reloc == false); + bfd_put_32 (output_bfd, + relocation - dtpoff_base (info), + htab->sgot->contents + off + 4); + } + else + { + bfd_put_32 (output_bfd, 0, + htab->sgot->contents + off + 4); + outrel.r_info = ELF32_R_INFO (indx, + R_386_TLS_DTPOFF32); + outrel.r_offset += 4; + htab->srelgot->reloc_count++; + loc++; + bfd_elf32_swap_reloc_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 == ELF32_R_TYPE (rel->r_info)) + { + relocation = htab->sgot->output_offset + off; + unresolved_reloc = false; + } + else + { + unsigned int val, type; + bfd_vma roff; + + /* GD->IE transition. */ + BFD_ASSERT (rel->r_offset >= 2); + type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + BFD_ASSERT (type == 0x8d || type == 0x04); + 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 (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32); + roff = rel->r_offset - 3; + val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); + if (type == 0x04) + { + /* leal foo(,%reg,1), %eax; call ___tls_get_addr + Change it into: + movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */ + BFD_ASSERT (rel->r_offset >= 3); + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset - 3) + == 0x8d); + BFD_ASSERT ((val & 0xc7) == 0x05 && val != (4 << 3)); + val >>= 3; + } + else + { + /* leal foo(%reg), %eax; call ___tls_get_addr; nop + Change it into: + movl %gs:0, %eax; subl $foo@gottpoff(%reg), %eax. */ + BFD_ASSERT (rel->r_offset + 10 <= input_section->_raw_size); + BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4); + BFD_ASSERT (bfd_get_8 (input_bfd, + contents + rel->r_offset + 9) + == 0x90); + roff = rel->r_offset - 2; + } + memcpy (contents + roff, + "\x65\xa1\0\0\0\0\x2b\x80\0\0\0", 12); + contents[roff + 7] = 0x80 | (val & 7); + bfd_put_32 (output_bfd, htab->sgot->output_offset + off, + contents + roff + 8); + /* Skip R_386_PLT32. */ + rel++; + continue; + } + break; + + case R_386_TLS_LDM: + if (! info->shared) + { + unsigned int val; + + /* LD->LE transition: + Ensure it is: + leal foo(%reg), %eax; call ___tls_get_addr. + We change it into: + movl %gs:0, %eax; nop; leal 0(%esi,1), %esi. */ + BFD_ASSERT (rel->r_offset >= 2); + BFD_ASSERT (bfd_get_8 (input_bfd, contents + rel->r_offset - 2) + == 0x8d); + val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); + BFD_ASSERT ((val & 0xf8) == 0x80 && (val & 7) != 4); + 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 (ELF32_R_TYPE (rel[1].r_info) == R_386_PLT32); + memcpy (contents + rel->r_offset - 2, + "\x65\xa1\0\0\0\0\x90\x8d\x74\x26", 11); + /* Skip R_386_PLT32. */ + rel++; + continue; + } + + if (htab->sgot == NULL) + abort (); + + off = htab->tls_ldm_got.offset; + if (off & 1) + off &= ~1; + else + { + Elf_Internal_Rel outrel; + Elf32_External_Rel *loc; + + if (htab->srelgot == NULL) + abort (); + + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + off); + + bfd_put_32 (output_bfd, 0, + htab->sgot->contents + off); + bfd_put_32 (output_bfd, 0, + htab->sgot->contents + off + 4); + outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32); + loc = (Elf32_External_Rel *) htab->srelgot->contents; + loc += htab->srelgot->reloc_count++; + bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc); + htab->tls_ldm_got.offset |= 1; + } + relocation = htab->sgot->output_offset + off; + unresolved_reloc = false; + break; + + case R_386_TLS_LDO_32: + if (info->shared) + relocation -= dtpoff_base (info); + else + /* When converting LDO to LE, we must negate. */ + relocation = -tpoff (info, relocation); + break; + + case R_386_TLS_LE_32: + relocation = tpoff (info, relocation); + break; + + case R_386_TLS_LE: + relocation = -tpoff (info, relocation); + break; + default: break; } @@ -2268,12 +2885,14 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym) the .plt section. Leave the value alone. This is a clue for the dynamic linker, to make function pointer comparisons work between an application and shared - library. */ + library. */ sym->st_shndx = SHN_UNDEF; } } - if (h->got.offset != (bfd_vma) -1) + if (h->got.offset != (bfd_vma) -1 + && elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD + && elf_i386_hash_entry(h)->tls_type != GOT_TLS_IE) { Elf_Internal_Rel rel; Elf32_External_Rel *loc; @@ -2505,6 +3124,9 @@ elf_i386_finish_dynamic_sections (output_bfd, info) #define elf_info_to_howto elf_i386_info_to_howto #define elf_info_to_howto_rel elf_i386_info_to_howto_rel +#define bfd_elf32_mkobject elf_i386_mkobject +#define elf_backend_object_p elf_i386_object_p + #define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name #define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup @@ -2524,4 +3146,6 @@ elf_i386_finish_dynamic_sections (output_bfd, info) #define elf_backend_relocate_section elf_i386_relocate_section #define elf_backend_size_dynamic_sections elf_i386_size_dynamic_sections +#ifndef ELF32_I386_C_INCLUDED #include "elf32-target.h" +#endif diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 7d5b0166095..2006652cb3e 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -413,7 +413,7 @@ elf32_m68k_print_private_bfd_data (abfd, ptr) fprintf (file, _(" [cpu32]")); if (elf_elfheader (abfd)->e_flags & EF_M68000) - fprintf (file, _ (" [m68000]")); + fprintf (file, _(" [m68000]")); fputc ('\n', file); @@ -2211,7 +2211,8 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx); } diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 1e6cf6fe53d..92887385745 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -82,171 +82,25 @@ static boolean elf32_mips_grok_psinfo PARAMS ((bfd *, Elf_Internal_Note *)); static boolean elf32_mips_discard_info PARAMS ((bfd *, struct elf_reloc_cookie *, struct bfd_link_info *)); -static boolean elf32_mips_ignore_discarded_relocs - PARAMS ((asection *)); static boolean elf32_mips_write_section PARAMS ((bfd *, asection *, bfd_byte *)); static irix_compat_t elf32_mips_irix_compat PARAMS ((bfd *)); -extern const bfd_target bfd_elf32_tradbigmips_vec; -extern const bfd_target bfd_elf32_tradlittlemips_vec; +extern const bfd_target bfd_elf32_bigmips_vec; +extern const bfd_target bfd_elf32_littlemips_vec; /* Nonzero if ABFD is using the N32 ABI. */ - #define ABI_N32_P(abfd) \ ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0) -/* Nonzero if ABFD is using the 64-bit ABI. */ -#define ABI_64_P(abfd) \ - ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0) - -#define NEWABI_P(abfd) (ABI_N32_P (abfd) || ABI_64_P (abfd)) - /* Whether we are trying to be compatible with IRIX at all. */ #define SGI_COMPAT(abfd) \ (elf32_mips_irix_compat (abfd) != ict_none) -/* The size of an external REL relocation. */ -#define MIPS_ELF_REL_SIZE(abfd) \ - (get_elf_backend_data (abfd)->s->sizeof_rel) - /* The number of local .got entries we reserve. */ #define MIPS_RESERVED_GOTNO (2) -#if 0 -/* We no longer try to identify particular sections for the .dynsym - section. When we do, we wind up crashing if there are other random - sections with relocations. */ - -/* Names of sections which appear in the .dynsym section in an Irix 5 - executable. */ - -static const char * const mips_elf_dynsym_sec_names[] = -{ - ".text", - ".init", - ".fini", - ".data", - ".rodata", - ".sdata", - ".sbss", - ".bss", - NULL -}; - -#define SIZEOF_MIPS_DYNSYM_SECNAMES \ - (sizeof mips_elf_dynsym_sec_names / sizeof mips_elf_dynsym_sec_names[0]) - -/* The number of entries in mips_elf_dynsym_sec_names which go in the - text segment. */ - -#define MIPS_TEXT_DYNSYM_SECNO (3) - -#endif /* 0 */ - -/* The names of the runtime procedure table symbols used on Irix 5. */ - -static const char * const mips_elf_dynsym_rtproc_names[] = -{ - "_procedure_table", - "_procedure_string_table", - "_procedure_table_size", - NULL -}; - -/* These structures are used to generate the .compact_rel section on - Irix 5. */ - -typedef struct -{ - unsigned long id1; /* Always one? */ - unsigned long num; /* Number of compact relocation entries. */ - unsigned long id2; /* Always two? */ - unsigned long offset; /* The file offset of the first relocation. */ - unsigned long reserved0; /* Zero? */ - unsigned long reserved1; /* Zero? */ -} Elf32_compact_rel; - -typedef struct -{ - bfd_byte id1[4]; - bfd_byte num[4]; - bfd_byte id2[4]; - bfd_byte offset[4]; - bfd_byte reserved0[4]; - bfd_byte reserved1[4]; -} Elf32_External_compact_rel; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ - unsigned long vaddr; /* VADDR to be relocated. */ -} Elf32_crinfo; - -typedef struct -{ - unsigned int ctype : 1; /* 1: long 0: short format. See below. */ - unsigned int rtype : 4; /* Relocation types. See below. */ - unsigned int dist2to : 8; - unsigned int relvaddr : 19; /* (VADDR - vaddr of the previous entry)/ 4 */ - unsigned long konst; /* KONST field. See below. */ -} Elf32_crinfo2; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; - bfd_byte vaddr[4]; -} Elf32_External_crinfo; - -typedef struct -{ - bfd_byte info[4]; - bfd_byte konst[4]; -} Elf32_External_crinfo2; - -/* These are the constants used to swap the bitfields in a crinfo. */ - -#define CRINFO_CTYPE (0x1) -#define CRINFO_CTYPE_SH (31) -#define CRINFO_RTYPE (0xf) -#define CRINFO_RTYPE_SH (27) -#define CRINFO_DIST2TO (0xff) -#define CRINFO_DIST2TO_SH (19) -#define CRINFO_RELVADDR (0x7ffff) -#define CRINFO_RELVADDR_SH (0) - -/* A compact relocation info has long (3 words) or short (2 words) - formats. A short format doesn't have VADDR field and relvaddr - fields contains ((VADDR - vaddr of the previous entry) >> 2). */ -#define CRF_MIPS_LONG 1 -#define CRF_MIPS_SHORT 0 - -/* There are 4 types of compact relocation at least. The value KONST - has different meaning for each type: - - (type) (konst) - CT_MIPS_REL32 Address in data - CT_MIPS_WORD Address in word (XXX) - CT_MIPS_GPHI_LO GP - vaddr - CT_MIPS_JMPAD Address to jump - */ - -#define CRT_MIPS_REL32 0xa -#define CRT_MIPS_WORD 0xb -#define CRT_MIPS_GPHI_LO 0xc -#define CRT_MIPS_JMPAD 0xd - -#define mips_elf_set_cr_format(x,format) ((x).ctype = (format)) -#define mips_elf_set_cr_type(x,type) ((x).rtype = (type)) -#define mips_elf_set_cr_dist2to(x,v) ((x).dist2to = (v)) -#define mips_elf_set_cr_relvaddr(x,d) ((x).relvaddr = (d)<<2) - /* In case we're on a 32-bit machine, construct a 64-bit "-1" value from smaller values. Start with zero, widen, *then* decrement. */ #define MINUS_ONE (((bfd_vma)0) - 1) @@ -904,7 +758,7 @@ mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_vma relocation; struct mips_hi16 *n; - /* If we're relocating, and this an external symbol, we don't want + /* If we're relocating, and this is an external symbol, we don't want to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 @@ -1099,7 +953,7 @@ mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section, bfd *output_bfd; char **error_message; { - /* If we're relocating, and this an external symbol, we don't want + /* If we're relocating, and this is an external symbol, we don't want to change anything. */ if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 @@ -1264,8 +1118,8 @@ _bfd_mips_elf32_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section, data, gp); } -/* Do a R_MIPS_GPREL32 relocation. Is this 32 bit value the offset - from the gp register? XXX */ +/* Do a R_MIPS_GPREL32 relocation. This is a 32 bit value which must + become the offset from the gp register. */ static bfd_reloc_status_type gprel32_with_gp PARAMS ((bfd *, asymbol *, arelent *, asection *, @@ -1531,8 +1385,8 @@ mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section, /* A mapping from BFD reloc types to MIPS ELF reloc types. */ struct elf_reloc_map { - bfd_reloc_code_real_type bfd_reloc_val; - enum elf_mips_reloc_type elf_reloc_val; + bfd_reloc_code_real_type bfd_val; + enum elf_mips_reloc_type elf_val; }; static const struct elf_reloc_map mips_reloc_map[] = @@ -1540,6 +1394,7 @@ static const struct elf_reloc_map mips_reloc_map[] = { BFD_RELOC_NONE, R_MIPS_NONE, }, { BFD_RELOC_16, R_MIPS_16 }, { BFD_RELOC_32, R_MIPS_32 }, + /* There is no BFD reloc for R_MIPS_REL32. */ { BFD_RELOC_64, R_MIPS_64 }, { BFD_RELOC_MIPS_JMP, R_MIPS_26 }, { BFD_RELOC_HI16_S, R_MIPS_HI16 }, @@ -1568,11 +1423,13 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) bfd_reloc_code_real_type code; { unsigned int i; + reloc_howto_type *howto_table = elf_mips_howto_table_rel; - for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); i++) + for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map); + i++) { - if (mips_reloc_map[i].bfd_reloc_val == code) - return &elf_mips_howto_table_rel[(int) mips_reloc_map[i].elf_reloc_val]; + if (mips_reloc_map[i].bfd_val == code) + return &howto_table[(int) mips_reloc_map[i].elf_val]; } switch (code) @@ -1586,7 +1443,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code) Select the right relocation (R_MIPS_32 or R_MIPS_64) based on the size of addresses on this architecture. */ if (bfd_arch_bits_per_address (abfd) == 32) - return &elf_mips_howto_table_rel[(int) R_MIPS_32]; + return &howto_table[(int) R_MIPS_32]; else return &elf_mips_ctor64_howto; @@ -1622,32 +1479,22 @@ mips_elf32_rtype_to_howto (r_type, rela_p) { case R_MIPS16_26: return &elf_mips16_jump_howto; - break; case R_MIPS16_GPREL: return &elf_mips16_gprel_howto; - break; case R_MIPS_GNU_VTINHERIT: return &elf_mips_gnu_vtinherit_howto; - break; case R_MIPS_GNU_VTENTRY: return &elf_mips_gnu_vtentry_howto; - break; case R_MIPS_GNU_REL_HI16: return &elf_mips_gnu_rel_hi16; - break; case R_MIPS_GNU_REL_LO16: return &elf_mips_gnu_rel_lo16; - break; case R_MIPS_GNU_REL16_S2: return &elf_mips_gnu_rel16_s2; - break; case R_MIPS_PC64: return &elf_mips_gnu_pcrel64; - break; case R_MIPS_PC32: return &elf_mips_gnu_pcrel32; - break; - default: BFD_ASSERT (r_type < (unsigned int) R_MIPS_max); return &elf_mips_howto_table_rel[r_type]; @@ -1822,7 +1669,6 @@ elf32_mips_discard_info (abfd, cookie, info) struct bfd_link_info *info; { asection *o; - struct elf_backend_data *bed = get_elf_backend_data (abfd); boolean ret = false; unsigned char *tdata; size_t i, skip; @@ -1852,8 +1698,7 @@ elf32_mips_discard_info (abfd, cookie, info) } cookie->rel = cookie->rels; - cookie->relend = - cookie->rels + o->reloc_count * bed->s->int_rels_per_ext_rel; + cookie->relend = cookie->rels + o->reloc_count; for (i = 0, skip = 0; i < o->_raw_size; i ++) { @@ -1879,15 +1724,6 @@ elf32_mips_discard_info (abfd, cookie, info) return ret; } -static boolean -elf32_mips_ignore_discarded_relocs (sec) - asection *sec; -{ - if (strcmp (sec->name, ".pdr") == 0) - return true; - return false; -} - static boolean elf32_mips_write_section (output_bfd, sec, contents) bfd *output_bfd; @@ -1927,11 +1763,11 @@ static irix_compat_t elf32_mips_irix_compat (abfd) bfd *abfd; { - if ((abfd->xvec == &bfd_elf32_tradbigmips_vec) - || (abfd->xvec == &bfd_elf32_tradlittlemips_vec)) - return ict_none; - else + if ((abfd->xvec == &bfd_elf32_bigmips_vec) + || (abfd->xvec == &bfd_elf32_littlemips_vec)) return ict_irix5; + else + return ict_none; } /* Given a data section and an in-memory embedded reloc section, store @@ -2050,7 +1886,8 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx); } @@ -2209,7 +2046,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { #define elf_backend_discard_info elf32_mips_discard_info #define elf_backend_ignore_discarded_relocs \ - elf32_mips_ignore_discarded_relocs + _bfd_mips_elf_ignore_discarded_relocs #define elf_backend_write_section elf32_mips_write_section #define elf_backend_mips_irix_compat elf32_mips_irix_compat #define elf_backend_mips_rtype_to_howto mips_elf32_rtype_to_howto diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c index 34d4d9facde..2dd7fb71da9 100644 --- a/bfd/elf32-openrisc.c +++ b/bfd/elf32-openrisc.c @@ -469,11 +469,11 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section, static asection * openrisc_elf_gc_mark_hook (abfd, info, rel, h, sym) - bfd *abfd ATTRIBUTE_UNUSED; + bfd *abfd; struct bfd_link_info *info ATTRIBUTE_UNUSED; - Elf_Internal_Rela *rel ATTRIBUTE_UNUSED; - struct elf_link_hash_entry *h ATTRIBUTE_UNUSED; - Elf_Internal_Sym *sym ATTRIBUTE_UNUSED; + Elf_Internal_Rela *rel; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; { if (h != NULL) { diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c index eed0b99168a..a61b09d4152 100644 --- a/bfd/elf32-or32.c +++ b/bfd/elf32-or32.c @@ -277,19 +277,19 @@ or32_elf_32_reloc (abfd, reloc_entry, symbol, data, input_section, asection *input_section; bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; -{ +{ if (output_bfd != (bfd *) NULL) { unsigned long insn; bfd_size_type addr = reloc_entry->address; reloc_entry->address += input_section->output_offset; - + insn = bfd_get_32 (abfd, (bfd_byte *) data + addr); insn += symbol->section->output_section->vma; insn += symbol->section->output_offset; insn += symbol->value; - bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); + bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); return bfd_reloc_ok; } @@ -307,7 +307,7 @@ or32_elf_16_reloc (abfd, reloc_entry, symbol, data, input_section, asection *input_section; bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; -{ +{ if (output_bfd != (bfd *) NULL) { unsigned short insn; @@ -319,7 +319,7 @@ or32_elf_16_reloc (abfd, reloc_entry, symbol, data, input_section, insn += symbol->section->output_section->vma; insn += symbol->section->output_offset; insn += symbol->value; - bfd_put_16 (abfd, insn, (bfd_byte *) data + addr); + bfd_put_16 (abfd, insn, (bfd_byte *) data + addr); return bfd_reloc_ok; } @@ -337,7 +337,7 @@ or32_elf_8_reloc (abfd, reloc_entry, symbol, data, input_section, asection *input_section; bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; -{ +{ if (output_bfd != (bfd *) NULL) { unsigned char insn; @@ -349,7 +349,7 @@ or32_elf_8_reloc (abfd, reloc_entry, symbol, data, input_section, insn += symbol->section->output_section->vma; insn += symbol->section->output_offset; insn += symbol->value; - bfd_put_8 (abfd, insn, (bfd_byte *) data + addr); + bfd_put_8 (abfd, insn, (bfd_byte *) data + addr); return bfd_reloc_ok; } @@ -391,7 +391,7 @@ or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section, bfd_reloc_status_type ret; bfd_vma relocation; struct or32_consth *n; - + ret = bfd_reloc_ok; if (bfd_is_und_section (symbol->section) @@ -505,7 +505,7 @@ or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section, asection *input_section; bfd *output_bfd; char **error_message ATTRIBUTE_UNUSED; -{ +{ if (output_bfd != (bfd *) NULL) { unsigned long insn, tmp; @@ -517,7 +517,7 @@ or32_elf_jumptarg_reloc (abfd, reloc_entry, symbol, data, input_section, tmp = insn | 0xfc000000; tmp -= (input_section->output_offset >> 2); insn = (insn & 0xfc000000) | (tmp & 0x03ffffff); - bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); + bfd_put_32 (abfd, insn, (bfd_byte *) data + addr); return bfd_reloc_ok; } diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 31d9e0c3f3d..17c5d254a46 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -56,7 +56,7 @@ static boolean ppc_elf_create_dynamic_sections static boolean ppc_elf_section_from_shdr PARAMS ((bfd *, Elf32_Internal_Shdr *, - char *)); + const char *)); static boolean ppc_elf_fake_sections PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); @@ -1490,7 +1490,7 @@ static boolean ppc_elf_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf32_Internal_Shdr *hdr; - char *name; + const char *name; { asection *newsect; flagword flags; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 5032a5c52d4..cdbdcba03d4 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1064,7 +1064,7 @@ elf_s390_adjust_dynamic_symbol (info, h) /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later - (although we could actually do it here). */ + (although we could actually do it here). */ if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ef737b5132f..e37d0d14d9a 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2067,7 +2067,8 @@ sh_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF32_R_SYM (irelfn->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec)) @@ -2447,7 +2448,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count) { esym = extsyms + ELF32_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &sym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, + (const PTR) shndx, &sym); if (sym.st_shndx == sec_shndx && (sym.st_value <= addr @@ -2710,7 +2712,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count) esym = extsyms + ELF32_R_SYM (irelscan->r_info); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelscan->r_info) : 0); - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &sym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &sym); if (sym.st_shndx == sec_shndx && (sym.st_value <= addr @@ -2757,7 +2760,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; Elf_External_Sym_Shndx dummy; - bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf32_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == sec_shndx && isym.st_value > addr @@ -4924,7 +4928,8 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, { asection *isec; - bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); + bfd_elf32_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isymp); if (isymp->st_shndx == SHN_UNDEF) isec = bfd_und_section_ptr; diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index 5e7ccdd6822..a14b1ba04d3 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -54,7 +54,7 @@ static boolean sh64_elf_link_output_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *)); static boolean sh64_backend_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); static void sh64_elf_final_write_processing PARAMS ((bfd *, boolean)); static boolean sh64_bfd_elf_copy_private_section_data PARAMS ((bfd *, asection *, bfd *, asection *)); @@ -105,15 +105,6 @@ static void sh64_find_section_for_address PARAMS ((bfd *, asection *, PTR)); #define INCLUDE_SHMEDIA #include "elf32-sh.c" -/* The type sh64_elf_crange is defined in elf/sh.h which is included in - elf32-sh.c, hence these prototypes located after including it. */ -static int crange_qsort_cmpb PARAMS ((const void *, const void *)); -static int crange_qsort_cmpl PARAMS ((const void *, const void *)); -static int crange_bsearch_cmpb PARAMS ((const void *, const void *)); -static int crange_bsearch_cmpl PARAMS ((const void *, const void *)); -static boolean sh64_address_in_cranges - PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *)); - /* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections, and pass through SHT_SH5_CR_SORTED on a sorted .cranges section. */ @@ -255,7 +246,7 @@ boolean sh64_backend_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf_Internal_Shdr *hdr; - char *name; + const char *name; { flagword flags = 0; @@ -731,7 +722,8 @@ sh64_elf_final_write_processing (abfd, linker) qsort (cranges->contents, cranges_size / SH64_CRANGE_SIZE, SH64_CRANGE_SIZE, bfd_big_endian (cranges->owner) - ? crange_qsort_cmpb : crange_qsort_cmpl); + ? _bfd_sh64_crange_qsort_cmpb + : _bfd_sh64_crange_qsort_cmpl); elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED; } @@ -750,236 +742,3 @@ sh64_elf_final_write_processing (abfd, linker) } } } - -/* Ordering functions of a crange, for the qsort and bsearch calls and for - different endianness. */ - -static int -crange_qsort_cmpb (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = bfd_getb32 (p1); - bfd_vma a2 = bfd_getb32 (p2); - - /* Preserve order if there's ambiguous contents. */ - if (a1 == a2) - return (char *) p1 - (char *) p2; - - return a1 - a2; -} - -static int -crange_qsort_cmpl (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = (bfd_vma) bfd_getl32 (p1); - bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); - - /* Preserve order if there's ambiguous contents. */ - if (a1 == a2) - return (char *) p1 - (char *) p2; - - return a1 - a2; -} - -static int -crange_bsearch_cmpb (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = *(bfd_vma *) p1; - bfd_vma a2 = (bfd_vma) bfd_getb32 (p2); - bfd_size_type size - = (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); - - if (a1 >= a2 + size) - return 1; - if (a1 < a2) - return -1; - return 0; -} - -static int -crange_bsearch_cmpl (p1, p2) - const PTR p1; - const PTR p2; -{ - bfd_vma a1 = *(bfd_vma *) p1; - bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); - bfd_size_type size - = (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2); - - if (a1 >= a2 + size) - return 1; - if (a1 < a2) - return -1; - return 0; -} - -/* Check whether a specific address is specified within a .cranges - section. Return FALSE if not found, and TRUE if found, and the region - filled into RANGEP if non-NULL. */ - -static boolean -sh64_address_in_cranges (cranges, addr, rangep) - asection *cranges; - bfd_vma addr; - sh64_elf_crange *rangep; -{ - bfd_byte *cranges_contents; - bfd_byte *found_rangep; - bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges); - - /* If the size is not a multiple of the cranges entry size, then - something is badly wrong. */ - if ((cranges_size % SH64_CRANGE_SIZE) != 0) - return false; - - /* If this section has relocations, then we can't do anything sane. */ - if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC) - return false; - - /* Has some kind soul (or previous call) left processed, sorted contents - for us? */ - if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY) - && elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED) - cranges_contents = cranges->contents; - else - { - cranges_contents - = bfd_malloc (cranges->_cooked_size == 0 - ? cranges->_cooked_size : cranges->_raw_size); - if (cranges_contents == NULL) - return false; - - if (! bfd_get_section_contents (cranges->owner, cranges, - cranges_contents, (file_ptr) 0, - cranges_size)) - goto error_return; - - /* Is it sorted? */ - if (elf_section_data (cranges)->this_hdr.sh_type - != SHT_SH5_CR_SORTED) - /* Nope. Lets sort it. */ - qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE, - SH64_CRANGE_SIZE, - bfd_big_endian (cranges->owner) - ? crange_qsort_cmpb : crange_qsort_cmpl); - - /* Let's keep it around. */ - cranges->contents = cranges_contents; - bfd_set_section_flags (cranges->owner, cranges, - bfd_get_section_flags (cranges->owner, cranges) - | SEC_IN_MEMORY); - - /* It's sorted now. */ - elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED; - } - - /* Try and find a matching range. */ - found_rangep - = bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE, - SH64_CRANGE_SIZE, - bfd_big_endian (cranges->owner) - ? crange_bsearch_cmpb : crange_bsearch_cmpl); - - /* Fill in a few return values if we found a matching range. */ - if (found_rangep) - { - enum sh64_elf_cr_type cr_type - = bfd_get_16 (cranges->owner, - SH64_CRANGE_CR_TYPE_OFFSET + found_rangep); - bfd_vma cr_addr - = bfd_get_32 (cranges->owner, - SH64_CRANGE_CR_ADDR_OFFSET - + (char *) found_rangep); - bfd_size_type cr_size - = bfd_get_32 (cranges->owner, - SH64_CRANGE_CR_SIZE_OFFSET - + (char *) found_rangep); - - rangep->cr_addr = cr_addr; - rangep->cr_size = cr_size; - rangep->cr_type = cr_type; - - return true; - } - - /* There is a .cranges section, but it does not have a descriptor - matching this address. */ - return false; - -error_return: - free (cranges_contents); - return false; -} - -/* Determine what ADDR points to in SEC, and fill in a range descriptor in - *RANGEP if it's non-NULL. */ - -enum sh64_elf_cr_type -sh64_get_contents_type (sec, addr, rangep) - asection *sec; - bfd_vma addr; - sh64_elf_crange *rangep; -{ - asection *cranges; - - /* Fill in the range with the boundaries of the section as a default. */ - if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour - && elf_elfheader (sec->owner)->e_type == ET_EXEC) - { - rangep->cr_addr = bfd_get_section_vma (sec->owner, sec); - rangep->cr_size = bfd_section_size (sec->owner, sec); - rangep->cr_type = CRT_NONE; - } - else - return false; - - /* If none of the pertinent bits are set, then it's a SHcompact (or at - least not SHmedia). */ - if ((elf_section_data (sec)->this_hdr.sh_flags - & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0) - { - enum sh64_elf_cr_type cr_type - = ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0 - ? CRT_SH5_ISA16 : CRT_DATA); - rangep->cr_type = cr_type; - return cr_type; - } - - /* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */ - if ((elf_section_data (sec)->this_hdr.sh_flags - & (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32) - { - rangep->cr_type = CRT_SH5_ISA32; - return CRT_SH5_ISA32; - } - - /* Otherwise, we have to look up the .cranges section. */ - cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME); - - if (cranges == NULL) - /* A mixed section but there's no .cranges section. This is probably - bad input; it does not comply to specs. */ - return CRT_NONE; - - /* If this call fails, we will still have CRT_NONE in rangep->cr_type - and that will be suitable to return. */ - sh64_address_in_cranges (cranges, addr, rangep); - - return rangep->cr_type; -} - -/* This is a simpler exported interface for the benefit of gdb et al. */ - -boolean -sh64_address_is_shmedia (sec, addr) - asection *sec; - bfd_vma addr; -{ - sh64_elf_crange dummy; - return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32; -} diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index ae0a0c4e88b..553cb4e0153 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -1,5 +1,5 @@ /* V850-specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -79,7 +79,7 @@ static boolean v850_elf_link_output_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *)); static boolean v850_elf_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); static boolean v850_elf_gc_sweep_hook PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); @@ -2135,7 +2135,7 @@ static boolean v850_elf_section_from_shdr (abfd, hdr, name) bfd * abfd; Elf_Internal_Shdr * hdr; - char * name; + const char * name; { /* There ought to be a place to keep ELF backend specific flags, but at the moment there isn't one. We just keep track of the diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index d6b8dd3c492..d58ea9cffc8 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -27,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Forward declarations. */ static reloc_howto_type * xstormy16_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); -static void xstormy16_info_to_howto_rela +static void xstormy16_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); -static bfd_reloc_status_type xstormy16_elf_24_reloc +static bfd_reloc_status_type xstormy16_elf_24_reloc PARAMS ((bfd *abfd, arelent *reloc_entry, asymbol *symbol, PTR data, asection *input_section, bfd *output_bfd, char **error_message)); @@ -45,7 +45,7 @@ static boolean xstormy16_elf_relax_section boolean *again)); static boolean xstormy16_elf_always_size_sections PARAMS ((bfd *, struct bfd_link_info *)); -static boolean xstormy16_elf_relocate_section +static boolean xstormy16_elf_relocate_section PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static boolean xstormy16_elf_finish_dynamic_sections @@ -88,7 +88,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ - + /* A 16 bit absolute relocation. */ HOWTO (R_XSTORMY16_16, /* type */ 0, /* rightshift */ @@ -103,7 +103,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ - + /* An 8 bit absolute relocation. */ HOWTO (R_XSTORMY16_8, /* type */ 0, /* rightshift */ @@ -118,7 +118,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ - + /* A 32 bit pc-relative relocation. */ HOWTO (R_XSTORMY16_PC32, /* type */ 0, /* rightshift */ @@ -133,7 +133,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ true), /* pcrel_offset */ - + /* A 16 bit pc-relative relocation. */ HOWTO (R_XSTORMY16_PC16, /* type */ 0, /* rightshift */ @@ -148,7 +148,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ true), /* pcrel_offset */ - + /* An 8 bit pc-relative relocation. */ HOWTO (R_XSTORMY16_PC8, /* type */ 0, /* rightshift */ @@ -163,7 +163,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffffffff, /* dst_mask */ true), /* pcrel_offset */ - + /* A 12-bit pc-relative relocation suitable for the branch instructions. */ HOWTO (R_XSTORMY16_REL_12, /* type */ 1, /* rightshift */ @@ -178,7 +178,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0x0fff, /* dst_mask */ true), /* pcrel_offset */ - + /* A 24-bit absolute relocation suitable for the jump instructions. */ HOWTO (R_XSTORMY16_24, /* type */ 0, /* rightshift */ @@ -193,7 +193,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0, /* src_mask */ 0xffff00ff, /* dst_mask */ true), /* pcrel_offset */ - + /* A 16 bit absolute relocation to a function pointer. */ HOWTO (R_XSTORMY16_FPTR16, /* type */ 0, /* rightshift */ @@ -209,7 +209,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] = 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ }; - + static reloc_howto_type xstormy16_elf_howto_table2 [] = { /* GNU extension to record C++ vtable hierarchy */ @@ -241,7 +241,7 @@ static reloc_howto_type xstormy16_elf_howto_table2 [] = 0, /* src_mask */ 0, /* dst_mask */ false), /* pcrel_offset */ - + }; /* Map BFD reloc types to XSTORMY16 ELF reloc types. */ @@ -286,7 +286,7 @@ xstormy16_reloc_type_lookup (abfd, code) return entry->table + (entry->xstormy16_reloc_val - entry->table[0].type); } - + return NULL; } @@ -451,7 +451,7 @@ xstormy16_elf_check_relocs (abfd, info, sec, relocs) if (local_plt_offsets == NULL) return false; elf_local_got_offsets (abfd) = local_plt_offsets; - + for (i = 0; i < symtab_hdr->sh_info; i++) local_plt_offsets[i] = (bfd_vma) -1; } @@ -471,7 +471,7 @@ xstormy16_elf_check_relocs (abfd, info, sec, relocs) if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) return false; break; - + /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_XSTORMY16_GNU_VTENTRY: @@ -578,7 +578,7 @@ xstormy16_elf_relax_section (dynobj, splt, info, again) if (splt->_cooked_size == 0) splt->_cooked_size = splt->_raw_size; - /* Map across all global symbols; see which ones happen to + /* Map across all global symbols; see which ones happen to fall in the low 64k. */ relax_plt_data.splt = splt; relax_plt_data.again = again; @@ -654,7 +654,8 @@ xstormy16_elf_relax_section (dynobj, splt, info, again) shndx = shndx_buf; if (shndx != NULL) shndx += idx; - bfd_elf32_swap_symbol_in (ibfd, extsyms + idx, shndx, &isym); + bfd_elf32_swap_symbol_in (ibfd, (const PTR) (extsyms + idx), + (const PTR) shndx, &isym); if (isym.st_shndx == SHN_UNDEF) continue; else if (isym.st_shndx == SHN_ABS) @@ -813,19 +814,19 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_reloc_status_type r; const char * name = NULL; int r_type; - + r_type = ELF32_R_TYPE (rel->r_info); - + if ( r_type == R_XSTORMY16_GNU_VTINHERIT || r_type == R_XSTORMY16_GNU_VTENTRY) continue; - + r_symndx = ELF32_R_SYM (rel->r_info); howto = xstormy16_elf_howto_table + ELF32_R_TYPE (rel->r_info); h = NULL; sym = NULL; sec = NULL; - + if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -833,7 +834,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, relocation = (sec->output_section->vma + sec->output_offset + sym->st_value); - + name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; @@ -841,13 +842,13 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { h = sym_hashes [r_symndx - symtab_hdr->sh_info]; - + while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; name = h->root.root.string; - + if (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) { @@ -869,14 +870,14 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, relocation = 0; } } - + switch (ELF32_R_TYPE (rel->r_info)) { case R_XSTORMY16_24: { bfd_vma reloc = relocation + rel->r_addend; unsigned int x; - + x = bfd_get_32 (input_bfd, contents + rel->r_offset); x &= 0x0000ff00; x |= reloc & 0xff; @@ -952,13 +953,13 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section, (info, name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset); break; - + case bfd_reloc_undefined: r = info->callbacks->undefined_symbol (info, name, input_bfd, input_section, rel->r_offset, true); break; - + case bfd_reloc_outofrange: msg = _("internal error: out of range error"); break; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 94b4ebe056e..a491ecad8c8 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -73,7 +73,7 @@ static boolean elf64_alpha_mkobject static boolean elf64_alpha_object_p PARAMS((bfd *)); static boolean elf64_alpha_section_from_shdr - PARAMS((bfd *, Elf64_Internal_Shdr *, char *)); + PARAMS((bfd *, Elf64_Internal_Shdr *, const char *)); static boolean elf64_alpha_section_flags PARAMS((flagword *, Elf64_Internal_Shdr *)); static boolean elf64_alpha_fake_sections @@ -106,14 +106,27 @@ static boolean elf64_alpha_calc_got_offsets_for_symbol PARAMS ((struct alpha_elf_link_hash_entry *, PTR)); static void elf64_alpha_calc_got_offsets PARAMS ((struct bfd_link_info *)); static boolean elf64_alpha_size_got_sections - PARAMS ((bfd *, struct bfd_link_info *)); + PARAMS ((struct bfd_link_info *)); +static boolean elf64_alpha_size_plt_section + PARAMS ((struct bfd_link_info *)); +static boolean elf64_alpha_size_plt_section_1 + PARAMS ((struct alpha_elf_link_hash_entry *, PTR)); static boolean elf64_alpha_always_size_sections PARAMS ((bfd *, struct bfd_link_info *)); +static int alpha_dynamic_entries_for_reloc + PARAMS ((int, int, int)); static boolean elf64_alpha_calc_dynrel_sizes PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *)); +static boolean elf64_alpha_size_rela_got_section + PARAMS ((struct bfd_link_info *)); +static boolean elf64_alpha_size_rela_got_1 + PARAMS ((struct alpha_elf_link_hash_entry *, struct bfd_link_info *)); static boolean elf64_alpha_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); +static struct alpha_elf_got_entry *get_got_entry + PARAMS ((bfd *, struct alpha_elf_link_hash_entry *, unsigned long, + unsigned long, bfd_vma)); static boolean elf64_alpha_check_relocs PARAMS((bfd *, struct bfd_link_info *, asection *sec, const Elf_Internal_Rela *)); @@ -121,6 +134,9 @@ static boolean elf64_alpha_adjust_dynamic_symbol PARAMS((struct bfd_link_info *, struct elf_link_hash_entry *)); static boolean elf64_alpha_size_dynamic_sections PARAMS((bfd *, struct bfd_link_info *)); +static boolean elf64_alpha_relocate_section_r + PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); static boolean elf64_alpha_relocate_section PARAMS((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); @@ -148,11 +164,15 @@ struct alpha_elf_link_hash_entry /* Cumulative flags for all the .got entries. */ int flags; - /* Contexts (LITUSE) in which a literal was referenced. */ -#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01 -#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02 -#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04 -#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x08 + /* Contexts in which a literal was referenced. */ +#define ALPHA_ELF_LINK_HASH_LU_ADDR 0x01 +#define ALPHA_ELF_LINK_HASH_LU_MEM 0x02 +#define ALPHA_ELF_LINK_HASH_LU_BYTE 0x04 +#define ALPHA_ELF_LINK_HASH_LU_JSR 0x08 +#define ALPHA_ELF_LINK_HASH_LU_TLSGD 0x10 +#define ALPHA_ELF_LINK_HASH_LU_TLSLDM 0x20 +#define ALPHA_ELF_LINK_HASH_LU_FUNC 0x38 +#define ALPHA_ELF_LINK_HASH_TLS_IE 0x40 /* Used to implement multiple .got subsections. */ struct alpha_elf_got_entry @@ -168,13 +188,20 @@ struct alpha_elf_link_hash_entry /* the .got offset for this entry. */ int got_offset; - int flags; + /* How many references to this entry? */ + int use_count; + + /* The relocation type of this entry. */ + unsigned char reloc_type; - /* Additional flags. */ -#define ALPHA_ELF_GOT_ENTRY_RELOCS_DONE 0x10 -#define ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED 0x20 + /* How a LITERAL is used. */ + unsigned char flags; - int use_count; + /* Have we initialized the dynamic relocation for this entry? */ + unsigned char reloc_done; + + /* Have we adjusted this entry for SEC_MERGE? */ + unsigned char reloc_xlated; } *got_entries; /* used to count non-got, non-plt relocations for delayed sizing @@ -361,12 +388,12 @@ struct alpha_elf_obj_tdata /* For every got, this is the section. */ asection *got; - /* For every got, this is it's total number of *entries*. */ - int total_got_entries; + /* For every got, this is it's total number of words. */ + int total_got_size; - /* For every got, this is the sum of the number of *entries* required + /* For every got, this is the sum of the number of words required to hold all of the member object's local got. */ - int n_local_got_entries; + int local_got_size; }; #define alpha_elf_tdata(abfd) \ @@ -748,6 +775,203 @@ static reloc_howto_type elf64_alpha_howto_table[] = 0x1fffff, /* src_mask */ 0x1fffff, /* dst_mask */ true), /* pcrel_offset */ + + /* Creates a tls_index for the symbol in the got. */ + HOWTO (R_ALPHA_TLSGD, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "TLSGD", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Creates a tls_index for the (current) module in the got. */ + HOWTO (R_ALPHA_TLSLDM, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "TLSLDM", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A dynamic relocation for a DTP module entry. */ + HOWTO (R_ALPHA_DTPMOD64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "DTPMOD64", /* name */ + false, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false), /* pcrel_offset */ + + /* Creates a 64-bit offset in the got for the displacement + from DTP to the target. */ + HOWTO (R_ALPHA_GOTDTPREL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "GOTDTPREL", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A dynamic relocation for a displacement from DTP to the target. */ + HOWTO (R_ALPHA_DTPREL64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "DTPREL64", /* name */ + false, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false), /* pcrel_offset */ + + /* The high 16 bits of the displacement from DTP to the target. */ + HOWTO (R_ALPHA_DTPRELHI, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "DTPRELHI", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* The low 16 bits of the displacement from DTP to the target. */ + HOWTO (R_ALPHA_DTPRELLO, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "DTPRELLO", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A 16-bit displacement from DTP to the target. */ + HOWTO (R_ALPHA_DTPREL16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "DTPREL16", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* Creates a 64-bit offset in the got for the displacement + from TP to the target. */ + HOWTO (R_ALPHA_GOTTPREL, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "GOTTPREL", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A dynamic relocation for a displacement from TP to the target. */ + HOWTO (R_ALPHA_TPREL64, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + 0, /* special_function */ + "TPREL64", /* name */ + false, /* partial_inplace */ + MINUS_ONE, /* src_mask */ + MINUS_ONE, /* dst_mask */ + false), /* pcrel_offset */ + + /* The high 16 bits of the displacement from TP to the target. */ + HOWTO (R_ALPHA_TPRELHI, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "TPRELHI", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* The low 16 bits of the displacement from TP to the target. */ + HOWTO (R_ALPHA_TPRELLO, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_dont, /* complain_on_overflow */ + 0, /* special_function */ + "TPRELLO", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A 16-bit displacement from TP to the target. */ + HOWTO (R_ALPHA_TPREL16, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + 0, /* special_function */ + "TPREL16", /* name */ + false, /* partial_inplace */ + 0xffff, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pcrel_offset */ }; /* A relocation function which doesn't do anything. */ @@ -902,6 +1126,19 @@ static const struct elf_reloc_map elf64_alpha_reloc_map[] = {BFD_RELOC_ALPHA_GPREL_LO16, R_ALPHA_GPRELLOW}, {BFD_RELOC_GPREL16, R_ALPHA_GPREL16}, {BFD_RELOC_ALPHA_BRSGP, R_ALPHA_BRSGP}, + {BFD_RELOC_ALPHA_TLSGD, R_ALPHA_TLSGD}, + {BFD_RELOC_ALPHA_TLSLDM, R_ALPHA_TLSLDM}, + {BFD_RELOC_ALPHA_DTPMOD64, R_ALPHA_DTPMOD64}, + {BFD_RELOC_ALPHA_GOTDTPREL16, R_ALPHA_GOTDTPREL}, + {BFD_RELOC_ALPHA_DTPREL64, R_ALPHA_DTPREL64}, + {BFD_RELOC_ALPHA_DTPREL_HI16, R_ALPHA_DTPRELHI}, + {BFD_RELOC_ALPHA_DTPREL_LO16, R_ALPHA_DTPRELLO}, + {BFD_RELOC_ALPHA_DTPREL16, R_ALPHA_DTPREL16}, + {BFD_RELOC_ALPHA_GOTTPREL16, R_ALPHA_GOTTPREL}, + {BFD_RELOC_ALPHA_TPREL64, R_ALPHA_TPREL64}, + {BFD_RELOC_ALPHA_TPREL_HI16, R_ALPHA_TPRELHI}, + {BFD_RELOC_ALPHA_TPREL_LO16, R_ALPHA_TPRELLO}, + {BFD_RELOC_ALPHA_TPREL16, R_ALPHA_TPREL16}, }; /* Given a BFD reloc type, return a HOWTO structure. */ @@ -936,6 +1173,19 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst) BFD_ASSERT (r_type < (unsigned int) R_ALPHA_max); cache_ptr->howto = &elf64_alpha_howto_table[r_type]; } + +/* These two relocations create a two-word entry in the got. */ +#define alpha_got_entry_size(r_type) \ + (r_type == R_ALPHA_TLSGD || r_type == R_ALPHA_TLSLDM ? 16 : 8) + +/* This is PT_TLS segment p_vaddr. */ +#define alpha_get_dtprel_base(tlss) \ + ((tlss)->start) + +/* Main program TLS (whose template starts at PT_TLS p_vaddr) + is assigned offset round(16, PT_TLS p_align). */ +#define alpha_get_tprel_base(tlss) \ + ((tlss)->start - align_power ((bfd_vma) 16, (tlss)->align)) /* These functions do relaxation for Alpha ELF. @@ -958,35 +1208,45 @@ elf64_alpha_info_to_howto (abfd, cache_ptr, dst) #define OP_BR 0x30 #define OP_BSR 0x34 #define INSN_UNOP 0x2ffe0000 +#define INSN_ADDQ 0x40000400 +#define INSN_RDUNIQ 0x0000009e struct alpha_relax_info { bfd *abfd; asection *sec; bfd_byte *contents; + Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *relocs, *relend; struct bfd_link_info *link_info; - boolean changed_contents; - boolean changed_relocs; + struct elf_link_tls_segment *tls_segment; bfd_vma gp; bfd *gotobj; asection *tsec; struct alpha_elf_link_hash_entry *h; + struct alpha_elf_got_entry **first_gotent; struct alpha_elf_got_entry *gotent; + boolean changed_contents; + boolean changed_relocs; unsigned char other; }; -static Elf_Internal_Rela * elf64_alpha_relax_with_lituse - PARAMS((struct alpha_relax_info *info, bfd_vma symval, - Elf_Internal_Rela *irel, Elf_Internal_Rela *irelend)); - -static boolean elf64_alpha_relax_without_lituse +static boolean elf64_alpha_relax_with_lituse PARAMS((struct alpha_relax_info *info, bfd_vma symval, Elf_Internal_Rela *irel)); - static bfd_vma elf64_alpha_relax_opt_call PARAMS((struct alpha_relax_info *info, bfd_vma symval)); - +static boolean elf64_alpha_relax_got_load + PARAMS((struct alpha_relax_info *info, bfd_vma symval, + Elf_Internal_Rela *irel, unsigned long)); +static boolean elf64_alpha_relax_gprelhilo + PARAMS((struct alpha_relax_info *info, bfd_vma symval, + Elf_Internal_Rela *irel, boolean)); +static boolean elf64_alpha_relax_tls_get_addr + PARAMS((struct alpha_relax_info *info, bfd_vma symval, + Elf_Internal_Rela *irel, boolean)); +static struct elf_link_tls_segment *elf64_alpha_relax_find_tls_segment + PARAMS((struct alpha_relax_info *, struct elf_link_tls_segment *)); static boolean elf64_alpha_relax_section PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info, boolean *again)); @@ -1007,13 +1267,13 @@ elf64_alpha_find_reloc_at_ofs (rel, relend, offset, type) return NULL; } -static Elf_Internal_Rela * -elf64_alpha_relax_with_lituse (info, symval, irel, irelend) +static boolean +elf64_alpha_relax_with_lituse (info, symval, irel) struct alpha_relax_info *info; bfd_vma symval; - Elf_Internal_Rela *irel, *irelend; + Elf_Internal_Rela *irel; { - Elf_Internal_Rela *urel; + Elf_Internal_Rela *urel, *irelend = info->relend; int flags, count, i; bfd_signed_vma disp; boolean fits16; @@ -1029,9 +1289,13 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn", bfd_archive_filename (info->abfd), info->sec->name, (unsigned long) irel->r_offset)); - return irel; + return true; } + /* Can't relax dynamic symbols. */ + if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info)) + return true; + /* Summarize how this particular LITERAL is used. */ for (urel = irel+1, flags = count = 0; urel < irelend; ++urel, ++count) { @@ -1054,25 +1318,27 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) switch (urel->r_addend) { - default: /* 0 = ADDRESS FORMAT */ + case LITUSE_ALPHA_ADDR: + default: /* This type is really just a placeholder to note that all uses cannot be optimized, but to still allow some. */ all_optimized = false; break; - case 1: /* MEM FORMAT */ + case LITUSE_ALPHA_BASE: /* We can always optimize 16-bit displacements. */ /* Extract the displacement from the instruction, sign-extending it if necessary, then test whether it is within 16 or 32 bits displacement from GP. */ insn_disp = insn & 0x0000ffff; - if (insn_disp & 0x00008000) - insn_disp |= 0xffff0000; /* Negative: sign-extend. */ + if (insn_disp & 0x8000) + insn_disp |= ~0xffff; /* Negative: sign-extend. */ xdisp = disp + insn_disp; - fits16 = (xdisp >= - (bfd_signed_vma) 0x00008000 && xdisp < 0x00008000); - fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000 && xdisp < 0x7fff8000); + fits16 = (xdisp >= - (bfd_signed_vma) 0x8000 && xdisp < 0x8000); + fits32 = (xdisp >= - (bfd_signed_vma) 0x80000000 + && xdisp < 0x7fff8000); if (fits16) { @@ -1111,7 +1377,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) all_optimized = false; break; - case 2: /* BYTE OFFSET FORMAT */ + case LITUSE_ALPHA_BYTOFF: /* We can always optimize byte instructions. */ /* FIXME: sanity check the insn for byte op. Check that the @@ -1129,16 +1395,20 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) info->changed_contents = true; break; - case 3: /* CALL FORMAT */ + case LITUSE_ALPHA_JSR: + case LITUSE_ALPHA_TLSGD: + case LITUSE_ALPHA_TLSLDM: { - /* If not zero, place to jump without needing pv. */ - bfd_vma optdest = elf64_alpha_relax_opt_call (info, symval); - bfd_vma org = (info->sec->output_section->vma - + info->sec->output_offset - + urel->r_offset + 4); + bfd_vma optdest, org; bfd_signed_vma odisp; + /* If not zero, place to jump without needing pv. */ + optdest = elf64_alpha_relax_opt_call (info, symval); + org = (info->sec->output_section->vma + + info->sec->output_offset + + urel->r_offset + 4); odisp = (optdest ? optdest : symval) - org; + if (odisp >= -0x400000 && odisp < 0x400000) { Elf_Internal_Rela *xrel; @@ -1180,10 +1450,11 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) { Elf_Internal_Rela *gpdisp = (elf64_alpha_find_reloc_at_ofs - (irel, irelend, urel->r_offset + 4, R_ALPHA_GPDISP)); + (info->relocs, irelend, urel->r_offset + 4, + R_ALPHA_GPDISP)); if (gpdisp) { - bfd_byte *p_ldah = info->contents + gpdisp->r_offset; + bfd_byte *p_ldah = info->contents + gpdisp->r_offset; bfd_byte *p_lda = p_ldah + gpdisp->r_addend; unsigned int ldah = bfd_get_32 (info->abfd, p_ldah); unsigned int lda = bfd_get_32 (info->abfd, p_lda); @@ -1213,14 +1484,17 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) got entry by one, possibly eliminating it. */ if (all_optimized) { - info->gotent->use_count -= 1; - alpha_elf_tdata (info->gotent->gotobj)->total_got_entries -= 1; - if (!info->h) - alpha_elf_tdata (info->gotent->gotobj)->n_local_got_entries -= 1; + if (--info->gotent->use_count == 0) + { + int sz = alpha_got_entry_size (R_ALPHA_LITERAL); + alpha_elf_tdata (info->gotobj)->total_got_size -= sz; + if (!info->h) + alpha_elf_tdata (info->gotobj)->local_got_size -= sz; + } /* If the literal instruction is no longer needed (it may have been - reused. We can eliminate it. - ??? For now, I don't want to deal with compacting the section, + reused. We can eliminate it. */ + /* ??? For now, I don't want to deal with compacting the section, so just nop it out. */ if (!lit_reused) { @@ -1233,7 +1507,7 @@ elf64_alpha_relax_with_lituse (info, symval, irel, irelend) } } - return irel + count; + return true; } static bfd_vma @@ -1309,10 +1583,11 @@ elf64_alpha_relax_opt_call (info, symval) } static boolean -elf64_alpha_relax_without_lituse (info, symval, irel) +elf64_alpha_relax_got_load (info, symval, irel, r_type) struct alpha_relax_info *info; bfd_vma symval; Elf_Internal_Rela *irel; + unsigned long r_type; { unsigned int insn; bfd_signed_vma disp; @@ -1322,37 +1597,74 @@ elf64_alpha_relax_without_lituse (info, symval, irel) if (insn >> 26 != OP_LDQ) { + reloc_howto_type *howto = elf64_alpha_howto_table + r_type; ((*_bfd_error_handler) - ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn", + ("%s: %s+0x%lx: warning: %s relocation against unexpected insn", bfd_archive_filename (info->abfd), info->sec->name, - (unsigned long) irel->r_offset)); + (unsigned long) irel->r_offset, howto->name)); return true; } - /* So we aren't told much. Do what we can with the address load and - fake the rest. All of the optimizations here require that the - offset from the GP fit in 16 bits. */ + /* Can't relax dynamic symbols. */ + if (alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info)) + return true; - disp = symval - info->gp; - if (disp < -0x8000 || disp >= 0x8000) + /* Can't use local-exec relocations in shared libraries. */ + if (r_type == R_ALPHA_GOTTPREL && info->link_info->shared) return true; - /* On the LITERAL instruction itself, consider exchanging - `ldq R,X(gp)' for `lda R,Y(gp)'. */ + if (r_type == R_ALPHA_LITERAL) + disp = symval - info->gp; + else + { + bfd_vma dtp_base, tp_base; + + BFD_ASSERT (info->tls_segment != NULL); + dtp_base = alpha_get_dtprel_base (info->tls_segment); + tp_base = alpha_get_tprel_base (info->tls_segment); + disp = symval - (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base); + } + + if (disp < -0x8000 || disp >= 0x8000) + return true; - insn = (OP_LDA << 26) | (insn & 0x03ff0000); + /* Exchange LDQ for LDA. In the case of the TLS relocs, we're loading + a constant, so force the base register to be $31. */ + if (r_type == R_ALPHA_LITERAL) + insn = (OP_LDA << 26) | (insn & 0x03ff0000); + else + insn = (OP_LDA << 26) | (insn & (31 << 21)) | (31 << 16); bfd_put_32 (info->abfd, (bfd_vma) insn, info->contents + irel->r_offset); info->changed_contents = true; - irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), R_ALPHA_GPREL16); + switch (r_type) + { + case R_ALPHA_LITERAL: + r_type = R_ALPHA_GPREL16; + break; + case R_ALPHA_GOTDTPREL: + r_type = R_ALPHA_DTPREL16; + break; + case R_ALPHA_GOTTPREL: + r_type = R_ALPHA_TPREL16; + break; + default: + BFD_ASSERT (0); + return false; + } + + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), r_type); info->changed_relocs = true; /* Reduce the use count on this got entry by one, possibly eliminating it. */ - info->gotent->use_count -= 1; - alpha_elf_tdata (info->gotent->gotobj)->total_got_entries -= 1; - if (!info->h) - alpha_elf_tdata (info->gotent->gotobj)->n_local_got_entries -= 1; + if (--info->gotent->use_count == 0) + { + int sz = alpha_got_entry_size (r_type); + alpha_elf_tdata (info->gotobj)->total_got_size -= sz; + if (!info->h) + alpha_elf_tdata (info->gotobj)->local_got_size -= sz; + } /* ??? Search forward through this basic block looking for insns that use the target register. Stop after an insn modifying the @@ -1371,39 +1683,387 @@ elf64_alpha_relax_without_lituse (info, symval, irel) } static boolean -elf64_alpha_relax_section (abfd, sec, link_info, again) - bfd *abfd; - asection *sec; - struct bfd_link_info *link_info; - boolean *again; +elf64_alpha_relax_gprelhilo (info, symval, irel, hi) + struct alpha_relax_info *info; + bfd_vma symval; + Elf_Internal_Rela *irel; + boolean hi; { - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Shdr *shndx_hdr; - Elf_Internal_Rela *internal_relocs; - Elf_Internal_Rela *free_relocs = NULL; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *free_contents = NULL; - Elf64_External_Sym *extsyms = NULL; - Elf64_External_Sym *free_extsyms = NULL; - Elf_External_Sym_Shndx *shndx_buf = NULL; - struct alpha_elf_got_entry **local_got_entries; - struct alpha_relax_info info; + unsigned int insn; + bfd_signed_vma disp; + bfd_byte *pos = info->contents + irel->r_offset; - /* We are not currently changing any sizes, so only one pass. */ - *again = false; + /* ??? This assumes that the compiler doesn't render - if (link_info->relocateable - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0) + array[i] + as + ldah t, array(gp) !gprelhigh + s8addl i, t, t + ldq r, array(t) !gprellow + + which would indeed be the most efficient way to implement this. */ + + return true; + + disp = symval - info->gp; + if (disp < -0x8000 || disp >= 0x8000) return true; - /* If this is the first time we have been called for this section, - initialize the cooked size. */ - if (sec->_cooked_size == 0) - sec->_cooked_size = sec->_raw_size; + if (hi) + { + /* Nop out the high instruction. */ - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos); + info->changed_contents = true; + + irel->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + irel->r_addend = 0; + info->changed_relocs = true; + } + else + { + /* Adjust the low instruction to reference GP directly. */ + + insn = bfd_get_32 (info->abfd, pos); + insn = (insn & 0xffe00000) | (29 << 16); + bfd_put_32 (info->abfd, (bfd_vma) insn, pos); + info->changed_contents = true; + + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_ALPHA_GPREL16); + info->changed_relocs = true; + } + + return true; +} + +static boolean +elf64_alpha_relax_tls_get_addr (info, symval, irel, is_gd) + struct alpha_relax_info *info; + bfd_vma symval; + Elf_Internal_Rela *irel; + boolean is_gd; +{ + bfd_byte *pos[5]; + unsigned int insn; + Elf_Internal_Rela *gpdisp, *hint; + boolean dynamic, use_gottprel; + + dynamic = alpha_elf_dynamic_symbol_p (&info->h->root, info->link_info); + + /* ??? For LD relaxation, we need a symbol referencing the beginning + of the TLS segment. */ + if (!is_gd) + return true; + + /* If a TLS symbol is accessed using IE at least once, there is no point + to use dynamic model for it. */ + if (is_gd && info->h && (info->h->flags & ALPHA_ELF_LINK_HASH_TLS_IE)) + ; + + /* If the symbol is local, and we've already committed to DF_STATIC_TLS, + then we might as well relax to IE. */ + else if (info->link_info->shared && !dynamic + && (info->link_info->flags & DF_STATIC_TLS)) + ; + + /* Otherwise we must be building an executable to do anything. */ + else if (info->link_info->shared) + return true; + + /* The TLSGD/TLSLDM relocation must be followed by a LITERAL and + the matching LITUSE_TLS relocations. */ + if (irel + 2 >= info->relend) + return true; + if (ELF64_R_TYPE (irel[1].r_info) != R_ALPHA_LITERAL + || ELF64_R_TYPE (irel[2].r_info) != R_ALPHA_LITUSE + || irel[2].r_addend != (is_gd ? LITUSE_ALPHA_TLSGD : LITUSE_ALPHA_TLSLDM)) + return true; + + /* There must be a GPDISP relocation positioned immediately after the + LITUSE relocation. */ + gpdisp = elf64_alpha_find_reloc_at_ofs (info->relocs, info->relend, + irel[2].r_offset + 4, R_ALPHA_GPDISP); + if (!gpdisp) + return true; + + pos[0] = info->contents + irel[0].r_offset; + pos[1] = info->contents + irel[1].r_offset; + pos[2] = info->contents + irel[2].r_offset; + pos[3] = info->contents + gpdisp->r_offset; + pos[4] = pos[3] + gpdisp->r_addend; + + /* Only positions 0 and 1 are allowed to be out of order. */ + if (pos[1] < pos[0]) + { + bfd_byte *tmp = pos[0]; + pos[0] = pos[1]; + pos[1] = tmp; + } + if (pos[1] >= pos[2] || pos[2] >= pos[3] || pos[3] >= pos[4]) + return true; + + /* Reduce the use count on the LITERAL relocation. Do this before we + smash the symndx when we adjust the relocations below. */ + { + struct alpha_elf_got_entry *lit_gotent; + struct alpha_elf_link_hash_entry *lit_h; + unsigned long indx; + + BFD_ASSERT (ELF64_R_SYM (irel[1].r_info) >= info->symtab_hdr->sh_info); + indx = ELF64_R_SYM (irel[1].r_info) - info->symtab_hdr->sh_info; + lit_h = alpha_elf_sym_hashes (info->abfd)[indx]; + + while (lit_h->root.root.type == bfd_link_hash_indirect + || lit_h->root.root.type == bfd_link_hash_warning) + lit_h = (struct alpha_elf_link_hash_entry *) lit_h->root.root.u.i.link; + + for (lit_gotent = lit_h->got_entries; lit_gotent ; + lit_gotent = lit_gotent->next) + if (lit_gotent->gotobj == info->gotobj + && lit_gotent->reloc_type == R_ALPHA_LITERAL + && lit_gotent->addend == irel[1].r_addend) + break; + BFD_ASSERT (lit_gotent); + + if (--lit_gotent->use_count == 0) + { + int sz = alpha_got_entry_size (R_ALPHA_LITERAL); + alpha_elf_tdata (info->gotobj)->total_got_size -= sz; + } + } + + /* Change + + lda $16,x($gp) !tlsgd!1 + ldq $27,__tls_get_addr($gp) !literal!1 + jsr $26,($27)__tls_get_addr !lituse_tlsgd!1 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + to + ldq $16,x($gp) !gottprel + unop + call_pal rduniq + addq $16,$0,$0 + unop + or the first pair to + lda $16,x($gp) !tprel + unop + or + ldah $16,x($gp) !tprelhi + lda $16,x($16) !tprello + + as appropriate. */ + + use_gottprel = false; + switch (!dynamic && !info->link_info->shared) + { + case 1: + { + bfd_vma tp_base; + bfd_signed_vma disp; + + BFD_ASSERT (info->tls_segment != NULL); + tp_base = alpha_get_tprel_base (info->tls_segment); + disp = symval - tp_base; + + if (disp >= -0x8000 && disp < 0x8000) + { + insn = (OP_LDA << 26) | (16 << 21) | (31 << 16); + bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]); + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]); + + irel[0].r_offset = pos[0] - info->contents; + irel[0].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_ALPHA_TPREL16); + irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + break; + } + else if (disp >= -(bfd_signed_vma) 0x80000000 + && disp < (bfd_signed_vma) 0x7fff8000) + { + insn = (OP_LDAH << 26) | (16 << 21) | (31 << 16); + bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]); + insn = (OP_LDA << 26) | (16 << 21) | (16 << 16); + bfd_put_32 (info->abfd, (bfd_vma) insn, pos[1]); + + irel[0].r_offset = pos[0] - info->contents; + irel[0].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_ALPHA_TPRELHI); + irel[1].r_offset = pos[1] - info->contents; + irel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_ALPHA_TPRELLO); + break; + } + } + /* FALLTHRU */ + + default: + use_gottprel = true; + + insn = (OP_LDQ << 26) | (16 << 21) | (29 << 16); + bfd_put_32 (info->abfd, (bfd_vma) insn, pos[0]); + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[1]); + + irel[0].r_offset = pos[0] - info->contents; + irel[0].r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_ALPHA_GOTTPREL); + irel[1].r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + break; + } + + bfd_put_32 (info->abfd, (bfd_vma) INSN_RDUNIQ, pos[2]); + + insn = INSN_ADDQ | (16 << 21) | (0 << 16) | (0 << 0); + bfd_put_32 (info->abfd, (bfd_vma) insn, pos[3]); + + bfd_put_32 (info->abfd, (bfd_vma) INSN_UNOP, pos[4]); + + irel[2].r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + gpdisp->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + + hint = elf64_alpha_find_reloc_at_ofs (info->relocs, info->relend, + irel[2].r_offset, R_ALPHA_HINT); + if (hint) + hint->r_info = ELF64_R_INFO (0, R_ALPHA_NONE); + + info->changed_contents = true; + info->changed_relocs = true; + + /* Reduce the use count on the TLSGD/TLSLDM relocation. */ + if (--info->gotent->use_count == 0) + { + int sz = alpha_got_entry_size (info->gotent->reloc_type); + alpha_elf_tdata (info->gotobj)->total_got_size -= sz; + if (!info->h) + alpha_elf_tdata (info->gotobj)->local_got_size -= sz; + } + + /* If we've switched to a GOTTPREL relocation, increment the reference + count on that got entry. */ + if (use_gottprel) + { + struct alpha_elf_got_entry *tprel_gotent; + + for (tprel_gotent = *info->first_gotent; tprel_gotent ; + tprel_gotent = tprel_gotent->next) + if (tprel_gotent->gotobj == info->gotobj + && tprel_gotent->reloc_type == R_ALPHA_GOTTPREL + && tprel_gotent->addend == irel->r_addend) + break; + if (tprel_gotent) + tprel_gotent->use_count++; + else + { + if (info->gotent->use_count == 0) + tprel_gotent = info->gotent; + else + { + tprel_gotent = (struct alpha_elf_got_entry *) + bfd_alloc (info->abfd, sizeof (struct alpha_elf_got_entry)); + if (!tprel_gotent) + return false; + + tprel_gotent->next = *info->first_gotent; + *info->first_gotent = tprel_gotent; + + tprel_gotent->gotobj = info->gotobj; + tprel_gotent->addend = irel->r_addend; + tprel_gotent->got_offset = -1; + tprel_gotent->reloc_done = 0; + tprel_gotent->reloc_xlated = 0; + } + + tprel_gotent->use_count = 1; + tprel_gotent->reloc_type = R_ALPHA_GOTTPREL; + } + } + + return true; +} + +static struct elf_link_tls_segment * +elf64_alpha_relax_find_tls_segment (info, seg) + struct alpha_relax_info *info; + struct elf_link_tls_segment *seg; +{ + bfd *output_bfd = info->sec->output_section->owner; + asection *o; + unsigned int align; + bfd_vma base, end; + + for (o = output_bfd->sections; o ; o = o->next) + if ((o->flags & SEC_THREAD_LOCAL) != 0 + && (o->flags & SEC_LOAD) != 0) + break; + if (!o) + return NULL; + + base = o->vma; + align = 0; + + do + { + bfd_vma size; + + if (bfd_get_section_alignment (output_bfd, o) > align) + align = bfd_get_section_alignment (output_bfd, o); + + size = o->_raw_size; + if (size == 0 && (o->flags & SEC_HAS_CONTENTS) == 0) + { + struct bfd_link_order *lo; + for (lo = o->link_order_head; lo ; lo = lo->next) + if (size < lo->offset + lo->size) + size = lo->offset + lo->size; + } + end = o->vma + size; + o = o->next; + } + while (o && (o->flags & SEC_THREAD_LOCAL)); + + seg->start = base; + seg->size = end - base; + seg->align = align; + + return seg; +} + +static boolean +elf64_alpha_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + boolean *again; +{ + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Shdr *shndx_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs = NULL; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *free_contents = NULL; + Elf64_External_Sym *extsyms; + Elf64_External_Sym *free_extsyms = NULL; + Elf_External_Sym_Shndx *shndx_buf = NULL; + struct alpha_elf_got_entry **local_got_entries; + struct alpha_relax_info info; + struct elf_link_tls_segment tls_segment; + + /* We are not currently changing any sizes, so only one pass. */ + *again = false; + + if (link_info->relocateable + || (sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0) + return true; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; /* Load the relocations for this section. */ internal_relocs = (_bfd_elf64_link_read_relocs @@ -1418,83 +2078,89 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) info.abfd = abfd; info.sec = sec; info.link_info = link_info; + info.symtab_hdr = symtab_hdr; info.relocs = internal_relocs; info.relend = irelend = internal_relocs + sec->reloc_count; - /* Find the GP for this object. */ + /* Find the GP for this object. Do not store the result back via + _bfd_set_gp_value, since this could change again before final. */ info.gotobj = alpha_elf_tdata (abfd)->gotobj; if (info.gotobj) { asection *sgot = alpha_elf_tdata (info.gotobj)->got; - info.gp = _bfd_get_gp_value (info.gotobj); - if (info.gp == 0) - { - info.gp = (sgot->output_section->vma - + sgot->output_offset - + 0x8000); - _bfd_set_gp_value (info.gotobj, info.gp); - } + info.gp = (sgot->output_section->vma + + sgot->output_offset + + 0x8000); } - for (irel = internal_relocs; irel < irelend; irel++) + /* Get the section contents. */ + if (elf_section_data (sec)->this_hdr.contents != NULL) + info.contents = elf_section_data (sec)->this_hdr.contents; + else { - bfd_vma symval; - Elf_Internal_Sym isym; - struct alpha_elf_got_entry *gotent; - - if (ELF64_R_TYPE (irel->r_info) != (int) R_ALPHA_LITERAL) - continue; - - /* Get the section contents. */ + info.contents = (bfd_byte *) bfd_malloc (sec->_raw_size); if (info.contents == NULL) - { - if (elf_section_data (sec)->this_hdr.contents != NULL) - info.contents = elf_section_data (sec)->this_hdr.contents; - else - { - info.contents = (bfd_byte *) bfd_malloc (sec->_raw_size); - if (info.contents == NULL) - goto error_return; - free_contents = info.contents; + goto error_return; + free_contents = info.contents; - if (! bfd_get_section_contents (abfd, sec, info.contents, - (file_ptr) 0, sec->_raw_size)) - goto error_return; - } - } + if (! bfd_get_section_contents (abfd, sec, info.contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } - /* Read this BFD's symbols if we haven't done so already. */ + /* Read this BFD's symbols. */ + if (symtab_hdr->contents != NULL) + extsyms = (Elf64_External_Sym *) symtab_hdr->contents; + else + { + bfd_size_type amt = symtab_hdr->sh_info * sizeof (Elf64_External_Sym); + extsyms = (Elf64_External_Sym *) bfd_malloc (amt); if (extsyms == NULL) - { - bfd_size_type amt; + goto error_return; + free_extsyms = extsyms; + if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread ((PTR) extsyms, amt, abfd) != amt) + goto error_return; + } - if (symtab_hdr->contents != NULL) - extsyms = (Elf64_External_Sym *) symtab_hdr->contents; - else - { - amt = symtab_hdr->sh_info; - amt *= sizeof (Elf64_External_Sym); - extsyms = (Elf64_External_Sym *) bfd_malloc (amt); - if (extsyms == NULL) - goto error_return; - free_extsyms = extsyms; - if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) extsyms, amt, abfd) != amt) - goto error_return; - } + shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; + if (shndx_hdr->sh_size != 0) + { + bfd_size_type amt; + amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx); + shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); + if (shndx_buf == NULL) + goto error_return; + if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0 + || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt) + goto error_return; + } - shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; - if (shndx_hdr->sh_size != 0) - { - amt = symtab_hdr->sh_info; - amt *= sizeof (Elf_External_Sym_Shndx); - shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt); - if (shndx_buf == NULL) - goto error_return; - if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt) - goto error_return; - } + /* Compute the TLS segment information. The version normally found in + elf_hash_table (link_info)->tls_segment isn't built until final_link. + ??? Probably should look into extracting this into a common function. */ + info.tls_segment = elf64_alpha_relax_find_tls_segment (&info, &tls_segment); + + for (irel = internal_relocs; irel < irelend; irel++) + { + bfd_vma symval; + Elf_Internal_Sym isym; + struct alpha_elf_got_entry *gotent; + unsigned long r_type = ELF64_R_TYPE (irel->r_info); + + /* Early exit for unhandled or unrelaxable relocations. */ + switch (r_type) + { + case R_ALPHA_LITERAL: + case R_ALPHA_GPRELHIGH: + case R_ALPHA_GPRELLOW: + case R_ALPHA_GOTDTPREL: + case R_ALPHA_GOTTPREL: + case R_ALPHA_TLSGD: + case R_ALPHA_TLSLDM: + break; + default: + continue; } /* Get the value of the symbol referred to by the reloc. */ @@ -1506,9 +2172,10 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF64_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF64_R_SYM (irel->r_info) : 0); - bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf64_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == SHN_UNDEF) - info.tsec = bfd_und_section_ptr; + continue; else if (isym.st_shndx == SHN_ABS) info.tsec = bfd_abs_section_ptr; else if (isym.st_shndx == SHN_COMMON) @@ -1518,7 +2185,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) info.h = NULL; info.other = isym.st_other; - gotent = local_got_entries[ELF64_R_SYM(irel->r_info)]; + info.first_gotent = &local_got_entries[ELF64_R_SYM(irel->r_info)]; symval = isym.st_value; } else @@ -1534,62 +2201,93 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) || h->root.root.type == bfd_link_hash_warning) h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; - /* We can't do anthing with undefined or dynamic symbols. */ - if (h->root.root.type == bfd_link_hash_undefined - || h->root.root.type == bfd_link_hash_undefweak - || alpha_elf_dynamic_symbol_p (&h->root, link_info)) + /* If the symbol is undefined, we can't do anything with it. */ + if (h->root.root.type == bfd_link_hash_undefweak + || h->root.root.type == bfd_link_hash_undefined) + continue; + + /* If the symbol isn't defined in the current module, again + we can't do anything. */ + if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) continue; info.h = h; info.tsec = h->root.root.u.def.section; info.other = h->root.other; - gotent = h->got_entries; + info.first_gotent = &h->got_entries; symval = h->root.root.u.def.value; } /* Search for the got entry to be used by this relocation. */ - while (gotent->gotobj != info.gotobj || gotent->addend != irel->r_addend) - gotent = gotent->next; + for (gotent = *info.first_gotent; gotent ; gotent = gotent->next) + if (gotent->gotobj == info.gotobj + && gotent->reloc_type == r_type + && gotent->addend == irel->r_addend) + break; info.gotent = gotent; symval += info.tsec->output_section->vma + info.tsec->output_offset; symval += irel->r_addend; - BFD_ASSERT(info.gotent != NULL); + switch (r_type) + { + case R_ALPHA_LITERAL: + BFD_ASSERT(info.gotent != NULL); - /* If there exist LITUSE relocations immediately following, this - opens up all sorts of interesting optimizations, because we - now know every location that this address load is used. */ + /* If there exist LITUSE relocations immediately following, this + opens up all sorts of interesting optimizations, because we + now know every location that this address load is used. */ + if (irel+1 < irelend + && ELF64_R_TYPE (irel[1].r_info) == R_ALPHA_LITUSE) + { + if (!elf64_alpha_relax_with_lituse (&info, symval, irel)) + goto error_return; + } + else + { + if (!elf64_alpha_relax_got_load (&info, symval, irel, r_type)) + goto error_return; + } + break; - if (irel+1 < irelend && ELF64_R_TYPE (irel[1].r_info) == R_ALPHA_LITUSE) - { - irel = elf64_alpha_relax_with_lituse (&info, symval, irel, irelend); - if (irel == NULL) + case R_ALPHA_GPRELHIGH: + case R_ALPHA_GPRELLOW: + if (!elf64_alpha_relax_gprelhilo (&info, symval, irel, + r_type == R_ALPHA_GPRELHIGH)) goto error_return; - } - else - { - if (!elf64_alpha_relax_without_lituse (&info, symval, irel)) + break; + + case R_ALPHA_GOTDTPREL: + case R_ALPHA_GOTTPREL: + BFD_ASSERT(info.gotent != NULL); + if (!elf64_alpha_relax_got_load (&info, symval, irel, r_type)) + goto error_return; + break; + + case R_ALPHA_TLSGD: + case R_ALPHA_TLSLDM: + BFD_ASSERT(info.gotent != NULL); + if (!elf64_alpha_relax_tls_get_addr (&info, symval, irel, + r_type == R_ALPHA_TLSGD)) goto error_return; + break; } } - if (!elf64_alpha_size_got_sections (abfd, link_info)) + if (!elf64_alpha_size_plt_section (link_info)) + return false; + if (!elf64_alpha_size_got_sections (link_info)) + return false; + if (!elf64_alpha_size_rela_got_section (link_info)) return false; if (info.changed_relocs) - { - elf_section_data (sec)->relocs = internal_relocs; - } + elf_section_data (sec)->relocs = internal_relocs; else if (free_relocs != NULL) - { - free (free_relocs); - } + free (free_relocs); if (info.changed_contents) - { - elf_section_data (sec)->this_hdr.contents = info.contents; - } + elf_section_data (sec)->this_hdr.contents = info.contents; else if (free_contents != NULL) { if (! link_info->keep_memory) @@ -1643,7 +2341,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) #define PLT_ENTRY_WORD2 0 #define PLT_ENTRY_WORD3 0 -#define MAX_GOT_ENTRIES (64*1024 / 8) +#define MAX_GOT_SIZE (64*1024) #define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so" @@ -1656,7 +2354,7 @@ static boolean elf64_alpha_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf64_Internal_Shdr *hdr; - char *name; + const char *name; { asection *newsect; @@ -2244,41 +2942,108 @@ elf64_alpha_output_extsym (h, data) return true; } - -/* FIXME: Create a runtime procedure table from the .mdebug section. - -static boolean -mips_elf_create_procedure_table (handle, abfd, info, s, debug) - PTR handle; - bfd *abfd; - struct bfd_link_info *info; - asection *s; - struct ecoff_debug_info *debug; -*/ -/* Handle dynamic relocations when doing an Alpha ELF link. */ +/* Search for and possibly create a got entry. */ -static boolean -elf64_alpha_check_relocs (abfd, info, sec, relocs) +static struct alpha_elf_got_entry * +get_got_entry (abfd, h, r_type, r_symndx, r_addend) bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; + struct alpha_elf_link_hash_entry *h; + unsigned long r_type, r_symndx; + bfd_vma r_addend; { - bfd *dynobj; - asection *sreloc; - const char *rel_sec_name; - Elf_Internal_Shdr *symtab_hdr; - struct alpha_elf_link_hash_entry **sym_hashes; - struct alpha_elf_got_entry **local_got_entries; - const Elf_Internal_Rela *rel, *relend; - int got_created; - bfd_size_type amt; + struct alpha_elf_got_entry *gotent; + struct alpha_elf_got_entry **slot; - if (info->relocateable) - return true; + if (h) + slot = &h->got_entries; + else + { + /* This is a local .got entry -- record for merge. */ - dynobj = elf_hash_table(info)->dynobj; + struct alpha_elf_got_entry **local_got_entries; + + local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; + if (!local_got_entries) + { + bfd_size_type size; + Elf_Internal_Shdr *symtab_hdr; + + symtab_hdr = &elf_tdata(abfd)->symtab_hdr; + size = symtab_hdr->sh_info; + size *= sizeof (struct alpha_elf_got_entry *); + + local_got_entries + = (struct alpha_elf_got_entry **) bfd_zalloc (abfd, size); + if (!local_got_entries) + return NULL; + + alpha_elf_tdata (abfd)->local_got_entries = local_got_entries; + } + + slot = &local_got_entries[r_symndx]; + } + + for (gotent = *slot; gotent ; gotent = gotent->next) + if (gotent->gotobj == abfd + && gotent->reloc_type == r_type + && gotent->addend == r_addend) + break; + + if (!gotent) + { + int entry_size; + bfd_size_type amt; + + amt = sizeof (struct alpha_elf_got_entry); + gotent = (struct alpha_elf_got_entry *) bfd_alloc (abfd, amt); + if (!gotent) + return NULL; + + gotent->gotobj = abfd; + gotent->addend = r_addend; + gotent->got_offset = -1; + gotent->use_count = 1; + gotent->reloc_type = r_type; + gotent->reloc_done = 0; + gotent->reloc_xlated = 0; + + gotent->next = *slot; + *slot = gotent; + + entry_size = alpha_got_entry_size (r_type); + alpha_elf_tdata (abfd)->total_got_size += entry_size; + if (!h) + alpha_elf_tdata(abfd)->local_got_size += entry_size; + } + else + gotent->use_count += 1; + + return gotent; +} + +/* Handle dynamic relocations when doing an Alpha ELF link. */ + +static boolean +elf64_alpha_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + bfd *dynobj; + asection *sreloc; + const char *rel_sec_name; + Elf_Internal_Shdr *symtab_hdr; + struct alpha_elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel, *relend; + boolean got_created; + bfd_size_type amt; + + if (info->relocateable) + return true; + + dynobj = elf_hash_table(info)->dynobj; if (dynobj == NULL) elf_hash_table(info)->dynobj = dynobj = abfd; @@ -2286,14 +3051,23 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) rel_sec_name = NULL; symtab_hdr = &elf_tdata(abfd)->symtab_hdr; sym_hashes = alpha_elf_sym_hashes(abfd); - local_got_entries = alpha_elf_tdata(abfd)->local_got_entries; - got_created = 0; + got_created = false; relend = relocs + sec->reloc_count; for (rel = relocs; rel < relend; ++rel) { + enum { + NEED_GOT = 1, + NEED_GOT_ENTRY = 2, + NEED_DYNREL = 4 + }; + unsigned long r_symndx, r_type; struct alpha_elf_link_hash_entry *h; + unsigned int gotent_flags; + boolean maybe_dynamic; + unsigned int need; + bfd_vma addend; r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) @@ -2308,125 +3082,40 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) h->root.elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; } + + /* We can only get preliminary data on whether a symbol is + locally or externally defined, as not all of the input files + have yet been processed. Do something with what we know, as + this may help reduce memory usage and processing time later. */ + maybe_dynamic = false; + if (h && ((info->shared + && (!info->symbolic || info->allow_shlib_undefined)) + || ! (h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + || h->root.root.type == bfd_link_hash_defweak)) + maybe_dynamic = true; + + need = 0; + gotent_flags = 0; r_type = ELF64_R_TYPE (rel->r_info); + addend = rel->r_addend; switch (r_type) { case R_ALPHA_LITERAL: - { - struct alpha_elf_got_entry *gotent; - int flags = 0; - - if (h) - { - /* Search for and possibly create a got entry. */ - for (gotent = h->got_entries; gotent ; gotent = gotent->next) - if (gotent->gotobj == abfd && - gotent->addend == rel->r_addend) - break; - - if (!gotent) - { - amt = sizeof (struct alpha_elf_got_entry); - gotent = ((struct alpha_elf_got_entry *) - bfd_alloc (abfd, amt)); - if (!gotent) - return false; - - gotent->gotobj = abfd; - gotent->addend = rel->r_addend; - gotent->got_offset = -1; - gotent->flags = 0; - gotent->use_count = 1; - - gotent->next = h->got_entries; - h->got_entries = gotent; - - alpha_elf_tdata (abfd)->total_got_entries++; - } - else - gotent->use_count += 1; - } - else - { - /* This is a local .got entry -- record for merge. */ - if (!local_got_entries) - { - bfd_size_type size; - size = symtab_hdr->sh_info; - size *= sizeof (struct alpha_elf_got_entry *); - - local_got_entries = ((struct alpha_elf_got_entry **) - bfd_alloc (abfd, size)); - if (!local_got_entries) - return false; - - memset (local_got_entries, 0, (size_t) size); - alpha_elf_tdata (abfd)->local_got_entries = - local_got_entries; - } - - for (gotent = local_got_entries[ELF64_R_SYM(rel->r_info)]; - gotent != NULL && gotent->addend != rel->r_addend; - gotent = gotent->next) - continue; - if (!gotent) - { - amt = sizeof (struct alpha_elf_got_entry); - gotent = ((struct alpha_elf_got_entry *) - bfd_alloc (abfd, amt)); - if (!gotent) - return false; - - gotent->gotobj = abfd; - gotent->addend = rel->r_addend; - gotent->got_offset = -1; - gotent->flags = 0; - gotent->use_count = 1; - - gotent->next = local_got_entries[ELF64_R_SYM(rel->r_info)]; - local_got_entries[ELF64_R_SYM(rel->r_info)] = gotent; - - alpha_elf_tdata(abfd)->total_got_entries++; - alpha_elf_tdata(abfd)->n_local_got_entries++; - } - else - gotent->use_count += 1; - } - - /* Remember how this literal is used from its LITUSEs. - This will be important when it comes to decide if we can - create a .plt entry for a function symbol. */ - if (rel+1 < relend - && ELF64_R_TYPE (rel[1].r_info) == R_ALPHA_LITUSE) - { - do - { - ++rel; - if (rel->r_addend >= 1 && rel->r_addend <= 3) - flags |= 1 << rel->r_addend; - } - while (rel+1 < relend && - ELF64_R_TYPE (rel[1].r_info) == R_ALPHA_LITUSE); - } - else - { - /* No LITUSEs -- presumably the address is not being - loaded for nothing. */ - flags = ALPHA_ELF_LINK_HASH_LU_ADDR; - } - - gotent->flags |= flags; - if (h) - { - /* Make a guess as to whether a .plt entry will be needed. */ - if ((h->flags |= flags) == ALPHA_ELF_LINK_HASH_LU_FUNC) - h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - else - h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; - } - } - /* FALLTHRU */ + need = NEED_GOT | NEED_GOT_ENTRY; + + /* Remember how this literal is used from its LITUSEs. + This will be important when it comes to decide if we can + create a .plt entry for a function symbol. */ + while (++rel < relend && ELF64_R_TYPE (rel->r_info) == R_ALPHA_LITUSE) + if (rel->r_addend >= 1 && rel->r_addend <= 5) + gotent_flags |= 1 << rel->r_addend; + --rel; + + /* No LITUSEs -- presumably the address is used somehow. */ + if (gotent_flags == 0) + gotent_flags = ALPHA_ELF_LINK_HASH_LU_ADDR; + break; case R_ALPHA_GPDISP: case R_ALPHA_GPREL16: @@ -2434,9 +3123,38 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) case R_ALPHA_GPRELHIGH: case R_ALPHA_GPRELLOW: case R_ALPHA_BRSGP: - /* We don't actually use the .got here, but the sections must - be created before the linker maps input sections to output - sections. */ + need = NEED_GOT; + break; + + case R_ALPHA_REFLONG: + case R_ALPHA_REFQUAD: + if (info->shared || maybe_dynamic) + need = NEED_DYNREL; + break; + + case R_ALPHA_TLSGD: + case R_ALPHA_TLSLDM: + case R_ALPHA_GOTDTPREL: + need = NEED_GOT | NEED_GOT_ENTRY; + break; + + case R_ALPHA_GOTTPREL: + need = NEED_GOT | NEED_GOT_ENTRY; + gotent_flags = ALPHA_ELF_LINK_HASH_TLS_IE; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_ALPHA_TPREL64: + if (info->shared || maybe_dynamic) + need = NEED_DYNREL; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + } + + if (need & NEED_GOT) + { if (!got_created) { if (!elf64_alpha_create_got_section (abfd, info)) @@ -2450,17 +3168,36 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) got_created = 1; } - break; + } - case R_ALPHA_SREL16: - case R_ALPHA_SREL32: - case R_ALPHA_SREL64: - if (h == NULL) - break; - /* FALLTHRU */ + if (need & NEED_GOT_ENTRY) + { + struct alpha_elf_got_entry *gotent; - case R_ALPHA_REFLONG: - case R_ALPHA_REFQUAD: + gotent = get_got_entry (abfd, h, r_type, r_symndx, addend); + if (!gotent) + return false; + + if (gotent_flags) + { + gotent->flags |= gotent_flags; + if (h) + { + gotent_flags |= h->flags; + h->flags = gotent_flags; + + /* Make a guess as to whether a .plt entry is needed. */ + if ((gotent_flags & ALPHA_ELF_LINK_HASH_LU_FUNC) + && !(gotent_flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC)) + h->root.elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + else + h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + } + } + + if (need & NEED_DYNREL) + { if (rel_sec_name == NULL) { rel_sec_name = (bfd_elf_string_from_elf_section @@ -2530,15 +3267,15 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs) else rent->count++; } - else if (info->shared && (sec->flags & SEC_ALLOC)) + else if (info->shared) { /* If this is a shared library, and the section is to be loaded into memory, we need a RELATIVE reloc. */ sreloc->_raw_size += sizeof (Elf64_External_Rela); - if (sec->flags & SEC_READONLY) + if ((sec->flags & (SEC_READONLY | SEC_ALLOC)) + == (SEC_READONLY | SEC_ALLOC)) info->flags |= DF_TEXTREL; } - break; } } @@ -2570,7 +3307,8 @@ elf64_alpha_adjust_dynamic_symbol (info, h) && ((h->type == STT_FUNC && !(ah->flags & ALPHA_ELF_LINK_HASH_LU_ADDR)) || (h->type == STT_NOTYPE - && ah->flags == ALPHA_ELF_LINK_HASH_LU_FUNC)) + && (ah->flags & ALPHA_ELF_LINK_HASH_LU_FUNC) + && !(ah->flags & ~ALPHA_ELF_LINK_HASH_LU_FUNC))) /* Don't prevent otherwise valid programs from linking by attempting to create a new .got entry somewhere. A Correct Solution would be to add a new .got section to a new object file and let it be merged @@ -2667,8 +3405,13 @@ elf64_alpha_merge_ind_symbols (hi, dummy) { gin = gi->next; for (gs = gsh; gs ; gs = gs->next) - if (gi->gotobj == gs->gotobj && gi->addend == gs->addend) - goto got_found; + if (gi->gotobj == gs->gotobj + && gi->reloc_type == gs->reloc_type + && gi->addend == gs->addend) + { + gi->use_count += gs->use_count; + goto got_found; + } gi->next = hs->got_entries; hs->got_entries = gi; got_found:; @@ -2710,15 +3453,15 @@ static boolean elf64_alpha_can_merge_gots (a, b) bfd *a, *b; { - int total = alpha_elf_tdata (a)->total_got_entries; + int total = alpha_elf_tdata (a)->total_got_size; bfd *bsub; /* Trivial quick fallout test. */ - if (total + alpha_elf_tdata (b)->total_got_entries <= MAX_GOT_ENTRIES) + if (total + alpha_elf_tdata (b)->total_got_size <= MAX_GOT_SIZE) return true; /* By their nature, local .got entries cannot be merged. */ - if ((total += alpha_elf_tdata (b)->n_local_got_entries) > MAX_GOT_ENTRIES) + if ((total += alpha_elf_tdata (b)->local_got_size) > MAX_GOT_SIZE) return false; /* Failing the common trivial comparison, we must effectively @@ -2749,10 +3492,13 @@ elf64_alpha_can_merge_gots (a, b) continue; for (ae = h->got_entries; ae ; ae = ae->next) - if (ae->gotobj == a && ae->addend == be->addend) + if (ae->gotobj == a + && ae->reloc_type == be->reloc_type + && ae->addend == be->addend) goto global_found; - if (++total > MAX_GOT_ENTRIES) + total += alpha_got_entry_size (be->reloc_type); + if (total > MAX_GOT_SIZE) return false; global_found:; } @@ -2768,14 +3514,14 @@ static void elf64_alpha_merge_gots (a, b) bfd *a, *b; { - int total = alpha_elf_tdata (a)->total_got_entries; + int total = alpha_elf_tdata (a)->total_got_size; bfd *bsub; /* Remember local expansion. */ { - int e = alpha_elf_tdata (b)->n_local_got_entries; + int e = alpha_elf_tdata (b)->local_got_size; total += e; - alpha_elf_tdata (a)->n_local_got_entries += e; + alpha_elf_tdata (a)->local_got_size += e; } for (bsub = b; bsub ; bsub = alpha_elf_tdata (bsub)->in_got_link_next) @@ -2825,7 +3571,9 @@ elf64_alpha_merge_gots (a, b) continue; for (ae = *start; ae ; ae = ae->next) - if (ae->gotobj == a && ae->addend == be->addend) + if (ae->gotobj == a + && ae->reloc_type == be->reloc_type + && ae->addend == be->addend) { ae->flags |= be->flags; ae->use_count += be->use_count; @@ -2833,7 +3581,7 @@ elf64_alpha_merge_gots (a, b) goto global_found; } be->gotobj = a; - total += 1; + total += alpha_got_entry_size (be->reloc_type); global_found:; } @@ -2841,7 +3589,7 @@ elf64_alpha_merge_gots (a, b) alpha_elf_tdata (bsub)->gotobj = a; } - alpha_elf_tdata (a)->total_got_entries = total; + alpha_elf_tdata (a)->total_got_size = total; /* Merge the two in_got chains. */ { @@ -2874,7 +3622,7 @@ elf64_alpha_calc_got_offsets_for_symbol (h, arg) = &alpha_elf_tdata (gotent->gotobj)->got->_raw_size; gotent->got_offset = *plge; - *plge += 8; + *plge += alpha_got_entry_size (gotent->reloc_type); } return true; @@ -2916,7 +3664,7 @@ elf64_alpha_calc_got_offsets (info) if (gotent->use_count > 0) { gotent->got_offset = got_offset; - got_offset += 8; + got_offset += alpha_got_entry_size (gotent->reloc_type); } } @@ -2928,8 +3676,7 @@ elf64_alpha_calc_got_offsets (info) /* Constructs the gots. */ static boolean -elf64_alpha_size_got_sections (output_bfd, info) - bfd *output_bfd ATTRIBUTE_UNUSED; +elf64_alpha_size_got_sections (info) struct bfd_link_info *info; { bfd *i, *got_list, *cur_got_obj = NULL; @@ -2950,13 +3697,13 @@ elf64_alpha_size_got_sections (output_bfd, info) /* We are assuming no merging has yet ocurred. */ BFD_ASSERT (this_got == i); - if (alpha_elf_tdata (this_got)->total_got_entries > MAX_GOT_ENTRIES) + if (alpha_elf_tdata (this_got)->total_got_size > MAX_GOT_SIZE) { /* Yikes! A single object file has too many entries. */ (*_bfd_error_handler) (_("%s: .got subsegment exceeds 64K (size %d)"), bfd_archive_filename (i), - alpha_elf_tdata (this_got)->total_got_entries * 8); + alpha_elf_tdata (this_got)->total_got_size); return false; } @@ -3003,9 +3750,80 @@ elf64_alpha_size_got_sections (output_bfd, info) return true; } +/* Called from relax_section to rebuild the PLT in light of + potential changes in the function's status. */ + +static boolean +elf64_alpha_size_plt_section (info) + struct bfd_link_info *info; +{ + asection *splt, *spltrel; + unsigned long entries; + bfd *dynobj; + + dynobj = elf_hash_table(info)->dynobj; + splt = bfd_get_section_by_name(dynobj, ".plt"); + if (splt == NULL) + return true; + + splt->_raw_size = 0; + + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_size_plt_section_1, splt); + + splt->_cooked_size = splt->_raw_size; + + /* Every plt entry requires a JMP_SLOT relocation. */ + spltrel = bfd_get_section_by_name (dynobj, ".rela.plt"); + if (splt->_raw_size) + entries = (splt->_raw_size - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; + else + entries = 0; + spltrel->_raw_size = entries * sizeof (Elf64_External_Rela); + spltrel->_cooked_size = spltrel->_raw_size; + + return true; +} + +static boolean +elf64_alpha_size_plt_section_1 (h, data) + struct alpha_elf_link_hash_entry *h; + PTR data; +{ + asection *splt = (asection *) data; + struct alpha_elf_got_entry *gotent; + + /* If we didn't need an entry before, we still don't. */ + if (!(h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)) + return true; + + /* There must still be a LITERAL got entry for the function. */ + for (gotent = h->got_entries; gotent ; gotent = gotent->next) + if (gotent->reloc_type == R_ALPHA_LITERAL + && gotent->use_count > 0) + break; + + /* If there is, reset the PLT offset. If not, there's no longer + a need for the PLT entry. */ + if (gotent) + { + if (splt->_raw_size == 0) + splt->_raw_size = PLT_HEADER_SIZE; + h->root.plt.offset = splt->_raw_size; + splt->_raw_size += PLT_ENTRY_SIZE; + } + else + { + h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->root.plt.offset = -1; + } + + return true; +} + static boolean elf64_alpha_always_size_sections (output_bfd, info) - bfd *output_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { bfd *i; @@ -3018,7 +3836,7 @@ elf64_alpha_always_size_sections (output_bfd, info) elf64_alpha_merge_ind_symbols, NULL); - if (!elf64_alpha_size_got_sections (output_bfd, info)) + if (!elf64_alpha_size_got_sections (info)) return false; /* Allocate space for all of the .got subsections. */ @@ -3037,6 +3855,40 @@ elf64_alpha_always_size_sections (output_bfd, info) return true; } +/* The number of dynamic relocations required by a static relocation. */ + +static int +alpha_dynamic_entries_for_reloc (r_type, dynamic, shared) + int r_type, dynamic, shared; +{ + switch (r_type) + { + /* May appear in GOT entries. */ + case R_ALPHA_TLSGD: + return (dynamic ? 2 : shared ? 1 : 0); + case R_ALPHA_TLSLDM: + return shared; + case R_ALPHA_LITERAL: + return dynamic || shared; + case R_ALPHA_GOTDTPREL: + case R_ALPHA_GOTTPREL: + return dynamic; + + /* May appear in data sections. */ + case R_ALPHA_REFLONG: + case R_ALPHA_REFQUAD: + return dynamic || shared; + case R_ALPHA_SREL64: + case R_ALPHA_TPREL64: + return dynamic; + + /* Everything else is illegal. We'll issue an error during + relocate_section. */ + default: + return 0; + } +} + /* Work out the sizes of the dynamic relocation entries. */ static boolean @@ -3044,6 +3896,10 @@ elf64_alpha_calc_dynrel_sizes (h, info) struct alpha_elf_link_hash_entry *h; struct bfd_link_info *info; { + boolean dynamic; + struct alpha_elf_reloc_entry *relent; + unsigned long entries; + if (h->root.root.type == bfd_link_hash_warning) h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; @@ -3062,51 +3918,125 @@ elf64_alpha_calc_dynrel_sizes (h, info) && (h->root.root.type == bfd_link_hash_defined || h->root.root.type == bfd_link_hash_defweak) && !(h->root.root.u.def.section->owner->flags & DYNAMIC)) - { - h->root.elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - } + h->root.elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; /* If the symbol is dynamic, we'll need all the relocations in their natural form. If this is a shared object, and it has been forced local, we'll need the same number of RELATIVE relocations. */ - if (alpha_elf_dynamic_symbol_p (&h->root, info) || info->shared) + dynamic = alpha_elf_dynamic_symbol_p (&h->root, info); + + for (relent = h->reloc_entries; relent; relent = relent->next) { - struct alpha_elf_reloc_entry *relent; - bfd *dynobj; - struct alpha_elf_got_entry *gotent; - bfd_size_type count; - asection *srel; + entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic, + info->shared); + if (entries) + { + relent->srel->_raw_size += + entries * sizeof (Elf64_External_Rela) * relent->count; + if (relent->reltext) + info->flags |= DT_TEXTREL; + } + } - for (relent = h->reloc_entries; relent; relent = relent->next) - if (relent->rtype == R_ALPHA_REFLONG - || relent->rtype == R_ALPHA_REFQUAD) - { - relent->srel->_raw_size += - sizeof (Elf64_External_Rela) * relent->count; - if (relent->reltext) - info->flags |= DT_TEXTREL; - } + return true; +} - dynobj = elf_hash_table(info)->dynobj; - count = 0; +/* Set the sizes of the dynamic relocation sections. */ - for (gotent = h->got_entries; gotent ; gotent = gotent->next) - count++; +static boolean +elf64_alpha_size_rela_got_section (info) + struct bfd_link_info *info; +{ + unsigned long entries; + bfd *i, *dynobj; + asection *srel; - /* If we are using a .plt entry, subtract one, as the first - reference uses a .rela.plt entry instead. */ - if (h->root.plt.offset != MINUS_ONE) - count--; + /* Shared libraries often require RELATIVE relocs, and some relocs + require attention for the main application as well. */ - if (count > 0) + entries = 0; + for (i = alpha_elf_hash_table(info)->got_list; + i ; i = alpha_elf_tdata(i)->got_link_next) + { + bfd *j; + + for (j = i; j ; j = alpha_elf_tdata(j)->in_got_link_next) { - srel = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (srel != NULL); - srel->_raw_size += sizeof (Elf64_External_Rela) * count; + struct alpha_elf_got_entry **local_got_entries, *gotent; + int k, n; + + local_got_entries = alpha_elf_tdata(j)->local_got_entries; + if (!local_got_entries) + continue; + + for (k = 0, n = elf_tdata(j)->symtab_hdr.sh_info; k < n; ++k) + for (gotent = local_got_entries[k]; + gotent ; gotent = gotent->next) + if (gotent->use_count > 0) + entries += (alpha_dynamic_entries_for_reloc + (gotent->reloc_type, 0, info->shared)); } } + dynobj = elf_hash_table(info)->dynobj; + srel = bfd_get_section_by_name (dynobj, ".rela.got"); + if (!srel) + { + BFD_ASSERT (entries == 0); + return true; + } + srel->_raw_size = sizeof (Elf64_External_Rela) * entries; + + /* Now do the non-local symbols. */ + alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), + elf64_alpha_size_rela_got_1, info); + + srel->_cooked_size = srel->_raw_size; + + return true; +} + +/* Subroutine of elf64_alpha_size_rela_got_section for doing the + global symbols. */ + +static boolean +elf64_alpha_size_rela_got_1 (h, info) + struct alpha_elf_link_hash_entry *h; + struct bfd_link_info *info; +{ + boolean dynamic; + struct alpha_elf_got_entry *gotent; + unsigned long entries; + + if (h->root.root.type == bfd_link_hash_warning) + h = (struct alpha_elf_link_hash_entry *) h->root.root.u.i.link; + + /* If the symbol is dynamic, we'll need all the relocations in their + natural form. If this is a shared object, and it has been forced + local, we'll need the same number of RELATIVE relocations. */ + + dynamic = alpha_elf_dynamic_symbol_p (&h->root, info); + + entries = 0; + for (gotent = h->got_entries; gotent ; gotent = gotent->next) + if (gotent->use_count > 0) + entries += alpha_dynamic_entries_for_reloc (gotent->reloc_type, + dynamic, info->shared); + + /* If we are using a .plt entry, subtract one, as the first + reference uses a .rela.plt entry instead. */ + if (h->root.plt.offset != MINUS_ONE) + entries--; + + if (entries > 0) + { + bfd *dynobj = elf_hash_table(info)->dynobj; + asection *srel = bfd_get_section_by_name (dynobj, ".rela.got"); + BFD_ASSERT (srel != NULL); + srel->_raw_size += sizeof (Elf64_External_Rela) * entries; + } + return true; } @@ -3140,27 +4070,9 @@ elf64_alpha_size_dynamic_sections (output_bfd, info) collected information in check_relocs that we can now apply to size the dynamic relocation sections. */ alpha_elf_link_hash_traverse (alpha_elf_hash_table (info), - elf64_alpha_calc_dynrel_sizes, - info); - - /* When building shared libraries, each local .got entry needs a - RELATIVE reloc. */ - if (info->shared) - { - bfd *i; - asection *srel; - bfd_size_type count; + elf64_alpha_calc_dynrel_sizes, info); - srel = bfd_get_section_by_name (dynobj, ".rela.got"); - BFD_ASSERT (srel != NULL); - - for (i = alpha_elf_hash_table(info)->got_list, count = 0; - i != NULL; - i = alpha_elf_tdata(i)->got_link_next) - count += alpha_elf_tdata(i)->n_local_got_entries; - - srel->_raw_size += count * sizeof (Elf64_External_Rela); - } + elf64_alpha_size_rela_got_section (info); } /* else we're not dynamic and by definition we don't need such things. */ @@ -3264,6 +4176,71 @@ elf64_alpha_size_dynamic_sections (output_bfd, info) return true; } +/* Relocate an Alpha ELF section for a relocatable link. + + We don't have to change anything unless the reloc is against a section + symbol, in which case we have to adjust according to where the section + symbol winds up in the output section. */ + +static boolean +elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd ATTRIBUTE_UNUSED; + struct bfd_link_info *info ATTRIBUTE_UNUSED; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents ATTRIBUTE_UNUSED; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + unsigned long symtab_hdr_sh_info; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + boolean ret_val = true; + + symtab_hdr_sh_info = elf_tdata (input_bfd)->symtab_hdr.sh_info; + + relend = relocs + input_section->reloc_count; + for (rel = relocs; rel < relend; rel++) + { + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + unsigned long r_type; + + r_type = ELF64_R_TYPE(rel->r_info); + if (r_type >= R_ALPHA_max) + { + (*_bfd_error_handler) + (_("%s: unknown relocation type %d"), + bfd_archive_filename (input_bfd), (int)r_type); + bfd_set_error (bfd_error_bad_value); + ret_val = false; + continue; + } + + r_symndx = ELF64_R_SYM(rel->r_info); + + /* The symbol associated with GPDISP and LITUSE is + immaterial. Only the addend is significant. */ + if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE) + continue; + + if (r_symndx < symtab_hdr_sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + } + + return ret_val; +} + /* Relocate an Alpha ELF section. */ static boolean @@ -3281,22 +4258,39 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - asection *sec, *sgot, *srel, *srelgot; + struct elf_link_tls_segment *tls_segment; + asection *sgot, *srel, *srelgot; bfd *dynobj, *gotobj; - bfd_vma gp; - boolean ret_val = true; + bfd_vma gp, tp_base, dtp_base; + struct alpha_elf_got_entry **local_got_entries; + boolean ret_val; + const char *section_name; + + /* Handle relocatable links with a smaller loop. */ + if (info->relocateable) + return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, + input_section, contents, relocs, + local_syms, local_sections); + + /* This is a final link. */ + + ret_val = true; - srelgot = srel = NULL; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + dynobj = elf_hash_table (info)->dynobj; if (dynobj) - { - srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); - } + srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); + else + srelgot = NULL; + + section_name = (bfd_elf_string_from_elf_section + (input_bfd, elf_elfheader(input_bfd)->e_shstrndx, + elf_section_data(input_section)->rel_hdr.sh_name)); + BFD_ASSERT(section_name != NULL); + srel = bfd_get_section_by_name (dynobj, section_name); /* Find the gp value for this input bfd. */ - sgot = NULL; - gp = 0; gotobj = alpha_elf_tdata (input_bfd)->gotobj; if (gotobj) { @@ -3310,66 +4304,97 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, _bfd_set_gp_value (gotobj, gp); } } + else + { + sgot = NULL; + gp = 0; + } + + local_got_entries = alpha_elf_tdata(input_bfd)->local_got_entries; + + tls_segment = elf_hash_table (info)->tls_segment; + if (tls_segment) + { + dtp_base = alpha_get_dtprel_base (tls_segment); + tp_base = alpha_get_tprel_base (tls_segment); + } + else + dtp_base = tp_base = 0; - rel = relocs; relend = relocs + input_section->reloc_count; - for (; rel < relend; rel++) + for (rel = relocs; rel < relend; rel++) { - int r_type; + struct alpha_elf_link_hash_entry *h = NULL; + struct alpha_elf_got_entry *gotent; + bfd_reloc_status_type r; reloc_howto_type *howto; unsigned long r_symndx; - struct alpha_elf_link_hash_entry *h; - Elf_Internal_Sym *sym; - bfd_vma relocation; + Elf_Internal_Sym *sym = NULL; + asection *sec = NULL; + bfd_vma value; bfd_vma addend; - bfd_reloc_status_type r; + boolean dynamic_symbol_p; + boolean undef_weak_ref = false; + unsigned long r_type; r_type = ELF64_R_TYPE(rel->r_info); - if (r_type < 0 || r_type >= (int) R_ALPHA_max) + if (r_type >= R_ALPHA_max) { + (*_bfd_error_handler) + (_("%s: unknown relocation type %d"), + bfd_archive_filename (input_bfd), (int)r_type); bfd_set_error (bfd_error_bad_value); - return false; + ret_val = false; + continue; } - howto = elf64_alpha_howto_table + r_type; + howto = elf64_alpha_howto_table + r_type; r_symndx = ELF64_R_SYM(rel->r_info); - if (info->relocateable) + if (r_symndx < symtab_hdr->sh_info) { - /* This is a relocateable link. We don't have to change - anything, unless the reloc is against a section symbol, - in which case we have to adjust according to where the - section symbol winds up in the output section. */ - - /* The symbol associated with GPDISP and LITUSE is - immaterial. Only the addend is significant. */ - if (r_type == R_ALPHA_GPDISP || r_type == R_ALPHA_LITUSE) - continue; + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); - if (r_symndx < symtab_hdr->sh_info) + if (local_got_entries) + gotent = local_got_entries[r_symndx]; + else + gotent = NULL; + + /* Need to adjust local GOT entries' addends for SEC_MERGE + unless it has been done already. */ + if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION + && (elf_section_data (sec)->sec_info_type + == ELF_INFO_TYPE_MERGE) + && gotent + && !gotent->reloc_xlated) { - sym = local_syms + r_symndx; - if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) + struct alpha_elf_got_entry *ent; + asection *msec; + + for (ent = gotent; ent; ent = ent->next) { - sec = local_sections[r_symndx]; - rel->r_addend += sec->output_offset + sym->st_value; + ent->reloc_xlated = 1; + if (ent->use_count == 0) + continue; + msec = sec; + ent->addend = + _bfd_merged_section_offset (output_bfd, &msec, + elf_section_data (sec)-> + sec_info, + sym->st_value + ent->addend, + (bfd_vma) 0); + ent->addend -= sym->st_value; + ent->addend += msec->output_section->vma + + msec->output_offset + - sec->output_section->vma + - sec->output_offset; } } - continue; - } - - /* This is a final link. */ - - h = NULL; - sym = NULL; - sec = NULL; - - if (r_symndx < symtab_hdr->sh_info) - { - sym = local_syms + r_symndx; - sec = local_sections[r_symndx]; - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + dynamic_symbol_p = false; } else { @@ -3379,27 +4404,32 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, || h->root.root.type == bfd_link_hash_warning) h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; + value = 0; if (h->root.root.type == bfd_link_hash_defined || h->root.root.type == bfd_link_hash_defweak) { sec = h->root.root.u.def.section; - if (sec->output_section == NULL) - relocation = 0; - else - { - relocation = (h->root.root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } + /* Detect the cases that sym_sec->output_section is + expected to be NULL -- all cases in which the symbol + is defined in another shared module. This includes + PLT relocs for which we've created a PLT entry and + other relocs for which we're prepared to create + dynamic relocations. */ + /* ??? Just accept it NULL and continue. */ + + if (sec->output_section != NULL) + value = (h->root.root.u.def.value + + sec->output_section->vma + + sec->output_offset); } else if (h->root.root.type == bfd_link_hash_undefweak) - relocation = 0; + undef_weak_ref = true; else if (info->shared && (!info->symbolic || info->allow_shlib_undefined) && !info->no_undefined && ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT) - relocation = 0; + ; else { if (!((*info->callbacks->undefined_symbol) @@ -3407,11 +4437,24 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, input_section, rel->r_offset, (!info->shared || info->no_undefined || ELF_ST_VISIBILITY (h->root.other))))) - ret_val = false; - relocation = 0; + return false; + ret_val = false; + continue; } + + dynamic_symbol_p = alpha_elf_dynamic_symbol_p (&h->root, info); + gotent = h->got_entries; } + addend = rel->r_addend; + value += addend; + + /* Search for the proper got entry. */ + for (; gotent ; gotent = gotent->next) + if (gotent->gotobj == gotobj + && gotent->reloc_type == r_type + && gotent->addend == addend) + break; switch (r_type) { @@ -3421,124 +4464,66 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT(gp != 0); - relocation = (input_section->output_section->vma - + input_section->output_offset - + rel->r_offset); + value = (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset); - p_ldah = contents + rel->r_offset - input_section->vma; + p_ldah = contents + rel->r_offset; p_lda = p_ldah + rel->r_addend; - r = elf64_alpha_do_reloc_gpdisp (input_bfd, gp - relocation, + r = elf64_alpha_do_reloc_gpdisp (input_bfd, gp - value, p_ldah, p_lda); } break; case R_ALPHA_LITERAL: - { - struct alpha_elf_got_entry *gotent; - boolean dynamic_symbol; - - BFD_ASSERT(sgot != NULL); - BFD_ASSERT(gp != 0); - - if (h != NULL) - { - gotent = h->got_entries; - dynamic_symbol = alpha_elf_dynamic_symbol_p (&h->root, info); - } - else - { - gotent = (alpha_elf_tdata(input_bfd)-> - local_got_entries[r_symndx]); - dynamic_symbol = false; - - /* Need to adjust local GOT entries' addends for SEC_MERGE - unless it has been done already. */ - if ((sec->flags & SEC_MERGE) - && ELF_ST_TYPE (sym->st_info) == STT_SECTION - && (elf_section_data (sec)->sec_info_type - == ELF_INFO_TYPE_MERGE) - && (gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED) == 0) - { - struct alpha_elf_got_entry *ent; - asection *msec; - - for (ent = gotent; ent; ent = ent->next) - { - ent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED; - if (ent->use_count == 0) - continue; - msec = sec; - ent->addend = - _bfd_merged_section_offset (output_bfd, &msec, - elf_section_data (sec)-> - sec_info, - sym->st_value - + ent->addend, - (bfd_vma) 0); - ent->addend -= sym->st_value; - ent->addend += msec->output_section->vma - + msec->output_offset - - sec->output_section->vma - - sec->output_offset; - } - } - } + BFD_ASSERT(sgot != NULL); + BFD_ASSERT(gp != 0); + BFD_ASSERT(gotent != NULL); + BFD_ASSERT(gotent->use_count >= 1); - BFD_ASSERT(gotent != NULL); + if (!gotent->reloc_done) + { + gotent->reloc_done = 1; - while (gotent->gotobj != gotobj || gotent->addend != addend) - gotent = gotent->next; + bfd_put_64 (output_bfd, value, + sgot->contents + gotent->got_offset); - BFD_ASSERT(gotent->use_count >= 1); + /* If the symbol has been forced local, output a + RELATIVE reloc, otherwise it will be handled in + finish_dynamic_symbol. */ + if (info->shared && !dynamic_symbol_p) + { + Elf_Internal_Rela outrel; - /* Initialize the .got entry's value. */ - if (!(gotent->flags & ALPHA_ELF_GOT_ENTRY_RELOCS_DONE)) - { - bfd_put_64 (output_bfd, relocation + addend, - sgot->contents + gotent->got_offset); + BFD_ASSERT(srelgot != NULL); - /* If the symbol has been forced local, output a - RELATIVE reloc, otherwise it will be handled in - finish_dynamic_symbol. */ - if (info->shared && !dynamic_symbol) - { - Elf_Internal_Rela outrel; - - BFD_ASSERT(srelgot != NULL); - - outrel.r_offset = (sgot->output_section->vma - + sgot->output_offset - + gotent->got_offset); - outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - outrel.r_addend = relocation + addend; - - bfd_elf64_swap_reloca_out (output_bfd, &outrel, - ((Elf64_External_Rela *) - srelgot->contents) - + srelgot->reloc_count++); - BFD_ASSERT (sizeof (Elf64_External_Rela) - * srelgot->reloc_count - <= srelgot->_cooked_size); - } + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE); + outrel.r_addend = value; - gotent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_DONE; - } + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *) + srelgot->contents) + + srelgot->reloc_count++); + BFD_ASSERT (sizeof (Elf64_External_Rela) + * srelgot->reloc_count + <= srelgot->_cooked_size); + } + } - /* Figure the gprel relocation. */ - addend = 0; - relocation = (sgot->output_section->vma - + sgot->output_offset - + gotent->got_offset); - relocation -= gp; - } - /* overflow handled by _bfd_final_link_relocate */ + value = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + value -= gp; goto default_reloc; case R_ALPHA_GPREL16: case R_ALPHA_GPREL32: case R_ALPHA_GPRELLOW: - if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + if (dynamic_symbol_p) { (*_bfd_error_handler) (_("%s: gp-relative relocation against dynamic symbol %s"), @@ -3546,11 +4531,11 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, ret_val = false; } BFD_ASSERT(gp != 0); - relocation -= gp; + value -= gp; goto default_reloc; case R_ALPHA_GPRELHIGH: - if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + if (dynamic_symbol_p) { (*_bfd_error_handler) (_("%s: gp-relative relocation against dynamic symbol %s"), @@ -3558,27 +4543,34 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, ret_val = false; } BFD_ASSERT(gp != 0); - relocation -= gp; - relocation += addend; - addend = 0; - relocation = (((bfd_signed_vma) relocation >> 16) - + ((relocation >> 15) & 1)); + value -= gp; + value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1); goto default_reloc; case R_ALPHA_HINT: /* A call to a dynamic symbol is definitely out of range of the 16-bit displacement. Don't bother writing anything. */ - if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + if (dynamic_symbol_p) { r = bfd_reloc_ok; break; } - /* FALLTHRU */ + /* The regular PC-relative stuff measures from the start of + the instruction rather than the end. */ + value -= 4; + goto default_reloc; case R_ALPHA_BRADDR: + if (dynamic_symbol_p) + { + (*_bfd_error_handler) + (_("%s: pc-relative relocation against dynamic symbol %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } /* The regular PC-relative stuff measures from the start of the instruction rather than the end. */ - addend -= 4; + value -= 4; goto default_reloc; case R_ALPHA_BRSGP: @@ -3588,12 +4580,12 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, /* The regular PC-relative stuff measures from the start of the instruction rather than the end. */ - addend -= 4; + value -= 4; /* The source and destination gp must be the same. Note that the source will always have an assigned gp, since we forced one in check_relocs, but that the destination may not, as - it might not have had any relocations at all. Also take + it might not have had any relocations at all. Also take care not to crash if H is an undefined symbol. */ if (h != NULL && sec != NULL && alpha_elf_tdata (sec->owner)->gotobj @@ -3641,41 +4633,52 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, case R_ALPHA_REFLONG: case R_ALPHA_REFQUAD: + case R_ALPHA_DTPREL64: + case R_ALPHA_TPREL64: { Elf_Internal_Rela outrel; /* Careful here to remember RELATIVE relocations for global variables for symbolic shared objects. */ - if (h && alpha_elf_dynamic_symbol_p (&h->root, info)) + if (dynamic_symbol_p) { BFD_ASSERT(h->root.dynindx != -1); - outrel.r_info = ELF64_R_INFO(h->root.dynindx, r_type); + outrel.r_info = ELF64_R_INFO (h->root.dynindx, r_type); outrel.r_addend = addend; - addend = 0, relocation = 0; + addend = 0, value = 0; + } + else if (r_type == R_ALPHA_DTPREL64) + { + BFD_ASSERT(tls_segment != NULL); + value -= dtp_base; + goto default_reloc; + } + else if (r_type == R_ALPHA_TPREL64) + { + BFD_ASSERT(tls_segment != NULL); + value -= dtp_base; + goto default_reloc; } else if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC)) { - outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); - outrel.r_addend = relocation + addend; + if (r_type == R_ALPHA_REFLONG) + { + (*_bfd_error_handler) + (_("%s: unhandled dynamic relocation against %s"), + bfd_archive_filename (input_bfd), + h->root.root.root.string); + ret_val = false; + } + outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE); + outrel.r_addend = value; } else goto default_reloc; - if (!srel) - { - const char *name; - - name = (bfd_elf_string_from_elf_section - (input_bfd, elf_elfheader(input_bfd)->e_shstrndx, - elf_section_data(input_section)->rel_hdr.sh_name)); - BFD_ASSERT(name != NULL); - - srel = bfd_get_section_by_name (dynobj, name); - BFD_ASSERT(srel != NULL); - } + BFD_ASSERT(srel != NULL); outrel.r_offset = _bfd_elf_section_offset (output_bfd, info, input_section, @@ -3695,8 +4698,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, } goto default_reloc; + case R_ALPHA_SREL16: case R_ALPHA_SREL32: case R_ALPHA_SREL64: + if (dynamic_symbol_p) + { + (*_bfd_error_handler) + (_("%s: pc-relative relocation against dynamic symbol %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } + /* ??? .eh_frame references to discarded sections will be smashed to relocations against SHN_UNDEF. The .eh_frame format allows NULL to be encoded as 0 in any format, so this works here. */ @@ -3705,11 +4717,134 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, + (r_type - R_ALPHA_SREL32 + R_ALPHA_REFLONG)); goto default_reloc; + case R_ALPHA_TLSLDM: + /* Ignore the symbol for the relocation. The result is always + the current module. */ + dynamic_symbol_p = 0; + /* FALLTHRU */ + + case R_ALPHA_TLSGD: + if (!gotent->reloc_done) + { + gotent->reloc_done = 1; + + /* Note that the module index for the main program is 1. */ + bfd_put_64 (output_bfd, !info->shared && !dynamic_symbol_p, + sgot->contents + gotent->got_offset); + + /* If the symbol has been forced local, output a + DTPMOD64 reloc, otherwise it will be handled in + finish_dynamic_symbol. */ + if (info->shared && !dynamic_symbol_p) + { + Elf_Internal_Rela outrel; + + BFD_ASSERT(srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + /* ??? Proper dynindx here. */ + outrel.r_info = ELF64_R_INFO (0, R_ALPHA_DTPMOD64); + outrel.r_addend = 0; + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *) + srelgot->contents) + + srelgot->reloc_count++); + BFD_ASSERT (sizeof (Elf64_External_Rela) + * srelgot->reloc_count + <= srelgot->_cooked_size); + } + + if (dynamic_symbol_p || r_type == R_ALPHA_TLSLDM) + value = 0; + else + { + BFD_ASSERT(tls_segment != NULL); + value -= dtp_base; + } + bfd_put_64 (output_bfd, value, + sgot->contents + gotent->got_offset + 8); + } + + value = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + value -= gp; + goto default_reloc; + + case R_ALPHA_DTPRELHI: + case R_ALPHA_DTPRELLO: + case R_ALPHA_DTPREL16: + if (dynamic_symbol_p) + { + (*_bfd_error_handler) + (_("%s: dtp-relative relocation against dynamic symbol %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } + BFD_ASSERT(tls_segment != NULL); + value -= dtp_base; + if (r_type == R_ALPHA_DTPRELHI) + value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1); + goto default_reloc; + + case R_ALPHA_TPRELHI: + case R_ALPHA_TPRELLO: + case R_ALPHA_TPREL16: + if (info->shared) + { + (*_bfd_error_handler) + (_("%s: TLS local exec code cannot be linked into shared objects"), + bfd_archive_filename (input_bfd)); + ret_val = false; + } + else if (dynamic_symbol_p) + { + (*_bfd_error_handler) + (_("%s: tp-relative relocation against dynamic symbol %s"), + bfd_archive_filename (input_bfd), h->root.root.root.string); + ret_val = false; + } + BFD_ASSERT(tls_segment != NULL); + value -= tp_base; + if (r_type == R_ALPHA_TPRELHI) + value = ((bfd_signed_vma) value >> 16) + ((value >> 15) & 1); + goto default_reloc; + + case R_ALPHA_GOTDTPREL: + case R_ALPHA_GOTTPREL: + BFD_ASSERT(sgot != NULL); + BFD_ASSERT(gp != 0); + BFD_ASSERT(gotent != NULL); + BFD_ASSERT(gotent->use_count >= 1); + + if (!gotent->reloc_done) + { + gotent->reloc_done = 1; + + if (dynamic_symbol_p) + value = 0; + else + { + BFD_ASSERT(tls_segment != NULL); + value -= (r_type == R_ALPHA_GOTDTPREL ? dtp_base : tp_base); + } + bfd_put_64 (output_bfd, value, + sgot->contents + gotent->got_offset); + } + + value = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + value -= gp; + goto default_reloc; + default: default_reloc: r = _bfd_final_link_relocate (howto, input_bfd, input_section, - contents, rel->r_offset, relocation, - addend); + contents, rel->r_offset, value, 0); break; } @@ -3881,20 +5016,58 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym) srel = bfd_get_section_by_name (dynobj, ".rela.got"); BFD_ASSERT (srel != NULL); - outrel.r_info = ELF64_R_INFO (h->dynindx, R_ALPHA_GLOB_DAT); for (gotent = ((struct alpha_elf_link_hash_entry *) h)->got_entries; gotent != NULL; gotent = gotent->next) { - asection *sgot = alpha_elf_tdata (gotent->gotobj)->got; + asection *sgot; + int r_type; + + if (gotent->use_count == 0) + continue; + + sgot = alpha_elf_tdata (gotent->gotobj)->got; outrel.r_offset = (sgot->output_section->vma + sgot->output_offset + gotent->got_offset); + + r_type = gotent->reloc_type; + switch (r_type) + { + case R_ALPHA_LITERAL: + r_type = R_ALPHA_GLOB_DAT; + break; + case R_ALPHA_TLSGD: + r_type = R_ALPHA_DTPMOD64; + break; + case R_ALPHA_GOTDTPREL: + r_type = R_ALPHA_DTPREL64; + break; + case R_ALPHA_GOTTPREL: + r_type = R_ALPHA_TPREL64; + break; + case R_ALPHA_TLSLDM: + default: + abort (); + } + + outrel.r_info = ELF64_R_INFO (h->dynindx, r_type); outrel.r_addend = gotent->addend; bfd_elf64_swap_reloca_out (output_bfd, &outrel, ((Elf64_External_Rela *)srel->contents + srel->reloc_count++)); + + if (gotent->reloc_type == R_ALPHA_TLSGD) + { + outrel.r_offset += 8; + outrel.r_info = ELF64_R_INFO (h->dynindx, R_ALPHA_DTPREL64); + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *)srel->contents + + srel->reloc_count++)); + } + BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count <= srel->_cooked_size); } @@ -4355,6 +5528,7 @@ const struct elf_size_info alpha_elf_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index c6ea4f43764..cc4694348f2 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -184,7 +184,7 @@ static boolean elf64_hppa_object_p PARAMS ((bfd *)); static boolean elf64_hppa_section_from_shdr - PARAMS ((bfd *, Elf64_Internal_Shdr *, char *)); + PARAMS ((bfd *, Elf64_Internal_Shdr *, const char *)); static void elf64_hppa_post_process_headers PARAMS ((bfd *, struct bfd_link_info *)); @@ -403,7 +403,7 @@ static boolean elf64_hppa_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf64_Internal_Shdr *hdr; - char *name; + const char *name; { asection *newsect; @@ -682,7 +682,8 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs) i < symtab_hdr->sh_info; i++, esym++, isym++, shndx = (shndx != NULL ? shndx + 1 : NULL)) { - bfd_elf64_swap_symbol_in (abfd, esym, shndx, isym); + bfd_elf64_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + isym); if (isym->st_shndx > highest_shndx) highest_shndx = isym->st_shndx; } @@ -1158,7 +1159,8 @@ allocate_global_data_opd (dyn_h, data) /* We never need an opd entry for a symbol which is not defined by this output file. */ - if (h && h->root.type == bfd_link_hash_undefined) + if (h && (h->root.type == bfd_link_hash_undefined + || h->root.u.def.section->output_section == NULL)) dyn_h->want_opd = 0; /* If we are creating a shared library, took the address of a local @@ -1167,9 +1169,8 @@ allocate_global_data_opd (dyn_h, data) else if (x->info->shared || h == NULL || h->dynindx == -1 - || ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && h->root.u.def.section->output_section != NULL)) + || (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak)) { /* If we are creating a shared library, then we will have to create a runtime relocation for the symbol to properly @@ -1534,9 +1535,8 @@ allocate_dynrel_entries (dyn_h, data) switch (rent->type) { case R_PARISC_FPTR64: - /* Allocate one iff we are not building a shared library and - !want_opd, which by this point will be true only if we're - actually allocating one statically in the main executable. */ + /* Allocate one iff we are building a shared library and don't + want an opd entry. */ if (!x->info->shared && dyn_h->want_opd) continue; break; @@ -2114,7 +2114,7 @@ elf64_hppa_finalize_opd (dyn_h, data) { struct bfd_link_info *info = (struct bfd_link_info *)data; struct elf64_hppa_link_hash_table *hppa_info; - struct elf_link_hash_entry *h = dyn_h->h; + struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL; asection *sopd; asection *sopdrel; @@ -2122,7 +2122,7 @@ elf64_hppa_finalize_opd (dyn_h, data) sopd = hppa_info->opd_sec; sopdrel = hppa_info->opd_rel_sec; - if (h && dyn_h && dyn_h->want_opd) + if (h && dyn_h->want_opd) { bfd_vma value; @@ -2235,7 +2235,7 @@ elf64_hppa_finalize_dlt (dyn_h, data) struct bfd_link_info *info = (struct bfd_link_info *)data; struct elf64_hppa_link_hash_table *hppa_info; asection *sdlt, *sdltrel; - struct elf_link_hash_entry *h = dyn_h->h; + struct elf_link_hash_entry *h = dyn_h ? dyn_h->h : NULL; hppa_info = elf64_hppa_hash_table (info); @@ -2246,7 +2246,7 @@ elf64_hppa_finalize_dlt (dyn_h, data) address, so there is no need to create a relocation. Just install the proper value into the DLT, note this shortcut can not be skipped when building a shared library. */ - if (! info->shared && h && dyn_h && dyn_h->want_dlt) + if (! info->shared && h && dyn_h->want_dlt) { bfd_vma value; @@ -2262,16 +2262,17 @@ elf64_hppa_finalize_dlt (dyn_h, data) + hppa_info->opd_sec->output_offset + hppa_info->opd_sec->output_section->vma); } - else + else if (h->root.u.def.section) { - value = (h->root.u.def.value - + h->root.u.def.section->output_offset); - + value = h->root.u.def.value + h->root.u.def.section->output_offset; if (h->root.u.def.section->output_section) value += h->root.u.def.section->output_section->vma; else value += h->root.u.def.section->vma; } + else + /* We have an undefined function reference. */ + value = 0; /* We do not need to include the output offset of the DLT section here because we are modifying the in-memory contents. */ @@ -2359,9 +2360,8 @@ elf64_hppa_finalize_dynreloc (dyn_h, data) switch (rent->type) { case R_PARISC_FPTR64: - /* Allocate one iff we are not building a shared library and - !want_opd, which by this point will be true only if we're - actually allocating one statically in the main executable. */ + /* Allocate one iff we are building a shared library and don't + want an opd entry. */ if (!info->shared && dyn_h->want_opd) continue; break; @@ -2394,7 +2394,7 @@ elf64_hppa_finalize_dynreloc (dyn_h, data) We use a section symbol recorded by check_relocs as the base symbol for the relocation. The addend is the difference between the section symbol and the address of the .opd entry. */ - if (info->shared && rent->type == R_PARISC_FPTR64) + if (info->shared && rent->type == R_PARISC_FPTR64 && dyn_h->want_opd) { bfd_vma value, value2; @@ -2673,6 +2673,7 @@ const struct elf_size_info hppa64_elf_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 508c0ee0bca..ea8f64588f7 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1548,7 +1548,7 @@ mips_elf64_assign_gp (output_bfd, pgp) { for (i = 0; i < count; i++, sym++) { - register CONST char *name; + register const char *name; name = bfd_asymbol_name (*sym); if (*name == '_' && strcmp (name, "_gp") == 0) @@ -2666,6 +2666,7 @@ const struct elf_size_info mips_elf64_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, mips_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, mips_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, @@ -2719,6 +2720,8 @@ const struct elf_size_info mips_elf64_size_info = #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook #define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol +#define elf_backend_ignore_discarded_relocs \ + _bfd_mips_elf_ignore_discarded_relocs #define elf_backend_mips_irix_compat elf64_mips_irix_compat #define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 96146ed016e..55ef061d645 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -943,7 +943,7 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) value += addr; break; } - /* FALLTHROUGH. */ + /* FALLTHROUGH. */ case R_MMIX_ADDR19: case R_MMIX_ADDR27: /* These must be in range, or else we emit an error. */ @@ -2419,7 +2419,8 @@ mmix_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF64_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELF64_R_SYM (irel->r_info) : 0); - bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elf64_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == SHN_UNDEF) sym_sec = bfd_und_section_ptr; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 5ae3aefd767..106fafcd990 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -55,12 +55,14 @@ static bfd_reloc_status_type ppc64_elf_toc64_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static bfd_reloc_status_type ppc64_elf_unhandled_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); +static void ppc64_elf_get_symbol_info + PARAMS ((bfd *, asymbol *, symbol_info *)); static boolean ppc64_elf_set_private_flags PARAMS ((bfd *, flagword)); static boolean ppc64_elf_merge_private_bfd_data PARAMS ((bfd *, bfd *)); static boolean ppc64_elf_section_from_shdr - PARAMS ((bfd *, Elf64_Internal_Shdr *, char *)); + PARAMS ((bfd *, Elf64_Internal_Shdr *, const char *)); /* The name of the dynamic interpreter. This is put in the .interp @@ -106,7 +108,7 @@ static boolean ppc64_elf_section_from_shdr #define CROR_151515 0x4def7b82 #define CROR_313131 0x4ffffb82 -/* .glink entries for the first 32k functions are two instructions. */ +/* .glink entries for the first 32k functions are two instructions. */ #define LI_R0_0 0x38000000 /* li %r0,0 */ #define B_DOT 0x48000000 /* b . */ @@ -523,7 +525,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { 32, /* bitsize */ true, /* pc_relative */ 0, /* bitpos */ - /* FIXME: Verify. Was complain_overflow_bitfield. */ + /* FIXME: Verify. Was complain_overflow_bitfield. */ complain_overflow_signed, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_PPC64_REL32", /* name */ @@ -796,7 +798,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = { 0xffffffffffffffff, /* dst_mask */ true), /* pcrel_offset */ - /* 64-bit relocation to the symbol's procedure linkage table. */ + /* 64-bit relocation to the symbol's procedure linkage table. */ HOWTO (R_PPC64_PLT64, /* type */ 0, /* rightshift */ 4, /* size (0=byte, 1=short, 2=long, 4=64 bits) */ @@ -1359,8 +1361,8 @@ ppc64_elf_info_to_howto (abfd, cache_ptr, dst) { unsigned int type; + /* Initialize howto table if needed. */ if (!ppc64_elf_howto_table[R_PPC64_ADDR32]) - /* Initialize howto table if needed. */ ppc_howto_init (); type = ELF64_R_TYPE (dst->r_info); @@ -1386,7 +1388,7 @@ ppc64_elf_ha_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); /* Adjust the addend for sign extension of the low 16 bits. @@ -1417,7 +1419,7 @@ ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); octets = reloc_entry->address * bfd_octets_per_byte (abfd); @@ -1426,7 +1428,7 @@ ppc64_elf_brtaken_reloc (abfd, reloc_entry, symbol, data, r_type = (enum elf_ppc_reloc_type) reloc_entry->howto->type; if (r_type == R_PPC64_ADDR14_BRTAKEN || r_type == R_PPC64_REL14_BRTAKEN) - insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */ + insn |= 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */ if (is_power4) { @@ -1478,7 +1480,7 @@ ppc64_elf_sectoff_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); /* Subtract the symbol section base address. */ @@ -1501,7 +1503,7 @@ ppc64_elf_sectoff_ha_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); /* Subtract the symbol section base address. */ @@ -1529,7 +1531,7 @@ ppc64_elf_toc_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); TOCstart = _bfd_get_gp_value (input_section->output_section->owner); @@ -1558,7 +1560,7 @@ ppc64_elf_toc_ha_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); TOCstart = _bfd_get_gp_value (input_section->output_section->owner); @@ -1591,7 +1593,7 @@ ppc64_elf_toc64_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); TOCstart = _bfd_get_gp_value (input_section->output_section->owner); @@ -1618,7 +1620,7 @@ ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data, call the generic function. Any adjustment will be done at final link time. */ if (output_bfd != NULL) - return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message); if (error_message != NULL) @@ -1631,6 +1633,22 @@ ppc64_elf_unhandled_reloc (abfd, reloc_entry, symbol, data, return bfd_reloc_dangerous; } +/* Return symbol info as per usual for ELF targets, except that + symbols in .opd are given 'd' or 'D' for type. */ + +static void +ppc64_elf_get_symbol_info (abfd, symbol, ret) + bfd *abfd; + asymbol *symbol; + symbol_info *ret; +{ + _bfd_elf_get_symbol_info (abfd, symbol, ret); + if (ret->type == '?' + && (symbol->flags & (BSF_GLOBAL | BSF_LOCAL)) != 0 + && strcmp (symbol->section->name, ".opd") == 0) + ret->type = (symbol->flags & BSF_GLOBAL) != 0 ? 'D' : 'd'; +} + /* Function to set whether a module needs the -mrelocatable bit set. */ static boolean @@ -1718,7 +1736,7 @@ ppc64_elf_merge_private_bfd_data (ibfd, obfd) elf_elfheader (obfd)->e_flags &= ~EF_PPC_RELOCATABLE_LIB; /* The output is -mrelocatable iff it can't be -mrelocatable-lib, - but each input file is either -mrelocatable or -mrelocatable-lib. */ + but each input file is either -mrelocatable or -mrelocatable-lib. */ if (! (elf_elfheader (obfd)->e_flags & EF_PPC_RELOCATABLE_LIB) && (new_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE)) && (old_flags & (EF_PPC_RELOCATABLE_LIB | EF_PPC_RELOCATABLE))) @@ -1757,7 +1775,7 @@ static boolean ppc64_elf_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf64_Internal_Shdr *hdr; - char *name; + const char *name; { asection *newsect; flagword flags; @@ -2690,14 +2708,14 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs) case R_PPC64_PLT32: case R_PPC64_PLT64: /* This symbol requires a procedure linkage table entry. We - actually build the entry in adjust_dynamic_symbol, - because this might be a case of linking PIC code without - linking in any dynamic objects, in which case we don't - need to generate a procedure linkage table after all. */ + actually build the entry in adjust_dynamic_symbol, + because this might be a case of linking PIC code without + linking in any dynamic objects, in which case we don't + need to generate a procedure linkage table after all. */ if (h == NULL) { /* It does not make sense to have a procedure linkage - table entry for a local symbol. */ + table entry for a local symbol. */ bfd_set_error (bfd_error_bad_value); return false; } @@ -2769,11 +2787,6 @@ ppc64_elf_check_relocs (abfd, info, sec, relocs) false, false, false); if (fdh != NULL) { - /* Ensure the function descriptor symbol string is - part of the code symbol string. We aren't - changing the name here, just allowing some tricks - in ppc64_elf_hide_symbol. */ - fdh->root.root.string = h->root.root.string + 1; ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1; ((struct ppc_link_hash_entry *) fdh)->oh = h; ((struct ppc_link_hash_entry *) h)->is_func = 1; @@ -3225,7 +3238,6 @@ func_desc_adjust (h, inf) } ((struct ppc_link_hash_entry *) fdh)->is_func_descriptor = 1; ((struct ppc_link_hash_entry *) fdh)->oh = h; - fdh->root.root.string = h->root.root.string + 1; ((struct ppc_link_hash_entry *) h)->oh = fdh; } @@ -3236,8 +3248,14 @@ func_desc_adjust (h, inf) been imported from another library. Function code syms that are really in the library we must leave global to prevent the linker dragging in a definition from a static library. */ - force_local = ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0 - && info->shared); + force_local = (info->shared + && ((h->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0 + || fdh == NULL + || (fdh->elf_link_hash_flags + & ELF_LINK_HASH_DEF_REGULAR) == 0 + || (fdh->elf_link_hash_flags + & ELF_LINK_FORCED_LOCAL) != 0)); _bfd_elf_link_hash_hide_symbol (info, h, force_local); } @@ -3502,14 +3520,48 @@ ppc64_elf_hide_symbol (info, h, force_local) if (((struct ppc_link_hash_entry *) h)->is_func_descriptor) { - const char *name; struct elf_link_hash_entry *fh = ((struct ppc_link_hash_entry *) h)->oh; - struct ppc_link_hash_table *htab; - name = h->root.root.string - 1; - htab = ppc_hash_table (info); if (fh == NULL) - fh = elf_link_hash_lookup (&htab->elf, name, false, false, false); + { + const char *p, *q; + struct ppc_link_hash_table *htab; + char save; + + /* We aren't supposed to use alloca in BFD because on + systems which do not have alloca the version in libiberty + calls xmalloc, which might cause the program to crash + when it runs out of memory. This function doesn't have a + return status, so there's no way to gracefully return an + error. So cheat. We know that string[-1] can be safely + dereferenced; It's either a string in an ELF string + table, or allocated in an objalloc structure. */ + + p = h->root.root.string - 1; + save = *p; + *(char *) p = '.'; + htab = ppc_hash_table (info); + fh = elf_link_hash_lookup (&htab->elf, p, false, false, false); + *(char *) p = save; + + /* Unfortunately, if it so happens that the string we were + looking for was allocated immediately before this string, + then we overwrote the string terminator. That's the only + reason the lookup should fail. */ + if (fh == NULL) + { + q = h->root.root.string + strlen (h->root.root.string); + while (q >= h->root.root.string && *q == *p) + --q, --p; + if (q < h->root.root.string && *p == '.') + fh = elf_link_hash_lookup (&htab->elf, p, false, false, false); + } + if (fh != NULL) + { + ((struct ppc_link_hash_entry *) h)->oh = fh; + ((struct ppc_link_hash_entry *) fh)->oh = h; + } + } if (fh != NULL) _bfd_elf_link_hash_hide_symbol (info, fh, force_local); } @@ -3871,6 +3923,10 @@ ppc64_elf_size_dynamic_sections (output_bfd, info) continue; } + /* .plt is in the bss section. We don't initialise it. */ + if ((s->flags & SEC_LOAD) == 0) + continue; + /* Allocate memory for the section contents. We use bfd_zalloc here in case unused entries are not reclaimed before the section's contents are written out. This should not happen, @@ -3897,7 +3953,7 @@ ppc64_elf_size_dynamic_sections (output_bfd, info) return false; } - if (htab->splt->_raw_size != 0) + if (htab->splt != NULL && htab->splt->_raw_size != 0) { if (!add_dynamic_entry (DT_PLTGOT, 0) || !add_dynamic_entry (DT_PLTRELSZ, 0) @@ -4153,6 +4209,20 @@ ppc_build_one_stub (gen_entry, in_arg) 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. */ + if (stub_entry->h->oh->root.type != bfd_link_hash_defined + && stub_entry->h->oh->root.type != bfd_link_hash_defweak) + { + /* Point the symbol at the stub. There may be multiple stubs, + we don't really care; The main thing is to make this sym + defined somewhere. */ + stub_entry->h->oh->root.type = bfd_link_hash_defined; + stub_entry->h->oh->root.u.def.section = stub_entry->stub_sec; + stub_entry->h->oh->root.u.def.value = stub_entry->stub_offset; + } + /* Now build the stub. */ off = stub_entry->h->elf.plt.offset; if (off >= (bfd_vma) -2) @@ -4262,7 +4332,7 @@ ppc_size_one_stub (gen_entry, in_arg) /* Set up various things so that we can make a list of input sections for each output section included in the link. Returns -1 on error, - 0 when no stubs will be needed, and 1 on success. */ + 0 when no stubs will be needed, and 1 on success. */ int ppc64_elf_setup_section_lists (output_bfd, info) @@ -4524,7 +4594,8 @@ get_local_syms (input_bfd, htab) isym = local_syms, shndx = shndx_buf; esym < end_sy; esym++, isym++, shndx = (shndx ? shndx + 1 : NULL)) - bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isym); + bfd_elf64_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isym); /* Now we can free the external symbols. */ free (shndx_buf); @@ -4820,12 +4891,10 @@ ppc64_elf_size_stubs (output_bfd, stub_bfd, info, group_size, (*htab->layout_sections_again) (); } - if (htab->sbrlt->_raw_size == 0) - { - _bfd_strip_section_from_output (info, htab->sbrlt); - if (htab->srelbrlt != NULL) - _bfd_strip_section_from_output (info, htab->srelbrlt); - } + /* It would be nice to strip .branch_lt from the output if the + section is empty, but it's too late. If we strip sections here, + the dynamic symbol table is corrupted since the section symbol + for the stripped section isn't written. */ ret = true; @@ -5075,6 +5144,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, unsigned long r_symndx; bfd_vma relocation; boolean unresolved_reloc; + boolean warned; long insn; struct ppc_stub_hash_entry *stub_entry; bfd_vma max_br_offset; @@ -5090,6 +5160,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, h = (struct elf_link_hash_entry *) 0; sym_name = (const char *) 0; unresolved_reloc = false; + warned = false; if (r_type == R_PPC64_TOC) { @@ -5146,6 +5217,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return false; + warned = true; } } @@ -5159,8 +5231,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Branch taken prediction relocations. */ case R_PPC64_ADDR14_BRTAKEN: case R_PPC64_REL14_BRTAKEN: - insn = 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */ - /* Fall thru. */ + insn = 0x01 << 21; /* 'y' or 't' bit, lowest bit of BO field. */ + /* Fall thru. */ /* Branch not taken prediction relocations. */ case R_PPC64_ADDR14_BRNTAKEN: @@ -5542,6 +5614,21 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, relocate = true; if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC) { + if (is_opd && h != NULL) + { + /* Lie about opd entries. This case occurs + when building shared libraries and we + reference a function in another shared + lib. The same thing happens for a weak + definition in an application that's + overridden by a strong definition in a + shared lib. (I believe this is a generic + bug in binutils handling of weak syms.) + In these cases we won't use the opd + entry in this lib; We ought to edit the + opd section to remove unused entries. */ + unresolved_reloc = false; + } outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE); } else @@ -5699,12 +5786,15 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, && !(info->shared && (input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) - (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), - (long) rel->r_offset, - h->root.root.string); + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, + h->root.root.string); + ret = false; + } r = _bfd_final_link_relocate (ppc64_elf_howto_table[(int) r_type], input_bfd, @@ -5714,9 +5804,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, relocation, addend); - if (r == bfd_reloc_ok) - ; - else if (r == bfd_reloc_overflow) + if (r != bfd_reloc_ok) { const char *name; @@ -5747,13 +5835,25 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, name = bfd_section_name (input_bfd, sec); } - if (! ((*info->callbacks->reloc_overflow) - (info, name, ppc64_elf_howto_table[(int) r_type]->name, - (bfd_vma) 0, input_bfd, input_section, offset))) - return false; + if (r == bfd_reloc_overflow) + { + if (warned) + continue; + if (!((*info->callbacks->reloc_overflow) + (info, name, ppc64_elf_howto_table[(int) r_type]->name, + rel->r_addend, input_bfd, input_section, offset))) + return false; + } + else + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): reloc against `%s': error %d"), + bfd_archive_filename (input_bfd), + bfd_get_section_name (input_bfd, input_section), + (long) rel->r_offset, name, (int) r); + ret = false; + } } - else - ret = false; } return ret; @@ -5782,7 +5882,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym) Elf64_External_Rela *loc; /* This symbol has an entry in the procedure linkage table. Set - it up. */ + it up. */ if (htab->splt == NULL || htab->srelplt == NULL @@ -5809,7 +5909,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym) 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 (); @@ -6036,6 +6136,7 @@ ppc64_elf_finish_dynamic_sections (output_bfd, info) #define bfd_elf64_bfd_merge_private_bfd_data ppc64_elf_merge_private_bfd_data #define bfd_elf64_bfd_link_hash_table_create ppc64_elf_link_hash_table_create #define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free +#define bfd_elf64_get_symbol_info ppc64_elf_get_symbol_info #define elf_backend_section_from_shdr ppc64_elf_section_from_shdr #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index ceb5efa0867..abbd4cce781 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1019,7 +1019,7 @@ elf_s390_adjust_dynamic_symbol (info, h) /* If this is a function, put it in the procedure linkage table. We will fill in the contents of the procedure linkage table later - (although we could actually do it here). */ + (although we could actually do it here). */ if (h->type == STT_FUNC || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) { @@ -2339,6 +2339,7 @@ const struct elf_size_info s390_elf64_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index b168934e963..ccb87e4a7f4 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -139,7 +139,7 @@ static int sh64_elf64_get_symbol_type PARAMS ((Elf_Internal_Sym *, int)); static boolean sh64_elf64_add_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **, flagword *, asection **, bfd_vma *)); -extern boolean sh64_elf64_link_output_symbol_hook +static boolean sh64_elf64_link_output_symbol_hook PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *)); static boolean sh64_elf64_fake_sections @@ -1342,8 +1342,8 @@ sh_elf64_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, return bfd_reloc_undefined; if (bfd_is_com_section (symbol_in->section)) - sym_value = 0; - else + sym_value = 0; + else sym_value = (symbol_in->value + symbol_in->section->output_section->vma + symbol_in->section->output_offset); @@ -1614,7 +1614,7 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section, sec = h->root.u.def.section; /* In these cases, we don't need the relocation value. We check specially because in some obscure cases - sec->output_section will be NULL. */ + sec->output_section will be NULL. */ if (r_type == R_SH_GOTPC_LOW16 || r_type == R_SH_GOTPC_MEDLOW16 || r_type == R_SH_GOTPC_MEDHI16 @@ -1756,7 +1756,7 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section, skip = true; else if (outrel.r_offset == (bfd_vma) -2) skip = true, relocate = true; - + outrel.r_offset += (input_section->output_section->vma + input_section->output_offset); @@ -2234,7 +2234,8 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order, { asection *isec; - bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isymp); + bfd_elf64_swap_symbol_in (input_bfd, (const PTR) esym, + (const PTR) shndx, isymp); if (isymp->st_shndx == SHN_UNDEF) isec = bfd_und_section_ptr; @@ -2481,11 +2482,7 @@ sh_elf64_gc_mark_hook (abfd, info, rel, h, sym) } else { - if (!(elf_bad_symtab (abfd) - && ELF_ST_BIND (sym->st_info) != STB_LOCAL) - && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE) - && sym->st_shndx != SHN_COMMON)) - return bfd_section_from_elf_index (abfd, sym->st_shndx); + return bfd_section_from_elf_index (abfd, sym->st_shndx); } return NULL; @@ -2507,7 +2504,7 @@ sh_elf64_gc_sweep_hook (abfd, info, sec, relocs) /* Look through the relocs for a section during the first phase. Since we don't do .gots or .plts, we just need to consider the virtual table relocs for gc. */ - + static boolean sh_elf64_check_relocs (abfd, info, sec, relocs) bfd *abfd; @@ -2537,7 +2534,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs) sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof(Elf64_External_Sym); if (!elf_bad_symtab (abfd)) sym_hashes_end -= symtab_hdr->sh_info; - + dynobj = elf_hash_table (info)->dynobj; local_got_offsets = elf_local_got_offsets (abfd); @@ -2546,13 +2543,13 @@ sh_elf64_check_relocs (abfd, info, sec, relocs) { struct elf_link_hash_entry *h; unsigned long r_symndx; - + r_symndx = ELF64_R_SYM (rel->r_info); if (r_symndx < symtab_hdr->sh_info) h = NULL; else h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - + /* Some relocs require a global offset table. */ if (dynobj == NULL) { @@ -2596,7 +2593,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs) if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset)) return false; break; - + /* This relocation describes which C++ vtable entries are actually used. Record for later use during GC. */ case R_SH_GNU_VTENTRY: @@ -2881,7 +2878,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs) break; } } - + return true; } @@ -3016,7 +3013,7 @@ sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) we don't need to look up and make sure to emit the main symbol for each DataLabel symbol. */ -boolean +static boolean sh64_elf64_link_output_symbol_hook (abfd, info, cname, sym, input_sec) bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 4933f8de801..590975d3c85 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1386,7 +1386,7 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) return true; } else if (*namep && **namep - && info->hash->creator->flavour == bfd_target_elf_flavour) + && info->hash->creator == abfd->xvec) { int i; struct sparc64_elf_app_reg *p; @@ -3067,6 +3067,7 @@ const struct elf_size_info sparc64_elf_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, sparc64_elf_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, sparc64_elf_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 30cc29a8d46..0ec6392dffa 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -125,6 +125,10 @@ static reloc_howto_type *elf64_x86_64_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type)); static void elf64_x86_64_info_to_howto PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *)); +static boolean elf64_x86_64_grok_prstatus + PARAMS ((bfd *, Elf_Internal_Note *)); +static boolean elf64_x86_64_grok_psinfo + PARAMS ((bfd *, Elf_Internal_Note *)); static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create PARAMS ((bfd *)); static boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd)); @@ -208,6 +212,73 @@ elf64_x86_64_info_to_howto (abfd, cache_ptr, dst) BFD_ASSERT (r_type == cache_ptr->howto->type); } +/* Support for core dump NOTE sections. */ +static boolean +elf64_x86_64_grok_prstatus (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + int offset; + size_t raw_size; + + switch (note->descsz) + { + default: + return false; + + case 336: /* sizeof(istruct elf_prstatus) on Linux/x86_64 */ + /* pr_cursig */ + elf_tdata (abfd)->core_signal + = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core_pid + = bfd_get_32 (abfd, note->descdata + 32); + + /* pr_reg */ + offset = 112; + raw_size = 216; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + +static boolean +elf64_x86_64_grok_psinfo (abfd, note) + bfd *abfd; + Elf_Internal_Note *note; +{ + switch (note->descsz) + { + default: + return false; + + case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */ + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80); + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core_command; + int n = strlen (command); + + if (0 < n && command[n - 1] == ' ') + command[n - 1] = '\0'; + } + + return true; +} + /* Functions for the x86-64 ELF linker. */ /* The name of the dynamic interpreter. This is put in the .interp @@ -1016,7 +1087,7 @@ elf64_x86_64_adjust_dynamic_symbol (info, h) /* We must generate a R_X86_64_COPY reloc to tell the dynamic linker to copy the initial value out of the dynamic object and into the - runtime process image. */ + runtime process image. */ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0) { htab->srelbss->_raw_size += sizeof (Elf64_External_Rela); @@ -2228,6 +2299,8 @@ elf64_x86_64_finish_dynamic_sections (output_bfd, info) #define elf_backend_finish_dynamic_symbol elf64_x86_64_finish_dynamic_symbol #define elf_backend_gc_mark_hook elf64_x86_64_gc_mark_hook #define elf_backend_gc_sweep_hook elf64_x86_64_gc_sweep_hook +#define elf_backend_grok_prstatus elf64_x86_64_grok_prstatus +#define elf_backend_grok_psinfo elf64_x86_64_grok_psinfo #define elf_backend_reloc_type_class elf64_x86_64_reloc_type_class #define elf_backend_relocate_section elf64_x86_64_relocate_section #define elf_backend_size_dynamic_sections elf64_x86_64_size_dynamic_sections diff --git a/bfd/elfarm-oabi.c b/bfd/elfarm-oabi.c index 25c4d894027..c8e3fe6248f 100644 --- a/bfd/elfarm-oabi.c +++ b/bfd/elfarm-oabi.c @@ -1,5 +1,5 @@ /* 32-bit ELF support for ARM old abi option. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -18,6 +18,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define OLD_ARM_ABI +#define bfd_elf32_arm_allocate_interworking_sections \ + bfd_elf32_arm_oabi_allocate_interworking_sections +#define bfd_elf32_arm_get_bfd_for_interworking \ + bfd_elf32_arm_oabi_get_bfd_for_interworking +#define bfd_elf32_arm_process_before_allocation \ + bfd_elf32_arm_oabi_process_before_allocation +#define bfd_elf32_arm_add_glue_sections_to_bfd \ + bfd_elf32_arm_oabi_add_glue_sections_to_bfd #include "elf/arm.h" #include "bfd.h" @@ -417,11 +425,4 @@ elf32_arm_reloc_type_lookup (abfd, code) return NULL; } -#define bfd_elf32_arm_allocate_interworking_sections \ - bfd_elf32_arm_oabi_allocate_interworking_sections -#define bfd_elf32_arm_get_bfd_for_interworking \ - bfd_elf32_arm_oabi_get_bfd_for_interworking -#define bfd_elf32_arm_process_before_allocation \ - bfd_elf32_arm_oabi_process_before_allocation - #include "elf32-arm.h" diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 203323cdb5e..3e29c0287b1 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1,6 +1,6 @@ /* ELF executable support for BFD. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001 Free Software Foundation, Inc. + 2001, 2002 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support, from information published in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -203,12 +203,14 @@ static char *elf_symbol_flags PARAMS ((flagword)); format. */ void -elf_swap_symbol_in (abfd, src, shndx, dst) +elf_swap_symbol_in (abfd, psrc, pshn, dst) bfd *abfd; - const Elf_External_Sym *src; - const Elf_External_Sym_Shndx *shndx; + const PTR psrc; + const PTR pshn; Elf_Internal_Sym *dst; { + const Elf_External_Sym *src = (const Elf_External_Sym *) psrc; + const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn; int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; dst->st_name = H_GET_32 (abfd, src->st_name); @@ -1242,8 +1244,9 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic) /* Skip first symbol, which is a null dummy. */ for (i = 1; i < symcount; i++) { - elf_swap_symbol_in (abfd, x_symp + i, - x_shndx + (x_shndx != NULL ? i : 0), &i_sym); + elf_swap_symbol_in (abfd, (const PTR) (x_symp + i), + (const PTR) (x_shndx + (x_shndx ? i : 0)), + &i_sym); memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym)); #ifdef ELF_KEEP_EXTSYM memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym)); @@ -1695,6 +1698,7 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = { elf_write_out_phdrs, elf_write_shdrs_and_ehdr, elf_write_relocs, + elf_swap_symbol_in, elf_swap_symbol_out, elf_slurp_reloc_table, elf_slurp_symbol_table, diff --git a/bfd/elflink.h b/bfd/elflink.h index bfe63742522..9ba13fd0a28 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -65,7 +65,7 @@ static boolean elf_link_read_relocs_from_section PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *)); static size_t compute_bucket_count PARAMS ((struct bfd_link_info *)); -static void elf_link_output_relocs +static boolean elf_link_output_relocs PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); static boolean elf_link_size_reloc_section PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); @@ -237,7 +237,7 @@ elf_link_is_defined_archive_symbol (abfd, symdef) Elf_Internal_Sym sym; const char * name; - elf_swap_symbol_in (abfd, esym, shndx, &sym); + elf_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, &sym); name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name); if (name == (const char *) NULL) @@ -313,12 +313,10 @@ elf_link_add_archive_symbols (abfd, info) return true; amt = c; amt *= sizeof (boolean); - defined = (boolean *) bfd_malloc (amt); - included = (boolean *) bfd_malloc (amt); + defined = (boolean *) bfd_zmalloc (amt); + included = (boolean *) bfd_zmalloc (amt); if (defined == (boolean *) NULL || included == (boolean *) NULL) goto error_return; - memset (defined, 0, (size_t) amt); - memset (included, 0, (size_t) amt); symdefs = bfd_ardata (abfd)->symdefs; @@ -1666,7 +1664,7 @@ elf_link_add_object_symbols (abfd, info) override = false; - elf_swap_symbol_in (abfd, esym, shndx, &sym); + elf_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, &sym); flags = BSF_NO_FLAGS; sec = NULL; @@ -1723,7 +1721,23 @@ elf_link_add_object_symbols (abfd, info) if (name == (const char *) NULL) goto error_return; - if (add_symbol_hook) + if (sym.st_shndx == SHN_COMMON && ELF_ST_TYPE (sym.st_info) == STT_TLS) + { + asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon"); + + if (tcomm == NULL) + { + tcomm = bfd_make_section (abfd, ".tcommon"); + if (tcomm == NULL + || !bfd_set_section_flags (abfd, tcomm, (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED + | SEC_THREAD_LOCAL))) + goto error_return; + } + sec = tcomm; + } + else if (add_symbol_hook) { if (! (*add_symbol_hook) (abfd, info, &sym, &name, &flags, &sec, &value)) @@ -2258,7 +2272,9 @@ elf_link_add_object_symbols (abfd, info) asection *stab, *stabstr; stab = bfd_get_section_by_name (abfd, ".stab"); - if (stab != NULL && !(stab->flags & SEC_MERGE)) + if (stab != NULL + && (stab->flags & SEC_MERGE) == 0 + && !bfd_is_abs_section (stab->output_section)) { stabstr = bfd_get_section_by_name (abfd, ".stabstr"); @@ -2284,7 +2300,8 @@ elf_link_add_object_symbols (abfd, info) asection *s; for (s = abfd->sections; s != NULL; s = s->next) - if (s->flags & SEC_MERGE) + if ((s->flags & SEC_MERGE) != 0 + && !bfd_is_abs_section (s->output_section)) { struct bfd_elf_section_data *secdata; @@ -2537,7 +2554,8 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx) || bfd_bread ((PTR) shndx, amt, input_bfd) != amt) return false; } - elf_swap_symbol_in (input_bfd, &esym, shndx, &entry->isym); + elf_swap_symbol_in (input_bfd, (const PTR) &esym, (const PTR) shndx, + &entry->isym); name = (bfd_elf_string_from_elf_section (input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link, @@ -3454,7 +3472,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, elf_tdata (output_bfd)->cverdefs = cdefs; } - if (info->new_dtags && info->flags) + if ((info->new_dtags && info->flags) || (info->flags & DF_STATIC_TLS)) { if (! elf_add_dynamic_entry (info, (bfd_vma) DT_FLAGS, info->flags)) return false; @@ -3645,10 +3663,9 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, BFD_ASSERT (s != NULL); hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize; s->_raw_size = ((2 + bucketcount + dynsymcount) * hash_entry_size); - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); if (s->contents == NULL) return false; - memset (s->contents, 0, (size_t) s->_raw_size); bfd_put (8 * hash_entry_size, output_bfd, (bfd_vma) bucketcount, s->contents); @@ -4478,6 +4495,8 @@ struct elf_final_link_info asection *hash_sec; /* symbol version section (.gnu.version). */ asection *symver_sec; + /* first SHF_TLS section (if any). */ + asection *first_tls_sec; /* Buffer large enough to hold contents of any section. */ bfd_byte *contents; /* Buffer large enough to hold external relocs of any section. */ @@ -4957,6 +4976,14 @@ elf_bfd_final_link (abfd, info) finfo.symbuf = NULL; finfo.symshndxbuf = NULL; finfo.symbuf_count = 0; + finfo.first_tls_sec = NULL; + for (o = abfd->sections; o != (asection *) NULL; o = o->next) + if ((o->flags & SEC_THREAD_LOCAL) != 0 + && (o->flags & SEC_LOAD) != 0) + { + finfo.first_tls_sec = o; + break; + } /* Count up the number of relocations we will output for each output section, so that we know the sizes of the reloc sections. We @@ -5321,6 +5348,40 @@ elf_bfd_final_link (abfd, info) goto error_return; } + if (finfo.first_tls_sec) + { + unsigned int align = 0; + bfd_vma base = finfo.first_tls_sec->vma, end = 0; + asection *sec; + + for (sec = finfo.first_tls_sec; + sec && (sec->flags & SEC_THREAD_LOCAL); + sec = sec->next) + { + bfd_vma size = sec->_raw_size; + + if (bfd_get_section_alignment (abfd, sec) > align) + align = bfd_get_section_alignment (abfd, sec); + if (sec->_raw_size == 0 && (sec->flags & SEC_HAS_CONTENTS) == 0) + { + struct bfd_link_order *o; + + size = 0; + for (o = sec->link_order_head; o != NULL; o = o->next) + if (size < o->offset + o->size) + size = o->offset + o->size; + } + end = sec->vma + size; + } + elf_hash_table (info)->tls_segment + = bfd_zalloc (abfd, sizeof (struct elf_link_tls_segment)); + if (elf_hash_table (info)->tls_segment == NULL) + goto error_return; + elf_hash_table (info)->tls_segment->start = base; + elf_hash_table (info)->tls_segment->size = end - base; + elf_hash_table (info)->tls_segment->align = align; + } + /* Since ELF permits relocations to be against local symbols, we must have the local symbols available when we do the relocations. Since we would rather only read the local symbols once, and we @@ -5631,7 +5692,13 @@ elf_bfd_final_link (abfd, info) name = ".fini_array"; get_size: o = bfd_get_section_by_name (abfd, name); - BFD_ASSERT (o != NULL); + if (o == NULL) + { + (*_bfd_error_handler) + (_("%s: could not find output section %s"), + bfd_get_filename (abfd), name); + goto error_return; + } if (o->_raw_size == 0) (*_bfd_error_handler) (_("warning: %s section has zero size"), name); @@ -5668,7 +5735,13 @@ elf_bfd_final_link (abfd, info) name = ".gnu.version"; get_vma: o = bfd_get_section_by_name (abfd, name); - BFD_ASSERT (o != NULL); + if (o == NULL) + { + (*_bfd_error_handler) + (_("%s: could not find output section %s"), + bfd_get_filename (abfd), name); + goto error_return; + } dyn.d_un.d_ptr = o->vma; elf_swap_dyn_out (dynobj, &dyn, dyncon); break; @@ -5747,6 +5820,15 @@ elf_bfd_final_link (abfd, info) } } + if (info->relocateable) + { + boolean failed = false; + + bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed); + if (failed) + goto error_return; + } + /* If we have optimized stabs strings, output them. */ if (elf_hash_table (info)->stab_info != NULL) { @@ -6097,7 +6179,16 @@ elf_link_output_extsym (h, data) addresses. */ sym.st_value = h->root.u.def.value + input_sec->output_offset; if (! finfo->info->relocateable) - sym.st_value += input_sec->output_section->vma; + { + sym.st_value += input_sec->output_section->vma; + if (h->type == STT_TLS) + { + /* STT_TLS symbols are relative to PT_TLS segment + base. */ + BFD_ASSERT (finfo->first_tls_sec != NULL); + sym.st_value -= finfo->first_tls_sec->vma; + } + } } else { @@ -6251,7 +6342,7 @@ elf_link_output_extsym (h, data) originated from the section given by INPUT_REL_HDR) to the OUTPUT_BFD. */ -static void +static boolean elf_link_output_relocs (output_bfd, input_section, input_rel_hdr, internal_relocs) bfd *output_bfd; @@ -6283,8 +6374,16 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr, output_rel_hdr = elf_section_data (output_section)->rel_hdr2; rel_countp = &elf_section_data (output_section)->rel_count2; } - - BFD_ASSERT (output_rel_hdr != NULL); + else + { + (*_bfd_error_handler) ( + _("%s: relocation size mismatch in %s section %s"), + bfd_get_filename (output_bfd), + bfd_archive_filename (input_section->owner), + input_section->name); + bfd_set_error (bfd_error_wrong_object_format); + return false; + } bed = get_elf_backend_data (output_bfd); irela = internal_relocs; @@ -6341,6 +6440,8 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr, /* Bump the counter, so that we know where to add the next set of relocations. */ *rel_countp += NUM_SHDR_ENTRIES (input_rel_hdr); + + return true; } /* Link an input file into the linker output file. This function @@ -6439,7 +6540,8 @@ elf_link_input_bfd (finfo, input_bfd) const char *name; Elf_Internal_Sym osym; - elf_swap_symbol_in (input_bfd, esym, shndx, isym); + elf_swap_symbol_in (input_bfd, (const PTR) esym, (const PTR) shndx, + isym); *pindex = -1; if (elf_bad_symtab (input_bfd)) @@ -6551,7 +6653,15 @@ elf_link_input_bfd (finfo, input_bfd) these requirements. */ osym.st_value += isec->output_offset; if (! finfo->info->relocateable) - osym.st_value += isec->output_section->vma; + { + osym.st_value += isec->output_section->vma; + if (ELF_ST_TYPE (osym.st_info) == STT_TLS) + { + /* STT_TLS symbols are relative to PT_TLS segment base. */ + BFD_ASSERT (finfo->first_tls_sec != NULL); + osym.st_value -= finfo->first_tls_sec->vma; + } + } if (! elf_link_output_sym (finfo, name, &osym, isec)) return false; @@ -6751,9 +6861,9 @@ elf_link_input_bfd (finfo, input_bfd) struct elf_link_hash_entry **rel_hash; Elf_Internal_Shdr *input_rel_hdr; unsigned int next_erel; - void (*reloc_emitter) PARAMS ((bfd *, asection *, - Elf_Internal_Shdr *, - Elf_Internal_Rela *)); + boolean (*reloc_emitter) PARAMS ((bfd *, asection *, + Elf_Internal_Shdr *, + Elf_Internal_Rela *)); boolean rela_normal; input_rel_hdr = &elf_section_data (o)->rel_hdr; @@ -6886,7 +6996,16 @@ elf_link_input_bfd (finfo, input_bfd) isym->st_value += sec->output_offset; if (! finfo->info->relocateable) - isym->st_value += osec->vma; + { + isym->st_value += osec->vma; + if (ELF_ST_TYPE (isym->st_info) == STT_TLS) + { + /* STT_TLS symbols are relative to PT_TLS + segment base. */ + BFD_ASSERT (finfo->first_tls_sec != NULL); + isym->st_value -= finfo->first_tls_sec->vma; + } + } finfo->indices[r_symndx] = bfd_get_symcount (output_bfd); @@ -6910,15 +7029,18 @@ elf_link_input_bfd (finfo, input_bfd) else reloc_emitter = elf_link_output_relocs; - (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs); + if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr, + internal_relocs)) + return false; input_rel_hdr = elf_section_data (o)->rel_hdr2; if (input_rel_hdr) { internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr) * bed->s->int_rels_per_ext_rel); - (*reloc_emitter) (output_bfd, o, input_rel_hdr, - internal_relocs); + if (! (*reloc_emitter) (output_bfd, o, input_rel_hdr, + internal_relocs)) + return false; } } @@ -7558,6 +7680,7 @@ elf_gc_mark (info, sec, gc_mark_hook) asection *rsec; struct elf_link_hash_entry *h; Elf_Internal_Sym s; + Elf_External_Sym_Shndx *locshndx; r_symndx = ELF_R_SYM (rel->r_info); if (r_symndx == 0) @@ -7565,9 +7688,10 @@ elf_gc_mark (info, sec, gc_mark_hook) if (elf_bad_symtab (sec->owner)) { + locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0); elf_swap_symbol_in (input_bfd, - locsyms + r_symndx, - locsym_shndx + (locsym_shndx ? r_symndx : 0), + (const PTR) (locsyms + r_symndx), + (const PTR) locshndx, &s); if (ELF_ST_BIND (s.st_info) == STB_LOCAL) rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); @@ -7584,9 +7708,10 @@ elf_gc_mark (info, sec, gc_mark_hook) } else { + locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0); elf_swap_symbol_in (input_bfd, - locsyms + r_symndx, - locsym_shndx + (locsym_shndx ? r_symndx : 0), + (const PTR) (locsyms + r_symndx), + (const PTR) locshndx, &s); rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); } @@ -8180,7 +8305,8 @@ elf_reloc_symbol_deleted_p (offset, cookie) lshndx = (Elf_External_Sym_Shndx *) rcookie->locsym_shndx; if (lshndx != NULL) lshndx += r_symndx; - elf_swap_symbol_in (rcookie->abfd, lsym, lshndx, &isym); + elf_swap_symbol_in (rcookie->abfd, (const PTR) lsym, + (const PTR) lshndx, &isym); } if (r_symndx >= rcookie->locsymcount @@ -8267,11 +8393,19 @@ elf_bfd_discard_info (output_bfd, info) if (ehdr) { eh = bfd_get_section_by_name (abfd, ".eh_frame"); - if (eh && eh->_raw_size == 0) + if (eh && (eh->_raw_size == 0 + || bfd_is_abs_section (eh->output_section))) eh = NULL; } - stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab"); + stab = NULL; + if (!strip) + { + stab = bfd_get_section_by_name (abfd, ".stab"); + if (stab && (stab->_raw_size == 0 + || bfd_is_abs_section (stab->output_section))) + stab = NULL; + } if ((! stab || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS) && ! eh diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index f92ab6ae0d8..c86ad43ac85 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -79,6 +79,9 @@ struct elfNN_ia64_dyn_sym_info bfd_vma pltoff_offset; bfd_vma plt_offset; bfd_vma plt2_offset; + bfd_vma tprel_offset; + bfd_vma dtpmod_offset; + bfd_vma dtprel_offset; /* The symbol table entry, if any, that this was derrived from. */ struct elf_link_hash_entry *h; @@ -97,6 +100,9 @@ struct elfNN_ia64_dyn_sym_info unsigned got_done : 1; unsigned fptr_done : 1; unsigned pltoff_done : 1; + unsigned tprel_done : 1; + unsigned dtpmod_done : 1; + unsigned dtprel_done : 1; /* True for the different kinds of linker data we want created. */ unsigned want_got : 1; @@ -105,6 +111,9 @@ struct elfNN_ia64_dyn_sym_info unsigned want_plt : 1; unsigned want_plt2 : 1; unsigned want_pltoff : 1; + unsigned want_tprel : 1; + unsigned want_dtpmod : 1; + unsigned want_dtprel : 1; }; struct elfNN_ia64_local_hash_entry @@ -165,7 +174,7 @@ static boolean elfNN_ia64_relax_section static boolean is_unwind_section_name PARAMS ((bfd *abfd, const char *)); static boolean elfNN_ia64_section_from_shdr - PARAMS ((bfd *, ElfNN_Internal_Shdr *, char *)); + PARAMS ((bfd *, ElfNN_Internal_Shdr *, const char *)); static boolean elfNN_ia64_section_flags PARAMS ((flagword *, ElfNN_Internal_Shdr *)); static boolean elfNN_ia64_fake_sections @@ -285,6 +294,10 @@ static bfd_vma set_pltoff_entry PARAMS ((bfd *abfd, struct bfd_link_info *info, struct elfNN_ia64_dyn_sym_info *dyn_i, bfd_vma value, boolean)); +static bfd_vma elfNN_ia64_tprel_base + PARAMS ((struct bfd_link_info *info)); +static bfd_vma elfNN_ia64_dtprel_base + PARAMS ((struct bfd_link_info *info)); static int elfNN_ia64_unwind_entry_compare PARAMS ((const PTR, const PTR)); static boolean elfNN_ia64_final_link @@ -423,10 +436,25 @@ static reloc_howto_type ia64_howto_table[] = IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, false, true), IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, false, true), + IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, false, false), IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, false, false), + IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, false, false), IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, false, false), IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, false, false), - IA64_HOWTO (R_IA64_LTOFF_TP22, "LTOFF_TP22", 0, false, false), + IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, false, false), + + IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 8, false, false), + IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 8, false, false), + IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, false, false), + + IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, false, false), + IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, false, false), + IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, false, false), + IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 4, false, false), + IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 4, false, false), + IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 8, false, false), + IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 8, false, false), + IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, false, false), }; static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1]; @@ -541,10 +569,25 @@ elfNN_ia64_reloc_type_lookup (abfd, bfd_code) case BFD_RELOC_IA64_LTOFF22X: rtype = R_IA64_LTOFF22X; break; case BFD_RELOC_IA64_LDXMOV: rtype = R_IA64_LDXMOV; break; + case BFD_RELOC_IA64_TPREL14: rtype = R_IA64_TPREL14; break; case BFD_RELOC_IA64_TPREL22: rtype = R_IA64_TPREL22; break; + case BFD_RELOC_IA64_TPREL64I: rtype = R_IA64_TPREL64I; break; case BFD_RELOC_IA64_TPREL64MSB: rtype = R_IA64_TPREL64MSB; break; case BFD_RELOC_IA64_TPREL64LSB: rtype = R_IA64_TPREL64LSB; break; - case BFD_RELOC_IA64_LTOFF_TP22: rtype = R_IA64_LTOFF_TP22; break; + case BFD_RELOC_IA64_LTOFF_TPREL22: rtype = R_IA64_LTOFF_TPREL22; break; + + case BFD_RELOC_IA64_DTPMOD64MSB: rtype = R_IA64_DTPMOD64MSB; break; + case BFD_RELOC_IA64_DTPMOD64LSB: rtype = R_IA64_DTPMOD64LSB; break; + case BFD_RELOC_IA64_LTOFF_DTPMOD22: rtype = R_IA64_LTOFF_DTPMOD22; break; + + case BFD_RELOC_IA64_DTPREL14: rtype = R_IA64_DTPREL14; break; + case BFD_RELOC_IA64_DTPREL22: rtype = R_IA64_DTPREL22; break; + case BFD_RELOC_IA64_DTPREL64I: rtype = R_IA64_DTPREL64I; break; + case BFD_RELOC_IA64_DTPREL32MSB: rtype = R_IA64_DTPREL32MSB; break; + case BFD_RELOC_IA64_DTPREL32LSB: rtype = R_IA64_DTPREL32LSB; break; + case BFD_RELOC_IA64_DTPREL64MSB: rtype = R_IA64_DTPREL64MSB; break; + case BFD_RELOC_IA64_DTPREL64LSB: rtype = R_IA64_DTPREL64LSB; break; + case BFD_RELOC_IA64_LTOFF_DTPREL22: rtype = R_IA64_LTOFF_DTPREL22; break; default: return 0; } @@ -769,7 +812,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* A local symbol. */ esym = extsyms + ELFNN_R_SYM (irel->r_info); shndx = shndx_buf + (shndx_buf ? ELFNN_R_SYM (irel->r_info) : 0); - bfd_elfNN_swap_symbol_in (abfd, esym, shndx, &isym); + bfd_elfNN_swap_symbol_in (abfd, (const PTR) esym, (const PTR) shndx, + &isym); if (isym.st_shndx == SHN_UNDEF) continue; /* We can't do anthing with undefined symbols. */ else if (isym.st_shndx == SHN_ABS) @@ -1004,7 +1048,7 @@ static boolean elfNN_ia64_section_from_shdr (abfd, hdr, name) bfd *abfd; ElfNN_Internal_Shdr *hdr; - char *name; + const char *name; { asection *newsect; @@ -2097,6 +2141,9 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) NEED_FULL_PLT = 16, NEED_DYNREL = 32, NEED_LTOFF_FPTR = 64, + NEED_TPREL = 128, + NEED_DTPMOD = 256, + NEED_DTPREL = 512 }; struct elf_link_hash_entry *h = NULL; @@ -2134,11 +2181,42 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) need_entry = 0; switch (ELFNN_R_TYPE (rel->r_info)) { - case R_IA64_TPREL22: case R_IA64_TPREL64MSB: case R_IA64_TPREL64LSB: - case R_IA64_LTOFF_TP22: - return false; + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_TPREL64LSB; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_IA64_LTOFF_TPREL22: + need_entry = NEED_TPREL; + if (info->shared) + info->flags |= DF_STATIC_TLS; + break; + + case R_IA64_DTPREL64MSB: + case R_IA64_DTPREL64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_DTPREL64LSB; + break; + + case R_IA64_LTOFF_DTPREL22: + need_entry = NEED_DTPREL; + break; + + case R_IA64_DTPMOD64MSB: + case R_IA64_DTPMOD64LSB: + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_DTPMOD64LSB; + break; + + case R_IA64_LTOFF_DTPMOD22: + need_entry = NEED_DTPMOD; + break; case R_IA64_LTOFF_FPTR22: case R_IA64_LTOFF_FPTR64I: @@ -2248,7 +2326,7 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) dyn_i->h = h; /* Create what's needed. */ - if (need_entry & NEED_GOT) + if (need_entry & (NEED_GOT | NEED_TPREL | NEED_DTPMOD | NEED_DTPREL)) { if (!got) { @@ -2256,7 +2334,14 @@ elfNN_ia64_check_relocs (abfd, info, sec, relocs) if (!got) return false; } - dyn_i->want_got = 1; + if (need_entry & NEED_GOT) + dyn_i->want_got = 1; + if (need_entry & NEED_TPREL) + dyn_i->want_tprel = 1; + if (need_entry & NEED_DTPMOD) + dyn_i->want_dtpmod = 1; + if (need_entry & NEED_DTPREL) + dyn_i->want_dtprel = 1; } if (need_entry & NEED_FPTR) { @@ -2336,6 +2421,21 @@ allocate_global_data_got (dyn_i, data) dyn_i->got_offset = x->ofs; x->ofs += 8; } + if (dyn_i->want_tprel) + { + dyn_i->tprel_offset = x->ofs; + x->ofs += 8; + } + if (dyn_i->want_dtpmod) + { + dyn_i->dtpmod_offset = x->ofs; + x->ofs += 8; + } + if (dyn_i->want_dtprel) + { + dyn_i->dtprel_offset = x->ofs; + x->ofs += 8; + } return true; } @@ -2582,6 +2682,10 @@ allocate_dynrel_entries (dyn_i, data) if (!dynamic_symbol) count *= 2; break; + case R_IA64_TPREL64LSB: + case R_IA64_DTPREL64LSB: + case R_IA64_DTPMOD64LSB: + break; default: abort (); } @@ -2593,6 +2697,12 @@ allocate_dynrel_entries (dyn_i, data) if (((dynamic_symbol || shared) && dyn_i->want_got) || (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1)) ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + if ((dynamic_symbol || shared) && dyn_i->want_tprel) + ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + if ((dynamic_symbol || shared) && dyn_i->want_dtpmod) + ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); + if (dynamic_symbol && dyn_i->want_dtprel) + ia64_info->rel_got_sec->_raw_size += sizeof (ElfNN_External_Rela); if (dyn_i->want_pltoff) { @@ -2903,7 +3013,11 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) /* Instruction relocations. */ - case R_IA64_IMM14: opnd = IA64_OPND_IMM14; break; + case R_IA64_IMM14: + case R_IA64_TPREL14: + case R_IA64_DTPREL14: + opnd = IA64_OPND_IMM14; + break; case R_IA64_PCREL21F: opnd = IA64_OPND_TGT25; break; case R_IA64_PCREL21M: opnd = IA64_OPND_TGT25b; break; @@ -2920,6 +3034,11 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case R_IA64_PLTOFF22: case R_IA64_PCREL22: case R_IA64_LTOFF_FPTR22: + case R_IA64_TPREL22: + case R_IA64_DTPREL22: + case R_IA64_LTOFF_TPREL22: + case R_IA64_LTOFF_DTPMOD22: + case R_IA64_LTOFF_DTPREL22: opnd = IA64_OPND_IMM22; break; @@ -2930,6 +3049,8 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case R_IA64_PCREL64I: case R_IA64_FPTR64I: case R_IA64_LTOFF_FPTR64I: + case R_IA64_TPREL64I: + case R_IA64_DTPREL64I: opnd = IA64_OPND_IMMU64; break; @@ -2943,6 +3064,7 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case R_IA64_SEGREL32MSB: case R_IA64_SECREL32MSB: case R_IA64_LTV32MSB: + case R_IA64_DTPREL32MSB: size = 4; bigendian = 1; break; @@ -2954,6 +3076,7 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case R_IA64_SEGREL32LSB: case R_IA64_SECREL32LSB: case R_IA64_LTV32LSB: + case R_IA64_DTPREL32LSB: size = 4; bigendian = 0; break; @@ -2966,6 +3089,9 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case R_IA64_SEGREL64MSB: case R_IA64_SECREL64MSB: case R_IA64_LTV64MSB: + case R_IA64_TPREL64MSB: + case R_IA64_DTPMOD64MSB: + case R_IA64_DTPREL64MSB: size = 8; bigendian = 1; break; @@ -2978,6 +3104,9 @@ elfNN_ia64_install_value (abfd, hit_addr, v, r_type) case R_IA64_SEGREL64LSB: case R_IA64_SECREL64LSB: case R_IA64_LTV64LSB: + case R_IA64_TPREL64LSB: + case R_IA64_DTPMOD64LSB: + case R_IA64_DTPREL64LSB: size = 8; bigendian = 0; break; @@ -3132,26 +3261,53 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) { struct elfNN_ia64_link_hash_table *ia64_info; asection *got_sec; + boolean done; + bfd_vma got_offset; ia64_info = elfNN_ia64_hash_table (info); got_sec = ia64_info->got_sec; - BFD_ASSERT ((dyn_i->got_offset & 7) == 0); - - if (! dyn_i->got_done) + switch (dyn_r_type) { + case R_IA64_TPREL64LSB: + done = dyn_i->tprel_done; + dyn_i->tprel_done = true; + got_offset = dyn_i->tprel_offset; + break; + case R_IA64_DTPMOD64LSB: + done = dyn_i->dtpmod_done; + dyn_i->dtpmod_done = true; + got_offset = dyn_i->dtpmod_offset; + break; + case R_IA64_DTPREL64LSB: + done = dyn_i->dtprel_done; + dyn_i->dtprel_done = true; + got_offset = dyn_i->dtprel_offset; + break; + default: + done = dyn_i->got_done; dyn_i->got_done = true; + got_offset = dyn_i->got_offset; + break; + } + BFD_ASSERT ((got_offset & 7) == 0); + + if (! done) + { /* Store the target address in the linkage table entry. */ - bfd_put_64 (abfd, value, got_sec->contents + dyn_i->got_offset); + bfd_put_64 (abfd, value, got_sec->contents + got_offset); /* Install a dynamic relocation if needed. */ - if (info->shared + if ((info->shared && dyn_r_type != R_IA64_DTPREL64LSB) || elfNN_ia64_dynamic_symbol_p (dyn_i->h, info) || elfNN_ia64_aix_vec (abfd->xvec) || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB)) { - if (dynindx == -1) + if (dynindx == -1 + && dyn_r_type != R_IA64_TPREL64LSB + && dyn_r_type != R_IA64_DTPMOD64LSB + && dyn_r_type != R_IA64_DTPREL64LSB) { dyn_r_type = R_IA64_REL64LSB; dynindx = 0; @@ -3171,6 +3327,15 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) case R_IA64_FPTR64LSB: dyn_r_type = R_IA64_FPTR64MSB; break; + case R_IA64_TPREL64LSB: + dyn_r_type = R_IA64_TPREL64MSB; + break; + case R_IA64_DTPMOD64LSB: + dyn_r_type = R_IA64_DTPMOD64MSB; + break; + case R_IA64_DTPREL64LSB: + dyn_r_type = R_IA64_DTPREL64MSB; + break; default: BFD_ASSERT (false); break; @@ -3179,7 +3344,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) elfNN_ia64_install_dyn_reloc (abfd, NULL, got_sec, ia64_info->rel_got_sec, - dyn_i->got_offset, dyn_r_type, + got_offset, dyn_r_type, dynindx, addend); } } @@ -3187,7 +3352,7 @@ set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) /* Return the address of the linkage table entry. */ value = (got_sec->output_section->vma + got_sec->output_offset - + dyn_i->got_offset); + + got_offset); return value; } @@ -3285,6 +3450,35 @@ set_pltoff_entry (abfd, info, dyn_i, value, is_plt) return value; } +/* Return the base VMA address which should be subtracted from real addresses + when resolving @tprel() relocation. + Main program TLS (whose template starts at PT_TLS p_vaddr) + is assigned offset round(16, PT_TLS p_align). */ + +static bfd_vma +elfNN_ia64_tprel_base (info) + struct bfd_link_info *info; +{ + struct elf_link_tls_segment *tls_segment + = elf_hash_table (info)->tls_segment; + + BFD_ASSERT (tls_segment != NULL); + return (tls_segment->start + - align_power ((bfd_vma) 16, tls_segment->align)); +} + +/* Return the base VMA address which should be subtracted from real addresses + when resolving @dtprel() relocation. + This is PT_TLS segment p_vaddr. */ + +static bfd_vma +elfNN_ia64_dtprel_base (info) + struct bfd_link_info *info; +{ + BFD_ASSERT (elf_hash_table (info)->tls_segment != NULL); + return elf_hash_table (info)->tls_segment->start; +} + /* Called through qsort to sort the .IA_64.unwind section during a non-relocatable link. Set elfNN_ia64_unwind_entry_compare_bfd to the output bfd so we can do proper endianness frobbing. */ @@ -4030,6 +4224,55 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, r_type); break; + case R_IA64_TPREL14: + case R_IA64_TPREL22: + case R_IA64_TPREL64I: + value -= elfNN_ia64_tprel_base (info); + r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_DTPREL14: + case R_IA64_DTPREL22: + case R_IA64_DTPREL64I: + value -= elfNN_ia64_dtprel_base (info); + r = elfNN_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_LTOFF_TPREL22: + case R_IA64_LTOFF_DTPMOD22: + case R_IA64_LTOFF_DTPREL22: + { + int got_r_type; + + switch (r_type) + { + default: + case R_IA64_LTOFF_TPREL22: + if (!dynamic_symbol_p && !info->shared) + value -= elfNN_ia64_tprel_base (info); + got_r_type = R_IA64_TPREL64LSB; + break; + case R_IA64_LTOFF_DTPMOD22: + if (!dynamic_symbol_p && !info->shared) + value = 1; + got_r_type = R_IA64_DTPMOD64LSB; + break; + case R_IA64_LTOFF_DTPREL22: + if (!dynamic_symbol_p) + value -= elfNN_ia64_dtprel_base (info); + got_r_type = R_IA64_DTPREL64LSB; + break; + } + dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); + value = set_got_entry (input_bfd, info, dyn_i, + (h ? h->dynindx : -1), rel->r_addend, + value, got_r_type); + value -= gp_val; + r = elfNN_ia64_install_value (output_bfd, hit_addr, value, + r_type); + } + break; + default: r = bfd_reloc_notsupported; break; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 8ec22b9aee3..a2200d50610 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -135,7 +135,7 @@ struct mips_elf_link_hash_table /* The size of the .compact_rel section (if SGI_COMPAT). */ bfd_size_type compact_rel_size; /* This flag indicates that the value of DT_MIPS_RLD_MAP dynamic - entry is set to the address of __rld_obj_head as in Irix 5. */ + entry is set to the address of __rld_obj_head as in IRIX5. */ boolean use_rld_obj_head; /* This is the value of the __rld_map or __rld_obj_head symbol. */ bfd_vma rld_value; @@ -154,7 +154,7 @@ struct extsym_info boolean failed; }; -/* The names of the runtime procedure table symbols used on Irix 5. */ +/* The names of the runtime procedure table symbols used on IRIX5. */ static const char * const mips_elf_dynsym_rtproc_names[] = { @@ -165,7 +165,7 @@ static const char * const mips_elf_dynsym_rtproc_names[] = }; /* These structures are used to generate the .compact_rel section on - Irix 5. */ + IRIX5. */ typedef struct { @@ -375,7 +375,7 @@ static bfd *reldyn_sorting_bfd; /* Nonzero if ABFD is using the 64-bit ABI. */ #define ABI_64_P(abfd) \ - ((elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) != 0) + ((get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64) != 0) #define IRIX_COMPAT(abfd) \ (get_elf_backend_data (abfd)->elf_backend_mips_irix_compat (abfd)) @@ -2082,8 +2082,16 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, sec = local_sections[r_symndx]; symbol = sec->output_section->vma + sec->output_offset; - if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION + || (sec->flags & SEC_MERGE)) symbol += sym->st_value; + if ((sec->flags & SEC_MERGE) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + addend = _bfd_elf_rel_local_sym (abfd, sym, &sec, addend); + addend -= symbol; + addend += sec->output_section->vma + sec->output_offset; + } /* MIPS16 text labels should be treated as odd. */ if (sym->st_other == STO_MIPS16) @@ -2411,7 +2419,7 @@ mips_elf_calculate_relocation (abfd, input_bfd, input_section, info, { value = addend + gp - p + 4; /* The MIPS ABI requires checking the R_MIPS_LO16 relocation - for overflow. But, on, say, Irix 5, relocations against + for overflow. But, on, say, IRIX5, relocations against _gp_disp are normally generated from the .cpload pseudo-op. It generates code that normally looks like this: @@ -3351,7 +3359,7 @@ boolean _bfd_mips_elf_section_from_shdr (abfd, hdr, name) bfd *abfd; Elf_Internal_Shdr *hdr; - char *name; + const char *name; { flagword flags = 0; @@ -3542,7 +3550,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec) else if (strcmp (name, ".mdebug") == 0) { hdr->sh_type = SHT_MIPS_DEBUG; - /* In a shared object on Irix 5.3, the .mdebug section has an + /* In a shared object on IRIX 5.3, the .mdebug section has an entsize of 0. FIXME: Does this matter? */ if (SGI_COMPAT (abfd) && (abfd->flags & DYNAMIC) != 0) hdr->sh_entsize = 0; @@ -3552,7 +3560,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec) else if (strcmp (name, ".reginfo") == 0) { hdr->sh_type = SHT_MIPS_REGINFO; - /* In a shared object on Irix 5.3, the .reginfo section has an + /* In a shared object on IRIX 5.3, the .reginfo section has an entsize of 0x18. FIXME: Does this matter? */ if (SGI_COMPAT (abfd)) { @@ -3572,7 +3580,7 @@ _bfd_mips_elf_fake_sections (abfd, hdr, sec) if (SGI_COMPAT (abfd)) hdr->sh_entsize = 0; #if 0 - /* This isn't how the Irix 6 linker behaves. */ + /* This isn't how the IRIX6 linker behaves. */ hdr->sh_info = SIZEOF_MIPS_DYNSYM_SECNAMES; #endif } @@ -3693,7 +3701,7 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) && (abfd->flags & DYNAMIC) != 0 && strcmp (*namep, "_rld_new_interface") == 0) { - /* Skip Irix 5 rld entry name. */ + /* Skip IRIX5 rld entry name. */ *namep = NULL; return true; } @@ -4790,7 +4798,7 @@ _bfd_mips_elf_size_dynamic_sections (output_bfd, info) } else if (strcmp (name, MIPS_ELF_STUB_SECTION_NAME (output_bfd)) == 0) { - /* Irix rld assumes that the function stub isn't at the end + /* IRIX rld assumes that the function stub isn't at the end of .text section. So put a dummy. XXX */ s->_raw_size += MIPS_FUNCTION_STUB_SIZE; } @@ -5005,8 +5013,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, space. Thus, when they use an R_MIPS_64 they mean what is usually meant by R_MIPS_32, with the exception that the stored value is sign-extended to 64 bits. */ - howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, R_MIPS_32, - NEWABI_P (input_bfd)); + howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, R_MIPS_32, false); /* On big-endian systems, we need to lie about the position of the reloc. */ @@ -5041,6 +5048,7 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend = mips_elf_obtain_contents (howto, rel, input_bfd, contents); addend &= howto->src_mask; + addend <<= howto->rightshift; /* For some kinds of relocations, the ADDEND is a combination of the addend stored in two different @@ -5073,11 +5081,11 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, return false; /* Obtain the addend kept there. */ - lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, lo, - rela_relocation_p); + lo16_howto = MIPS_ELF_RTYPE_TO_HOWTO (input_bfd, lo, false); l = mips_elf_obtain_contents (lo16_howto, lo16_relocation, input_bfd, contents); l &= lo16_howto->src_mask; + l <<= lo16_howto->rightshift; l = mips_elf_sign_extend (l, 16); addend <<= 16; @@ -5136,13 +5144,6 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, || r_type == R_MIPS_LITERAL) addend -= (_bfd_get_gp_value (output_bfd) - _bfd_get_gp_value (input_bfd)); - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - /* The addend is stored without its two least - significant bits (which are always zero.) In a - non-relocateable link, calculate_relocation will do - this shift; here, we must do it ourselves. */ - addend <<= 2; r_symndx = ELF_R_SYM (output_bfd, rel->r_info); sym = local_syms + r_symndx; @@ -5150,23 +5151,20 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Adjust the addend appropriately. */ addend += local_sections[r_symndx]->output_offset; - /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16, - then we only want to write out the high-order 16 bits. - The subsequent R_MIPS_LO16 will handle the low-order bits. */ - if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16 - || r_type == R_MIPS_GNU_REL_HI16) - addend = mips_elf_high (addend); - else if (r_type == R_MIPS_HIGHER) - addend = mips_elf_higher (addend); - else if (r_type == R_MIPS_HIGHEST) - addend = mips_elf_highest (addend); - - /* If the relocation is for an R_MIPS_26 relocation, then - the two low-order bits are not stored in the object file; - they are implicitly zero. */ - else if (r_type == R_MIPS_26 || r_type == R_MIPS16_26 - || r_type == R_MIPS_GNU_REL16_S2) - addend >>= 2; + if (howto->partial_inplace) + { + /* If the relocation is for a R_MIPS_HI16 or R_MIPS_GOT16, + then we only want to write out the high-order 16 bits. + The subsequent R_MIPS_LO16 will handle the low-order bits. + */ + if (r_type == R_MIPS_HI16 || r_type == R_MIPS_GOT16 + || r_type == R_MIPS_GNU_REL_HI16) + addend = mips_elf_high (addend); + else if (r_type == R_MIPS_HIGHER) + addend = mips_elf_higher (addend); + else if (r_type == R_MIPS_HIGHEST) + addend = mips_elf_highest (addend); + } if (rela_relocation_p) /* If this is a RELA relocation, just update the addend. @@ -5179,9 +5177,10 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, destination mask because the place to which we are writing will be source of the addend in the final link. */ + addend >>= howto->rightshift; addend &= howto->src_mask; - if (r_type == R_MIPS_64 && !ABI_64_P (output_bfd)) + if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd)) /* See the comment above about using R_MIPS_64 in the 32-bit ABI. Here, we need to update the addend. It would be possible to get away with just using the R_MIPS_32 reloc @@ -5242,6 +5241,8 @@ _bfd_mips_elf_relocate_section (output_bfd, info, input_bfd, input_section, else use_saved_addend_p = false; + addend >>= howto->rightshift; + /* Figure out what value we are supposed to relocate. */ switch (mips_elf_calculate_relocation (output_bfd, input_bfd, input_section, info, rel, @@ -5785,7 +5786,7 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info) /* The first entry of the global offset table will be filled at runtime. The second entry will be used by some runtime loaders. - This isn't the case of Irix rld. */ + This isn't the case of IRIX rld. */ if (sgot != NULL && sgot->_raw_size > 0) { MIPS_ELF_PUT_WORD (output_bfd, (bfd_vma) 0, sgot->contents); @@ -6030,7 +6031,7 @@ _bfd_mips_elf_final_write_processing (abfd, linker) } } -/* When creating an Irix 5 executable, we need REGINFO and RTPROC +/* When creating an IRIX5 executable, we need REGINFO and RTPROC segments. */ int @@ -6060,7 +6061,7 @@ _bfd_mips_elf_additional_program_headers (abfd) return ret; } -/* Modify the segment map for an Irix 5 executable. */ +/* Modify the segment map for an IRIX5 executable. */ boolean _bfd_mips_elf_modify_segment_map (abfd) @@ -6183,7 +6184,7 @@ _bfd_mips_elf_modify_segment_map (abfd) } } } - /* On Irix 5, the PT_DYNAMIC segment includes the .dynamic, + /* On IRIX5, the PT_DYNAMIC segment includes the .dynamic, .dynstr, .dynsym, and .hash sections, and everything in between. */ for (pm = &elf_tdata (abfd)->segment_map; *pm != NULL; @@ -6414,6 +6415,15 @@ _bfd_mips_elf_hide_symbol (info, entry, force_local) got->_raw_size += MIPS_ELF_GOT_SIZE (dynobj); } +boolean +_bfd_mips_elf_ignore_discarded_relocs (sec) + asection *sec; +{ + if (strcmp (sec->name, ".pdr") == 0) + return true; + return false; +} + /* MIPS ELF uses a special find_nearest_line routine in order the handle the ECOFF debugging information. */ diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 959bfa6c899..b0812652633 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -25,7 +25,7 @@ extern void _bfd_mips_elf_symbol_processing extern boolean _bfd_mips_elf_section_processing PARAMS ((bfd *, Elf_Internal_Shdr *)); extern boolean _bfd_mips_elf_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, char *)); + PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); extern boolean _bfd_mips_elf_fake_sections PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); extern boolean _bfd_mips_elf_section_from_bfd_section @@ -71,6 +71,8 @@ extern void _bfd_mips_elf_copy_indirect_symbol PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *)); extern void _bfd_mips_elf_hide_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean)); +extern boolean _bfd_mips_elf_ignore_discarded_relocs + PARAMS ((asection *)); extern boolean _bfd_mips_elf_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)); diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 7d391d42e6e..369a44e0105 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -44,7 +44,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef bfd_elfNN_get_reloc_upper_bound #define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound #endif +#ifndef bfd_elfNN_get_symbol_info #define bfd_elfNN_get_symbol_info _bfd_elf_get_symbol_info +#endif #define bfd_elfNN_get_symtab _bfd_elf_get_symtab #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound #if 0 /* done in elf-bfd.h */ @@ -126,6 +128,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ _bfd_elf_merge_sections #endif +#ifndef bfd_elfNN_bfd_discard_group +#define bfd_elfNN_bfd_discard_group bfd_elf_discard_group +#endif + #ifndef bfd_elfNN_bfd_make_debug_symbol #define bfd_elfNN_bfd_make_debug_symbol \ ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) @@ -194,6 +200,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define bfd_elfNN_bfd_final_link _bfd_generic_final_link #endif #endif /* ! defined (elf_backend_relocate_section) */ + +#ifndef bfd_elfNN_bfd_link_just_syms +#define bfd_elfNN_bfd_link_just_syms _bfd_elf_link_just_syms +#endif + #ifndef bfd_elfNN_bfd_link_split_section #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section #endif @@ -371,6 +382,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef elf_backend_write_section #define elf_backend_write_section NULL #endif +#ifndef elf_backend_set_nonloadable_filepos +#define elf_backend_set_nonloadable_filepos NULL +#endif +#ifndef elf_backend_is_contained_by_filepos +#define elf_backend_is_contained_by_filepos NULL +#endif +#ifndef elf_backend_copy_private_bfd_data_p +#define elf_backend_copy_private_bfd_data_p NULL +#endif #ifndef elf_backend_mips_irix_compat #define elf_backend_mips_irix_compat NULL #endif @@ -472,6 +492,9 @@ static const struct elf_backend_data elfNN_bed = elf_backend_discard_info, elf_backend_ignore_discarded_relocs, elf_backend_write_section, + elf_backend_set_nonloadable_filepos, + elf_backend_is_contained_by_filepos, + elf_backend_copy_private_bfd_data_p, elf_backend_mips_irix_compat, elf_backend_mips_rtype_to_howto, elf_backend_ecoff_debug_swap, diff --git a/bfd/hash.c b/bfd/hash.c index 9766eaf0cf2..a498cce46c9 100644 --- a/bfd/hash.c +++ b/bfd/hash.c @@ -375,8 +375,8 @@ bfd_hash_lookup (table, string, create, copy) { hash += c + (c << 17); hash ^= hash >> 2; - ++len; } + len = (s - (const unsigned char *) string) - 1; hash += len + (len << 17); hash ^= hash >> 2; diff --git a/bfd/i386linux.c b/bfd/i386linux.c index 755b456cfcd..c144822ac2a 100644 --- a/bfd/i386linux.c +++ b/bfd/i386linux.c @@ -597,10 +597,9 @@ bfd_i386linux_size_dynamic_sections (output_bfd, info) { s->_raw_size = linux_hash_table (info)->fixup_count + 1; s->_raw_size *= 8; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); if (s->contents == NULL) return false; - memset (s->contents, 0, (size_t) s->_raw_size); } return true; diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c index f74854334b4..fc58767a97f 100644 --- a/bfd/i386lynx.c +++ b/bfd/i386lynx.c @@ -1,5 +1,5 @@ /* BFD back-end for i386 a.out binaries under LynxOS. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -429,10 +429,9 @@ doit: count = reloc_size / each_size; - reloc_cache = (arelent *) bfd_malloc (count * sizeof (arelent)); + reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent)); if (!reloc_cache && count != 0) return false; - memset (reloc_cache, 0, (size_t) count * sizeof (arelent)); relocs = (PTR) bfd_alloc (abfd, reloc_size); if (!relocs && reloc_size != 0) diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 655ecfd65a4..5c060ecf58e 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -173,9 +173,11 @@ msdos_set_section_contents (abfd, section, location, offset, count) #define msdos_bfd_relax_section bfd_generic_relax_section #define msdos_bfd_gc_sections bfd_generic_gc_sections #define msdos_bfd_merge_sections bfd_generic_merge_sections +#define msdos_bfd_discard_group bfd_generic_discard_group #define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define msdos_bfd_link_just_syms _bfd_generic_link_just_syms #define msdos_bfd_final_link _bfd_generic_final_link #define msdos_bfd_link_split_section _bfd_generic_link_split_section #define msdos_set_arch_mach _bfd_generic_set_arch_mach diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 099a7142fba..5ae994bfd6f 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -329,9 +329,11 @@ os9k_sizeof_headers (ignore_abfd, ignore) #define os9k_bfd_relax_section bfd_generic_relax_section #define os9k_bfd_gc_sections bfd_generic_gc_sections #define os9k_bfd_merge_sections bfd_generic_merge_sections +#define os9k_bfd_discard_group bfd_generic_discard_group #define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define os9k_bfd_link_just_syms _bfd_generic_link_just_syms #define os9k_bfd_final_link _bfd_generic_final_link #define os9k_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/ieee.c b/bfd/ieee.c index cd56101aa13..2433cc432d6 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -2398,10 +2398,9 @@ do_with_relocs (abfd, s) if ((PTR) stream == (PTR) NULL) { /* Outputting a section without data, fill it up */ - stream = (unsigned char *) (bfd_alloc (abfd, s->_raw_size)); + stream = (unsigned char *) bfd_zalloc (abfd, s->_raw_size); if (!stream) return false; - memset ((PTR) stream, 0, (size_t) s->_raw_size); } while (current_byte_index < s->_raw_size) { @@ -4010,9 +4009,11 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_bfd_relax_section bfd_generic_relax_section #define ieee_bfd_gc_sections bfd_generic_gc_sections #define ieee_bfd_merge_sections bfd_generic_merge_sections +#define ieee_bfd_discard_group bfd_generic_discard_group #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define ieee_bfd_link_just_syms _bfd_generic_link_just_syms #define ieee_bfd_final_link _bfd_generic_final_link #define ieee_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/ihex.c b/bfd/ihex.c index 0aad1649d52..4cba29bf7bb 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -977,9 +977,11 @@ ihex_sizeof_headers (abfd, exec) #define ihex_bfd_relax_section bfd_generic_relax_section #define ihex_bfd_gc_sections bfd_generic_gc_sections #define ihex_bfd_merge_sections bfd_generic_merge_sections +#define ihex_bfd_discard_group bfd_generic_discard_group #define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms #define ihex_bfd_final_link _bfd_generic_final_link #define ihex_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/libaout.h b/bfd/libaout.h index d7e5c7166ff..a76b935d394 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -302,6 +302,7 @@ enum machine_type { M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */ M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */ M_SPARCLET_1 = 147, /* 0x93, reserved */ + M_VAX4K_NETBSD = 150, /* NetBSD/vax 4K pages binary */ M_MIPS1 = 151, /* MIPS R2000/R3000 binary */ M_MIPS2 = 152, /* MIPS R4000/R6000 binary */ M_SPARCLET_2 = 163, /* 0xa3, reserved */ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 68006fa463f..776dcd62f91 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -322,12 +322,18 @@ extern boolean _bfd_generic_set_section_contents ((boolean (*) \ PARAMS ((bfd *, struct bfd_link_info *))) \ bfd_false) +#define _bfd_nolink_bfd_discard_group \ + ((boolean (*) \ + PARAMS ((bfd *, struct sec *))) \ + bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) #define _bfd_nolink_bfd_link_hash_table_free \ ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void) #define _bfd_nolink_bfd_link_add_symbols \ ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) +#define _bfd_nolink_bfd_link_just_syms \ + ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void) #define _bfd_nolink_bfd_final_link \ ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) #define _bfd_nolink_bfd_link_split_section \ @@ -410,8 +416,6 @@ extern boolean _bfd_generic_link_add_archive_symbols PARAMS ((bfd *, struct bfd_link_info *, boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *))); - - /* Forward declaration to avoid prototype errors. */ typedef struct bfd_link_hash_entry _bfd_link_hash_entry; @@ -421,6 +425,10 @@ extern boolean _bfd_generic_link_add_one_symbol asection *, bfd_vma, const char *, boolean copy, boolean constructor, struct bfd_link_hash_entry **)); +/* Generic routine to mark section as supplying symbols only. */ +extern void _bfd_generic_link_just_syms + PARAMS ((asection *, struct bfd_link_info *)); + /* Generic link routine. */ extern boolean _bfd_generic_final_link PARAMS ((bfd *, struct bfd_link_info *)); @@ -585,5 +593,3 @@ extern boolean _bfd_sh_align_load_span boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *)); -/* And more follows */ - diff --git a/bfd/libbfd.h b/bfd/libbfd.h index cbe4973a669..fa9873f35bc 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -327,12 +327,18 @@ extern boolean _bfd_generic_set_section_contents ((boolean (*) \ PARAMS ((bfd *, struct bfd_link_info *))) \ bfd_false) +#define _bfd_nolink_bfd_discard_group \ + ((boolean (*) \ + PARAMS ((bfd *, struct sec *))) \ + bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) #define _bfd_nolink_bfd_link_hash_table_free \ ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void) #define _bfd_nolink_bfd_link_add_symbols \ ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) +#define _bfd_nolink_bfd_link_just_syms \ + ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void) #define _bfd_nolink_bfd_final_link \ ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) #define _bfd_nolink_bfd_link_split_section \ @@ -415,8 +421,6 @@ extern boolean _bfd_generic_link_add_archive_symbols PARAMS ((bfd *, struct bfd_link_info *, boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *))); - - /* Forward declaration to avoid prototype errors. */ typedef struct bfd_link_hash_entry _bfd_link_hash_entry; @@ -426,6 +430,10 @@ extern boolean _bfd_generic_link_add_one_symbol asection *, bfd_vma, const char *, boolean copy, boolean constructor, struct bfd_link_hash_entry **)); +/* Generic routine to mark section as supplying symbols only. */ +extern void _bfd_generic_link_just_syms + PARAMS ((asection *, struct bfd_link_info *)); + /* Generic link routine. */ extern boolean _bfd_generic_final_link PARAMS ((bfd *, struct bfd_link_info *)); @@ -590,14 +598,15 @@ extern boolean _bfd_sh_align_load_span boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *)); -/* And more follows */ - +/* Extracted from init.c. */ +/* Extracted from libbfd.c. */ boolean bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int)); unsigned int bfd_log2 PARAMS ((bfd_vma x)); +/* Extracted from cache.c. */ #define BFD_CACHE_MAX_OPEN 10 extern bfd *bfd_last_cache; @@ -617,6 +626,7 @@ bfd_open_file PARAMS ((bfd *abfd)); FILE * bfd_cache_lookup_worker PARAMS ((bfd *abfd)); +/* Extracted from reloc.c. */ #ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", @@ -728,6 +738,19 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ALPHA_GPREL_HI16", "BFD_RELOC_ALPHA_GPREL_LO16", "BFD_RELOC_ALPHA_BRSGP", + "BFD_RELOC_ALPHA_TLSGD", + "BFD_RELOC_ALPHA_TLSLDM", + "BFD_RELOC_ALPHA_DTPMOD64", + "BFD_RELOC_ALPHA_GOTDTPREL16", + "BFD_RELOC_ALPHA_DTPREL64", + "BFD_RELOC_ALPHA_DTPREL_HI16", + "BFD_RELOC_ALPHA_DTPREL_LO16", + "BFD_RELOC_ALPHA_DTPREL16", + "BFD_RELOC_ALPHA_GOTTPREL16", + "BFD_RELOC_ALPHA_TPREL64", + "BFD_RELOC_ALPHA_TPREL_HI16", + "BFD_RELOC_ALPHA_TPREL_LO16", + "BFD_RELOC_ALPHA_TPREL16", "BFD_RELOC_MIPS_JMP", "BFD_RELOC_MIPS16_JMP", "BFD_RELOC_MIPS16_GPREL", @@ -767,6 +790,15 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_386_RELATIVE", "BFD_RELOC_386_GOTOFF", "BFD_RELOC_386_GOTPC", + "BFD_RELOC_386_TLS_LE", + "BFD_RELOC_386_TLS_GD", + "BFD_RELOC_386_TLS_LDM", + "BFD_RELOC_386_TLS_LDO_32", + "BFD_RELOC_386_TLS_IE_32", + "BFD_RELOC_386_TLS_LE_32", + "BFD_RELOC_386_TLS_DTPMOD32", + "BFD_RELOC_386_TLS_DTPOFF32", + "BFD_RELOC_386_TLS_TPOFF32", "BFD_RELOC_X86_64_GOT32", "BFD_RELOC_X86_64_PLT32", "BFD_RELOC_X86_64_COPY", @@ -973,6 +1005,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_D30V_21_PCREL_R", "BFD_RELOC_D30V_32", "BFD_RELOC_D30V_32_PCREL", + "BFD_RELOC_DLX_HI16_S", + "BFD_RELOC_DLX_LO16", + "BFD_RELOC_DLX_JMP26", "BFD_RELOC_M32R_24", "BFD_RELOC_M32R_10_PCREL", "BFD_RELOC_M32R_18_PCREL", @@ -1138,12 +1173,25 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_IA64_IPLTMSB", "BFD_RELOC_IA64_IPLTLSB", "BFD_RELOC_IA64_COPY", + "BFD_RELOC_IA64_LTOFF22X", + "BFD_RELOC_IA64_LDXMOV", + "BFD_RELOC_IA64_TPREL14", "BFD_RELOC_IA64_TPREL22", + "BFD_RELOC_IA64_TPREL64I", "BFD_RELOC_IA64_TPREL64MSB", "BFD_RELOC_IA64_TPREL64LSB", - "BFD_RELOC_IA64_LTOFF_TP22", - "BFD_RELOC_IA64_LTOFF22X", - "BFD_RELOC_IA64_LDXMOV", + "BFD_RELOC_IA64_LTOFF_TPREL22", + "BFD_RELOC_IA64_DTPMOD64MSB", + "BFD_RELOC_IA64_DTPMOD64LSB", + "BFD_RELOC_IA64_LTOFF_DTPMOD22", + "BFD_RELOC_IA64_DTPREL14", + "BFD_RELOC_IA64_DTPREL22", + "BFD_RELOC_IA64_DTPREL64I", + "BFD_RELOC_IA64_DTPREL32MSB", + "BFD_RELOC_IA64_DTPREL32LSB", + "BFD_RELOC_IA64_DTPREL64MSB", + "BFD_RELOC_IA64_DTPREL64LSB", + "BFD_RELOC_IA64_LTOFF_DTPREL22", "BFD_RELOC_M68HC11_HI8", "BFD_RELOC_M68HC11_LO8", "BFD_RELOC_M68HC11_3B", @@ -1205,6 +1253,9 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_XSTORMY16_REL_12", "BFD_RELOC_XSTORMY16_24", "BFD_RELOC_XSTORMY16_FPTR16", + "BFD_RELOC_VAX_GLOB_DAT", + "BFD_RELOC_VAX_JMP_SLOT", + "BFD_RELOC_VAX_RELATIVE", "@@overflow: BFD_RELOC_UNUSED@@", }; #endif @@ -1232,6 +1283,7 @@ bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd, boolean relocateable, asymbol **symbols)); +/* Extracted from archures.c. */ extern const bfd_arch_info_type bfd_default_arch_struct; boolean bfd_default_set_arch_mach PARAMS ((bfd *abfd, @@ -1245,6 +1297,7 @@ bfd_default_compatible PARAMS ((const bfd_arch_info_type *a, boolean bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string)); +/* Extracted from elf.c. */ struct elf_internal_shdr * bfd_elf_find_section PARAMS ((bfd *abfd, char *name)); diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index 618dddaee45..efc2fee268b 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -598,5 +598,3 @@ extern boolean ppc_allocate_toc_section extern boolean ppc_process_before_allocation PARAMS ((bfd *, struct bfd_link_info *)); -/* And more taken from the source .. */ - diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 2e9a7d8c2ee..88b09098296 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -602,8 +602,7 @@ extern boolean ppc_allocate_toc_section extern boolean ppc_process_before_allocation PARAMS ((bfd *, struct bfd_link_info *)); -/* And more taken from the source .. */ - +/* Extracted from coffcode.h. */ typedef struct coff_ptr_struct { /* Remembers the offset from the first symbol in the file for diff --git a/bfd/libecoff.h b/bfd/libecoff.h index c900ee8ddfd..eb90a8cddb9 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -333,6 +333,7 @@ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create #define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free extern boolean _bfd_ecoff_bfd_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); +#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms extern boolean _bfd_ecoff_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); diff --git a/bfd/linker.c b/bfd/linker.c index b4b9f292b87..228f088a017 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -757,6 +757,19 @@ _bfd_generic_link_add_symbols_collect (abfd, info) return generic_link_add_symbols (abfd, info, true); } +/* Indicate that we are only retrieving symbol values from this + section. We want the symbols to act as though the values in the + file are absolute. */ + +void +_bfd_generic_link_just_syms (sec, info) + asection *sec; + struct bfd_link_info *info ATTRIBUTE_UNUSED; +{ + sec->output_section = bfd_abs_section_ptr; + sec->output_offset = sec->vma; +} + /* Add symbols from an object file to the global hash table. */ static boolean @@ -1800,37 +1813,38 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, /* Fall through. */ case MDEF: /* Handle a multiple definition. */ - { - asection *msec = NULL; - bfd_vma mval = 0; + if (!info->allow_multiple_definition) + { + asection *msec = NULL; + bfd_vma mval = 0; - switch (h->type) - { - case bfd_link_hash_defined: - msec = h->u.def.section; - mval = h->u.def.value; - break; - case bfd_link_hash_indirect: - msec = bfd_ind_section_ptr; - mval = 0; - break; - default: - abort (); - } + switch (h->type) + { + case bfd_link_hash_defined: + msec = h->u.def.section; + mval = h->u.def.value; + break; + case bfd_link_hash_indirect: + msec = bfd_ind_section_ptr; + mval = 0; + break; + default: + abort (); + } - /* Ignore a redefinition of an absolute symbol to the same - value; it's harmless. */ - if (h->type == bfd_link_hash_defined - && bfd_is_abs_section (msec) - && bfd_is_abs_section (section) - && value == mval) - break; + /* Ignore a redefinition of an absolute symbol to the + same value; it's harmless. */ + if (h->type == bfd_link_hash_defined + && bfd_is_abs_section (msec) + && bfd_is_abs_section (section) + && value == mval) + break; - if (! ((*info->callbacks->multiple_definition) - (info, h->root.string, msec->owner, msec, mval, abfd, - section, value))) - return false; - } + if (! ((*info->callbacks->multiple_definition) + (info, h->root.string, msec->owner, msec, mval, + abfd, section, value))) + return false; + } break; case CIND: diff --git a/bfd/m68klinux.c b/bfd/m68klinux.c index 7dd0428947e..863a61d68f8 100644 --- a/bfd/m68klinux.c +++ b/bfd/m68klinux.c @@ -601,13 +601,12 @@ bfd_m68klinux_size_dynamic_sections (output_bfd, info) { s->_raw_size = linux_hash_table (info)->fixup_count + 1; s->_raw_size *= 8; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); if (s->contents == NULL) { bfd_set_error (bfd_error_no_memory); return false; } - memset (s->contents, 0, (size_t) s->_raw_size); } return true; diff --git a/bfd/merge.c b/bfd/merge.c index e175efdf881..866b69ce730 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -1,22 +1,22 @@ /* SEC_MERGE support. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. Written by Jakub Jelinek . -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This file contains support for merging duplicate entities within sections, as used in ELF SHF_MERGE. */ @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" #include "hashtab.h" +#include "libiberty.h" struct sec_merge_sec_info; @@ -38,7 +39,8 @@ struct sec_merge_hash_entry /* Start of this string needs to be aligned to alignment octets (not 1 << align). */ unsigned int alignment; - union { + union + { /* Index within the merged section. */ bfd_size_type index; /* Entity size (if present in suffix hash tables). */ @@ -144,7 +146,7 @@ sec_merge_hash_newfunc (entry, table, string) ret->next = NULL; } - return (struct bfd_hash_entry *)ret; + return (struct bfd_hash_entry *) ret; } /* Look up an entry in a section merge hash table. */ @@ -650,8 +652,10 @@ merge_strings (sinfo) qsort (array, (size_t) sinfo->htab->size, sizeof (struct sec_merge_hash_entry *), cmplengthentry); - last4tab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last4_eq, NULL); - lasttab = htab_create ((size_t) sinfo->htab->size * 4, NULL, last_eq, NULL); + last4tab = htab_create_alloc ((size_t) sinfo->htab->size * 4, + NULL, last4_eq, NULL, calloc, free); + lasttab = htab_create_alloc ((size_t) sinfo->htab->size * 4, + NULL, last_eq, NULL, calloc, free); if (lasttab == NULL || last4tab == NULL) goto alloc_failure; diff --git a/bfd/mmo.c b/bfd/mmo.c index fe70a18407b..3238e2240b4 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -260,7 +260,7 @@ enum mmo_sym_type { mmo_reg_sym, mmo_undef_sym, mmo_data_sym, mmo_abs_sym}; struct mmo_symbol { struct mmo_symbol *next; - CONST char *name; + const char *name; bfd_vma value; enum mmo_sym_type sym_type; unsigned int serno; @@ -357,7 +357,7 @@ static void mmo_write_section_unless_reg_contents PARAMS ((bfd *, asection *, PTR)); static void mmo_find_sec_w_addr PARAMS ((bfd *, asection *, PTR)); static void mmo_find_sec_w_addr_grow PARAMS ((bfd *, asection *, PTR)); -static asection *mmo_make_section PARAMS ((bfd *, CONST char *)); +static asection *mmo_make_section PARAMS ((bfd *, const char *)); static void mmo_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static void mmo_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); @@ -371,10 +371,10 @@ static INLINE bfd_byte *mmo_get_loc PARAMS ((asection *, bfd_vma, int)); static void mmo_xore_64 PARAMS ((asection *, bfd_vma vma, bfd_vma value)); static void mmo_xore_32 PARAMS ((asection *, bfd_vma vma, unsigned int)); static void mmo_xore_16 PARAMS ((asection *, bfd_vma vma, unsigned int)); -static CONST bfd_target *mmo_object_p PARAMS ((bfd *)); +static const bfd_target *mmo_object_p PARAMS ((bfd *)); static void mmo_map_set_sizes PARAMS ((bfd *, asection *, PTR)); static boolean mmo_get_symbols PARAMS ((bfd *)); -static boolean mmo_create_symbol PARAMS ((bfd *, CONST char *, bfd_vma, +static boolean mmo_create_symbol PARAMS ((bfd *, const char *, bfd_vma, enum mmo_sym_type, unsigned int)); static boolean mmo_get_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); @@ -391,7 +391,7 @@ static long mmo_get_reloc_upper_bound PARAMS ((bfd *, asection *)); static boolean mmo_internal_write_header PARAMS ((bfd *)); static boolean mmo_internal_write_post PARAMS ((bfd *, int, asection *)); static boolean mmo_internal_add_3_sym - PARAMS ((bfd *, struct mmo_symbol_trie *, CONST struct mmo_symbol *)); + PARAMS ((bfd *, struct mmo_symbol_trie *, const struct mmo_symbol *)); static unsigned int mmo_internal_3_length PARAMS ((bfd *, struct mmo_symbol_trie *)); static void mmo_internal_3_dump @@ -404,10 +404,10 @@ static void mmo_write_tetra_raw PARAMS ((bfd *, unsigned int)); static void mmo_write_octa PARAMS ((bfd *, bfd_vma)); static void mmo_write_octa_raw PARAMS ((bfd *, bfd_vma)); static boolean mmo_write_chunk - PARAMS ((bfd *, CONST bfd_byte *, unsigned int)); + PARAMS ((bfd *, const bfd_byte *, unsigned int)); static boolean mmo_flush_chunk PARAMS ((bfd *)); static boolean mmo_write_loc_chunk - PARAMS ((bfd *, bfd_vma, CONST bfd_byte *, unsigned int, bfd_vma *)); + PARAMS ((bfd *, bfd_vma, const bfd_byte *, unsigned int, bfd_vma *)); static boolean mmo_write_chunk_list PARAMS ((bfd *, mmo_data_list_type *)); static boolean mmo_write_loc_chunk_list PARAMS ((bfd *, mmo_data_list_type *)); @@ -417,7 +417,7 @@ static flagword bfd_sec_flags_from_mmo_flags PARAMS ((flagword)); static bfd_byte mmo_get_byte PARAMS ((bfd *)); static void mmo_write_byte PARAMS ((bfd *, bfd_byte)); static boolean mmo_new_section_hook PARAMS ((bfd *, asection *)); -static int mmo_sort_mmo_symbols PARAMS ((CONST PTR, CONST PTR)); +static int mmo_sort_mmo_symbols PARAMS ((const PTR, const PTR)); static boolean mmo_write_object_contents PARAMS ((bfd *)); static long mmo_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); @@ -446,7 +446,7 @@ char valid_mmo_symbol_character_set[/* A-Z a-z (we assume consecutive static asection * mmo_make_section (abfd, secname) bfd *abfd; - CONST char *secname; + const char *secname; { asection *sec = bfd_get_section_by_name (abfd, secname); @@ -495,7 +495,7 @@ mmo_init () /* Check whether an existing file is an mmo file. */ -static CONST bfd_target * +static const bfd_target * mmo_object_p (abfd) bfd *abfd; { @@ -819,7 +819,7 @@ mmo_write_octa_raw (abfd, value) static INLINE boolean mmo_write_chunk (abfd, loc, len) bfd *abfd; - CONST bfd_byte *loc; + const bfd_byte *loc; unsigned int len; { boolean retval = true; @@ -907,7 +907,7 @@ static boolean mmo_write_loc_chunk (abfd, vma, loc, len, last_vmap) bfd *abfd; bfd_vma vma; - CONST bfd_byte *loc; + const bfd_byte *loc; unsigned int len; bfd_vma *last_vmap; { @@ -1199,7 +1199,7 @@ mmo_write_byte (abfd, value) static boolean mmo_create_symbol (abfd, symname, addr, sym_type, serno) bfd *abfd; - CONST char *symname; + const char *symname; bfd_vma addr; enum mmo_sym_type sym_type; unsigned int serno; @@ -2135,11 +2135,11 @@ mmo_get_symtab_upper_bound (abfd) static int mmo_sort_mmo_symbols (arg1, arg2) - CONST PTR arg1; - CONST PTR arg2; + const PTR arg1; + const PTR arg2; { - CONST struct mmo_symbol *sym1 = *(CONST struct mmo_symbol **) arg1; - CONST struct mmo_symbol *sym2 = *(CONST struct mmo_symbol **) arg2; + const struct mmo_symbol *sym1 = *(const struct mmo_symbol **) arg1; + const struct mmo_symbol *sym2 = *(const struct mmo_symbol **) arg2; /* Sort by serial number first. */ if (sym1->serno < sym2->serno) @@ -2148,7 +2148,7 @@ mmo_sort_mmo_symbols (arg1, arg2) return 1; /* Then sort by address of the table entries. */ - return ((CONST char *) arg1 - (CONST char *) arg2); + return ((const char *) arg1 - (const char *) arg2); } /* Translate the symbol table. */ @@ -2295,7 +2295,7 @@ static boolean mmo_internal_write_header (abfd) bfd *abfd; { - CONST char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1}; + const char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1}; if (bfd_bwrite (lop_pre_bfd, 4, abfd) != 4) return false; @@ -2619,9 +2619,9 @@ static boolean mmo_internal_add_3_sym (abfd, rootp, symp) bfd *abfd; struct mmo_symbol_trie *rootp; - CONST struct mmo_symbol *symp; + const struct mmo_symbol *symp; { - CONST char *name = symp->name; + const char *name = symp->name; struct mmo_symbol_trie *trie = rootp; struct mmo_symbol_trie **triep = NULL; @@ -3247,6 +3247,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) #define mmo_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define mmo_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define mmo_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define mmo_bfd_link_just_syms _bfd_generic_link_just_syms #define mmo_bfd_final_link _bfd_generic_final_link #define mmo_bfd_link_split_section _bfd_generic_link_split_section @@ -3255,6 +3256,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) #define mmo_set_arch_mach bfd_default_set_arch_mach #define mmo_bfd_relax_section bfd_generic_relax_section #define mmo_bfd_merge_sections bfd_generic_merge_sections +#define mmo_bfd_discard_group bfd_generic_discard_group /* objcopy will be upset if we return -1 from bfd_get_reloc_upper_bound by using BFD_JUMP_TABLE_RELOCS (_bfd_norelocs) rather than 0. FIXME: Most @@ -3276,7 +3278,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) #define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags #define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data -CONST bfd_target bfd_mmo_vec = +const bfd_target bfd_mmo_vec = { "mmo", /* name */ bfd_target_mmo_flavour, diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index 79877fe7cd0..e0a83044e91 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -44,9 +44,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define nlm_bfd_relax_section bfd_generic_relax_section #define nlm_bfd_gc_sections bfd_generic_gc_sections #define nlm_bfd_merge_sections bfd_generic_merge_sections +#define nlm_bfd_discard_group bfd_generic_discard_group #define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms #define nlm_bfd_final_link _bfd_generic_final_link #define nlm_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/ns32knetbsd.c b/bfd/ns32knetbsd.c index 032a96dd486..3c3b5a22d0e 100644 --- a/bfd/ns32knetbsd.c +++ b/bfd/ns32knetbsd.c @@ -1,5 +1,5 @@ /* BFD back-end for NetBSD/ns32k a.out-ish binaries. - Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001 + Copyright 1990, 1991, 1992, 1994, 1995, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" /* To ensure following declaration is OK */ -CONST struct reloc_howto_struct * +const struct reloc_howto_struct * MY_bfd_reloc_type_lookup PARAMS((bfd *abfd AND bfd_reloc_code_real_type code)); diff --git a/bfd/oasys.c b/bfd/oasys.c index 4cadb6900ed..17fc735d779 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1490,9 +1490,11 @@ oasys_sizeof_headers (abfd, exec) #define oasys_bfd_relax_section bfd_generic_relax_section #define oasys_bfd_gc_sections bfd_generic_gc_sections #define oasys_bfd_merge_sections bfd_generic_merge_sections +#define oasys_bfd_discard_group bfd_generic_discard_group #define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define oasys_bfd_link_just_syms _bfd_generic_link_just_syms #define oasys_bfd_final_link _bfd_generic_final_link #define oasys_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/pdp11.c b/bfd/pdp11.c index d4fe79eba65..90db56b9875 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -1841,11 +1841,9 @@ NAME(aout,slurp_symbol_table) (abfd) cached_size = obj_aout_external_sym_count (abfd); cached_size *= sizeof (aout_symbol_type); - cached = (aout_symbol_type *) bfd_malloc (cached_size); + cached = (aout_symbol_type *) bfd_zmalloc (cached_size); if (cached == NULL && cached_size != 0) return false; - if (cached_size != 0) - memset (cached, 0, (size_t) cached_size); /* Convert from external symbol information to internal. */ if (! (NAME(aout,translate_symbol_table) @@ -2255,10 +2253,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) count = real_count; } - reloc_cache = (arelent *) bfd_malloc (count * sizeof (arelent)); + reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent)); if (reloc_cache == NULL && count != 0) return false; - memset (reloc_cache, 0, (size_t) count * sizeof (arelent)); cache_ptr = reloc_cache; @@ -2319,8 +2316,6 @@ NAME(aout,squirt_out_relocs) (abfd, section) if (!native) return false; - memset ((PTR)native, 0, (size_t) natsize); - generic = section->orelocation; if (generic != NULL) { diff --git a/bfd/pe-i386.c b/bfd/pe-i386.c index 7ced1471156..9c75f95e9fb 100644 --- a/bfd/pe-i386.c +++ b/bfd/pe-i386.c @@ -1,21 +1,21 @@ /* BFD back-end for Intel 386 PECOFF files. - Copyright 1995, 1996, 1999, 2001 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2001, 2002 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -29,6 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define COFF_LONG_FILENAMES #define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 04b741979aa..69864334fbb 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -3,21 +3,21 @@ Free Software Foundation, Inc. Written by Cygnus Solutions. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Most of this hacked by Steve Chamberlain . @@ -1142,6 +1142,7 @@ pe_print_idata (abfd, vfile) adj = section->vma - extra->ImageBase; + /* Print all image import descriptors. */ for (i = 0; i < datasize; i += onaline) { bfd_vma hint_addr; @@ -1153,7 +1154,7 @@ pe_print_idata (abfd, vfile) bfd_size_type j; char *dll; - /* print (i + extra->DataDirectory[1].VirtualAddress) */ + /* Print (i + extra->DataDirectory[1].VirtualAddress). */ fprintf (file, " %08lx\t", (unsigned long) (i + adj + dataoff)); #if 0 if (i + 20 > datasize) @@ -1181,19 +1182,83 @@ pe_print_idata (abfd, vfile) if (hint_addr != 0) { - fprintf (file, _("\tvma: Hint/Ord Member-Name\n")); + bfd_byte *ft_data; + asection *ft_section; + bfd_vma ft_addr; + bfd_size_type ft_datasize; + int ft_idx; + int ft_allocated = 0; + + fprintf (file, _("\tvma: Hint/Ord Member-Name Bound-To\n")); idx = hint_addr - adj; + + ft_addr = first_thunk + extra->ImageBase; + ft_data = data; + ft_idx = first_thunk - adj; + ft_allocated = 0; + + if (first_thunk != hint_addr) + { + /* Find the section which contains the first thunk. */ + for (ft_section = abfd->sections; + ft_section != NULL; + ft_section = ft_section->next) + { + ft_datasize = bfd_section_size (abfd, ft_section); + if (ft_addr >= ft_section->vma + && ft_addr < ft_section->vma + ft_datasize) + break; + } + + if (ft_section == NULL) + { + fprintf (file, + _("\nThere is a first thunk, but the section containing it could not be found\n")); + continue; + } + + /* Now check to see if this section is the same as our current + section. If it is not then we will have to load its data in. */ + if (ft_section == section) + { + ft_data = data; + ft_idx = first_thunk - adj; + } + else + { + ft_idx = first_thunk - (ft_section->vma - extra->ImageBase); + ft_data = (bfd_byte *) bfd_malloc (datasize); + if (ft_data == NULL) + continue; + + /* Read datasize bfd_bytes starting at offset ft_idx. */ + if (! bfd_get_section_contents (abfd, ft_section, + (PTR) ft_data, + (bfd_vma) ft_idx, + datasize)) + { + free (ft_data); + continue; + } + + ft_idx = 0; + ft_allocated = 1; + } + } + /* Print HintName vector entries. */ for (j = 0; j < datasize; j += 4) { unsigned long member = bfd_get_32 (abfd, data + idx + j); + /* Print single IMAGE_IMPORT_BY_NAME vector. */ if (member == 0) break; + if (member & 0x80000000) - fprintf (file, "\t%04lx\t %4lu", member, - member & 0x7fffffff); + fprintf (file, "\t%04lx\t %4lu ", + member, member & 0x7fffffff); else { int ordinal; @@ -1206,69 +1271,18 @@ pe_print_idata (abfd, vfile) } /* If the time stamp is not zero, the import address - table holds actual addresses. */ + table holds actual addresses. */ if (time_stamp != 0 && first_thunk != 0 && first_thunk != hint_addr) fprintf (file, "\t%04lx", - (long) bfd_get_32 (abfd, data + first_thunk - adj + j)); + (long) bfd_get_32 (abfd, ft_data + ft_idx + j)); fprintf (file, "\n"); } - } - - if (hint_addr != first_thunk && time_stamp == 0) - { - int differ = 0; - int idx2; - - idx2 = first_thunk - adj; - - for (j = 0; j < datasize; j += 4) - { - int ordinal; - char *member_name; - bfd_vma hint_member = 0; - bfd_vma iat_member; - - if (hint_addr != 0) - hint_member = bfd_get_32 (abfd, data + idx + j); - iat_member = bfd_get_32 (abfd, data + idx2 + j); - - if (hint_addr == 0 && iat_member == 0) - break; - - if (hint_addr == 0 || hint_member != iat_member) - { - if (differ == 0) - { - fprintf (file, - _("\tThe Import Address Table (difference found)\n")); - fprintf (file, _("\tvma: Hint/Ord Member-Name\n")); - differ = 1; - } - - if (iat_member == 0) - fprintf (file, - _("\t>>> Ran out of IAT members!\n")); - else - { - ordinal = bfd_get_16 (abfd, data + iat_member - adj); - member_name = (char *) data + iat_member - adj + 2; - fprintf (file, "\t%04lx\t %4d %s\n", - (unsigned long) iat_member, - ordinal, - member_name); - } - } - - if (hint_addr != 0 && hint_member == 0) - break; - } - if (differ == 0) - fprintf (file, - _("\tThe Import Address Table is identical\n")); + if (ft_allocated) + free (ft_data); } fprintf (file, "\n"); diff --git a/bfd/pei-i386.c b/bfd/pei-i386.c index 8f0f77acb84..9f577e669f7 100644 --- a/bfd/pei-i386.c +++ b/bfd/pei-i386.c @@ -1,21 +1,21 @@ /* BFD back-end for Intel 386 PE IMAGE COFF files. - Copyright 1995, 1996, 1999 Free Software Foundation, Inc. + Copyright 1995, 1996, 1999, 2002 Free Software Foundation, Inc. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -30,6 +30,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define COFF_LONG_FILENAMES #define COFF_SECTION_ALIGNMENT_ENTRIES \ +{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ +{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ { COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index 8f0199d8e53..086d8022d59 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -65,6 +65,7 @@ cpu-avr.c cpu-cris.c cpu-d10v.c cpu-d30v.c +cpu-dlx.c cpu-fr30.c cpu-h8300.c cpu-h8500.c @@ -124,6 +125,7 @@ elf32-avr.c elf32-cris.c elf32-d10v.c elf32-d30v.c +elf32-dlx.c elf32-fr30.c elf32-gen.c elf32-h8300.c @@ -131,6 +133,7 @@ elf32-hppa.c elf32-hppa.h elf32-i370.c elf32-i386.c +elf32-i386qnx.c elf32-i860.c elf32-i960.c elf32-m32r.c @@ -148,9 +151,12 @@ elf32-s390.c elf32-sh-lin.c elf32-sh-nbsd.c elf32-sh.c +elf32-sh64-com.c +elf32-sh64-nbsd.c elf32-sh64.c elf32-sparc.c elf32-v850.c +elf32-vax.c elf32-xstormy16.c elf32.c elf64-alpha.c @@ -161,6 +167,7 @@ elf64-mips.c elf64-mmix.c elf64-ppc.c elf64-s390.c +elf64-sh64-nbsd.c elf64-sh64.c elf64-sparc.c elf64-x86-64.c diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index d40590f702f..5b153bdff08 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -469,9 +469,11 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg) #define ppcboot_bfd_relax_section bfd_generic_relax_section #define ppcboot_bfd_gc_sections bfd_generic_gc_sections #define ppcboot_bfd_merge_sections bfd_generic_merge_sections +#define ppcboot_bfd_discard_group bfd_generic_discard_group #define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms #define ppcboot_bfd_final_link _bfd_generic_final_link #define ppcboot_bfd_link_split_section _bfd_generic_link_split_section #define ppcboot_get_section_contents_in_window \ diff --git a/bfd/reloc.c b/bfd/reloc.c index c701fe0d403..8af90fc796a 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -1962,6 +1962,35 @@ ENUMDOC share a common GP, and the target address is adjusted for STO_ALPHA_STD_GPLOAD. +ENUM + BFD_RELOC_ALPHA_TLSGD +ENUMX + BFD_RELOC_ALPHA_TLSLDM +ENUMX + BFD_RELOC_ALPHA_DTPMOD64 +ENUMX + BFD_RELOC_ALPHA_GOTDTPREL16 +ENUMX + BFD_RELOC_ALPHA_DTPREL64 +ENUMX + BFD_RELOC_ALPHA_DTPREL_HI16 +ENUMX + BFD_RELOC_ALPHA_DTPREL_LO16 +ENUMX + BFD_RELOC_ALPHA_DTPREL16 +ENUMX + BFD_RELOC_ALPHA_GOTTPREL16 +ENUMX + BFD_RELOC_ALPHA_TPREL64 +ENUMX + BFD_RELOC_ALPHA_TPREL_HI16 +ENUMX + BFD_RELOC_ALPHA_TPREL_LO16 +ENUMX + BFD_RELOC_ALPHA_TPREL16 +ENUMDOC + Alpha thread-local storage relocations. + ENUM BFD_RELOC_MIPS_JMP ENUMDOC @@ -2072,6 +2101,24 @@ ENUMX BFD_RELOC_386_GOTOFF ENUMX BFD_RELOC_386_GOTPC +ENUMX + BFD_RELOC_386_TLS_LE +ENUMX + BFD_RELOC_386_TLS_GD +ENUMX + BFD_RELOC_386_TLS_LDM +ENUMX + BFD_RELOC_386_TLS_LDO_32 +ENUMX + BFD_RELOC_386_TLS_IE_32 +ENUMX + BFD_RELOC_386_TLS_LE_32 +ENUMX + BFD_RELOC_386_TLS_DTPMOD32 +ENUMX + BFD_RELOC_386_TLS_DTPOFF32 +ENUMX + BFD_RELOC_386_TLS_TPOFF32 ENUMDOC i386/elf relocations @@ -2597,6 +2644,19 @@ ENUM ENUMDOC This is a 32-bit pc-relative reloc. +ENUM + BFD_RELOC_DLX_HI16_S +ENUMDOC + DLX relocs +ENUM + BFD_RELOC_DLX_LO16 +ENUMDOC + DLX relocs +ENUM + BFD_RELOC_DLX_JMP26 +ENUMDOC + DLX relocs + ENUM BFD_RELOC_M32R_24 ENUMDOC @@ -3184,18 +3244,44 @@ ENUMX BFD_RELOC_IA64_IPLTLSB ENUMX BFD_RELOC_IA64_COPY +ENUMX + BFD_RELOC_IA64_LTOFF22X +ENUMX + BFD_RELOC_IA64_LDXMOV +ENUMX + BFD_RELOC_IA64_TPREL14 ENUMX BFD_RELOC_IA64_TPREL22 +ENUMX + BFD_RELOC_IA64_TPREL64I ENUMX BFD_RELOC_IA64_TPREL64MSB ENUMX BFD_RELOC_IA64_TPREL64LSB ENUMX - BFD_RELOC_IA64_LTOFF_TP22 + BFD_RELOC_IA64_LTOFF_TPREL22 ENUMX - BFD_RELOC_IA64_LTOFF22X + BFD_RELOC_IA64_DTPMOD64MSB ENUMX - BFD_RELOC_IA64_LDXMOV + BFD_RELOC_IA64_DTPMOD64LSB +ENUMX + BFD_RELOC_IA64_LTOFF_DTPMOD22 +ENUMX + BFD_RELOC_IA64_DTPREL14 +ENUMX + BFD_RELOC_IA64_DTPREL22 +ENUMX + BFD_RELOC_IA64_DTPREL64I +ENUMX + BFD_RELOC_IA64_DTPREL32MSB +ENUMX + BFD_RELOC_IA64_DTPREL32LSB +ENUMX + BFD_RELOC_IA64_DTPREL64MSB +ENUMX + BFD_RELOC_IA64_DTPREL64LSB +ENUMX + BFD_RELOC_IA64_LTOFF_DTPREL22 ENUMDOC Intel IA64 Relocations. @@ -3363,6 +3449,15 @@ ENUMX ENUMDOC Sony Xstormy16 Relocations. +ENUM + BFD_RELOC_VAX_GLOB_DAT +ENUMX + BFD_RELOC_VAX_JMP_SLOT +ENUMX + BFD_RELOC_VAX_RELATIVE +ENUMDOC + Relocations used by VAX ELF. + ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT diff --git a/bfd/reloc16.c b/bfd/reloc16.c index 1d69a7f25d3..1db8daf2aa4 100644 --- a/bfd/reloc16.c +++ b/bfd/reloc16.c @@ -196,8 +196,7 @@ bfd_coff_reloc16_relax_section (abfd, input_section, link_info, again) The last element is used as an accumlator of shrinks. */ amt = reloc_count + 1; amt *= sizeof (unsigned); - shrinks = (unsigned *) bfd_malloc (amt); - memset (shrinks, 0, (size_t) amt); + shrinks = (unsigned *) bfd_zmalloc (amt); /* Loop until nothing changes in this section. */ do { diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c index 0edcdc43edb..a61f25caa22 100644 --- a/bfd/rs6000-core.c +++ b/bfd/rs6000-core.c @@ -182,7 +182,7 @@ typedef union { /* Return the c_impl field from struct core_dumpx C. */ -#ifdef AIX_CORE_DUMPX_CORE +#if defined (HAVE_ST_C_IMPL) || defined (AIX_5_CORE) # define CNEW_IMPL(c) (c).c_impl #else # define CNEW_IMPL(c) 0 diff --git a/bfd/section.c b/bfd/section.c index 076a0122be7..8bb85c890f3 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -230,12 +230,6 @@ CODE_FRAGMENT . standard data. *} .#define SEC_CONSTRUCTOR 0x100 . -. {* The section is a constructor, and should be placed at the -. end of the text, data, or bss section(?). *} -.#define SEC_CONSTRUCTOR_TEXT 0x1100 -.#define SEC_CONSTRUCTOR_DATA 0x2100 -.#define SEC_CONSTRUCTOR_BSS 0x3100 -. . {* The section has contents - a data section could be . <> | <>; a debug section could be . <> *} @@ -256,6 +250,9 @@ CODE_FRAGMENT . sections. *} .#define SEC_COFF_SHARED_LIBRARY 0x800 . +. {* The section contains thread local data. *} +.#define SEC_THREAD_LOCAL 0x1000 +. . {* The section has GOT references. This flag is only for the . linker, and is currently only used by the elf32-hppa back end. . It will be set if global offset table references were detected @@ -1371,6 +1368,7 @@ _bfd_strip_section_from_output (info, s) if (*spp == os) { bfd_section_list_remove (os->owner, spp); + os->flags |= SEC_EXCLUDE; os->owner->section_count--; break; } @@ -1378,3 +1376,22 @@ _bfd_strip_section_from_output (info, s) s->flags |= SEC_EXCLUDE; } + +/* +FUNCTION + bfd_generic_discard_group + +SYNOPSIS + boolean bfd_generic_discard_group (bfd *abfd, asection *group); + +DESCRIPTION + Remove all members of @var{group} from the output. +*/ + +boolean +bfd_generic_discard_group (abfd, group) + bfd *abfd ATTRIBUTE_UNUSED; + asection *group ATTRIBUTE_UNUSED; +{ + return true; +} diff --git a/bfd/som.c b/bfd/som.c index 4672379e934..68c561c9b36 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -4141,10 +4141,9 @@ som_build_and_write_symbol_table (abfd) to hold the symbol table as we build it. */ symtab_size = num_syms; symtab_size *= sizeof (struct symbol_dictionary_record); - som_symtab = (struct symbol_dictionary_record *) bfd_malloc (symtab_size); + som_symtab = (struct symbol_dictionary_record *) bfd_zmalloc (symtab_size); if (som_symtab == NULL && symtab_size != 0) goto error_return; - memset (som_symtab, 0, (size_t) symtab_size); /* Walk over each symbol. */ for (i = 0; i < num_syms; i++) @@ -4230,10 +4229,9 @@ som_slurp_string_table (abfd) /* Allocate and read in the string table. */ amt = obj_som_stringtab_size (abfd); - stringtab = bfd_malloc (amt); + stringtab = bfd_zmalloc (amt); if (stringtab == NULL) return false; - memset (stringtab, 0, obj_som_stringtab_size (abfd)); if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) != 0) return false; @@ -4336,10 +4334,9 @@ som_slurp_symbol_table (abfd) amt = symbol_count; amt *= sizeof (som_symbol_type); - symbase = (som_symbol_type *) bfd_malloc (amt); + symbase = (som_symbol_type *) bfd_zmalloc (amt); if (symbase == NULL) goto error_return; - memset (symbase, 0, symbol_count * sizeof (som_symbol_type)); /* Read in the external SOM representation. */ amt = symbol_count; @@ -5899,19 +5896,19 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength) amt = lst.hash_size; amt *= sizeof (unsigned int); - hash_table = (unsigned int *) bfd_malloc (amt); + hash_table = (unsigned int *) bfd_zmalloc (amt); if (hash_table == NULL && lst.hash_size != 0) goto error_return; amt = lst.module_count; amt *= sizeof (struct som_entry); - som_dict = (struct som_entry *) bfd_malloc (amt); + som_dict = (struct som_entry *) bfd_zmalloc (amt); if (som_dict == NULL && lst.module_count != 0) goto error_return; amt = lst.hash_size; amt *= sizeof (struct lst_symbol_record *); - last_hash_entry = ((struct lst_symbol_record **) bfd_malloc (amt)); + last_hash_entry = ((struct lst_symbol_record **) bfd_zmalloc (amt)); if (last_hash_entry == NULL && lst.hash_size != 0) goto error_return; @@ -5919,12 +5916,6 @@ som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength) of the lst record. So save its location. */ lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); - /* Some initialization. */ - memset (hash_table, 0, 4 * lst.hash_size); - memset (som_dict, 0, lst.module_count * sizeof (struct som_entry)); - memset (last_hash_entry, 0, - lst.hash_size * sizeof (struct lst_symbol_record *)); - /* Symbols have som_index fields, so we have to keep track of the index of each SOM in the archive. @@ -6335,10 +6326,12 @@ som_bfd_link_split_section (abfd, sec) #define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define som_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define som_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define som_bfd_link_just_syms _bfd_generic_link_just_syms #define som_bfd_final_link _bfd_generic_final_link #define som_bfd_gc_sections bfd_generic_gc_sections #define som_bfd_merge_sections bfd_generic_merge_sections +#define som_bfd_discard_group bfd_generic_discard_group const bfd_target som_vec = { "som", /* name */ diff --git a/bfd/sparclinux.c b/bfd/sparclinux.c index 7f1d270ea3a..e55a4ffc2b2 100644 --- a/bfd/sparclinux.c +++ b/bfd/sparclinux.c @@ -599,10 +599,9 @@ bfd_sparclinux_size_dynamic_sections (output_bfd, info) { s->_raw_size = linux_hash_table (info)->fixup_count + 1; s->_raw_size *= 8; - s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); + s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); if (s->contents == NULL) return false; - memset (s->contents, 0, (size_t) s->_raw_size); } return true; diff --git a/bfd/srec.c b/bfd/srec.c index f40af69bcdf..e7a27be2ce6 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1270,9 +1270,11 @@ srec_print_symbol (abfd, afile, symbol, how) #define srec_bfd_relax_section bfd_generic_relax_section #define srec_bfd_gc_sections bfd_generic_gc_sections #define srec_bfd_merge_sections bfd_generic_merge_sections +#define srec_bfd_discard_group bfd_generic_discard_group #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define srec_bfd_link_just_syms _bfd_generic_link_just_syms #define srec_bfd_final_link _bfd_generic_final_link #define srec_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/stabs.c b/bfd/stabs.c index bba4a6d61ed..e225d9cd60d 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -284,6 +284,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) sym < symend; sym += STABSIZE, ++pstridx) { + bfd_size_type symstroff; int type; const char *string; @@ -311,9 +312,18 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo) } /* Store the string in the hash table, and record the index. */ - string = ((char *) stabstrbuf - + stroff - + bfd_get_32 (abfd, sym + STRDXOFF)); + symstroff = stroff + bfd_get_32 (abfd, sym + STRDXOFF); + if (symstroff >= stabstrsec->_raw_size) + { + (*_bfd_error_handler) + (_("%s(%s+0x%lx): Stabs entry has invalid string index."), + bfd_archive_filename (abfd), + bfd_get_section_name (abfd, stabsec), + (long) (sym - stabbuf)); + bfd_set_error (bfd_error_bad_value); + goto error_return; + } + string = (char *) stabstrbuf + symstroff; *pstridx = _bfd_stringtab_add (sinfo->strings, string, true, true); /* An N_BINCL symbol indicates the start of the stabs entries diff --git a/bfd/sunos.c b/bfd/sunos.c index 7825a821a05..5fec6f91d7d 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -1434,10 +1434,9 @@ bfd_sunos_size_dynamic_sections (output_bfd, info, sdynptr, sneedptr, s = bfd_get_section_by_name (dynobj, ".hash"); BFD_ASSERT (s != NULL); hashalloc = (dynsymcount + bucketcount - 1) * HASH_ENTRY_SIZE; - s->contents = (bfd_byte *) bfd_alloc (dynobj, hashalloc); + s->contents = (bfd_byte *) bfd_zalloc (dynobj, hashalloc); if (s->contents == NULL && dynsymcount > 0) return false; - memset (s->contents, 0, (size_t) hashalloc); for (i = 0; i < bucketcount; i++) PUT_WORD (output_bfd, (bfd_vma) -1, s->contents + i * HASH_ENTRY_SIZE); s->_raw_size = bucketcount * HASH_ENTRY_SIZE; diff --git a/bfd/syms.c b/bfd/syms.c index 01f7eee2cce..1c4bf288a83 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -285,6 +285,9 @@ CODE_FRAGMENT . as well. *} .#define BSF_DEBUGGING_RELOC 0x20000 . +. {* This symbol is thread local. Used in ELF. *} +.#define BSF_THREAD_LOCAL 0x40000 +. . flagword flags; . . {* A pointer to the section to which this symbol is @@ -880,6 +883,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, char *file_name; char *directory_name; int saw_fun; + boolean saw_line, saw_func; *pfound = false; *pfilename = bfd_get_filename (abfd); @@ -1236,13 +1240,13 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, directory_name = indexentry->directory_name; str = indexentry->str; + saw_line = false; + saw_func = false; for (; stab < (indexentry+1)->stab; stab += STABSIZE) { - boolean done, saw_line, saw_func; + boolean done; bfd_vma val; - saw_line = false; - saw_func = false; done = false; switch (stab[TYPEOFF]) diff --git a/bfd/targets.c b/bfd/targets.c index b9d3a93a6eb..7c6f4f3c94a 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -396,10 +396,12 @@ the tokens. .CONCAT2 (NAME,_bfd_link_hash_table_create), \ .CONCAT2 (NAME,_bfd_link_hash_table_free), \ .CONCAT2 (NAME,_bfd_link_add_symbols), \ +.CONCAT2 (NAME,_bfd_link_just_syms), \ .CONCAT2 (NAME,_bfd_final_link), \ .CONCAT2 (NAME,_bfd_link_split_section), \ .CONCAT2 (NAME,_bfd_gc_sections), \ -.CONCAT2 (NAME,_bfd_merge_sections) +.CONCAT2 (NAME,_bfd_merge_sections), \ +.CONCAT2 (NAME,_bfd_discard_group) . int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); . bfd_byte *(*_bfd_get_relocated_section_contents) . PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, @@ -418,6 +420,9 @@ the tokens. . {* Add symbols from this object file into the hash table. *} . boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *)); . +. {* Indicate that we are only retrieving symbol values from this section. *} +. void (*_bfd_link_just_syms) PARAMS ((asection *, struct bfd_link_info *)); +. . {* Do a link based on the link_order structures attached to each . section of the BFD. *} . boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); @@ -431,6 +436,9 @@ the tokens. . {* Attempt to merge SEC_MERGE sections. *} . boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); . +. {* Discard members of a group. *} +. boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *)); +. . {* Routines to handle dynamic symbols and relocs. *} .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ .CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \ @@ -503,12 +511,14 @@ extern const bfd_target bfd_elf32_bigmips_vec; extern const bfd_target bfd_elf32_cris_vec; extern const bfd_target bfd_elf32_d10v_vec; extern const bfd_target bfd_elf32_d30v_vec; +extern const bfd_target bfd_elf32_dlx_big_vec; extern const bfd_target bfd_elf32_fr30_vec; extern const bfd_target bfd_elf32_h8300_vec; extern const bfd_target bfd_elf32_hppa_linux_vec; extern const bfd_target bfd_elf32_hppa_vec; extern const bfd_target bfd_elf32_i370_vec; extern const bfd_target bfd_elf32_i386_vec; +extern const bfd_target bfd_elf32_i386qnx_vec; extern const bfd_target bfd_elf32_i860_little_vec; extern const bfd_target bfd_elf32_i860_vec; extern const bfd_target bfd_elf32_i960_vec; @@ -546,6 +556,7 @@ extern const bfd_target bfd_elf32_tradbigmips_vec; extern const bfd_target bfd_elf32_tradlittlemips_vec; extern const bfd_target bfd_elf32_us_cris_vec; extern const bfd_target bfd_elf32_v850_vec; +extern const bfd_target bfd_elf32_vax_vec; extern const bfd_target bfd_elf32_xstormy16_vec; extern const bfd_target bfd_elf64_alpha_vec; extern const bfd_target bfd_elf64_big_generic_vec; @@ -660,6 +671,7 @@ extern const bfd_target tic54x_coff2_beh_vec; extern const bfd_target tic54x_coff2_vec; extern const bfd_target tic80coff_vec; extern const bfd_target vaxnetbsd_vec; +extern const bfd_target vax1knetbsd_vec; extern const bfd_target versados_vec; extern const bfd_target vms_alpha_vec; extern const bfd_target vms_vax_vec; @@ -691,6 +703,11 @@ extern const bfd_target bfd_elf32_sh64_vec; extern const bfd_target bfd_elf32_sh64l_vec; extern const bfd_target bfd_elf64_sh64_vec; extern const bfd_target bfd_elf64_sh64l_vec; + +extern const bfd_target bfd_elf32_sh64nbsd_vec; +extern const bfd_target bfd_elf32_sh64lnbsd_vec; +extern const bfd_target bfd_elf64_sh64nbsd_vec; +extern const bfd_target bfd_elf64_sh64lnbsd_vec; static const bfd_target * const _bfd_target_vector[] = { #ifdef SELECT_VECS @@ -753,12 +770,14 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_cris_vec, &bfd_elf32_d10v_vec, &bfd_elf32_d30v_vec, + &bfd_elf32_dlx_big_vec, &bfd_elf32_fr30_vec, &bfd_elf32_h8300_vec, &bfd_elf32_hppa_linux_vec, &bfd_elf32_hppa_vec, &bfd_elf32_i370_vec, &bfd_elf32_i386_vec, + &bfd_elf32_i386qnx_vec, &bfd_elf32_i860_little_vec, &bfd_elf32_i860_vec, &bfd_elf32_i960_vec, @@ -798,6 +817,7 @@ static const bfd_target * const _bfd_target_vector[] = { &bfd_elf32_tradlittlemips_vec, &bfd_elf32_us_cris_vec, &bfd_elf32_v850_vec, + &bfd_elf32_vax_vec, &bfd_elf32_xstormy16_vec, #ifdef BFD64 &bfd_elf64_alpha_vec, @@ -960,6 +980,7 @@ static const bfd_target * const _bfd_target_vector[] = { &tic54x_coff2_vec, &tic80coff_vec, &vaxnetbsd_vec, + &vax1knetbsd_vec, &versados_vec, #ifdef BFD64 &vms_alpha_vec, diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 565568a27b4..034ef28b867 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -354,17 +354,13 @@ find_chunk (abfd, vma) } if (!d) { - char *sname = bfd_alloc (abfd, (bfd_size_type) 12); - /* No chunk for this address, so make one up */ d = ((struct data_struct *) - bfd_alloc (abfd, (bfd_size_type) sizeof (struct data_struct))); + bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct))); - if (!sname || !d) + if (!d) return NULL; - memset (d->chunk_init, 0, CHUNK_MASK + 1); - memset (d->chunk_data, 0, CHUNK_MASK + 1); d->next = abfd->tdata.tekhex_data->data; d->vma = vma; abfd->tdata.tekhex_data->data = d; @@ -1005,9 +1001,11 @@ tekhex_print_symbol (abfd, filep, symbol, how) #define tekhex_bfd_relax_section bfd_generic_relax_section #define tekhex_bfd_gc_sections bfd_generic_gc_sections #define tekhex_bfd_merge_sections bfd_generic_merge_sections +#define tekhex_bfd_discard_group bfd_generic_discard_group #define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms #define tekhex_bfd_final_link _bfd_generic_final_link #define tekhex_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/vaxnetbsd.c b/bfd/vaxnetbsd.c index 21a0b37aafc..48a1ed637a2 100644 --- a/bfd/vaxnetbsd.c +++ b/bfd/vaxnetbsd.c @@ -1,5 +1,5 @@ -/* BFD back-end for NetBSD/VAX a.out-ish binaries. - Copyright 1998, 2000, 2001 Free Software Foundation, Inc. +/* BFD back-end for NetBSD/VAX (4K page size) a.out-ish binaries. + Copyright 1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define BYTES_IN_WORD 4 #undef TARGET_IS_BIG_ENDIAN_P -#define TARGET_PAGE_SIZE 1024 +#define TARGET_PAGE_SIZE 0x1000 #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_vax -#define DEFAULT_MID M_VAX_NETBSD +#define DEFAULT_MID M_VAX4K_NETBSD /* Do not "beautify" the CONCAT* macro args. Traditional C will not remove whitespace added here, and thus will fail to concatenate diff --git a/bfd/versados.c b/bfd/versados.c index 9a7bcc71a40..297bbe60a4a 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -867,9 +867,11 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols) #define versados_bfd_relax_section bfd_generic_relax_section #define versados_bfd_gc_sections bfd_generic_gc_sections #define versados_bfd_merge_sections bfd_generic_merge_sections +#define versados_bfd_discard_group bfd_generic_discard_group #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free #define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols +#define versados_bfd_link_just_syms _bfd_generic_link_just_syms #define versados_bfd_final_link _bfd_generic_final_link #define versados_bfd_link_split_section _bfd_generic_link_split_section diff --git a/bfd/version.h b/bfd/version.h index 6ab3d30a800..e1448566304 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1 +1 @@ -#define BFD_VERSION_DATE 20020511 +#define BFD_VERSION_DATE 20020615 diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c index d9dcd785789..002412232dc 100644 --- a/bfd/vms-gsd.c +++ b/bfd/vms-gsd.c @@ -426,13 +426,12 @@ _bfd_vms_slurp_gsd (abfd, objtype) else { section->contents = ((unsigned char *) - bfd_malloc (section->_raw_size)); + bfd_zmalloc (section->_raw_size)); if (section->contents == NULL) { bfd_set_error (bfd_error_no_memory); return -1; } - memset (section->contents, 0, (size_t) section->_raw_size); } section->_cooked_size = section->_raw_size; #if VMS_DEBUG @@ -618,10 +617,9 @@ _bfd_vms_slurp_gsd (abfd, objtype) section->vma = (bfd_vma)base_addr; base_addr += section->_raw_size; section->contents = ((unsigned char *) - bfd_malloc (section->_raw_size)); + bfd_zmalloc (section->_raw_size)); if (section->contents == NULL) return -1; - memset (section->contents, 0, (size_t) section->_raw_size); section->_cooked_size = section->_raw_size; #if VMS_DEBUG vms_debug(4, "egsd psc %d (%s, flags %04x=%s) ", diff --git a/bfd/vms.c b/bfd/vms.c index 7ca74591016..60326179b32 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -132,6 +132,8 @@ static boolean vms_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); #define vms_make_empty_symbol _bfd_generic_make_empty_symbol +#define vms_bfd_link_just_syms _bfd_generic_link_just_syms +#define vms_bfd_discard_group bfd_generic_discard_group /*===========================================================================*/ diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h index 0787b8de3e2..413511b96e7 100644 --- a/bfd/xcoff-target.h +++ b/bfd/xcoff-target.h @@ -1,5 +1,5 @@ /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001 + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -98,6 +98,7 @@ extern int lynx_core_file_failing_signal PARAMS ((bfd *abfd)); #define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section #define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections #define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections +#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group #define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section /* XCOFF archives do not have anything which corresponds to an diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 9d66243478c..7215b1bc64a 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1086,21 +1086,19 @@ xcoff_link_add_symbols (abfd, info) /* We keep a list of the linker hash table entries that correspond to each external symbol. */ amt = symcount * sizeof (struct xcoff_link_hash_entry *); - sym_hash = (struct xcoff_link_hash_entry **) bfd_alloc (abfd, amt); + sym_hash = (struct xcoff_link_hash_entry **) bfd_zalloc (abfd, amt); if (sym_hash == NULL && symcount != 0) goto error_return; coff_data (abfd)->sym_hashes = (struct coff_link_hash_entry **) sym_hash; - memset (sym_hash, 0, (size_t) amt); /* Because of the weird stuff we are doing with XCOFF csects, we can not easily determine which section a symbol is in, so we store the information in the tdata for the input file. */ amt = symcount * sizeof (asection *); - csect_cache = (asection **) bfd_alloc (abfd, amt); + csect_cache = (asection **) bfd_zalloc (abfd, amt); if (csect_cache == NULL && symcount != 0) goto error_return; xcoff_data (abfd)->csects = csect_cache; - memset (csect_cache, 0, (size_t) amt); /* While splitting sections into csects, we need to assign the relocs correctly. The relocs and the csects must both be in @@ -1109,10 +1107,9 @@ xcoff_link_add_symbols (abfd, info) into reloc_info using the section target_index. */ amt = abfd->section_count + 1; amt *= sizeof (struct reloc_info_struct); - reloc_info = (struct reloc_info_struct *) bfd_malloc (amt); + reloc_info = (struct reloc_info_struct *) bfd_zmalloc (amt); if (reloc_info == NULL) goto error_return; - memset ((PTR) reloc_info, 0, (size_t) amt); /* Read in the relocs and line numbers for each section. */ linesz = bfd_coff_linesz (abfd); @@ -1129,11 +1126,9 @@ xcoff_link_add_symbols (abfd, info) false, (struct internal_reloc *) NULL); amt = o->reloc_count; amt *= sizeof (asection *); - reloc_info[o->target_index].csects = (asection **) bfd_malloc (amt); + reloc_info[o->target_index].csects = (asection **) bfd_zmalloc (amt); if (reloc_info[o->target_index].csects == NULL) goto error_return; - memset (reloc_info[o->target_index].csects, 0, (size_t) amt); - } if ((info->strip == strip_none || info->strip == strip_some) diff --git a/config-ml.in b/config-ml.in index c968bf0d719..aae3f87fe74 100644 --- a/config-ml.in +++ b/config-ml.in @@ -510,14 +510,16 @@ multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ] cat > Multi.tem <<\EOF +PWD=$${PWDCMD-pwd} + # FIXME: There should be an @-sign in front of the `if'. # Leave out until this is tested a bit more. multi-do: if [ -z "$(MULTIDIRS)" ]; then \ true; \ else \ - rootpre=`pwd`/; export rootpre; \ - srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + rootpre=`${PWD}`/; export rootpre; \ + srcrootpre=`cd $(srcdir); ${PWD}`/; export srcrootpre; \ lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ compiler="$(CC)"; \ for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ @@ -535,6 +537,7 @@ multi-do: LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ LDFLAGS="$(LDFLAGS) $${flags}" \ + DESTDIR="$(DESTDIR)" \ $(DO)); then \ true; \ else \ @@ -552,7 +555,7 @@ multi-clean: if [ -z "$(MULTIDIRS)" ]; then \ true; \ else \ - lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ + lib=`${PWD} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ for dir in Makefile $(MULTIDIRS); do \ if [ -f ../$${dir}/$${lib}/Makefile ]; then \ if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ @@ -659,10 +662,10 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then if [ "${ml_verbose}" = --verbose ]; then echo "Running configure in multilib subdirs ${multidirs}" - echo "pwd: `pwd`" + echo "pwd: `${PWDCMD-pwd}`" fi - ml_origdir=`pwd` + ml_origdir=`${PWDCMD-pwd}` ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'` # cd to top-level-build-dir/${with_target_subdir} cd .. @@ -671,7 +674,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then if [ "${ml_verbose}" = --verbose ]; then echo "Running configure in multilib subdir ${ml_dir}" - echo "pwd: `pwd`" + echo "pwd: `${PWDCMD-pwd}`" fi if [ -d ${ml_dir} ]; then true; else @@ -699,7 +702,7 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then case ${srcdir} in ".") - echo Building symlink tree in `pwd`/${ml_dir}/${ml_libdir} + echo Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir} if [ "${with_target_subdir}" != "." ]; then ml_unsubdir="../" else diff --git a/config.guess b/config.guess index ed2e03b7f2b..fbad77f14ba 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-03-20' +timestamp='2002-05-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -142,6 +142,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; @@ -428,6 +429,9 @@ EOF Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -958,7 +962,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` diff --git a/config.sub b/config.sub index 299f3f4c5ea..4693ac17f95 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. -timestamp='2002-04-26' +timestamp='2002-05-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -230,7 +230,7 @@ case $basic_machine in | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ - | d10v | d30v | dsp16xx \ + | d10v | d30v | dlx | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ @@ -281,12 +281,12 @@ case $basic_machine in | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armv*-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cydra-* \ - | d10v-* | d30v-* \ + | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ @@ -1090,7 +1090,7 @@ case $os in | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* ) + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) diff --git a/config/ChangeLog b/config/ChangeLog index 06f7605dc78..129ce6168f3 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,13 @@ +2002-05-16 Rainer Orth + + * acinclude.m4: Allow for PWDCMD to override hardcoded pwd. + +2002-05-13 Nathanael Nerode + + * mh-apollo68: remove unused HDEFINES setting. + * mh-dgux: remove unused HDEFINES setting. + * mh-dgux386: remove unused HDEFINES setting, duplicate RANLIB=true. + 2002-04-29 Nathanael Nerode * config/mh-cxux: remove dead code diff --git a/config/acinclude.m4 b/config/acinclude.m4 index 9be62cb9a06..00887e0dd30 100755 --- a/config/acinclude.m4 +++ b/config/acinclude.m4 @@ -206,7 +206,7 @@ dnl Look for the header file AC_CACHE_VAL(ac_cv_c_bfdh,[ for i in $dirlist; do if test -f "$i/bfd/bfd.h" ; then - ac_cv_c_bfdh=`(cd $i/bfd; pwd)` + ac_cv_c_bfdh=`(cd $i/bfd; ${PWDCMD-pwd})` break fi done @@ -224,7 +224,7 @@ AC_MSG_CHECKING(for the bfd library in the build tree) AC_CACHE_VAL(ac_cv_c_bfdlib,[ for i in $dirlist; do if test -f "$i/bfd/Makefile" ; then - ac_cv_c_bfdlib=`(cd $i/bfd; pwd)` + ac_cv_c_bfdlib=`(cd $i/bfd; ${PWDCMD-pwd})` fi done ]) @@ -247,7 +247,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_liberty,[ for i in $dirlist; do if test -f "$i/libiberty/Makefile" ; then - ac_cv_c_liberty=`(cd $i/libiberty; pwd)` + ac_cv_c_liberty=`(cd $i/libiberty; ${PWDCMD-pwd})` fi done ]) @@ -268,7 +268,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_opc,[ for i in $dirlist; do if test -f "$i/opcodes/Makefile" ; then - ac_cv_c_opc=`(cd $i/opcodes; pwd)` + ac_cv_c_opc=`(cd $i/opcodes; ${PWDCMD-pwd})` fi done ]) @@ -290,7 +290,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_dejagnu,[ for i in $dirlist; do if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then - ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; pwd)` + ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; ${PWDCMD-pwd})` fi done ]) @@ -303,7 +303,7 @@ fi AC_CACHE_VAL(ac_cv_c_dejagnulib,[ for i in $dirlist; do if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then - ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; pwd)` + ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; ${PWDCMD-pwd})` fi done ]) @@ -316,7 +316,7 @@ AC_MSG_CHECKING(for runtest in the source tree) AC_CACHE_VAL(ac_cv_c_runtest,[ for i in $dirlist; do if test -f "$srcdir/$i/dejagnu/runtest" ; then - ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; pwd)` + ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; ${PWDCMD-pwd})` fi done ]) @@ -342,7 +342,7 @@ dnl Look for the header file AC_CACHE_VAL(ac_cv_c_intlh,[ for i in $dirlist; do if test -f "$i/intl/libintl.h" ; then - ac_cv_c_intlh=`(cd $i/intl; pwd)` + ac_cv_c_intlh=`(cd $i/intl; ${PWDCMD-pwd})` break fi done @@ -360,7 +360,7 @@ AC_MSG_CHECKING(for the libintl library in the build tree) AC_CACHE_VAL(ac_cv_c_intllib,[ for i in $dirlist; do if test -f "$i/intl/Makefile" ; then - ac_cv_c_intllib=`(cd $i/intl; pwd)` + ac_cv_c_intllib=`(cd $i/intl; ${PWDCMD-pwd})` fi done ]) @@ -388,7 +388,7 @@ AC_MSG_CHECKING(for the simulator header file) AC_CACHE_VAL(ac_cv_c_simh,[ for i in $dirlist; do if test -f "${srcdir}/$i/include/remote-sim.h" ; then - ac_cv_c_simh=`(cd ${srcdir}/$i/include; pwd)` + ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})` break fi done @@ -420,7 +420,7 @@ AC_MSG_CHECKING(for the simulator library) AC_CACHE_VAL(ac_cv_c_simlib,[ for i in $dirlist; do if test -f "$i/sim/$target_dir/Makefile" ; then - ac_cv_c_simlib=`(cd $i/sim/$target_dir; pwd)` + ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})` fi done ]) @@ -463,7 +463,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_libib,[ for i in $dirlist; do if test -f "$i/libiberty/Makefile" ; then - ac_cv_c_libib=`(cd $i/libiberty/; pwd)` + ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})` fi done ]) @@ -483,7 +483,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_devoh,[ for i in $dirlist; do if test -f "${srcdir}/$i/include/remote-sim.h" ; then - ac_cv_c_devoh=`(cd ${srcdir}/$i/include; pwd)` + ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})` fi done ]) @@ -506,7 +506,7 @@ IDELIB= AC_CACHE_VAL(ac_cv_c_ideh,[ for i in $dirlist; do if test -f "${srcdir}/$i/libide/src/event.h" ; then - ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; pwd)`; + ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; ${PWDCMD-pwd})`; fi done ]) @@ -521,7 +521,7 @@ AC_MSG_CHECKING(for LIBIDE TCL headers in the source tree) AC_CACHE_VAL(ac_cv_c_idetclh,[ for i in $dirlist; do if test -f "${srcdir}/$i/libidetcl/src/idetcl.h" ; then - ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; pwd)`; + ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; ${PWDCMD-pwd})`; fi done ]) @@ -536,7 +536,7 @@ AC_MSG_CHECKING(for IDE headers in the build tree) AC_CACHE_VAL(ac_cv_c_ideh2,[ for i in $dirlist; do if test -f "$i/libide/src/Makefile" ; then - ac_cv_c_ideh2=`(cd $i/libide/src; pwd)`; + ac_cv_c_ideh2=`(cd $i/libide/src; ${PWDCMD-pwd})`; fi done ]) @@ -553,7 +553,7 @@ AC_CACHE_VAL(ac_cv_c_idelib,[ if test x"${ac_cv_c_idelib}" = x ; then for i in $dirlist; do if test -f "$i/libide/src/Makefile" ; then - ac_cv_c_idelib=`(cd $i/libide/src; pwd)` + ac_cv_c_idelib=`(cd $i/libide/src; ${PWDCMD-pwd})` break fi done @@ -571,7 +571,7 @@ AC_CACHE_VAL(ac_cv_c_idetcllib,[ if test x"${ac_cv_c_idetcllib}" = x ; then for i in $dirlist; do if test -f "$i/libidetcl/src/Makefile" ; then - ac_cv_c_idetcllib=`(cd $i/libidetcl/src; pwd)` + ac_cv_c_idetcllib=`(cd $i/libidetcl/src; ${PWDCMD-pwd})` break fi done @@ -597,7 +597,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_iluh,[ for i in $dirlist; do if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then - ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; pwd)` + ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})` fi done ]) @@ -613,7 +613,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../ AC_CACHE_VAL(ac_cv_c_iluh5,[ for i in $dirlist; do if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then - ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; pwd)` + ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})` fi done ]) @@ -628,7 +628,7 @@ AC_MSG_CHECKING(for ILU C++ headers in the source tree) AC_CACHE_VAL(ac_cv_c_iluh2,[ for i in $dirlist; do if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then - ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; pwd)` + ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})` fi done ]) @@ -643,7 +643,7 @@ AC_MSG_CHECKING(for ILU C headers) AC_CACHE_VAL(ac_cv_c_iluh3,[ for i in $dirlist; do if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then - ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; pwd)` + ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; ${PWDCMD-pwd})` fi done ]) @@ -658,7 +658,7 @@ AC_MSG_CHECKING(for ILU C runtime headers) AC_CACHE_VAL(ac_cv_c_iluh4,[ for i in $dirlist; do if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then - ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; pwd)` + ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; ${PWDCMD-pwd})` fi done ]) @@ -672,7 +672,7 @@ fi AC_CACHE_VAL(ac_cv_c_ilupath,[ for i in $dirlist; do if test -f "$i/ilu/Makefile" ; then - ac_cv_c_ilupath=`(cd $i/ilu; pwd)` + ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})` break fi done @@ -682,7 +682,7 @@ ILUTOP=${ac_cv_c_ilupath} AC_MSG_CHECKING(for the ILU library in the build tree) AC_CACHE_VAL(ac_cv_c_ilulib,[ if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then - ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; pwd)` + ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})` AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a) else AC_MSG_RESULT(no) @@ -691,7 +691,7 @@ fi]) AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree) AC_CACHE_VAL(ac_cv_c_ilulib2,[ if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then - ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; pwd)` + ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})` AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a) else AC_MSG_RESULT(no) @@ -700,7 +700,7 @@ fi]) AC_MSG_CHECKING(for the ILU C bindings library in the build tree) AC_CACHE_VAL(ac_cv_c_ilulib3,[ if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then - ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; pwd)` + ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})` AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a) else AC_MSG_RESULT(no) @@ -709,7 +709,7 @@ fi]) AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree) AC_CACHE_VAL(ac_cv_c_ilulib4,[ if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then - ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; pwd)` + ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})` AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a) else AC_MSG_RESULT(no) @@ -858,9 +858,9 @@ AC_CACHE_VAL(ac_cv_c_tclh,[ dnl first check to see if --with-tclinclude was specified if test x"${with_tclinclude}" != x ; then if test -f ${with_tclinclude}/tcl.h ; then - ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)` + ac_cv_c_tclh=`(cd ${with_tclinclude}; ${PWDCMD-pwd})` elif test -f ${with_tclinclude}/generic/tcl.h ; then - ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)` + ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_tclinclude} directory doesn't contain headers]) fi @@ -870,7 +870,7 @@ dnl next check if it came with Tcl configuration file if test x"${ac_cv_c_tclconfig}" != x ; then for i in $dirlist; do if test -f $ac_cv_c_tclconfig/$i/generic/tcl.h ; then - ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; pwd)` + ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; ${PWDCMD-pwd})` break fi done @@ -891,7 +891,7 @@ if test x"${ac_cv_c_tclh}" = x ; then dnl might be multiple version of Tcl, and we want the most recent one. for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do if test -f $i/generic/tcl.h ; then - ac_cv_c_tclh=`(cd $i/generic; pwd)` + ac_cv_c_tclh=`(cd $i/generic; ${PWDCMD-pwd})` break fi done @@ -950,7 +950,7 @@ if test x"${no_tcl}" = x ; then dnl First check to see if --with-tclconfig was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) fi @@ -963,11 +963,11 @@ if test x"${no_tcl}" = x ; then dnl cygwin's tkConfig.sh could be in either directory depending dnl on the cygwin port of tcl. if test -f $srcdir/$i/unix/tclConfig.sh ; then - ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; pwd)` + ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})` break fi if test -f $srcdir/$i/win/tclConfig.sh ; then - ac_cv_c_tclconfig=`(cd $srcdir/$i/win; pwd)` + ac_cv_c_tclconfig=`(cd $srcdir/$i/win; ${PWDCMD-pwd})` break fi done @@ -989,11 +989,11 @@ if test x"${no_tcl}" = x ; then dnl cygwin's tclConfig.sh could be in either directory depending dnl on the cygwin port of tcl. if test -f $i/unix/tclConfig.sh ; then - ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + ac_cv_c_tclconfig=`(cd $i/unix; ${PWDCMD-pwd})` break fi if test -f $i/win/tclConfig.sh ; then - ac_cv_c_tclconfig=`(cd $i/win; pwd)` + ac_cv_c_tclconfig=`(cd $i/win; ${PWDCMD-pwd})` break fi done @@ -1097,9 +1097,9 @@ AC_CACHE_VAL(ac_cv_c_tkh,[ dnl first check to see if --with-tkinclude was specified if test x"${with_tkinclude}" != x ; then if test -f ${with_tkinclude}/tk.h ; then - ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)` + ac_cv_c_tkh=`(cd ${with_tkinclude}; ${PWDCMD-pwd})` elif test -f ${with_tkinclude}/generic/tk.h ; then - ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)` + ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_tkinclude} directory doesn't contain headers]) fi @@ -1109,7 +1109,7 @@ dnl next check if it came with Tk configuration file if test x"${ac_cv_c_tkconfig}" != x ; then for i in $dirlist; do if test -f $ac_cv_c_tkconfig/$i/generic/tk.h ; then - ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; pwd)` + ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; ${PWDCMD-pwd})` break fi done @@ -1130,7 +1130,7 @@ if test x"${ac_cv_c_tkh}" = x ; then dnl might be multiple version of Tk, and we want the most recent one. for i in `ls -dr $tkpath/tk* 2>/dev/null ` ; do if test -f $i/generic/tk.h ; then - ac_cv_c_tkh=`(cd $i/generic; pwd)` + ac_cv_c_tkh=`(cd $i/generic; ${PWDCMD-pwd})` break fi done @@ -1183,7 +1183,7 @@ if test x"${no_tk}" = x ; then dnl First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then if test -f "${with_tkconfig}/tkConfig.sh" ; then - ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` + ac_cv_c_tkconfig=`(cd ${with_tkconfig}; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh]) fi @@ -1196,11 +1196,11 @@ if test x"${no_tk}" = x ; then dnl cygwin's tkConfig.sh could be in either directory depending dnl on the cygwin port of tk. if test -f $srcdir/$i/unix/tkConfig.sh ; then - ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; pwd)` + ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})` break fi if test -f $srcdir/$i/win/tkConfig.sh ; then - ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; pwd)` + ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})` break fi done @@ -1222,11 +1222,11 @@ if test x"${no_tk}" = x ; then dnl cygwin's tkConfig.sh could be in either directory depending dnl on the cygwin port of tk. if test -f $i/unix/tkConfig.sh ; then - ac_cv_c_tkconfig=`(cd $i/unix; pwd)` + ac_cv_c_tkconfig=`(cd $i/unix; ${PWDCMD-pwd})` break fi if test -f $i/win/tkConfig.sh ; then - ac_cv_c_tkconfig=`(cd $i/win; pwd)` + ac_cv_c_tkconfig=`(cd $i/win; ${PWDCMD-pwd})` break fi done @@ -1302,9 +1302,9 @@ AC_CACHE_VAL(ac_cv_c_itclh,[ dnl first check to see if --with-itclinclude was specified if test x"${with_itclinclude}" != x ; then if test -f ${with_itclinclude}/itcl.h ; then - ac_cv_c_itclh=`(cd ${with_itclinclude}; pwd)` + ac_cv_c_itclh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})` elif test -f ${with_itclinclude}/src/itcl.h ; then - ac_cv_c_itclh=`(cd ${with_itclinclude}/src; pwd)` + ac_cv_c_itclh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_itclinclude} directory doesn't contain headers]) fi @@ -1314,7 +1314,7 @@ dnl next check if it came with Itcl configuration file if test x"${ac_cv_c_itclconfig}" != x ; then for i in $dirlist; do if test -f $ac_cv_c_itclconfig/$i/src/itcl.h ; then - ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; pwd)` + ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; ${PWDCMD-pwd})` break fi done @@ -1335,7 +1335,7 @@ if test x"${ac_cv_c_itclh}" = x ; then dnl might be multiple version of Itcl, and we want the most recent one. for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do if test -f $i/src/itcl.h ; then - ac_cv_c_itclh=`(cd $i/src; pwd)` + ac_cv_c_itclh=`(cd $i/src; ${PWDCMD-pwd})` break fi done @@ -1380,10 +1380,10 @@ if test x"${no_itcl}" = x ; then dnl First check to see if --with-itcllib was specified. if test x"${with_itcllib}" != x ; then if test -f "${with_itcllib}/libitcl$TCL_SHARED_LIB_SUFFIX" ; then - ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_SHARED_LIB_SUFFIX + ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_SHARED_LIB_SUFFIX else if test -f "${with_itcllib}/libitcl$TCL_UNSHARED_LIB_SUFFIX"; then - ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_UNSHARED_LIB_SUFFIX + ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_UNSHARED_LIB_SUFFIX fi fi fi @@ -1399,9 +1399,9 @@ if test x"${no_itcl}" = x ; then done dnl Itcl 7.5 and greater puts library in subdir. Look there first. if test -f "$itclpath/src/libitcl.$TCL_SHLIB_SUFFIX" ; then - ac_cv_c_itcllib=`(cd $itclpath/src; pwd)` + ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})` elif test -f "$itclpath/src/libitcl.a"; then - ac_cv_c_itcllib=`(cd $itclpath/src; pwd)` + ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})` fi fi dnl check in a few other private locations @@ -1415,10 +1415,10 @@ if test x"${no_itcl}" = x ; then for i in `ls -dr ${itclpath}/itcl* 2>/dev/null` ; do dnl Itcl 7.5 and greater puts library in subdir. Look there first. if test -f "$i/src/libitcl$TCL_SHLIB_SUFFIX" ; then - ac_cv_c_itcllib=`(cd $i/src; pwd)` + ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})` break elif test -f "$i/src/libitcl.a"; then - ac_cv_c_itcllib=`(cd $i/src; pwd)` + ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})` break fi done @@ -1430,9 +1430,9 @@ if test x"${no_itcl}" = x ; then ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib dnl Itcl 7.5 and greater puts library in subdir. Look there first. if test -f "${ccpath}/libitcl$TCL_SHLIB_SUFFIX" ; then - ac_cv_c_itcllib=`(cd ${ccpath}; pwd)` + ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})` elif test -f "${ccpath}/libitcl.a"; then - ac_cv_c_itcllib=`(cd ${ccpath}; pwd)` + ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})` fi fi ]) @@ -1463,9 +1463,9 @@ AC_CACHE_VAL(ac_cv_c_itclsh,[ dnl first check to see if --with-itclinclude was specified if test x"${with_itclinclude}" != x ; then if test -f ${with_itclinclude}/itcl_sh ; then - ac_cv_c_itclsh=`(cd ${with_itclinclude}; pwd)` + ac_cv_c_itclsh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})` elif test -f ${with_itclinclude}/src/itcl_sh ; then - ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; pwd)` + ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh]) fi @@ -1486,7 +1486,7 @@ if test x"${ac_cv_c_itclsh}" = x ; then dnl might be multiple version of Itcl, and we want the most recent one. for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do if test -f $i/src/itcl_sh ; then - ac_cv_c_itclsh=`(cd $i/src; pwd)`/itcl_sh + ac_cv_c_itclsh=`(cd $i/src; ${PWDCMD-pwd})`/itcl_sh break fi done @@ -1525,9 +1525,9 @@ AC_CACHE_VAL(ac_cv_c_itclmkidx,[ dnl first check to see if --with-itclinclude was specified if test x"${with_itclinclude}" != x ; then if test -f ${with_itclinclude}/itcl_sh ; then - ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; pwd)` + ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; ${PWDCMD-pwd})` elif test -f ${with_itclinclude}/src/itcl_sh ; then - ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; pwd)` + ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh]) fi @@ -1548,7 +1548,7 @@ if test x"${ac_cv_c_itclmkidx}" = x ; then dnl might be multiple version of Itcl, and we want the most recent one. for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do if test -f $i/library/itcl_mkindex.tcl ; then - ac_cv_c_itclmkidx=`(cd $i/library; pwd)`/itcl_mkindex.tcl + ac_cv_c_itclmkidx=`(cd $i/library; ${PWDCMD-pwd})`/itcl_mkindex.tcl break fi done @@ -1559,7 +1559,7 @@ if test x"${ac_cv_c_itclmkidx}" = x ; then dnl Itcl 7.5 and greater puts library in subdir. Look there first. for i in `ls -dr $ccpath/itcl* 2>/dev/null ` ; do if test -f $i/itcl_mkindex.tcl ; then - ac_cv_c_itclmkidx=`(cd $i; pwd)`/itcl_mkindex.tcl + ac_cv_c_itclmkidx=`(cd $i; ${PWDCMD-pwd})`/itcl_mkindex.tcl break fi done @@ -1595,9 +1595,9 @@ AC_CACHE_VAL(ac_cv_c_tixh,[ dnl first check to see if --with-tixinclude was specified if test x"${with_tixinclude}" != x ; then if test -f ${with_tixinclude}/tix.h ; then - ac_cv_c_tixh=`(cd ${with_tixinclude}; pwd)` + ac_cv_c_tixh=`(cd ${with_tixinclude}; ${PWDCMD-pwd})` elif test -f ${with_tixinclude}/generic/tix.h ; then - ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; pwd)` + ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_tixinclude} directory doesn't contain headers]) fi @@ -1607,7 +1607,7 @@ dnl next check if it came with Tix configuration file if test x"${ac_cv_c_tixconfig}" != x ; then for i in $dirlist; do if test -f $ac_cv_c_tixconfig/$i/generic/tix.h ; then - ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; pwd)` + ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; ${PWDCMD-pwd})` break fi done @@ -1628,7 +1628,7 @@ if test x"${ac_cv_c_tixh}" = x ; then dnl might be multiple version of Tix, and we want the most recent one. for i in `ls -dr $tixpath/tix* 2>/dev/null ` ; do if test -f $i/generic/tix.h ; then - ac_cv_c_tixh=`(cd $i/generic; pwd)` + ac_cv_c_tixh=`(cd $i/generic; ${PWDCMD-pwd})` break fi done @@ -1681,7 +1681,7 @@ if test x"${no_tix}" = x ; then # First check to see if --with-tixconfig was specified. if test x"${with_tixconfig}" != x ; then if test -f "${with_tixconfig}/tixConfig.sh" ; then - ac_cv_c_tixconfig=`(cd ${with_tixconfig}; pwd)` + ac_cv_c_tixconfig=`(cd ${with_tixconfig}; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_tixconfig} directory doesn't contain tixConfig.sh]) fi @@ -1697,7 +1697,7 @@ if test x"${no_tix}" = x ; then ../../../tix \ `ls -dr ../../../tix[[4]]* 2>/dev/null` ; do if test -f "$i/tixConfig.sh" ; then - ac_cv_c_tixconfig=`(cd $i; pwd)` + ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1706,7 +1706,7 @@ if test x"${no_tix}" = x ; then if test x"${ac_cv_c_tixconfig}" = x ; then for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do if test -f "$i/tixConfig.sh" ; then - ac_cv_c_tkconfig=`(cd $i; pwd)` + ac_cv_c_tkconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1717,7 +1717,7 @@ if test x"${no_tix}" = x ; then ${srcdir}/../tix \ `ls -dr ${srcdir}/../tix[[4-9]]* 2>/dev/null` ; do if test -f "$i/tixConfig.sh" ; then - ac_cv_c_tixconfig=`(cd $i; pwd)` + ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1764,7 +1764,7 @@ if test x"${no_itcl}" = x ; then # First check to see if --with-itclconfig was specified. if test x"${with_itclconfig}" != x ; then if test -f "${with_itclconfig}/itclConfig.sh" ; then - ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)` + ac_cv_c_itclconfig=`(cd ${with_itclconfig}; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh]) fi @@ -1780,7 +1780,7 @@ if test x"${no_itcl}" = x ; then ../../../itcl/itcl \ `ls -dr ../../../itcl/itcl[[3]]* 2>/dev/null` ; do if test -f "$i/itclConfig.sh" ; then - ac_cv_c_itclconfig=`(cd $i; pwd)` + ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1789,7 +1789,7 @@ if test x"${no_itcl}" = x ; then if test x"${ac_cv_c_itclconfig}" = x ; then for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do if test -f "$i/itclConfig.sh" ; then - ac_cv_c_itclconfig=`(cd $i; pwd)` + ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1800,7 +1800,7 @@ if test x"${no_itcl}" = x ; then ${srcdir}/../itcl/itcl \ `ls -dr ${srcdir}/../itcl/itcl[[3]]* 2>/dev/null` ; do if test -f "$i/itcl/itclConfig.sh" ; then - ac_cv_c_itclconfig=`(cd $i; pwd)` + ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1851,7 +1851,7 @@ if test x"${no_itk}" = x ; then # First check to see if --with-itkconfig was specified. if test x"${with_itkconfig}" != x ; then if test -f "${with_itkconfig}/itkConfig.sh" ; then - ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)` + ac_cv_c_itkconfig=`(cd ${with_itkconfig}; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh]) fi @@ -1867,7 +1867,7 @@ if test x"${no_itk}" = x ; then ../../../itcl/itk \ `ls -dr ../../../itcl/itk[[3]]* 2>/dev/null` ; do if test -f "$i/itkConfig.sh" ; then - ac_cv_c_itkconfig=`(cd $i; pwd)` + ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1876,7 +1876,7 @@ if test x"${no_itk}" = x ; then if test x"${ac_cv_c_itkconfig}" = x ; then for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do if test -f "$i/itcl/itkConfig.sh" ; then - ac_cv_c_itkconfig=`(cd $i; pwd)` + ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1887,7 +1887,7 @@ if test x"${no_itk}" = x ; then ${srcdir}/../itcl/itk \ `ls -dr ${srcdir}/../itcl/itk[[3]]* 2>/dev/null` ; do if test -f "$i/itkConfig.sh" ; then - ac_cv_c_itkconfig=`(cd $i; pwd)` + ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})` break fi done @@ -1934,9 +1934,9 @@ AC_CACHE_VAL(ac_cv_c_libguih,[ dnl first check to see if --with-libguiinclude was specified if test x"${with_libguiinclude}" != x ; then if test -f ${with_libguiinclude}/guitcl.h ; then - ac_cv_c_libguih=`(cd ${with_libguiinclude}; pwd)` + ac_cv_c_libguih=`(cd ${with_libguiinclude}; ${PWDCMD-pwd})` elif test -f ${with_libguiinclude}/src/guitcl.h ; then - ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; pwd)` + ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; ${PWDCMD-pwd})` else AC_MSG_ERROR([${with_libguiinclude} directory doesn't contain headers]) fi @@ -1946,7 +1946,7 @@ dnl next check if it came with Libgui configuration file if test x"${ac_cv_c_libguiconfig}" != x ; then for i in $dirlist; do if test -f $ac_cv_c_libguiconfig/$i/src/guitcl.h ; then - ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; pwd)` + ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; ${PWDCMD-pwd})` break fi done @@ -1967,7 +1967,7 @@ if test x"${ac_cv_c_libguih}" = x ; then dnl might be multiple version of Libgui, and we want the most recent one. for i in `ls -dr $libguipath/libgui* 2>/dev/null ` ; do if test -f $i/src/guitcl.h ; then - ac_cv_c_libguih=`(cd $i/src; pwd)` + ac_cv_c_libguih=`(cd $i/src; ${PWDCMD-pwd})` break fi done @@ -2004,7 +2004,7 @@ AC_CACHE_VAL(ac_cv_c_libguilib,[ if test x"${ac_cv_c_libguilib}" = x ; then for i in $dirlist; do if test -f "$i/libgui/src/Makefile" ; then - ac_cv_c_libguilib=`(cd $i/libgui/src; pwd)` + ac_cv_c_libguilib=`(cd $i/libgui/src; ${PWDCMD-pwd})` break fi done diff --git a/config/mh-apollo68 b/config/mh-apollo68 index 4b4ffa54b8e..eb102d55010 100644 --- a/config/mh-apollo68 +++ b/config/mh-apollo68 @@ -1,2 +1 @@ -HDEFINES = -DUSG RANLIB=true diff --git a/config/mh-dgux b/config/mh-dgux index 746ffdb2d6c..b55fb2fe0b5 100644 --- a/config/mh-dgux +++ b/config/mh-dgux @@ -1,3 +1,2 @@ -HDEFINES=-DHOST_SYS=DGUX_SYS RANLIB=true diff --git a/config/mh-dgux386 b/config/mh-dgux386 index f1e533a2e30..2fcd4bf09bb 100644 --- a/config/mh-dgux386 +++ b/config/mh-dgux386 @@ -1,7 +1,3 @@ -# from mh-dgux -HDEFINES=-DHOST_SYS=DGUX_SYS -RANLIB = true - # from mh-sysv4 RANLIB = true diff --git a/configure b/configure index 30446a209db..339b23d3e7e 100755 --- a/configure +++ b/configure @@ -3,8 +3,8 @@ ### WARNING: this file contains embedded tabs. Do not run untabify on this file. # Configuration script -# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001, +# 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 @@ -152,13 +152,13 @@ NO_EDIT="This file was generated automatically by configure. Do not edit." progname=$0 # if PWD already has a value, it is probably wrong. -if [ -n "$PWD" ]; then PWD=`pwd`; fi +if [ -n "$PWD" ]; then PWD=`${PWDCMD-pwd}`; fi case "${progname}" in /* | [A-Za-z]:[\\/]* ) ;; */*) ;; *) - PATH=$PATH:${PWD=`pwd`} ; export PATH + PATH=$PATH:${PWD=`${PWDCMD-pwd}`} ; export PATH ;; esac @@ -526,7 +526,7 @@ fi configsub=`echo ${progname} | sed 's/configure$/config.sub/'` moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'` ## the sed command below emulates the dirname command -topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd` +topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; ${PWDCMD-pwd}` # this is a hack. sun4 must always be a valid host alias or this will fail. @@ -566,8 +566,8 @@ case "${srcdir}" in echo "Invalid source directory ${srcdir}" >&2 exit 1 fi - pwd=`pwd` - srcpwd=`cd ${srcdir} ; pwd` + pwd=`${PWDCMD-pwd}` + srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}` if [ "${pwd}" = "${srcpwd}" ] ; then srcdir=. fi @@ -579,7 +579,7 @@ case "${srcdir}" in ".") ;; *) if [ -f ${srcdir}/config.status ] ; then - echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2 + echo '***' Cannot configure here in \"${PWD=`${PWDCMD-pwd}`}\" when \"${srcdir}\" is currently configured. 1>&2 exit 1 fi esac @@ -708,7 +708,7 @@ fi # some sanity checks on configure.in case "${srctrigger}" in "") - echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2 + echo '***' srctrigger not set in ${PWD=`${PWDCMD-pwd}`}/configure.in. 1>&2 exit 1 ;; *) ;; @@ -778,8 +778,8 @@ esac if [ ! -r ${srcdir}/${srctrigger} ] ; then case "${srcdirdefaulted}" in - "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;; - *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;; + "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/${srcdir}" 1>&2 ;; + *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`${PWDCMD-pwd}`}/. or ${PWD=`${PWDCMD-pwd}`}/.." 1>&2 ;; esac echo '***' \(At least ${srctrigger} is missing.\) 1>&2 @@ -917,8 +917,8 @@ if [ "${build}" != "${host}" ]; then tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD" tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET" - tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX" - tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM" + tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX" + tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM" tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET" tools="${tools} WINDRES WINDRES_FOR_TARGET YACC" tools="${tools} OBJCOPY OBJDUMP" @@ -955,8 +955,8 @@ t loop DLLTOOL=${DLLTOOL-${host_alias}-dlltool} DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool} GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}} - HOST_PREFIX=${build_alias}- - HOST_PREFIX_1=${build_alias}- + BUILD_PREFIX=${build_alias}- + BUILD_PREFIX_1=${build_alias}- LD=${LD-${host_alias}-ld} LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld} MAKEINFO=${MAKEINFO-makeinfo} @@ -1072,22 +1072,6 @@ export CXX export CFLAGS export CXXFLAGS -# FIXME: This should be in configure.in, not configure -case "$host" in - *go32*) - enable_gdbtk=no ;; - *msdosdjgpp*) - enable_gdbtk=no ;; -esac - -# FIXME: This should be in configure.in, not configure -# Determine whether gdb needs tk/tcl or not. -if [ "$enable_gdbtk" != "no" ]; then - GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui" -else - GDB_TK="" -fi - all_build_modules= if test x"${build_alias}" != x"${host_alias}" then @@ -1124,7 +1108,7 @@ for subdir in . ${subdirs} ; do if mkdir ${subdir} ; then true else - echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2 + echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${subdir}" 1>&2 exit 1 fi fi @@ -1223,7 +1207,7 @@ EOF sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem else echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2 - echo '***' is missing in ${PWD=`pwd`}. 1>&2 + echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2 cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem fi esac @@ -1259,7 +1243,7 @@ EOF sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem else echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2 - echo '***' is missing in ${PWD=`pwd`}. 1>&2 + echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2 mv ${Makefile} ${subdir}/Makefile.tem fi esac @@ -1295,7 +1279,7 @@ EOF sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem else echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2 - echo '***' is missing in ${PWD=`pwd`}. 1>&2 + echo '***' is missing in ${PWD=`${PWDCMD-pwd}`}. 1>&2 mv ${Makefile} ${subdir}/Makefile.tem fi esac @@ -1481,7 +1465,7 @@ EOF newusing=`echo "${using}" | sed 's/and/using/'` using=${newusing} - echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using} + echo "Created \"${Makefile}\" in" ${PWD=`${PWDCMD-pwd}`} ${using} . ${tmpfile}.pos @@ -1547,14 +1531,14 @@ if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then if mkdir ./${bld_dir} ; then true else - echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2 + echo '***' "${progname}: could not make ${PWD=`${PWDCMD-pwd}`}/${bld_dir}" 1>&2 exit 1 fi fi ;; esac - POPDIR=${PWD=`pwd`} + POPDIR=${PWD=`${PWDCMD-pwd}`} cd ${bld_dir} ### figure out what to do with srcdir @@ -1602,7 +1586,7 @@ if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then true else - echo Configure in `pwd` failed, exiting. 1>&2 + echo Configure in `${PWDCMD-pwd}` failed, exiting. 1>&2 exit 1 fi fi diff --git a/configure.in b/configure.in index 2569cc2ecfc..5962337875f 100644 --- a/configure.in +++ b/configure.in @@ -42,7 +42,7 @@ # these libraries are used by various programs built for the host environment # -host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk tcl8.1 tk8.1 tclX itcl tix libgui zlib" +host_libs="intl mmalloc libiberty opcodes bfd readline db tcl tk tclX itcl tix libgui zlib" libstdcxx_version="target-libstdc++-v3" # Don't use libstdc++-v3's flags to configure/build itself. @@ -51,7 +51,7 @@ libstdcxx_flags='`case $$dir in libstdc++-v3 | libjava) ;; *) test ! -f $$r/$(TA # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to # know that we are building the simulator. -host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find emacs emacs19 uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip fastjar" +host_tools="texinfo byacc flex bison binutils ld gas gcc cgen sid sim gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool ispell grep diff rcs cvssrc fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl apache inet gawk findutils snavigator libtool gettext zip fastjar" # libgcj represents the runtime libraries only used by gcj. libgcj="target-libffi \ @@ -93,7 +93,7 @@ target_tools="target-examples target-groff target-gperf" # # This must be a single line because of the way it is searched by grep in # the code below. -native_only="autoconf automake libtool cvssrc emacs emacs19 fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl apache inet time ash bash bzip2 prms snavigator gnuserv target-gperf" +native_only="autoconf automake libtool cvssrc fileutils find gawk gettext grep gzip hello indent ispell m4 rcs recode sed shellutils tar textutils uudecode wdiff gprof target-groff guile perl apache inet time ash bash bzip2 prms snavigator gnuserv target-gperf" # directories to be built in a cross environment only # @@ -125,11 +125,11 @@ case "${host}" in m68k-hp-hpux*) # Avoid "too much defining" errors from HPUX compiler. tentative_cc="cc -Wp,-H256000" - host_makefile_frag="${host_makefile_frag} config/mh-hp300" + host_makefile_frag="config/mh-hp300" ;; m68k-apollo-sysv*) tentative_cc="cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DUSG" - host_makefile_frag="${host_makefile_frag} config/mh-apollo68" + host_makefile_frag="config/mh-apollo68" ;; m68k-apollo-bsd*) #None of the Apollo compilers can compile gas or binutils. The preprocessor @@ -139,34 +139,34 @@ case "${host}" in # or whatever), but I'm not sure leaving CC as cc is any better... #CC=cc -A ansi -A runtype,any -A systype,any -U__STDC__ -DNO_STDARG tentative_cc=gcc - host_makefile_frag="${host_makefile_frag} config/mh-a68bsd" + host_makefile_frag="config/mh-a68bsd" ;; m88k-dg-dgux*) tentative_cc="gcc -Wall -ansi -D__using_DGUX" - host_makefile_frag="${host_makefile_frag} config/mh-dgux" + host_makefile_frag="config/mh-dgux" ;; m88k-harris-cxux*) # Under CX/UX, we want to tell the compiler to use ANSI mode. tentative_cc="cc -Xa" - host_makefile_frag="${host_makefile_frag} config/mh-cxux" + host_makefile_frag="config/mh-cxux" ;; m88k-motorola-sysv*) - host_makefile_frag="${host_makefile_frag} config/mh-delta88" + host_makefile_frag="config/mh-delta88" ;; mips*-dec-ultrix*) tentative_cc="cc -Wf,-XNg1000" - host_makefile_frag="${host_makefile_frag} config/mh-decstation" + host_makefile_frag="config/mh-decstation" ;; mips*-nec-sysv4*) # The C compiler on NEC MIPS SVR4 needs bigger tables. tentative_cc="cc -ZXNd=5000 -ZXNg=1000" - host_makefile_frag="${host_makefile_frag} config/mh-necv4" + host_makefile_frag="config/mh-necv4" ;; mips*-sgi-irix6*) - host_makefile_frag="${host_makefile_frag} config/mh-irix6" + host_makefile_frag="config/mh-irix6" ;; mips*-sgi-irix5*) - host_makefile_frag="${host_makefile_frag} config/mh-irix5" + host_makefile_frag="config/mh-irix5" ;; mips*-sgi-irix4*) # Tell compiler to use K&R C. We can't compile under the SGI Ansi @@ -175,10 +175,10 @@ case "${host}" in tentative_cc="cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh2000 -Wf,-XNl8192" ;; mips*-sgi-irix3*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv" + host_makefile_frag="config/mh-sysv" ;; mips*-*-sysv4*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv4" + host_makefile_frag="config/mh-sysv4" ;; mips*-*-sysv*) # This is for a MIPS running RISC/os 4.52C. @@ -194,24 +194,24 @@ case "${host}" in # This is not part of CFLAGS because perhaps not all C compilers have this # option. tentative_cc="cc -systype sysv" - host_makefile_frag="${host_makefile_frag} config/mh-riscos" + host_makefile_frag="config/mh-riscos" ;; i370-ibm-opened*) tentative_cc="c89" - host_makefile_frag="${host_makefile_frag} config/mh-openedition" + host_makefile_frag="config/mh-openedition" ;; i[3456]86-*-sysv5*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv5" + host_makefile_frag="config/mh-sysv5" ;; i[3456]86-*-dgux*) tentative_cc="gcc -Wall -ansi -D__using_DGUX" - host_makefile_frag="${host_makefile_frag} config/mh-dgux386" + host_makefile_frag="config/mh-dgux386" ;; i[3456]86-ncr-sysv4.3*) # The MetaWare compiler will generate a copyright message unless you # turn it off by adding the -Hnocopyr flag. tentative_cc="cc -Hnocopyr" - host_makefile_frag="${host_makefile_frag} config/mh-ncrsvr43" + host_makefile_frag="config/mh-ncrsvr43" ;; i[3456]86-ncr-sysv4*) # for an NCR 3000 (i486/SVR4) system. @@ -220,47 +220,47 @@ case "${host}" in # you run it, but it chokes and dies on a whole bunch of GNU source # files. Default to using the AT&T compiler installed in /usr/ccs/ATT/cc. tentative_cc="/usr/ccs/ATT/cc" - host_makefile_frag="${host_makefile_frag} config/mh-ncr3000" + host_makefile_frag="config/mh-ncr3000" ;; i[3456]86-*-sco3.2v5*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv" + host_makefile_frag="config/mh-sysv" ;; i[3456]86-*-sco*) # The native C compiler botches some simple uses of const. Unfortunately, # it doesn't defined anything like "__sco__" for us to test for in ansidecl.h. tentative_cc="cc -Dconst=" - host_makefile_frag="${host_makefile_frag} config/mh-sco" + host_makefile_frag="config/mh-sco" ;; i[3456]86-*-udk*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv5" + host_makefile_frag="config/mh-sysv5" ;; i[3456]86-*-isc*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv" + host_makefile_frag="config/mh-sysv" ;; i[3456]86-*-solaris2*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv4" + host_makefile_frag="config/mh-sysv4" ;; i[3456]86-*-aix*) - host_makefile_frag="${host_makefile_frag} config/mh-aix386" + host_makefile_frag="config/mh-aix386" ;; i[3456]86-*-msdosdjgpp*) - host_makefile_frag="${host_makefile_frag} config/mh-djgpp" + host_makefile_frag="config/mh-djgpp" ;; *-cygwin*) - host_makefile_frag="${host_makefile_frag} config/mh-cygwin" + host_makefile_frag="config/mh-cygwin" ;; *-mingw32*) - host_makefile_frag="${host_makefile_frag} config/mh-mingw32" + host_makefile_frag="config/mh-mingw32" ;; *-interix*) - host_makefile_frag="${host_makefile_frag} config/mh-interix" + host_makefile_frag="config/mh-interix" ;; vax-*-ultrix2*) # The old BSD pcc isn't up to compiling parts of gdb so use gcc tentative_cc=gcc ;; *-*-solaris2*) - host_makefile_frag="${host_makefile_frag} config/mh-solaris" + host_makefile_frag="config/mh-solaris" ;; m68k-sun-sunos*) # Sun's C compiler needs the -J flag to be able to compile cp-parse.c @@ -269,30 +269,30 @@ case "${host}" in ;; *-hp-hpux[78]*) tentative_cc="cc -Wp,-H256000" - host_makefile_frag="${host_makefile_frag} config/mh-hpux8" + host_makefile_frag="config/mh-hpux8" ;; *-hp-hpux*) tentative_cc="cc -Wp,-H256000" - host_makefile_frag="${host_makefile_frag} config/mh-hpux" + host_makefile_frag="config/mh-hpux" ;; *-*-hiux*) tentative_cc="cc -Wp,-H256000" - host_makefile_frag="${host_makefile_frag} config/mh-hpux" + host_makefile_frag="config/mh-hpux" ;; rs6000-*-lynxos*) # /bin/cc is less than useful for our purposes. Always use GCC tentative_cc="/usr/cygnus/progressive/bin/gcc" - host_makefile_frag="${host_makefile_frag} config/mh-lynxrs6k" + host_makefile_frag="config/mh-lynxrs6k" ;; *-*-lynxos*) # /bin/cc is less than useful for our purposes. Always use GCC tentative_cc="/bin/gcc" ;; *-*-sysv4*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv4" + host_makefile_frag="config/mh-sysv4" ;; *-*-sysv*) - host_makefile_frag="${host_makefile_frag} config/mh-sysv" + host_makefile_frag="config/mh-sysv" ;; esac fi @@ -446,7 +446,7 @@ target_subdir=${target_alias} if test ! -d ${target_subdir} ; then if mkdir ${target_subdir} ; then true else - echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2 + echo "'*** could not make ${PWD=`${PWDCMD-pwd}`}/${target_subdir}" 1>&2 exit 1 fi fi @@ -457,7 +457,7 @@ if test x"${build_alias}" != x"${host}" ; then if test ! -d ${build_subdir} ; then if mkdir ${build_subdir} ; then true else - echo "'*** could not make ${PWD=`pwd`}/${build_subdir}" 1>&2 + echo "'*** could not make ${PWD=`${PWDCMD-pwd}`}/${build_subdir}" 1>&2 exit 1 fi fi @@ -654,10 +654,10 @@ case "${target}" in noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" ;; alpha*-dec-osf*) - # ld works, but does not support shared libraries. emacs doesn't - # work. newlib is not 64 bit ready. I'm not sure about fileutils. + # ld works, but does not support shared libraries. + # newlib is not 64 bit ready. I'm not sure about fileutils. # gas doesn't generate exception information. - noconfigdirs="$noconfigdirs gas ld emacs fileutils target-newlib target-libgloss" + noconfigdirs="$noconfigdirs gas ld fileutils target-newlib target-libgloss" ;; alpha*-*-*vms*) noconfigdirs="$noconfigdirs gdb ld target-newlib target-libgloss ${libgcj}" @@ -731,6 +731,9 @@ case "${target}" in arm-*-riscix*) noconfigdirs="$noconfigdirs ld target-libgloss ${libgcj}" ;; + avr-*-*) + noconfigdirs="$noconfigdirs target-libiberty ${libstdcxx_version} ${libgcj}" + ;; c4x-*-*) noconfigdirs="$noconfigdirs ${libstdcxx_version} target-librx target-libgloss ${libgcj}" ;; @@ -772,13 +775,6 @@ case "${target}" in # Do configure ld/binutils/gas for this case. ;; hppa*-*-*) - # HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach - # cc is gcc, and on any system a user should be able to link cc to - # whatever they want. FIXME, emacs emacs19). - case "${CC}" in - "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;; - *) ;; - esac # According to Alexandre Oliva , libjava won't # build on HP-UX 10.20. noconfigdirs="$noconfigdirs ld shellutils ${libgcj}" @@ -864,13 +860,7 @@ case "${target}" in noconfigdirs="$noconfigdirs target-libgloss" ;; i[3456]86-*-sysv4*) - # The SYSV4 C compiler doesn't handle Emacs correctly - case "${CC}" in - "" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;; - *) ;; - esac - # but that's okay since emacs doesn't work anyway - noconfigdirs="$noconfigdirs emacs emacs19 target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;; i[3456]86-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" @@ -950,17 +940,15 @@ case "${target}" in ;; mips*-*-irix5*) # The GNU linker does not support shared libraries. - # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work) - noconfigdirs="$noconfigdirs ld gprof emacs target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs ld gprof target-libgloss ${libgcj}" ;; mips*-*-irix6*) # The GNU assembler does not support IRIX 6. - # emacs is emacs 18, which does not work on Irix 5 (emacs19 does work) # Linking libjava exceeds command-line length limits on at least # IRIX 6.2, but not on IRIX 6.5. # Also, boehm-gc won't build on IRIX 6.5, according to Jeffrey Oldham # - noconfigdirs="$noconfigdirs gas gprof emacs target-libgloss ${libgcj}" + noconfigdirs="$noconfigdirs gas gprof target-libgloss ${libgcj}" ;; mips*-dec-bsd*) noconfigdirs="$noconfigdirs gprof target-libgloss ${libgcj}" @@ -1319,6 +1307,18 @@ if test -n "${target_makefile_frag}" ; then target_makefile_frag=mt-frag fi +case "$host" in + *msdosdjgpp*) + enable_gdbtk=no ;; +esac +# Determine whether gdb needs tk/tcl or not. +case "$enable_gdbtk" in + no) + GDB_TK="" ;; + *) + GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui" ;; +esac + # post-target: # Make sure that the compiler is able to generate an executable. If it @@ -1389,12 +1389,12 @@ if test "${shared}" = "yes" ; then esac fi -# Record target_configdirs and the configure arguments for target and -# build configuration in Makefile. -target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'` -targargs=`echo "${arguments}" | \ +# Base args. Strip norecursion, cache-file, srcdir, host, build, target. +# These are the ones we might not want to pass down to subconfigures. +baseargs=`echo "${arguments}" | \ sed -e 's/--no[^ ]*//' \ -e 's/--cache[a-z-]*=[^ ]*//' \ + -e 's/--sr[a-z-]*=[^ ]*//' \ -e 's/--ho[a-z-]*=[^ ]*//' \ -e 's/--bu[a-z-]*=[^ ]*//' \ -e 's/--ta[a-z-]*=[^ ]*//'` @@ -1402,7 +1402,12 @@ targargs=`echo "${arguments}" | \ # For the build-side libraries, we just need to pretend we're native, # and not use the same cache file. Multilibs are neither needed nor # desired. -buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${targargs}" +buildargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} ${baseargs}" + +# Record target_configdirs and the configure arguments for target and +# build configuration in Makefile. +target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'` +targargs=${baseargs} # Passing a --with-cross-host argument lets the target libraries know # whether they are being built with a cross-compiler or being built diff --git a/etc/ChangeLog b/etc/ChangeLog index 6b13bfdb6c1..debe735ca99 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,31 @@ +2002-06-11 Nick Clifton + + Import the following patches from the FSF GCC sources: + 2002-03-25 Zack Weinberg + + * texi2pod.pl: Handle @end ftable and @end vtable. + + 2001-12-12 Matthias Klose + + * texi2pod.pl: Merge changes from binutils' texi2pod.pl. Allows + generation of more than one man page from one source. + Add '-' to set of valid chars for an identifier. + Let -D option accept flags of the form =. + Use \s+ for whitespace detection in '@c man' lines. + Handle @set and @clear independent of $output. + Substitute all @value{}'s in a line. + + 2001-11-14 Joseph S. Myers + + * texi2pod.pl: Handle @ifnottex, @iftex and @display. Handle @var + in verbatim blocks specially. Handle @unnumbered, @unnumberedsec + and @center. Allow [a-z] after @enumerate. Handle 0 and numbers + greater than 9 in enumerations. + + 2001-07-03 Joseph S. Myers + + * texi2pod.pl: Handle @r inside @item. + 2002-02-27 Andrew Cagney * fdl.texi: New file. @@ -19,7 +47,7 @@ * add-log.el, add-log.vi: New files. -Wed Jan 20 01:33:50 1999 Angela Marie Thomas (angela@cygnus.com) +1999-01-20 Angela Marie Thomas (angela@cygnus.com) * comp-tools-verify: Remove some checks that are no longer valid. @@ -27,16 +55,16 @@ Wed Jan 20 01:33:50 1999 Angela Marie Thomas (angela@cygnus.com) * targetdoc/fr30.texi: New document. -Thu Oct 1 21:15:59 1998 Angela Marie Thomas (angela@cygnus.com) +1998-10-01 Angela Marie Thomas (angela@cygnus.com) * comp-tools-fix, cross-tools-fix: Replace /usr/include with ${FIXINCDIR}. -Tue Aug 11 19:22:11 1998 Doug Evans +1998-08-11 Doug Evans * make-rel-sym-tree (version): Update calculation. -Fri Jun 12 21:34:01 1998 Ian Lance Taylor +1998-06-12 Ian Lance Taylor * configure.texi: Various additions. * Makefile.in (TEXI2HTML, DVIPS): New variables. @@ -51,7 +79,7 @@ Fri Jun 12 21:34:01 1998 Ian Lance Taylor * configbuild.ein: New file (EPS version of configbuild.fig). * configbuild.jin: New file (JPEG version of configbuild.fig). -Wed Jun 10 14:41:25 1998 Ian Lance Taylor +1998-06-10 Ian Lance Taylor * configure.texi: New file. * configdev.tin: New file. diff --git a/etc/texi2pod.pl b/etc/texi2pod.pl index e6ad9f92d50..bdc20e8118f 100644 --- a/etc/texi2pod.pl +++ b/etc/texi2pod.pl @@ -1,6 +1,6 @@ #! /usr/bin/perl -w -# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 200 Free Software Foundation, Inc. # This file is part of GNU CC. @@ -30,9 +30,12 @@ $section = ""; @icstack = (); @endwstack = (); @skstack = (); +@instack = (); $shift = ""; %defs = (); $fnno = 1; +$inf = ""; +$ibase = ""; while ($_ = shift) { if (/^-D(.*)$/) { @@ -41,15 +44,13 @@ while ($_ = shift) { } else { $flag = shift; } - $value=$flag; - $value =~ s,^[a-zA-Z0-9_]+,,; - $value =~ s,.*=,,; - $flag =~ s,=.*$,,; + $value = ""; + ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/); die "no flag specified for -D\n" unless $flag ne ""; - #print STDERR "FL = $flag, V = $value\n"; + die "flags may only contain letters, digits, hyphens, dashes and underscores\n" + unless $flag =~ /^[a-zA-Z0-9_-]+$/; $defs{$flag} = $value; - } elsif (/^-/) { usage(); } else { @@ -60,14 +61,19 @@ while ($_ = shift) { } if (defined $in) { - open(STDIN, $in) or die "opening \"$in\": $!\n"; + $inf = gensym(); + open($inf, "<$in") or die "opening \"$in\": $!\n"; + $ibase = $1 if $in =~ m|^(.+)/[^/]+$|; +} else { + $inf = \*STDIN; } + if (defined $out) { open(STDOUT, ">$out") or die "opening \"$out\": $!\n"; } -while() -{ +while(defined $inf) { +while(<$inf>) { # Certain commands are discarded without further processing. /^\@(?: [a-z]+index # @*index: useful only in complete manual @@ -75,8 +81,9 @@ while() |(?:end\s+)?group # @group .. @end group: ditto |page # @page: ditto |node # @node: useful only in .info file + |(?:end\s+)?ifnottex # @ifnottex .. @end ifnottex: use contents )\b/x and next; - + chomp; # Look for filename and title markers. @@ -84,7 +91,7 @@ while() /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next; # Identify a man title but keep only the one we are interested in. - /^\@c man title ([A-Za-z0-9]+) (.+)/ and do { + /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do { if (exists $defs{$1}) { $fn = $1; $tl = postprocess($2); @@ -95,19 +102,30 @@ while() # Look for blocks surrounded by @c man begin SECTION ... @c man end. # This really oughta be @ifman ... @end ifman and the like, but such # would require rev'ing all other Texinfo translators. - /^\@c man begin ([A-Z]+) ([A-Za-z0-9]+)/ and do { + /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { $output = 1 if exists $defs{$2}; $sect = $1; next; }; - /^\@c man begin ([A-Z]+)/ and $sect = $1, $output = 1, next; - /^\@c man end/ and do { + /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next; + /^\@c\s+man\s+end/ and do { $sects{$sect} = "" unless exists $sects{$sect}; $sects{$sect} .= postprocess($section); $section = ""; $output = 0; next; }; + + # handle variables + /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { + $defs{$1} = $2; + next; + }; + /^\@clear\s+([a-zA-Z0-9_-]+)/ and do { + delete $defs{$1}; + next; + }; + next unless $output; # Discard comments. (Can't do it above, because then we'd never see @@ -120,20 +138,20 @@ while() # Ignore @end foo, where foo is not an operation which may # cause us to skip, if we are presently skipping. my $ended = $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu)$/; + next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; die "\@end $ended without \@$ended at line $.\n" unless defined $endw; die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; $endw = pop @endwstack; - if ($ended =~ /^(?:ifset|ifclear|ignore|menu)$/) { + if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { $skipping = pop @skstack; next; - } elsif ($ended =~ /^(?:example|smallexample)$/) { + } elsif ($ended =~ /^(?:example|smallexample|display)$/) { $shift = ""; $_ = ""; # need a paragraph break - } elsif ($ended =~ /^(?:itemize|enumerate|table)$/) { + } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { $_ = "\n=back\n"; $ic = pop @icstack; } else { @@ -160,7 +178,7 @@ while() next; }; - /^\@(ignore|menu)\b/ and do { + /^\@(ignore|menu|iftex)\b/ and do { push @endwstack, $endw; push @skstack, $skipping; $endw = $1; @@ -189,6 +207,12 @@ while() s/\@\{/{/g; s/\@\}/}/g; s/\@\@/&at;/g; + + # Inside a verbatim block, handle @var specially. + if ($shift ne "") { + s/\@var\{([^\}]*)\}/<$1>/g; + } + # POD doesn't interpret E<> inside a verbatim block. if ($shift eq "") { s/) } # Single line command handlers. - /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and $defs{$1} = $2, next; - /^\@clear\s+([a-zA-Z0-9_-]+)/ and delete $defs{$1}, next; - /^\@section\s+(.+)$/ and $_ = "\n=head2 $1\n"; - /^\@subsection\s+(.+)$/ and $_ = "\n=head3 $1\n"; + /^\@include\s+(.+)$/ and do { + push @instack, $inf; + $inf = gensym(); + + # Try cwd and $ibase. + open($inf, "<" . $1) + or open($inf, "<" . $ibase . "/" . $1) + or die "cannot open $1 or $ibase/$1: $!\n"; + next; + }; + + /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ + and $_ = "\n=head2 $1\n"; + /^\@subsection\s+(.+)$/ + and $_ = "\n=head3 $1\n"; # Block command handlers: /^\@itemize\s+(\@[a-z]+|\*|-)/ and do { @@ -214,7 +249,7 @@ while() $endw = "itemize"; }; - /^\@enumerate(?:\s+([A-Z0-9]+))?/ and do { + /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do { push @endwstack, $endw; push @icstack, $ic; if (defined $1) { @@ -226,19 +261,19 @@ while() $endw = "enumerate"; }; - /^\@table\s+(\@[a-z]+)/ and do { + /^\@([fv]?table)\s+(\@[a-z]+)/ and do { push @endwstack, $endw; push @icstack, $ic; - $ic = $1; + $endw = $1; + $ic = $2; $ic =~ s/\@(?:samp|strong|key|gcctabopt|env)/B/; $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; $_ = "\n=over 4\n"; - $endw = "table"; }; - /^\@((?:small)?example)/ and do { + /^\@((?:small)?example|display)/ and do { push @endwstack, $endw; $endw = $1; $shift = "\t"; @@ -251,12 +286,17 @@ while() $_ = "\n=item $ic\<$1\>\n"; } else { $_ = "\n=item $ic\n"; - $ic =~ y/A-Ya-y1-8/B-Zb-z2-9/; + $ic =~ y/A-Ya-y/B-Zb-z/; + $ic =~ s/(\d+)/$1 + 1/eg; } }; $section .= $shift.$_."\n"; } +# End of current file. +close($inf); +$inf = pop @instack; +} die "No filename or title\n" unless defined $fn && defined $tl; @@ -284,13 +324,15 @@ sub postprocess local $_ = $_[0]; # @value{foo} is replaced by whatever 'foo' is defined as. - if (/\@value\{([a-zA-Z0-9_-]+)\}/) { - if (! exists $defs{$1}) { - print STDERR "Option $1 not define\n"; + while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) { + if (! exists $defs{$2}) { + print STDERR "Option $2 not defined\n"; + s/\Q$1\E//; + } else { + $value = $defs{$2}; + s/\Q$1\E/$value/; } - } - s/\@value\{([a-zA-Z0-9_-]+)\}/$defs{$1}/g; # Formatting commands. # Temporary escape for @r. @@ -303,9 +345,6 @@ sub postprocess s/\@w\{([^\}]*)\}/S<$1>/g; s/\@(?:dmn|math)\{([^\}]*)\}/$1/g; - # Handle @r inside bold. - 1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B blah> into B I B to - # match Texinfo semantics of @emph inside @samp. + # match Texinfo semantics of @emph inside @samp. Also handle @r + # inside bold. s/<//g; + 1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B]*)I<([^>]+)>/B<$1>I<$2>B]*)B<([^>]+)>/I<$1>B<$2>I//g; @@ -372,4 +413,15 @@ sub add_footnote $sects{FOOTNOTES} .= $_[0]; $sects{FOOTNOTES} .= "\n\n"; } - + +# stolen from Symbol.pm +{ + my $genseq = 0; + sub gensym + { + my $name = "GEN" . $genseq++; + my $ref = \*{$name}; + delete $::{$name}; + return $ref; + } +} diff --git a/gdb/29k-share/udi/udip2soc.c b/gdb/29k-share/udi/udip2soc.c deleted file mode 100644 index c8af3fee285..00000000000 --- a/gdb/29k-share/udi/udip2soc.c +++ /dev/null @@ -1,1250 +0,0 @@ -/* Copyright 1993, 1998 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. */ - -static char udip2soc_c[]="@(#)udip2soc.c 2.11 Daniel Mann"; -static char udip2soc_c_AMD[]="@(#)udip2soc.c 2.8, AMD"; -/* -* This module converts UDI Procedural calls into -* UDI socket messages for UNIX. -* It is used by DFE client processes -********************************************************************** HISTORY -*/ -/* This is all unneeded on DOS machines. */ -#ifndef __GO32__ - -#include -#include - -/* Before sys/file.h for Unixware. */ -#include - -#include - -/* This used to say sys/fcntl.h, but the only systems I know of that - require that are old (pre-4.3, at least) BSD systems, which we - probably don't need to worry about. */ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "udiproc.h" -#include "udisoc.h" - -extern int errno; -extern int sys_nerr; -extern int udr_errno; -extern char* getenv(); - -/* local type decs. and macro defs. not in a .h file ************* MACRO/TYPE -*/ -#define version_c 0x121 /* DFE-IPC version id */ -#define TRUE -1 -#define FALSE 0 -#define PORT_NUM 7000 -#define MAX_SESSIONS 5 /* maximum DFE-TIP connections */ -#define SOC_BUF_SIZE 4* 1024 /* size of socket comms buffer */ -#define SBUF_SIZE 500 /* size of string buffer */ -#define ERRMSG_SIZE 500 /* size of error message buffer */ - -typedef struct connection_str /* record of connect session */ -{ - int in_use; - char connect_id[20]; /* connection identifier */ - char domain_string[20]; /* dommaing for conection */ - char tip_string[30]; /* TIP host name for AF_INET */ - char tip_exe[80]; /* TIP exe name */ - int dfe_sd; /* associated DFE socket */ - int tip_pid; /* pid of TIP process */ - struct sockaddr_in dfe_sockaddr; - struct sockaddr_in tip_sockaddr_in; - struct sockaddr tip_sockaddr; -} connection_t; - -typedef struct session_str -{ - int in_use; - connection_t* soc_con_p; /* associated connection */ - UDISessionId tip_id; /* associated TIP session ID */ -} session_t; - -/* global dec/defs. which are not in a .h file ************* EXPORT DEC/DEFS -*/ -UDIError dfe_errno; -char dfe_errmsg[ERRMSG_SIZE];/* error string */ - -/* local dec/defs. which are not in a .h file *************** LOCAL DEC/DEFS -*/ -LOCAL connection_t soc_con[MAX_SESSIONS]; -LOCAL session_t session[MAX_SESSIONS]; -LOCAL UDR udr; -LOCAL UDR* udrs = &udr; /* UDR for current session */ -LOCAL int current; /* int-id for current session */ -LOCAL char sbuf[SBUF_SIZE]; /* String handler buffer */ -LOCAL char config_file[80]; /* path/name for config file */ - -/***************************************************************** UDI_CONNECT -* Establish a new FDE to TIP conection. The file "./udi_soc" or -* "/etc/udi_soc" may be examined to obtain the conection information -* if the "Config" parameter is not a completd "line entry". -* -* NOTE: the Session string must not start whith white-space characters. -* Format of string is: -* -* soc2cayman AF_INET cayman 7000 -* soc2tip AF_UNIX astring tip.exe ... -*/ -UDIError -UDIConnect(Config, Session) - char *Config; /* in -- identification string */ - UDISessionId *Session; /* out -- session ID */ -{ - UDIInt32 service_id = UDIConnect_c; - int domain; - int cnt=0; - int rcnt, pos, params_pos=0; - char *tip_main_string; - char *env_p; - struct hostent *tip_info_p; - FILE *fd; -#if 0 - FILE *f_p; -#endif - UDIUInt32 TIPIPCId; - UDIUInt32 DFEIPCId; - -#if 0 /* This is crap. It assumes that udi_soc is executable! */ - sprintf(sbuf, "which udi_soc"); - f_p = popen(sbuf, "r"); - if(f_p) - { while( (sbuf[cnt++]=getc(f_p)) != EOF); - sbuf[cnt-2]=0; - } - pclose(f_p); -#endif - - for (rcnt=0; - rcnt < MAX_SESSIONS && session[rcnt].in_use; - rcnt++); - - if (rcnt >= MAX_SESSIONS) - { - sprintf(dfe_errmsg, "DFE-ipc ERROR: Too many sessions already open"); - return UDIErrorIPCLimitation; - } - - /* One connection can be multiplexed between several sessions. */ - - for (cnt=0; - cnt < MAX_SESSIONS && soc_con[cnt].in_use; - cnt++); - - if (cnt >= MAX_SESSIONS) - { - sprintf(dfe_errmsg, - "DFE-ipc ERROR: Too many connections already open"); - return UDIErrorIPCLimitation; - } - - *Session = rcnt; - session[rcnt].soc_con_p = &soc_con[cnt]; - - if (strchr(Config, ' ')) /* test if file entry given */ - { - soc_con[cnt].in_use = TRUE; - sscanf(Config, "%s %s %s %s %n", - soc_con[cnt].connect_id, - soc_con[cnt].domain_string, - soc_con[cnt].tip_string, - soc_con[cnt].tip_exe, - ¶ms_pos); - tip_main_string = Config + params_pos; - } - else /* here if need to read udi_soc file */ - { - strcpy(config_file, "udi_soc"); - env_p = getenv("UDICONF"); - if (env_p) - strcpy(config_file, env_p); - - fd = fopen(config_file, "r"); - - if (!fd) - { - sprintf(dfe_errmsg, "UDIConnect, can't open udi_soc file:\n%s ", - strerror(errno)); - dfe_errno = UDIErrorCantOpenConfigFile; - goto tip_failure; - } - - while (1) - { - if (fscanf(fd, "%s %s %s %s %[^\n]\n", - soc_con[cnt].connect_id, - soc_con[cnt].domain_string, - soc_con[cnt].tip_string, - soc_con[cnt].tip_exe, - sbuf) == EOF) - break; - - if (strcmp(Config, soc_con[cnt].connect_id) != 0) - continue; - - soc_con[cnt].in_use = TRUE; /* here if entry found */ - - tip_main_string = sbuf; - break; - } - - fclose(fd); - if (!soc_con[cnt].in_use) - { - sprintf(dfe_errmsg, - "UDIConnect, can't find `%s' entry in udi_soc file", - Config); - dfe_errno = UDIErrorNoSuchConfiguration; - goto tip_failure; - } - } -/*----------------------------------------------------------- SELECT DOMAIN */ - if (strcmp(soc_con[cnt].domain_string, "AF_UNIX") == 0) - domain = AF_UNIX; - else if (strcmp(soc_con[cnt].domain_string, "AF_INET") == 0) - domain = AF_INET; - else - { - sprintf(dfe_errmsg, "DFE-ipc ERROR: socket address family not known"); - dfe_errno = UDIErrorBadConfigFileEntry; - goto tip_failure; - } - -/*---------------------------------------------------- MULTIPLEXED SOCKET ? */ -/* If the requested session requires communication with - a TIP which already has a socket connection established, - then we do not create a new socket but multiplex the - existing one. A TIP is said to use the same socket if - socket-name/host-name and the domain are the same. - */ - for (rcnt=0; rcnt < MAX_SESSIONS; rcnt++) - { - if (soc_con[rcnt].in_use - && rcnt != cnt - && strcmp(soc_con[cnt].domain_string, - soc_con[rcnt].domain_string) == 0 - && strcmp(soc_con[cnt].tip_string, - soc_con[rcnt].tip_string) == 0) - { - session[*Session].soc_con_p = &soc_con[rcnt]; - soc_con[cnt].in_use = FALSE; /* don't need new connect */ - goto tip_connect; - } - } -/*------------------------------------------------------------------ SOCKET */ - soc_con[cnt].dfe_sd = socket(domain, SOCK_STREAM, 0); - if (soc_con[cnt].dfe_sd == -1) - { - sprintf(dfe_errmsg, "DFE-ipc ERROR, socket() call failed %s ", - strerror (errno)); - dfe_errno = UDIErrorUnknownError; - goto tip_failure; - } - -/*--------------------------------------------------------- AF_UNIX CONNECT */ - if (domain == AF_UNIX) - { - if (strcmp(soc_con[cnt].tip_string, "*") == 0) - { - for (pos = 0; pos < 20; pos++) - { - int f; - - sprintf(soc_con[cnt].tip_string,"/tmp/U%d", getpid() + pos); - f = open(soc_con[cnt].tip_string, O_CREAT); - if (f == -1) - continue; - - close(f); - unlink(soc_con[cnt].tip_string); - break; - } - - if (pos >= 20) - { - sprintf(dfe_errmsg, - "DFE-ipc ERROR, can't create random socket name"); - dfe_errno = UDIErrorCantConnect; - goto tip_failure; - } - } - - soc_con[cnt].tip_sockaddr.sa_family = domain; - memcpy(soc_con[cnt].tip_sockaddr.sa_data, - soc_con[cnt].tip_string, - sizeof(soc_con[cnt].tip_sockaddr.sa_data)); - if (connect(soc_con[cnt].dfe_sd, - &soc_con[cnt].tip_sockaddr, - sizeof(soc_con[cnt].tip_sockaddr))) - { /* if connect() fails assume TIP not yet started */ -/*------------------------------------------------------------ AF_UNIX EXEC */ - int pid; - int statusp; - char *arg0; - - arg0 = strrchr(soc_con[cnt].tip_exe,'/'); - - if (arg0) - arg0++; - else - arg0 = soc_con[cnt].tip_exe; - - pid = vfork(); - - if (pid == 0) /* Child */ - { - execlp(soc_con[cnt].tip_exe, - arg0, - soc_con[cnt].domain_string, - soc_con[cnt].tip_string, - NULL); - _exit(1); - } - - if (waitpid(pid, &statusp, WNOHANG)) - { - sprintf(dfe_errmsg, "DFE-ipc ERROR: can't exec the TIP"); - dfe_errno = UDIErrorCantStartTIP; - goto tip_failure; - } - - pos = 3; - for (pos = 3; pos > 0; pos--) - { - if (!connect(soc_con[cnt].dfe_sd, - &soc_con[cnt].tip_sockaddr, - sizeof(soc_con[cnt].tip_sockaddr))) - break; - sleep(1); - } - - if (pos == 0) - { - sprintf(dfe_errmsg, "DFE-ipc ERROR, connect() call failed: %s", - strerror (errno)); - dfe_errno = UDIErrorCantConnect; - goto tip_failure; - } - } - } -/*--------------------------------------------------------- AF_INET CONNECT */ - else if (domain == AF_INET) - { - fprintf(stderr, - "DFE-ipc WARNING, need to have first started remote TIP"); - - soc_con[cnt].tip_sockaddr_in.sin_family = domain; - soc_con[cnt].tip_sockaddr_in.sin_addr.s_addr = - inet_addr(soc_con[cnt].tip_string); - if (soc_con[cnt].tip_sockaddr_in.sin_addr.s_addr == -1) - { - tip_info_p = gethostbyname(soc_con[cnt].tip_string); - if (tip_info_p == NULL) - { - sprintf(dfe_errmsg,"DFE-ipc ERROR, No such host %s", - soc_con[cnt].tip_string); - dfe_errno = UDIErrorNoSuchConnection; - goto tip_failure; - } - memcpy((char *)&soc_con[cnt].tip_sockaddr_in.sin_addr, - tip_info_p->h_addr, - tip_info_p->h_length); - } - soc_con[cnt].tip_sockaddr_in.sin_port - = htons(atoi(soc_con[cnt].tip_exe)); - - if (connect(soc_con[cnt].dfe_sd, - (struct sockaddr *) &soc_con[cnt].tip_sockaddr_in, - sizeof(soc_con[cnt].tip_sockaddr_in))) - { - sprintf(dfe_errmsg, "DFE-ipc ERROR, connect() call failed %s ", - strerror (errno)); - dfe_errno = UDIErrorCantConnect; - goto tip_failure; - } - } -/*------------------------------------------------------------- TIP CONNECT */ - if (cnt == 0) udr_create(udrs, soc_con[cnt].dfe_sd, SOC_BUF_SIZE); - -tip_connect: - current = cnt; - session[*Session].in_use = TRUE; /* session id is now in use */ - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - - DFEIPCId = (company_c << 16) + (product_c << 12) + version_c; - udr_UDIUInt32(udrs, &DFEIPCId); - - udr_string(udrs, tip_main_string); - - udr_sendnow(udrs); - - udrs->udr_op = UDR_DECODE; /* recv all "out" parameters */ - udr_UDIUInt32(udrs, &TIPIPCId); - if ((TIPIPCId & 0xfff) < version_c) - sprintf(dfe_errmsg, "DFE-ipc: Obsolete TIP Specified"); - - udr_UDIInt32(udrs, &soc_con[cnt].tip_pid); - - udr_UDISessionId(udrs, &session[*Session].tip_id); - - udr_UDIError(udrs, &dfe_errno); - if (dfe_errno > 0) UDIKill(*Session, 0); - - return dfe_errno; - -tip_failure: - - soc_con[cnt].in_use = FALSE; - session[*Session].in_use = FALSE; -/* XXX - Should also close dfe_sd, but not sure what to do if muxed */ - return dfe_errno; -} - -/************************************************************** UDI_Disconnect -* UDIDisconnect() should be called before exiting the -* DFE to ensure proper shut down of the TIP. -*/ -UDIError UDIDisconnect(Session, Terminate) -UDISessionId Session; -UDIBool Terminate; -{ - int cnt; - UDIInt32 service_id = UDIDisconnect_c; - if(Session < 0 || Session > MAX_SESSIONS) - { - sprintf(dfe_errmsg," SessionId not valid (%d)", Session); - return UDIErrorNoSuchConfiguration; - } - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISessionId(udrs, &session[Session].tip_id); - udr_UDIBool(udrs, &Terminate); - udr_sendnow(udrs); - - session[Session].in_use = FALSE; /* session id is now free */ - for (cnt=0; cnt < MAX_SESSIONS; cnt++) - if(session[cnt].in_use - && session[cnt].soc_con_p == session[Session].soc_con_p - ) break; - if(cnt >= MAX_SESSIONS) /* test if socket not multiplexed */ - if(shutdown(session[Session].soc_con_p->dfe_sd, 2)) - { - sprintf(dfe_errmsg, "DFE-ipc WARNING: socket shutdown failed"); - return UDIErrorIPCInternal; - } - else - session[Session].soc_con_p->in_use = 0; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/******************************************************************** UDI_KILL -* UDIKill() is used to send a signal to the TIP. -* This is a private IPC call. -*/ -UDIError UDIKill(Session, Signal) -UDISessionId Session; -UDIInt32 Signal; -{ - int cnt; - UDIInt32 service_id = UDIKill_c; - if(Session < 0 || Session > MAX_SESSIONS) - { - sprintf(dfe_errmsg," SessionId not valid (%d)", Session); - return UDIErrorNoSuchConfiguration; - } - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISessionId(udrs, &session[Session].tip_id); - udr_UDIInt32(udrs, &Signal); - udr_sendnow(udrs); - - session[Session].in_use = FALSE; /* session id is now free */ - for (cnt=0; cnt < MAX_SESSIONS; cnt++) - if(session[cnt].in_use - && session[cnt].soc_con_p == session[Session].soc_con_p - ) break; - if(cnt < MAX_SESSIONS) /* test if socket not multiplexed */ - if(shutdown(session[Session].soc_con_p->dfe_sd, 2)) - { - sprintf(dfe_errmsg, "DFE-ipc WARNING: socket shutdown failed"); - return UDIErrorIPCInternal; - } - else - session[Session].soc_con_p->in_use = 0; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/************************************************** UDI_Set_Current_Connection -* If you are connected to multiple TIPs, you can change -* TIPs using UDISetCurrentConnection(). -*/ -UDIError UDISetCurrentConnection(Session) -UDISessionId Session; -{ - UDIInt32 service_id = UDISetCurrentConnection_c; - - if(Session < 0 || Session > MAX_SESSIONS) - return UDIErrorNoSuchConfiguration; - if(!session[Session].in_use) /* test if not in use yet */ - return UDIErrorNoSuchConnection; - - current = Session; - /* change socket or multiplex the same socket */ - udrs->sd = session[Session].soc_con_p->dfe_sd; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISessionId(udrs, &session[Session].tip_id); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/************************************************************ UDI_Capabilities -* The DFE uses UDICapabilities() to both inform the TIP -* of what services the DFE offers and to inquire of the -* TIP what services the TIP offers. -*/ -UDIError UDICapabilities(TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, - TIPIPCId, TIPString) -UDIUInt32 *TIPId; /* out */ -UDIUInt32 *TargetId; /* out */ -UDIUInt32 DFEId; /* in */ -UDIUInt32 DFE; /* in */ -UDIUInt32 *TIP; /* out */ -UDIUInt32 *DFEIPCId; /* out */ -UDIUInt32 *TIPIPCId; /* out */ -char *TIPString; /* out */ -{ - UDIInt32 service_id = UDICapabilities_c; - int size; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIInt32(udrs, &DFEId); - udr_UDIInt32(udrs, &DFE); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */ - udr_UDIInt32(udrs, TIPId); - udr_UDIInt32(udrs, TargetId); - udr_UDIInt32(udrs, TIP); - udr_UDIInt32(udrs, DFEIPCId); - *DFEIPCId = (company_c << 16) + (product_c << 12) + version_c; - udr_UDIInt32(udrs, TIPIPCId); - udr_string(udrs, sbuf); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - size = strlen(sbuf); - if(size +1 > 80) return -1; /* test if sufficient space */ - strcpy(TIPString, sbuf); - return dfe_errno; -} - -/********************************************************** UDI_Enumerate_TIPs -* Used by the DFE to enquire about available TIP -* connections. -*/ -UDIError UDIEnumerateTIPs(UDIETCallback) - int (*UDIETCallback)(); /* In -- function to callback */ -{ - FILE *fp; - - fp = fopen(config_file, "r"); - if(fp == NULL) - return UDIErrorCantOpenConfigFile; - while(fgets( sbuf, SBUF_SIZE, fp)) - if(UDIETCallback( sbuf) == UDITerminateEnumeration) - break; - fclose( fp); - return UDINoError; /* return success */ -} - -/*********************************************************** UDI_GET_ERROR_MSG -* Some errors are target specific. They are indicated -* by a negative error return value. The DFE uses -* UDIGetErrorMsg() to get the descriptive text for -* the error message which can then be displayed to -* the user. -*/ -UDIError UDIGetErrorMsg(error_code, msg_len, msg, CountDone) -UDIError error_code; /* In */ -UDISizeT msg_len; /* In -- allowed message space */ -char* msg; /* Out -- length of message*/ -UDISizeT *CountDone; /* Out -- number of characters */ -{ - UDIInt32 service_id = UDIGetErrorMsg_c; - int size; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIError(udrs, &error_code); - udr_UDISizeT(udrs, &msg_len); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_string(udrs, sbuf); - udr_UDISizeT(udrs, CountDone); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - size = strlen(sbuf); - if(size +1 > msg_len) return -1; /* test if sufficient space */ - strcpy(msg, sbuf); - return dfe_errno; -} - -/******************************************************* UDI_GET_TARGET_CONFIG -* UDIGetTargetConfig() gets information about the target. -*/ -UDIError UDIGetTargetConfig(KnownMemory, NumberOfRanges, ChipVersions, - NumberOfChips) -UDIMemoryRange KnownMemory[]; /* Out */ -UDIInt *NumberOfRanges; /* In and Out */ -UDIUInt32 ChipVersions[]; /* Out */ -UDIInt *NumberOfChips; /* In and Out */ -{ - UDIInt32 service_id = UDIGetTargetConfig_c; - int cnt; - int MaxOfRanges = *NumberOfRanges; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIInt(udrs, NumberOfRanges); - udr_UDIInt(udrs, NumberOfChips); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */ - for(cnt=1; cnt <= MaxOfRanges; cnt++) - udr_UDIMemoryRange(udrs, &KnownMemory[cnt-1]); - udr_UDIInt(udrs, NumberOfRanges); - udr_UDIInt(udrs, NumberOfChips); - for(cnt=1; cnt <= *NumberOfChips; cnt++) - udr_UDIUInt32(udrs, &ChipVersions[cnt -1]); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/********************************************************** UDI_CREATE_PRCOESS -* UDICreateProcess() tells the target OS that a -* process is to be created and gets a PID back unless -* there is some error. -*/ -UDIError UDICreateProcess(pid) -UDIPId *pid; /* out */ -{ - UDIInt32 service_id = UDICreateProcess_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIPId(udrs, pid); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/***************************************************** UDI_Set_Current_Process -* UDISetCurrentProcess uses a pid supplied by -* UDICreateProcess and sets it as the default for all -* udi calls until a new one is set. A user of a -*/ -UDIError UDISetCurrentProcess (pid) -UDIPId pid; /* In */ -{ - UDIInt32 service_id = UDISetCurrentProcess_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIPId(udrs, &pid); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/****************************************************** UDI_INITIALISE_PROCESS -* UDIInitializeProcess() prepare process for -* execution. (Reset processor if process os processor). -*/ -UDIError UDIInitializeProcess( ProcessMemory, NumberOfRanges, EntryPoint, - StackSizes, NumberOfStacks, ArgString) -UDIMemoryRange ProcessMemory[]; /* In */ -UDIInt NumberOfRanges; /* In */ -UDIResource EntryPoint; /* In */ -CPUSizeT *StackSizes; /* In */ -UDIInt NumberOfStacks; /* In */ -char *ArgString; /* In */ -{ - UDIInt32 service_id = UDIInitializeProcess_c; - int cnt; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIInt(udrs, &NumberOfRanges); - for(cnt = 0; cnt < NumberOfRanges; cnt++) - udr_UDIMemoryRange(udrs, &ProcessMemory[cnt] ); - udr_UDIResource(udrs, &EntryPoint); - udr_UDIInt(udrs, &NumberOfStacks); - for(cnt = 0; cnt < NumberOfStacks; cnt++) - udr_CPUSizeT(udrs, &StackSizes[cnt]); - udr_string(udrs, ArgString); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/********************************************************* UDI_DESTROY_PROCESS -* UDIDestroyProcess() frees a process resource -* previously created by UDICreateProcess(). -*/ -UDIError UDIDestroyProcess(pid) -UDIPId pid; /* in */ -{ - UDIInt32 service_id = UDIDestroyProcess_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIPId(udrs, &pid); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/****************************************************************** UDI_READ -* UDIRead() reads a block of objects from a target -* address space to host space. -*/ - -UDIError UDIRead (from, to, count, size, count_done, host_endian) -UDIResource from; /* in - source address on target */ -UDIHostMemPtr to; /* out - destination address on host */ -UDICount count; /* in -- count of objects to be transferred */ -UDISizeT size; /* in -- size of each object */ -UDICount *count_done; /* out - count actually transferred */ -UDIBool host_endian; /* in -- flag for endian information */ -{ - UDIInt32 service_id = UDIRead_c; - int byte_count; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIResource(udrs, &from); - udr_UDICount(udrs, &count); - udr_UDISizeT(udrs, &size); - udr_UDIBool(udrs, &host_endian); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */ - udr_UDICount(udrs, count_done); - byte_count = (*count_done) * size; - if(*count_done > 0 && *count_done <= count) - udr_bytes(udrs, to, byte_count); - if(udr_errno) return udr_errno; - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/****************************************************************** UDI_WRITE -* UDIWrite() writes a block of objects from host -* space to a target address+space. -*/ -UDIError UDIWrite( from, to, count, size, count_done, host_endian ) -UDIHostMemPtr from; /* in -- source address on host */ -UDIResource to; /* in -- destination address on target */ -UDICount count; /* in -- count of objects to be transferred */ -UDISizeT size; /* in -- size of each object */ -UDICount *count_done; /* out - count actually transferred */ -UDIBool host_endian; /* in -- flag for endian information */ -{ - UDIInt32 service_id = UDIWrite_c; - int byte_count = count * size; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIResource(udrs, &to); - udr_UDICount(udrs, &count); - udr_UDISizeT(udrs, &size); - udr_UDIBool(udrs, &host_endian); - udr_bytes(udrs, from, byte_count); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" paramters */ - udr_UDICount(udrs, count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/******************************************************************** UDI_COPY -* UDICopy() copies a block of objects from one target -* get address/space to another target address/space. -*/ -UDIError UDICopy(from, to, count, size, count_done, direction ) -UDIResource from; /* in -- destination address on target */ -UDIResource to; /* in -- source address on target */ -UDICount count; /* in -- count of objects to be transferred */ -UDISizeT size; /* in -- size of each object */ -UDICount *count_done; /* out - count actually transferred */ -UDIBool direction; /* in -- high-to-low or reverse */ -{ - UDIInt32 service_id = UDICopy_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIResource(udrs, &from); - udr_UDIResource(udrs, &to); - udr_UDICount(udrs, &count); - udr_UDISizeT(udrs, &size); - udr_UDIBool(udrs, &direction); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDICount(udrs, count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/***************************************************************** UDI_EXECUTE -* UDIExecute() continues execution of the default -* process from the current PC. -*/ -UDIError UDIExecute() -{ - UDIInt32 service_id = UDIExecute_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/******************************************************************** UDI_STEP -* UDIStep() specifies a number of "instruction" -* steps to make. -*/ -UDIError UDIStep(steps, steptype, range) -UDIUInt32 steps; /* in -- number of steps */ -UDIStepType steptype; /* in -- type of stepping to be done */ -UDIRange range; /* in -- range if StepInRange is TRUE */ -{ - UDIInt32 service_id = UDIStep_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIInt32(udrs, &steps); - udr_UDIStepType(udrs, &steptype); - udr_UDIRange(udrs, &range); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/******************************************************************** UDI_STOP -* UDIStop() stops the default process -*/ -UDIVoid UDIStop() -{ - if (strcmp(session[current].soc_con_p->domain_string, "AF_UNIX") == 0) - kill(session[current].soc_con_p->tip_pid, SIGINT); - else - udr_signal(udrs); - -/* XXX - should clean up session[] and soc_con[] structs here as well... */ - - return; -} - -/******************************************************************** UDI_WAIT -* UDIWait() returns the state of the target procesor. -*/ -UDIError UDIWait(maxtime, pid, stop_reason) -UDIInt32 maxtime; /* in -- maximum time to wait for completion */ -UDIPId *pid; /* out -- pid of process which stopped if any */ -UDIUInt32 *stop_reason; /* out -- PC where process stopped */ -{ - UDIInt32 service_id = UDIWait_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIInt32(udrs, &maxtime); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIPId(udrs, pid); - udr_UDIUInt32(udrs, stop_reason); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/********************************************************** UDI_SET_BREAKPOINT -* UDISetBreakpoint() sets a breakpoint at an adress -* and uses the passcount to state how many -* times that instruction should be hit before the -* break occurs. -*/ -UDIError UDISetBreakpoint (addr, passcount, type, break_id) -UDIResource addr; /* in -- where breakpoint gets set */ -UDIInt32 passcount; /* in -- passcount for breakpoint */ -UDIBreakType type; /* in -- breakpoint type */ -UDIBreakId *break_id; /* out - assigned break id */ -{ - UDIInt32 service_id = UDISetBreakpoint_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIResource(udrs, &addr); - udr_UDIInt32(udrs, &passcount); - udr_UDIBreakType(udrs, &type); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIBreakId(udrs, break_id); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/******************************************************** UDI_QUERY_BREAKPOINT -*/ -UDIError UDIQueryBreakpoint (break_id, addr, passcount, type, current_count) -UDIBreakId break_id; /* in -- assigned break id */ -UDIResource *addr; /* out - where breakpoint was set */ -UDIInt32 *passcount; /* out - trigger passcount for breakpoint */ -UDIBreakType *type; /* out - breakpoint type */ -UDIInt32 *current_count; /* out - current count for breakpoint */ -{ - UDIInt32 service_id = UDIQueryBreakpoint_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIBreakId(udrs, &break_id); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIResource(udrs, addr); - udr_UDIInt32(udrs, passcount); - udr_UDIBreakType(udrs, type); - udr_UDIInt32(udrs, current_count); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/******************************************************** UDI_CLEAR_BREAKPOINT -* UDIClearBreakpoint() is used to clear a breakpoint. -*/ -UDIError UDIClearBreakpoint (break_id) -UDIBreakId break_id; /* in -- assigned break id */ -{ - UDIInt32 service_id = UDIClearBreakpoint_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIBreakId(udrs, &break_id); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/************************************************************** UDI_GET_STDOUT -* UDIGetStdout() is called when a call to -* UDIWait() indicates there is STD output data ready. -*/ -UDIError UDIGetStdout(buf, bufsize, count_done) -UDIHostMemPtr buf; /* out -- buffer to be filled */ -UDISizeT bufsize; /* in -- buffer size in bytes */ -UDISizeT *count_done; /* out -- number of bytes written to buf */ -{ - UDIInt32 service_id = UDIGetStdout_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISizeT(udrs, &bufsize); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDISizeT(udrs, count_done); - udr_bytes(udrs, buf, *count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/************************************************************** UDI_GET_STDERR -* UDIGetStderr() is called when a call to -* UDIWait() indicates there is STDERR output data ready -*/ -UDIError UDIGetStderr(buf, bufsize, count_done) -UDIHostMemPtr buf; /* out -- buffer to be filled */ -UDISizeT bufsize; /* in -- buffer size in bytes */ -UDISizeT *count_done; /* out -- number of bytes written to buf */ -{ - UDIInt32 service_id = UDIGetStderr_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISizeT(udrs, &bufsize); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDISizeT(udrs, count_done); - udr_bytes(udrs, buf, *count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/*************************************************************** UDI_PUT_STDIN -* UDIPutStdin() is called whenever the DFE wants to -* deliver an input character to the TIP. -*/ -UDIError UDIPutStdin (buf, count, count_done) -UDIHostMemPtr buf; /* in -- buffer to be filled */ -UDISizeT count; /* in -- buffer size in bytes */ -UDISizeT *count_done; /* out - number of bytes written to buf */ -{ - UDIInt32 service_id = UDIPutStdin_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISizeT(udrs, &count); - udr_bytes(udrs, buf, count); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDISizeT(udrs, count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/************************************************************** UDI_STDIN_MODE -* UDIStdinMode() is used to change the mode that chazcters -* are fetched from the user. -*/ -UDIError UDIStdinMode(mode) -UDIMode *mode; /* out - */ -{ - UDIInt32 service_id = UDIStdinMode_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIMode(udrs, mode); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/*************************************************************** UDI_PUT_TRANS -* UDIPutTrans() is used to feed input to the passthru mode. -*/ -UDIError UDIPutTrans (buf, count, count_done) -UDIHostMemPtr buf; /* in -- buffer address containing input data */ -UDISizeT count; /* in -- number of bytes in buf */ -UDISizeT *count_done; /* out-- number of bytes transfered */ -{ - UDIInt32 service_id = UDIPutTrans_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISizeT(udrs, &count); - udr_bytes(udrs, buf, count); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDISizeT(udrs, count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/*************************************************************** UDI_GET_TRANS -* UDIGetTrans() is used to get output lines from the -* passthru mode. -*/ -UDIError UDIGetTrans (buf, bufsize, count_done) -UDIHostMemPtr buf; /* out -- buffer to be filled */ -UDISizeT bufsize; /* in -- size of buf */ -UDISizeT *count_done; /* out -- number of bytes in buf */ -{ - UDIInt32 service_id = UDIGetTrans_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDISizeT(udrs, &bufsize); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDISizeT(udrs, count_done); - udr_bytes(udrs, buf, *count_done); - udr_UDIError(udrs, &dfe_errno); /* get any TIP error */ - return dfe_errno; -} - -/************************************************************** UDI_Trans_Mode -* UDITransMode() is used to change the mode that the -* transparent routines operate in. -*/ -UDIError UDITransMode(mode) -UDIMode *mode; /* out -- selected mode */ -{ - UDIInt32 service_id = UDITransMode_c; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - udr_UDIMode(udrs, mode); - udr_sendnow(udrs); - if(udr_errno) return udr_errno; - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - udr_UDIError(udrs, &dfe_errno); - return dfe_errno; -} - -/******************************************************************** UDI_TEST -*/ -UDIError UDITest( cnt, str_p, array) -UDISizeT cnt; -UDIHostMemPtr str_p; -UDIInt32 array[]; -{ - UDIInt32 service_id = UDITest_c; - UDIInt16 scnt = cnt; - UDISizeT r_cnt; - char buf[256]; - - udr_errno = 0; - udrs->udr_op = UDR_ENCODE; /* send all "in" parameters */ - udr_UDIInt32(udrs, &service_id); - - printf("send cnt=%d scnt=%d\n", cnt, scnt); - udr_UDISizeT(udrs, &cnt); - udr_UDIInt16(udrs, &scnt); - printf(" array[0]=0x%x array[1]=0x%x array[2]=0x%x array[3]=0x%x\n", - array[0], array[1], array[2], array[3]); - udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32)); - printf(" string=%s\n", str_p); - udr_string(udrs, str_p); - udr_sendnow(udrs); - if(udr_errno) - { fprintf(stderr, " DFE-ipc Send ERROR\n"); - return udr_errno; - } - - udrs->udr_op = UDR_DECODE; /* receive all "out" parameters */ - printf("recv "); - udr_UDISizeT(udrs, &r_cnt); - udr_UDIInt16(udrs, &scnt); - printf(" rcnt=%d scnt=%d\n", r_cnt, scnt); - udr_bytes(udrs, (char*)array, 4*sizeof(UDIInt32)); - - printf(" array[0]=0x%x array[1]=0x%x array[2]=0x%x array[3]=0x%x\n", - array[0], array[1], array[2], array[3]); - udr_string(udrs, str_p); - printf(" string=%s\n", str_p); - - udr_UDIError(udrs, &dfe_errno); - return dfe_errno; -} - - - -UDIUInt32 UDIGetDFEIPCId() -{ - return ((company_c << 16) + (product_c << 12) + version_c); -} -#endif /* __GO32__ */ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a5e0502b82e..c1582ca06ba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2002-05-23 Andrew Cagney + + * regbuf.h, regbuf.c: Delete. + 2002-05-23 Andrew Cagney * regcache.c (register_buffer): Add regcache parameter. Update @@ -242,6 +246,1516 @@ (COMMON_OBS): Add regbuf.o. (regbuf.o): Specify dependencies. +2002-06-14 Andrew Cagney + + * gdbarch.sh (DEPRECATED_EXTRACT_RETURN_VALUE): Rename + EXTRACT_RETURN_VALUE. + (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Rename + EXTRACT_STRUCT_VALUE_ADDRESS. + * gdbarch.h, gdbarch.c: Regenerate. + + * values.c (value_being_returned): Handle + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS. + (EXTRACT_RETURN_VALUE): Define as DEPRECATED_EXTRACT_RETURN_VALUE. + + * arm-linux-tdep.c (arm_linux_init_abi): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * avr-tdep.c (avr_gdbarch_init): Update. + * cris-tdep.c (cris_gdbarch_init): Update. + * d10v-tdep.c (d10v_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * sparc-tdep.c (sparc_gdbarch_init): Update. + * ns32k-tdep.c (ns32k_gdbarch_init): Update. + * v850-tdep.c (v850_gdbarch_init): Update. + * vax-tdep.c (vax_gdbarch_init): Update. + * x86-64-tdep.c (x86_64_gdbarch_init): Update. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + + * config/arc/tm-arc.h: Update. + * config/d30v/tm-d30v.h: Update. + * config/fr30/tm-fr30.h: Update. + * config/h8300/tm-h8300.h: Update. + * config/h8500/tm-h8500.h: Update. + * config/i386/tm-i386.h: Update. + * config/i386/tm-ptx.h: Update. + * config/i386/tm-symmetry.h: Update. + * config/i960/tm-i960.h: Update. + * config/m32r/tm-m32r.h: Update. + * config/m68k/tm-delta68.h: Update. + * config/m68k/tm-linux.h: Update. + * config/m68k/tm-m68k.h: Update. + * config/m88k/tm-m88k.h: Update. + * config/mcore/tm-mcore.h: Update. + * config/mips/tm-mips.h: Update. + * config/mn10200/tm-mn10200.h: Update. + * config/pa/tm-hppa.h: Update. + * config/pa/tm-hppa64.h: Update. + * config/sparc/tm-sp64.h: Update. + * config/sparc/tm-sparc.h: Update. + * config/sparc/tm-sparclet.h: Update. + * config/z8k/tm-z8k.h: Update. + +2002-06-14 Andrew Cagney + + * Makefile.in (i386_linux_tdep_h): Define. + (i386_tdep_h, i387_tdep_h): Define. + (i386-linux-nat.o): Add $(i386_linux_tdep_h), + $(i386_tdep_h) and $(i387_tdep_h). + * i386-linux-nat.c: Include "i386-linux-tdep.h". + +2002-06-14 Mark Kettenis + + * config/i386/tm-i386.h (START_INFERIOR_TRAPS_EXPECTED): Removed. + Already covered by the default. + + * config/i386/tm-i386.h (TARGET_LONG_DOUBLE_FORMAT, + TARGET_LONG_DOUBLE_BIT): Remove. * i386-tdep.c + (i386_gdbarch_init): Initialize long_double_format and long_double + bit. + + * config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and + i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. + Move these to ... + * config/i386/i386sol2.mh: ... here. + * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. + (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. + (SIGCONTEXT_PC_OFFSET): Remove define. + (IN_SIGTRAMP): Remove define. + * i386-sol2-tdep.c: New file. + + * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. + * config/i386/tm-i386nw.h: Removed. + + * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, + USE_STRUCT_CONVENTION): Remove defines. + (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. + (get_longjmp_target): Remove prototype. + (IN_SIGTRAMP): Remove define. + (i386bsd_in_sigtramp): Remove prototype. + (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a + function. Update comment accordingly + (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. + (FRAME_SAVED_PC): Remove define. + (i386bsd_frame_saved_pc): Remove prototype. + * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, + GET_LONGJMP_TARGET): Remove defines. + (get_longjmp_target): Remove prototype. + (IN_SIGTRAMP): Remove define. + (i386bsd_in_sigtramp): Remove prototype. + (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a + function. Update comment accordingly + (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. + (FRAME_SAVED_PC): Remove define. + (i386bsd_frame_saved_pc): Remove prototype. + * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): + Remove prototype. + (USE_STRUCT_CONVENTION): Remove prototype. + * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove + declaration. + (_initialize_i386bsd_nat): Revise logic to determine some + constants at compile time when compiling a native GDB. Warn if + things don't match up with what we expect. + * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): + Remove variables. + (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite + to use date stored in `struct gdbarch_tdep'. + (i386bsd_sigcontext_offset): Remove varaible. + (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data + stored in `struct gdbarch_tdep'. + (i386bsd_frame_saved_pc): Make static. + (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. + (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, + i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, + i386fbsd4_sc_pc_offset): New variables. + (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, + i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New + functions. + (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New + functions. + * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. + Modify the value of i386fbsd_sigtramp_start and + i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and + i386fbsd_sigtramp_end. + * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove + function. + + * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move + define to i386-linux-tdep.h. + (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, + REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove + defines. + (i386_linux_register_name, i386_linux_register_byte, + i386_linux_register_raw_size): Remove prototypes. + (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. + (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. + (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, + TARGET_WRITE_PC): Remove defines. + (i386_linux_in_sigtramp, i386_linux_frame_chain, + i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, + i386_linux_write_pc): Remove prototypes. + (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. + (get_longjmp_target): Remove prototype. + * i386-linux-tdep.h: New file. + * i386-linux-nat.c: Include "i386-linux-tdep.h". + * i386-linux-tdep.c: Include "i386-tdep.h" and + "i386-linux-tdep.h". + (i386_linux_register_name, i386_linux_register_byte, + i386_linux_register_raw_size, i386_linux_in_sigtramp, + i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): + Make static. + (i386_linux_init_abi): New function. + (_initialize_i386_linux_tdep): New function. + + * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. + (i386_saved_pc_after_call): Remove prototype. + (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". + (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, + DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. + (i386_register_name, i386_stab_reg_to_regnum, + i386_dwarf_reg_to_regnum): Remove prototypes. + (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, + SIZEOF_SSE_REGS): Remove defines. + (REGISTER_BYTES): Remove define. + (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. + (i386_register_byte, i386_register_raw_size): Remove prototypes. + (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. + (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. + * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. + (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, + JB_EDX, GET_LONGJMP_TARGET): Remove defines. + (get_longjmp_target): Remove prototype. + (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. + (sigtramp_saved_pc): Remove define. + (i386v4_sigtramp_saved_pc): Remove prototype. + * config/i386/tm-go32.h (FRAME_CHAIN, + FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. + (i386go32_frame_saved_pc): Remove prototype. + (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. + (get_longjmp_target): Remove prototype. + * i386-tdep.h: Include "osabi.h". + (enum i386_abi): Removed. + (enum struct_return): New enum. + (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, + struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and + sc_pc_offset members. + (i386_gdbarch_register_os_abi): Remove prototype. + (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, + I386_SSE_NUM_REGS): New defines. + (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, + I386_SSE_SIZEOF_REGS): New defines. + (i386_register_name, i386_register_byte, i386_register_raw_size): + New prototypes. + (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. + (i386bsd_sigtramp_saved_pc): New prototype. + * i386-tdep.c: Don't include "elf-bfd.h". + (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, + i386_frame_chain, i386_saved_pc_after_call): Make static. + (i386_frame_saved_pc): Rewrite to call architecture dependent + function to deal with signal handlers. Make static. + (i386go32_frame_saved_pc): Removed. + [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): + Removed. + (i386_get_longjmp_target): New function. + (default_struct_convention, pcc_struct_convention, + reg_struct_convention, valid_conventions, struct_convention): New + variables. + (i386_use_struct_convention): New function. + (i386v4_sigtramp_saved_pc): Renamed to + i386_svr4_sigtramp_saved_pc. Made static. Moved. + (i386_pc_in_sigtramp): New function. + (i386_abi_names): Removed. + (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, + ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): + Removed. + (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, + i386_gdbarch_register_os_abi): Removed. + (struct i386_abi_handler): Removed. + (i386_abi_handler_list): Removed. + (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New + functions. + (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, + i386_nw_init_abi): New functions. + (i386_gdbarch_init): Rewritten to use generic OS ABI framework. + Use set_gdbarch_xxx() calls instead of relying on macros for a + number of calls. + (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. + (_initialize_i386_tdep): Add new 'struct-convcention' command. + Register the various architecture variants defined in this file. + +2002-06-14 Daniel Jacobowitz + + * gdbtypes.h (TYPE_FLAG_VARARGS): Update comment. + (struct main_type): Remove arg_types member. Update comments for + struct field. + (TYPE_ARG_TYPES): Remove. + (TYPE_FN_FIELD_ARGS): Update. + (smash_to_method_type): Update prototype. + + * c-typeprint.c (cp_type_print_method_args): Take method type + instead of argument list. Use new argument layout. Simplify. + (c_type_print_args): Use new argument layout. Simplify. + (c_type_print_base): Update call to cp_type_print_method_args. + * dwarf2read.c (dwarf2_add_member_fn): Remove unneeded type + argument; use die->type instead. Update call to + smash_to_method_type. + (read_structure_scope): Update call to dwarf2_add_member_fn. + * gdbtypes.c (allocate_stub_method): Update comment. + (smash_to_method_type): Take new NARGS and VARARGS arguments. + Use new argument layout. + (check_stub_method): Use new argument layout. Don't count + void as an argument. + (print_arg_types): Update comments. Use new argument layout. + (recursive_dump_type): Don't print arg_types member. + * hpread.c (hpread_read_struct_type): Use new argument layout. + (fixup_class_method_type): Likewise. + (hpread_type_lookup): Likewise. + * stabsread.c (read_type): Update calls to read_args and + smash_to_method_type. + (read_args): Use new argument layout. Simplify. + * valops.c (typecmp): Use new argument layout. Update parameters + and comments. Simplify. + (hand_function_call): Use new argument layout. + (search_struct_method): Update call to typecmp. + (find_overload_match): Use new argument layout. + +2002-06-13 Daniel Jacobowitz + + * NEWS: Mention multithreaded debug support for gdbserver. + +2002-06-13 Daniel Jacobowitz + + * MAINTAINERS: Mention NEWS. + +2002-06-13 Daniel Jacobowitz + + * gdbserver/regcache.c: Add comment. + +2002-06-13 Daniel Jacobowitz + + * mips-tdep.c (PROC_SYMBOL): Add warning comment. + (struct mips_objfile_private, compare_pdr_entries): New. + (non_heuristic_proc_desc): Read the ".pdr" section if it + is present. + +2002-06-12 Andrew Cagney + + * arm-tdep.c (arm_push_arguments): Rewrite using a two-pass loop. + (arm_debug): New static variable. + (_initialize_arm_tdep): Add ``set debug arm'' command. + +2002-06-12 Andrew Cagney + + * Makefile.in (sim_arm_h): Define. + (arm-tdep.o): Add $(sim_arm_h) and $(gdb_assert_h). + * arm-tdep.c: Include "gdb/sim-arm.h" and "gdb_assert.h". + (arm_register_sim_regno): New function, map an internal REGNUM + onto a simulator register number. + (arm_gdbarch_init): Set register_sim_regno. + +2002-06-09 Aldy Hernandez + + * MAINTAINERS: Add self. + +2002-06-11 Jim Blandy + + * source.c (source_info): Mention whether the symtab has + information about preprocessor macros. + + Call the command `info macro', not `show macro'. + * macrocmd.c (info_macro_command): Renamed from `show_macro_command'. + Fix error message. + (_initialize_macrocmd): Register `info_macro_command' in + `infolist', not `showlist'. + +2002-06-11 Daniel Jacobowitz + + * mips-tdep.c (MIPS_FPU_TYPE, FP_REGISTER_DOUBLE, MIPS_EABI) + (MIPS_LAST_FP_ARG_REGNUM, MIPS_LAST_ARG_REGNUM) + (MIPS_DEFAULT_SAVED_REGSIZE, MIPS_REGS_HAVE_HOME_P) + (MIPS_DEFAULT_STACK_ARGSIZE, GDB_TARGET_IS_MIPS64) + (MIPS_DEFAULT_MASK_ADDRESS_P): Remove obsolete definitions. Define + unconditionally. + (set_mipsfpu_single_command, set_mipsfpu_double_command) + (set_mipsfpu_none_command): Remove if (GDB_MULTI_ARCH). + (_initialize_mips_tdep): Remove dead code. + * config/mips/tm-irix5.h (MIPS_LAST_ARG_REGNUM) + (MIPS_DEFAULT_STACK_ARGSIZE, MIPS_REGS_HAVE_HOME_P): Remove. + * config/mips/tm-irix6.h (MIPS_LAST_ARG_REGNUM) + (MIPS_DEFAULT_STACK_ARGSIZE, MIPS_REGS_HAVE_HOME_P): Remove. + * config/mips/tm-mips.h (MIPS_EABI, MIPS_LAST_ARG_REGNUM, + MIPS_LAST_FP_ARG_REGNUM): Remove. + +2002-06-11 Daniel Jacobowitz + + * gdbserver/thread-db.c: New file. + * gdbserver/proc-service.c: New file. + * gdbserver/acinclude.m4: New file. + * gdbserver/Makefile.in: Add GDBSERVER_LIBS, gdb_proc_service_h, + proc-service.o, and thread-db.o. + (linux-low.o): Add USE_THREAD_DB. + * gdbserver/acconfig.h: Add HAVE_PRGREGSET_T, HAVE_PRFPREGSET_T, + HAVE_LWPID_T, HAVE_PSADDR_T, and PRFPREGSET_T_BROKEN. + * gdbserver/aclocal.m4: Regenerated. + * gdbserver/config.in: Regenerated. + * gdbserver/configure: Regenerated. + * gdbserver/configure.in: Check for proc_service.h, sys/procfs.h, + thread_db.h, and linux/elf.h headrs. + Check for lwpid_t, psaddr_t, prgregset_t, prfpregset_t, and + PRFPREGSET_T_BROKEN. Introduce srv_thread_depfiles and USE_THREAD_DB. + Check for -lthread_db and thread support. + * gdbserver/configure.srv: Enable thread_db support for ARM, i386, MIPS, + PowerPC, and SuperH. + * gdbserver/i387-fp.c: Constify arguments. + * gdbserver/i387-fp.h: Likewise. + * gdbserver/inferiors.c: (struct thread_info): Renamed from + `struct inferior_info'. Remove PID member. Use generic inferior + list header. All uses updated. + (inferiors, signal_pid): Removed. + (all_threads): New variable. + (get_thread): Define. + (add_inferior_to_list): New function. + (for_each_inferior): New function. + (change_inferior_id): New function. + (add_inferior): Removed. + (remove_inferior): New function. + (add_thread): New function. + (free_one_thread): New function. + (remove_thread): New function. + (clear_inferiors): Use for_each_inferior and free_one_thread. + (find_inferior): New function. + (find_inferior_id): New function. + (inferior_target_data): Update argument type. + (set_inferior_target_data): Likewise. + (inferior_regcache_data): Likewise. + (set_inferior_regcache_data): Likewise. + * gdbserver/linux-low.c (linux_bp_reinsert): Remove. + (all_processes, stopping_threads, using_thrads) + (struct pending_signals, debug_threads, pid_of): New. + (inferior_pid): Replace with macro. + (struct inferior_linux_data): Remove. + (get_stop_pc, add_process): New functions. + (linux_create_inferior): Restore SIGRTMIN+1 before calling exec. + Use add_process and add_thread. + (linux_attach_lwp): New function, based on old linux_attach. Use + add_process and add_thread. Set stop_expected for new threads. + (linux_attach): New function. + (linux_kill_one_process): New function. + (linux_kill): Kill all LWPs. + (linux_thread_alive): Use find_inferior_id. + (check_removed_breakpoints, status_pending_p): New functions. + (linux_wait_for_process): Renamed from linux_wait_for_one_inferior. + Update. Use WNOHANG. Wait for cloned processes also. Update process + struct for the found process. + (linux_wait_for_event): New function. + (linux_wait): Use it. Support LWPs. + (send_sigstop, wait_for_sigstop, stop_all_processes) + (linux_resume_one_process, linux_continue_one_process): New functions. + (linux_resume): Support LWPs. + (REGISTER_RAW_SIZE): Remove. + (fetch_register): Use register_size instead. Call supply_register. + (usr_store_inferior_registers): Likewise. Call collect_register. + Fix recursive case. + (regsets_fetch_inferior_registers): Improve error message. + (regsets_store_inferior_registers): Add debugging. + (linux_look_up_symbols): Call thread_db_init if USE_THREAD_DB. + (unstopped_p, linux_signal_pid): New functions. + (linux_target_ops): Add linux_signal_pid. + (linux_init_signals): New function. + (initialize_low): Call it. Initialize using_threads. + * gdbserver/regcache.c (inferior_regcache_data): Add valid + flag. + (get_regcache): Fetch registers lazily. Add fetch argument + and update all callers. + (regcache_invalidate_one, regcache_invalidate): New + functions. + (new_register_cache): Renamed from create_register_cache. + Return the new regcache. + (free_register_cache): Change argument to a void *. + (registers_to_string, registers_from_string): Call get_regcache + with fetch flag set. + (register_data): Make static. Pass fetch flag to get_regcache. + (supply_register): Call get_regcache with fetch flag clear. + (collect_register): Call get_regcache with fetch flag set. + (collect_register_as_string): New function. + * gdbserver/regcache.h: Update. + * gdbserver/remote-utils.c (putpkt): Flush after debug output and use + stderr. + Handle input interrupts while waiting for an ACK. + (input_interrupt): Use signal_pid method. + (getpkt): Flush after debug output and use stderr. + (outreg): Use collect_register_as_string. + (new_thread_notify, dead_thread_notify): New functions. + (prepare_resume_reply): Check using_threads. Set thread_from_wait + and general_thread. + (look_up_one_symbol): Flush after debug output. + * gdbserver/server.c (step_thread, server_waiting): New variables. + (start_inferior): Don't use signal_pid. Update call to mywait. + (attach_inferior): Update call to mywait. + (handle_query): Handle qfThreadInfo and qsThreadInfo. + (main): Don't fetch/store registers explicitly. Use + set_desired_inferior. Support proposed ``Hs'' packet. Update + calls to mywait. + * gdbserver/server.h: Update. + (struct inferior_list, struct_inferior_list_entry): New. + * gdbserver/target.c (set_desired_inferior): New. + (write_inferior_memory): Constify. + (mywait): New function. + * gdbserver/target.h: Update. + (struct target_ops): New signal_pid method. + (mywait): Removed macro, added prototype. + + * gdbserver/linux-low.h (regset_func): Removed. + (regset_fill_func, regset_store_func): New. + (enum regset_type): New. + (struct regset_info): Add type field. Use new operation types. + (struct linux_target_ops): stop_pc renamed to get_pc. + Add decr_pc_after_break and breakpoint_at. + (get_process, get_thread_proess, get_process_thread) + (strut process_info, all_processes, linux_attach_lwp) + (thread_db_init): New. + + * gdbserver/linux-arm-low.c (arm_get_pc, arm_set_pc, + arm_breakpoint, arm_breakpoint_len, arm_breakpoint_at): New. + (the_low_target): Add new members. + * gdbserver/linux-i386-low.c (i386_store_gregset, i386_store_fpregset) + (i386_store_fpxregset): Constify. + (target_regsets): Add new kind identifier. + (i386_get_pc): Renamed from i386_stop_pc. Simplify. + (i386_set_pc): Add debugging. + (i386_breakpoint_at): New function. + (the_low_target): Add new members. + * gdbserver/linux-mips-low.c (mips_get_pc, mips_set_pc) + (mips_breakpoint, mips_breakpoint_len, mips_reinsert_addr) + (mips_breakpoint_at): New. + (the_low_target): Add new members. + * gdbserver/linux-ppc-low.c (ppc_get_pc, ppc_set_pc) + (ppc_breakpoint, ppc_breakpoint_len, ppc_breakpoint_at): New. + (the_low_target): Add new members. + * gdbserver/linux-sh-low.c (sh_get_pc, sh_set_pc) + (sh_breakpoint, sh_breakpoint_len, sh_breakpoint_at): New. + (the_low_target): Add new members. + * gdbserver/linux-x86-64-low.c (target_regsets): Add new kind + identifier. + +2002-06-11 Michal Ludvig + + * dwarf2cfi.c (unwind_tmp_obstack_init): New. + (unwind_tmp_obstack_free, parse_frame_info) + (update_context, cfi_read_fp, cfi_write_fp) + (cfi_frame_chain, cfi_init_extra_frame_info) + (cfi_virtual_frame_pointer): Use the above function. + * dwarf2cfi.c: Reindented (using 'indent dwarf2cfi.c'). + +2002-06-11 Corinna Vinschen + + * v850-tdep.c (v850_type_is_scalar): New function. + (v850_use_struct_convention): Match current gcc implementation + as close as possible. + (v850_push_arguments): Fix stack_offset handling. Don't write + struct_addr into register. This is done by v850_store_struct_return. + (v850_extract_return_value): Care for structs. + (v850_store_return_value): Ditto. + (v850_store_struct_return): Actually write address. + +2002-06-11 Michal Ludvig + + * x86-64-tdep.c (x86_64_skip_prologue): Fix to work on functions + without debug information too. + +2002-06-10 Andrew Cagney + + * gdbarch.sh (PRINT_FLOAT_INFO): Add frame and ui_file parameters. + Make multi-arch pure. + * gdbarch.h, gdbarch.c: Re-generate. + * arm-tdep.c (arm_print_float_info): Update. + * arch-utils.h (default_print_float_info): Update. + * arch-utils.c (default_print_float_info): Update. + * infcmd.c (float_info): Update call. + +2002-06-10 Andrew Cagney + + * Makefile.in (init.c): Move the call to _initialize_gdbtypes to + the front of the initialize list. + +2002-06-10 Andrew Cagney + + * infrun.c (struct inferior_status): Replace fields + selected_frame_address and selected_level with field + selected_frame_id. + (save_inferior_status): Update. Use get_frame_id. + (struct restore_selected_frame_args): Delete. + (restore_selected_frame): Update. Use frame_find_by_id. + (restore_inferior_status): Update. + + * breakpoint.h (struct breakpoint): Change type of + watchpoint_frame to frame_id. + * breakpoint.c (insert_breakpoints): Use frame_find_by_id. Remove + call to get_current_frame. + (do_enable_breakpoint): Use frame_find_by_id. Remove call to + get_current_frame. + (watchpoint_check): Use frame_find_by_id. + + * frame.h (record_selected_frame): Delete declaration. + * stack.c (record_selected_frame): Delete function. + + * frame.h (struct frame_id): Define. + (get_frame_id): Declare. + (frame_find_by_id): Declare. + * frame.c (frame_find_by_id): New function. + (get_frame_id): New function. + +2002-06-10 Andrey Volkov + + * ser-e7kpc.c: Fix duplicated define and call of + _initialize_ser_e7000pc + +2002-06-09 Daniel Jacobowitz + + * signals/signals.c (target_signal_from_host): Fix #ifdef + SIGRTMIN case. + (do_target_signal_to_host): Likewise. + +2002-06-09 Daniel Jacobowitz + + * mips-tdep.c (mips_find_abi_section): New function. + (mips_gdbarch_init): Call it. + +2002-06-09 Mark Kettenis + + * solib-svr4.c (init_fetch_link_map_offsets): Simply return + legacy_fetch_link_map_offsets. Adjust comment to reflect reality + after Andrew's 2002-06-08 gdbarch change. + +2002-06-09 Mark Kettenis + + * i386-linux-nat.c (suppy_gregset): Don't supply + I386_LINUX_ORIG_EAX_REGNUM if there isn't room for it in GDB's + register cache. + (fill_gregset): Don't fetch it under the same circumstances. + +2002-06-09 Andrew Cagney + + * Makefile.in (callback_h): Define. + (remote_sim_h): Update path to remote-sim.h. + (remote-rdp.o): Add $(callback_h). + (remote-sim.o): Use $(callback_h). + * remote-sim.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + * remote-rdp.c: Include "gdb/callback.h". + +2002-06-09 Mark Kettenis + + * osabi.h (gdb_osabi): Add GDB_OSABI_GO32 and GDB_OSABI_NETWARE. + * osabi.c (gdb_osabi_names): Add "DJGPP" and "NetWare". + +2002-06-08 Andrew Cagney + + * sparcl-tdep.c: Use __CYGWIN__ instead of __CYGWIN32__. + * rdi-share/serpardr.c: Ditto. + * rdi-share/unixcomm.c: Ditto. + * rdi-share/serdrv.c: Ditto. + * rdi-share/hostchan.h: Ditto. + * rdi-share/hostchan.c: Ditto. + * rdi-share/host.h: Ditto. + * rdi-share/devsw.c: Ditto. + + * objfiles.h: Change type of obj_private to void pointer. + * pa64solib.c: Update copyright. Don't include "assert.h", use + strcmp instead of STREQ, use LONGEST, do not use PTR + * somsolib.c: Ditto. + + * config/djgpp/fnchange.lst: Fix problems with bfd/elf32-i386.c, + bfd/elf32-i386qnx.c, bfd/elf32-sh.c, bfd/elf32-sh64-nbsd.c, + bfd/elf64-sh64-nbsd.c bfd/elf64-sh64.c. + +2002-06-08 Andrew Cagney + + * frame.c (GET_SAVED_REGISTER): Delete macro definition. + (default_get_saved_register): Delete function. + * gdbarch.sh (GET_SAVED_REGISTER): Set default to + generic_unwind_get_saved_register. + * gdbarch.h, gdbarch.c: Re-generate. + +2002-06-08 Andrew Cagney + + * gdbarch.sh (FRAME_CHAIN_VALID): Set default to + generic_func_frame_chain_valid. + * gdbarch.h, gdbarch.c: Re-generate. + * blockframe.c (generic_func_frame_chain_valid): Only check + PC_IN_CALL_DUMMY when generic dummy frames. Don't worry about + passing FP to PC_IN_CALL_DUMMY. + Fix PR gdb/360. + +2002-06-08 Andrew Cagney + + * gdbarch.sh (struct gdbarch_data): Add field init_p. + (register_gdbarch_data): Initialize init_p. + (gdbarch_data): Initialize data pointer using the init function. + (init_gdbarch_data): Delete function. + (gdbarch_update_p): Update. + (initialize_non_multiarch): Update. + (struct gdbarch): Add field initialized_p. + * gdbarch.h, gdbarch.c: Re-generate. + +2002-06-07 Michal Ludvig + + * x86-64-linux-nat.c (x86_64_fxsave_offset): New. + (supply_fpregset, fill_fpregset): Don't call i387_*_fxsave, + better do the things actually here. + * x86-64-tdep.c (x86_64_register_name2nr): New. + (x86_64_register_name): Renamed to x86_64_register_nr2name. + (x86_64_gdbarch_init): Respect the above change. + * x86-64-tdep.h (x86_64_register_name2nr) + (x86_64_register_nr2name): Add prototypes. + * config/i386/x86-64linux.mt (TDEPFILES): Remove i387-tdep.o. + +2002-06-06 Michael Snyder + + * d10v-tdep.c (d10v_push_arguments): Handle struct_return. + Delete extra braces and re-indent. + (d10v_store_return_value): Char return values + must be shifted over by one byte in R0. + (d10v_extract_return_value): Delete extra braces, re-indent. + +2002-06-06 Elena Zannoni + + * d10v-tdep.c (d10v_read_sp, d10v_read_fp): Add prototype. + (d10v_register_virtual_type): Make $fp and $sp be pointer to data. + (d10v_integer_to_address): Rewrite. + (d10v_frame_init_saved_regs): When reading fp and sp registers use + the d10v specific functions which take care of converting to the + correct space. + +2002-06-06 Elena Zannoni + + * config/djgpp/fnchange.lst: Add testsuite files altivec-abi.c, + altivec-abi.exp, altivec-regs.c, altivec-regs.exp. + +2002-06-02 Andrew Cagney + + * config/alpha/nm-linux.h: Add "config/" prefix to tm, nm and xm + includes. + * config/tm-linux.h: Ditto. + * config/alpha/tm-alphalinux.h: Ditto. + * config/arm/nm-linux.h, config/arm/tm-linux.h: Ditto. + * config/arm/xm-nbsd.h, config/i386/nm-gnu.h: Ditto. + * config/i386/nm-i386lynx.h, config/i386/nm-i386sol2.h: Ditto. + * config/i386/nm-i386v4.h, config/i386/nm-i386v42mp.h: Ditto. + * config/i386/nm-linux.h, config/i386/nm-m3.h: Ditto. + * config/i386/nm-ptx4.h, config/i386/nm-x86-64.h: Ditto. + * config/i386/tm-i386gnu.h, config/i386/tm-i386lynx.h: Ditto. + * config/i386/tm-i386m3.h, config/i386/tm-i386sco5.h: Ditto. + * config/i386/tm-i386v4.h, config/i386/tm-linux.h: Ditto. + * config/i386/tm-ptx4.h, config/i386/tm-vxworks.h: Ditto. + * config/i386/xm-i386v4.h, config/i386/xm-nbsd.h: Ditto. + * config/i386/xm-ptx.h, config/i386/xm-ptx4.h: Ditto. + * config/i960/tm-vx960.h, config/ia64/nm-aix.h: Ditto. + * config/ia64/nm-linux.h, config/ia64/tm-aix.h: Ditto. + * config/ia64/tm-linux.h, config/ia64/xm-aix.h: Ditto. + * config/m68k/nm-linux.h, config/m68k/nm-m68klynx.h: Ditto. + * config/m68k/nm-sysv4.h, config/m68k/tm-linux.h: Ditto. + * config/m68k/tm-m68klynx.h, config/m68k/tm-m68kv4.h: Ditto. + * config/m68k/tm-sun2os4.h, config/m68k/tm-sun3os4.h: Ditto. + * config/m68k/tm-vx68.h, config/m68k/xm-m68kv4.h: Ditto. + * config/m68k/xm-nbsd.h, config/m88k/nm-delta88v4.h: Ditto. + * config/m88k/tm-delta88v4.h, config/m88k/xm-delta88v4.h: Ditto. + * config/mips/nm-irix5.h, config/mips/nm-linux.h: Ditto. + * config/mips/tm-linux.h, config/mips/tm-mips64.h: Ditto. + * config/mips/tm-mipsm3.h, config/mips/tm-mipsv4.h: Ditto. + * config/mips/tm-vxmips.h, config/mips/xm-irix5.h: Ditto. + * config/mips/xm-mipsv4.h, config/ns32k/xm-nbsd.h: Ditto. + * config/pa/nm-hppao.h, config/powerpc/nm-linux.h: Ditto. + * config/powerpc/tm-linux.h, config/powerpc/tm-vxworks.h: Ditto. + * config/powerpc/xm-aix.h, config/rs6000/nm-rs6000ly.h: Ditto. + * config/rs6000/tm-rs6000ly.h, config/rs6000/xm-aix4.h: Ditto. + * config/sh/tm-linux.h, config/sparc/nm-linux.h: Ditto. + * config/sparc/nm-sparclynx.h, config/sparc/nm-sun4sol2.h: Ditto. + * config/sparc/tm-linux.h, config/sparc/tm-sp64linux.h: Ditto. + * config/sparc/tm-sp64sim.h, config/sparc/tm-sparclynx.h: Ditto. + * config/sparc/tm-sun4os4.h, config/sparc/tm-sun4sol2.h: Ditto. + * config/sparc/tm-vxsparc.h, config/sparc/xm-sun4sol2.h: Ditto. + +2002-05-04 Aidan Skinner + + * ada-exp.tab.c: New file + * ada-exp.y: New file + * ada-lang.c: New file + * ada-lang.h: New file + * ada-lex.c: New file + * ada-lex.l: New file + * ada-tasks.c: New file + * ada-typeprint.c: New file + * ada-valprint.c: New file + +2002-06-02 Jason Thorpe + + * ppcnbsd-tdep.c (ppcnbsd_init_abi): Don't set + use_struct_convention to ppc_sysv_abi_broken_use_struct_convention. + +2002-06-02 Jason Thorpe + + * config/rs6000/aix4.mt (TDEPFILES): Use ppc-sysv-tdep.o + insetead of ppc-linux-tdep.o. + * config/rs6000/rs6000.mt (TDEPFILES): Likewise. + * config/rs6000/rs6000lynx.mt (TDEPFILES): Likewise. + +2002-06-02 Andrew Cagney + + 2002-05-07 Christian Groessler + * z8k-tdep.c (z8k_print_register_hook): Fix display of 32 and 64 + bit register contents for little endian hosts. + +2002-06-01 Andrew Cagney + + * MAINTAINERS: Mention that any `HP/UX reader' can be changed by + any maintainer. + +2002-06-01 Andrew Cagney + + * gdbarch.h: Regenerate. + +2002-06-01 Andrew Cagney + + * MAINTAINERS: Add everyone to write-after-approval list. + +2002-06-01 Andrew Cagney + + * stack.c (frame_info): Use frame_register_unwind instead of + saved_regs. Mention when the SP is on the stack or in a register. + + * frame.h (frame_register_unwind_ftype): Define. Document. + (struct frame_info): Add field register_unwind and + register_unwind_cache. + (frame_register_unwind): Declare. + (generic_unwind_get_saved_register): Declare. + + * frame.c (frame_register_unwind): New function. + (generic_unwind_get_saved_register): New function. + + * blockframe.c (generic_call_dummy_register_unwind): New function. + (frame_saved_regs_register_unwind): New function. + (set_unwind_by_pc): New function. + (create_new_frame): New function. + (get_prev_frame): New function. + +2002-05-30 Andrew Cagney + + * a29k-share/: Delete directory. + * remote-vx29k.c: Delete file. + +2002-05-30 Jason Thorpe + + * config/djgpp/fnchange.lst: Add ns32knbsd-nat.c, ns32knbsd-tdep.c, + ppcnbsd-nat.c, ppcnbsd-tdep.c, sparcnbsd-nat.c, and sparcnbsd-tdep.c. + +2002-05-30 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Add sparc64nbsd-nat.c, + sparcnbsd-nat.c, and sparcnbsd-tdep.c. + (sparc64nbsd-nat.o) + (sparcnbsd-nat.o) + (sparcnbsd-tdep.o): New dependency lists. + * NEWS: Note new UltraSPARC NetBSD native configuration. + * configure.host (sparc64-*-netbsd*): New host. + * configure.tgt (sparc-*-netbsdelf*) + (sparc-*-netbsd*): Set gdb_target to nbsd. + (sparc64-*-netbsd*): New target. + * sparc64nbsd-nat.c: New file. + * sparcnbsd-nat.c: New file. + * sparcnbsd-tdep.c: New file. + * sparcnbsd-tdep.h: New file. + * config/sparc/nbsd.mt: New file. + * config/sparc/nbsd64.mh: New file. + * config/sparc/nbsd64.mt: New file. + * config/sparc/nbsdaout.mh (NATDEPFILES): Remove corelow.o, + sparc-nat.o, and solib.o. Add sparcnbsd-nat.o. + (HOST_IPC): Remove. + * config/sparc/nbsdaout.mt: Remove. + * config/sparc/nbsdelf.mh (NATDEPFILES): Remove corelow.o, + sparc-nat.o, and solib.o. Add sparcnbsd-nat.o. + (HOST_IPC): Remove. + * config/sparc/nbsdelf.mt: Remove. + * config/sparc/nm-nbsd.h: Update copyright years. Remove all + sparc-nat.c compatiblity defines. + * config/sparc/tm-nbsd.h: Update copyright years. Include solib.h. + (GDB_MULTI_ARCH): Set to GDB_MULTI_ARCH_PARTIAL. + * config/sparc/tm-nbsd64.h: New file. + * config/sparc/tm-nbsdaout.h: Remove. + * config/sparc/xm-nbsd.h: Remove. + +2002-05-30 Jason Thorpe + + * Makefile.in (sparc-tdep.o): Add osabi.h to dependency list. + * sparc-tdep.c: Include osabi.h. + (gdbarch_tdep): Add osabi member. + (_initialize_sparc_tdep): Use gdbarch_register. + (sparc_gdbarch_init): Use generic OS ABI framework. + (sparc_dump_tdep): New function. + +2002-05-30 Kevin Buettner + + * corefile.c (do_captured_read_memory_integer): Return non-zero + result. + (safe_read_memory_integer): Copy result of memory read when + status is non-zero. Also, add comments. + +2002-05-20 Jason Thorpe + + * Makefile.in (ppc_tdep_h): Define. + (ppc-linux-nat.o) + (ppc-linux-tdep.o) + (rs6000-tdep.o): Use $(ppc_tdep_h). + (ppc-sysv-tdep.o) + (ppcnbsd-nat.o) + (ppcnbsd-tdep.o): New dependency lists. + * ppc-tdep.h: Use generic OS ABI framework. + * ppc-linux-tdep.c (_initialize_ppc_linux_tdep) + (ppc_linux_init_abi): New functions. + (ppc_sysv_abi_broken_use_struct_convention) + (ppc_sysv_abi_use_struct_convention) + (ppc_sysv_abi_push_arguments): Move to... + * ppc-sysv-tdep.c: ...here. + * ppcnbsd-nat.c: Don't include gdbcore.h and regcache.h. + * rs6000-tdep.c (process_note_abi_tag_sections) + (get_elfosabi): Remove. + (rs6000_gdbarch_init): Use generic OS ABI framework. + (rs6000_dump_tdep): New function. + (_initialize_rs6000_tdep): Use gdbarch_register. + * config/powerpc/linux.mt (TDEPFILES): Add ppc-sysv-tdep.o. + * config/powerpc/nbsd.mh (NATDEPFILES): Remove solib-legacy.o. + * config/powerpc/aix.mt (TDEPFILES): Use ppc-sysv-tdep.o instead + of ppc-linux-tdep.o. + * config/powerpc/nbsd.mt (TDEPFILES): Likewise. + * config/powerpc/ppc-eabi.mt (TDEPFILES): Likewise. + * config/powerpc/ppc-sim.mt (TDEPFILES): Likewise. + * config/powerpc/ppcle-eabi.mt (TDEPFILES): Likewise. + * config/powerpc/ppcle-sim.mt (TDEPFILES): Likewise. + * config/powerpc/vxworks.mt (TDEPFILES): Likewise. + +2002-05-29 Jim Blandy + + * macroscope.c (default_macro_scope): Put `void' in empty argument + list. + +2002-05-29 Andrew Cagney + + * Makefile.in (arch-utils.o): Add $(sim_regno_h). + * arch-utils.c: Include "sim-regno.h". + * gdbarch.sh: Don't include "sim-regno.h". + * gdbarch.h, gdbarch.c: Regenerate. + * sim-regno.h (legacy_register_sim_regno): Move declaration from + here. + * arch-utils.h (legacy_register_sim_regno): To here. + * remote-sim.c (legacy_register_sim_regno): Move function from + here. + * arch-utils.c (legacy_register_sim_regno): To here. + +2002-05-28 Andrew Cagney + + * sim-regno.h: New file. + * Makefile.in (sim_regno_h): Define. + (d10v-tdep.o, remote-sim.o): Add dependency on $(sim_regno_h). + * remote-sim.c: Include "sim-regno.h" and "gdb_assert.h". + (legacy_register_sim_regno): New function. + (one2one_register_sim_regno): New function. + (gdbsim_fetch_register): Rewrite. + (gdbsim_store_register): Only store a register when + REGISTER_SIM_REGNO is valid. + * d10v-tdep.c: Include "sim-regno.h". + (d10v_ts2_register_sim_regno): Add legacy_regiter_sim_regno check. + (d10v_ts3_register_sim_regno): Ditto. + * gdbarch.sh: Include "sim-regno.h". + (REGISTER_SIM_REGNO): Set default to legacy_register_sim_regno. + * gdbarch.h, gdbarch.c: Regenerate. + * arch-utils.h (default_register_sim_regno): Delete declaration. + * arch-utils.c (default_register_sim_regno): Delete function. + +2002-05-28 Jason Thorpe + + * ppcnbsd-nat.c: Rewrite. + * ppcnbsd-tdep.c: New file. + * ppcnbsd-tdep.h: New file. + * config/powerpc/nbsd.mh (NATDEPFILES): Remove corelow.o, + solib.o, and solib-svr4.o. + * config/powerpc/nbsd.mt (TDEPFILES): Add ppcnbsd-tdep.o, + nbsd-tdep.o, and corelow.o. + +2002-05-28 Andrew Cagney + + * MAINTAINERS (--enable-gdb-build-warnings): Rewrite script to use + `tr' and `sed'. Mention that `broken' targets are not expected to + build. + +2002-05-27 Michal Ludvig + + * x86-64-tdep.c (x86_64_skip_prologue): Remove obsolete note. + Let PC point right after the prologue before looking up symbols. + +2002-05-27 Martin M. Hunt + + * i386-tdep.c (i386_register_virtual_type): Return + builtin_type_vec128i for SSE registers. + + * gdbtypes.h (builtin_type_vec128i): Declare. + + * gdbtypes.c (build_builtin_type_vec128i): New function. + (builtin_type_v2_double, builtin_type_v4_int64): New types. + (builtin_type_vec128i): New type for SSE2 128-bit registers. + (build_gdbtypes): Initialize new builtin vector types. + (_initialize_gdbtypes): Register new vector types with gdbarch. + +2002-05-26 Jason Thorpe + + * MAINTAINERS: ns32k is not longer an obsolete candidate, + since it has been multi-arch'd. + * NEWS: Note that ns32k-*-* is now partial multi-arch. + Move Alpha and VAX multi-arch news entries to same section + as other multi-arch news. + +2002-05-26 Jason Thorpe + + * ns32k-tdep.c: include gdbtypes.h, inferior.h, regcache.h, + target.s, arch-utils.h, ns32k-tdep.h. Make many functions + static. Rename some register numbers to put them in ns32k-tdep + private namespace. + (ns32k_get_saved_register, ns32k_gdbarch_init_32082, + ns32k_gdbarch_init_32382, ns32k_gdbarch_init, ns32k_dump_tdep): New + functions. + (_initialize_ns32k_tdep): Use gdbarch_register. + * ns32k-tdep.h: New file. + * ns32knbsd-tdep.c: New file. + * config/ns32k/nbsdaout.mt (TDEPFILES): Add ns32knbsd-tdep.o. + * config/ns32k/tm-nbsd.h: Include "ns32k/tm-ns32k.h". + (IN_SOLIB_CALL_TRAMPOLINE, REGISTER_NAME, NUM_REGS, + REGISTER_BYTES, REGISTER_BYTE): Remove. + * config/ns32k/tm-ns32k.h: New file. + * config/ns32k/tm-umax.h: Remove. + +2002-05-26 Jason Thorpe + + * ns32k-tdep.c (ns32k_saved_pc_after_call, + ns32k_store_struct_return, ns32k_extract_return_value, + ns32k_store_return_value, ns32k_extract_struct_value_address): New + functions. + * config/ns32k/tm-umax.h (SAVED_PC_AFTER_CALL): Define as + ns32k_saved_pc_after_call. + (STORE_STRUCT_RETURN): Define as ns32k_store_struct_return. + (EXTRACT_RETURN_VALUE): Define as ns32k_extract_return_value. + (STORE_RETURN_VALUE): Define as ns32k_store_return_value. + (EXTRACT_STRUCT_VALUE_ADDRESS): Define as + ns32k_extract_struct_value_address. + +2002-05-26 Jason Thorpe + + * ns32k-tdep.c (ns32k_call_dummy_words, sizeof_ns32k_call_dummy_words, + ns32k_fix_call_dummy): New. + * config/ns32k/tm-umax.h (CALL_DUMMY_WORDS): Define as + ns32k_call_dummy_words. + (SIZEOF_CALL_DUMMY_WORDS): Define as sizeof_ns32k_call_dummy_words. + (CALL_DUMMY, CALL_DUMMY_LENGTH, CALL_DUMMY_ADDR, + CALL_DUMMY_NARGS): Remove. + (FIX_CALL_DUMMY): Define as ns32k_fix_call_dummy. + +2002-05-26 Jason Thorpe + + * ns32k-tdep.c (ns32k_breakpoint_from_pc, ns32k_frame_chain, + ns32k_frame_saved_pc, ns32k_frame_args_address, + ns32k_frame_locals_address, ns32k_frame_init_saved_regs, + ns32k_push_dummy_frame, ns32k_pop_frame): New functions. + * config/ns32k/tm-nbsd.h (FRAME_SAVED_PC): Remove. + * config/ns32k/tm-umax.h (INNER_THAN): Define as core_addr_lessthan. + (BREAKPOINT_FROM_PC): Define as ns32k_breakpoint_from_pc. + (BREAKPOINT): Remove.. + (FRAME_CHAIN): Define as ns32k_frame_chain. + (FRAME_SAVED_PC): Define as ns32k_frame_saved_pc. + (FRAME_ARGS_ADDRESS): Define as ns32k_frame_args_address. + (FRAME_LOCALS_ADDRESS): Define as ns32k_frame_locals_address. + (FRAME_FIND_SAVED_REGS): Remove. + (FRAME_INIT_SAVED_REGS): Define as ns32k_frame_init_saved_regs. + (PUSH_DUMMY_FRAME): Define as ns32k_push_dummy_frame. + (POP_FRAME): Define as ns32k_pop_frame. + +2002-05-26 Jason Thorpe + + * ns32k-tdep.c (ns32k_register_byte_32082, + ns32k_register_byte_32382, ns32k_register_raw_size, + ns32k_register_virtual_size, ns32k_register_virtual_type): New + functions. + * config/ns32k/tm-nbsd.h (REGISTER_BYTE): Define as + ns32k_register_byte_32382. + * config/ns32k/tm-umax.h: Update copyright years. + (REGISTER_BYTE): Define as ns32k_register_byte_32082. + (REGISTER_RAW_SIZE): Define as ns32k_register_raw_size. + (REGISTER_VIRTUAL_SIZE): Define as ns32k_register_virtual_size. + (REGISTER_VIRTUAL_TYPE): Define as ns32k_register_virtual_type. + (ns32k_get_enter_addr): Fix prototype. + +2002-05-26 Jason Thorpe + + * ns32k-tdep.c: Update copyright years. + (ns32k_register_name_32082): New function. + (ns32k_register_name_32382): Ditto. + * config/ns32k/tm-nbsd.h (REGISTER_NAMES): Remove. + (REGISTER_NAME): Define as ns32k_register_name_32382. + * config/ns32k/tm-umax.h (REGISTER_NAMES): Remove. + (REGISTER_NAME): Define as ns32k_register_name_32082. + +2002-05-24 Jim Blandy + + * dwarf2read.c (free_line_header): Use xfree, not free. + +2002-05-24 Jason Thorpe + + * config/djgpp/fnchange.lst: Add alphabsd-nat.c, + alphabsd-tdep.c, mipsnbsd-nat.c, and mipsnbsd-tdep.c + +2002-05-23 Andrew Cagney + + * PROBLEMS: Mention s390 and FreeBSD 4.4 build problems. + +2002-05-23 Andrew Cagney + + From Ross Alexander at NEC Europe: + * config/pa/hpux11w.mh (NATDEPFILES): Add solib.o. + +2002-05-23 Michael Snyder + + * cli/cli-dump.c (restore_command): Use parse_and_eval_long + for input, rather than parse_and_eval_address. + +2002-05-23 Andrew Cagney + + * d10v-tdep.c: Include "gdb/sim-d10v.h" instead of "sim-d10v.h". + * Makefile.in (sim_d10v_h): Update definition. + +2002-05-24 Andrew Cagney + + * d10v-tdep.c (d10v_gdbarch_init): Revert old code included in + change `2002-05-22 Michael Snyder' below. + (d10v_push_arguments): Ditto. + (d10v_extract_return_value): Ditto. + +2002-05-23 Jim Blandy + + * macrotab.c (check_for_redefinition): Don't complain if the new + definition is the same as the previous one. Take more arguments + to allow the comparison. + (macro_define_object, macro_define_function): Pass more arguments + to check_for_redefinition. + +2002-05-22 Michael Snyder + + * d10v-tdep.c: Change a few macros to enums for ease of debugging. + (d10v_frame_chain_valid): Add PC_IN_CALL_DUMMY clause. + (d10v_frame_saved_pc): Add PC_IN_CALL_DUMMY clause. + (d10v_frame_chain): Bail immediately if PC_IN_CALL_DUMMY. + Don't bail if return_pc is PC_IN_CALL_DUMMY. + Add a temp variable to save a call (and a memory read). + (d10v_init_extra_frame_info): Get fi->pc from callee's return_pc + if possible (so that PC_IN_CALL_DUMMY will work). + +2002-05-22 Corinna Vinschen + + * MAINTAINERS: Remove status `OBSOLETE' from v850. + +2002-05-22 Michal Ludvig + + * dwarf2cfi.c (frame_state_for): Added safety check for a valid + fde->cie_ptr. + (dwarf2_build_frame_info): Corrected handling of eh_frame. + (dwarf2_build_frame_info): Add offset to fde->initial_location + so that frames of shared libraries are mapped correctly. + (execute_stack_op): Change type of 'result' from ULONGEST to + CORE_ADDR. + +2002-05-22 Jason Thorpe + + * config/alpha/tm-nbsd.h: Include solib.h. + +2002-05-22 Jason Thorpe + + * alphanbsd-tdep.c (alphanbsd_sigtramp_offset): Don't make + assumptions about the host's byte order. + +2002-05-22 Jason Thorpe + + * Makefile.in (alphanbsd-tdep.o, shnbsd-tdep.o): Add solib-svr4.h + to dependency list. + * alphanbsd-tdep.c: Include solib-svr4.h. + * shnbsd-tdep.c: Ditto. + +2002-05-22 Jason Thorpe + + * Makefile.in (armnbsd-tdep.o): Add solib-svr4.h and + nbsd-tdep.h to dependency list. + * configure.host (arm*-*-netbsdelf*, arm*-*-netbsd*, + i[3456]86-*-netbsdaout*, i[3456]86-*-netbsd*, m68*-*-netbsd*, + ns32k-*-netbsd*, sparc-*-netbsdaout*, sparc-*-netbsd*): Use + nbsdaout.mh and nbsdelf.mh consistently. + * configure.tgt (i[3456]86-*-netbsd*, m68*-*-netbsd*, + ns32k-*-netbsd*, sparc-*-netbsdelf*, sparc-*-netbsd*) Use + nbsdaout.mt and nbsdelf.mh consistently. + * armnbsd-tdep.c: Include nbsd-tdep.h and solib-svr4.h. + (arm_netbsd_elf_init_abi): Use set_solib_svr4_fetch_link_map_offsets + to set nbsd_ilp32_solib_svr4_fetch_link_map_offsets. + * config/nm-nbsd.h: Garbage-collect SVR4_SHARED_LIBS. Move + a.out shared library stuff from here... + * config/nm-nbsdaout.h: ...to here. + * config/tm-nbsd.h: Remove. + * config/alpha/nm-nbsd.h (SVR4_SHARED_LIBS): Remove. + * config/arm/nbsd.mh: Remove. + * config/arm/nbsd.mt (TDEPFILES): Remove solib-sunos.o, add + nbsd-tdep.o. + * config/arm/nbsdaout.mh: New file. + * config/arm/nbsdelf.mh: New file. + * config/arm/nm-nbsdaout.h: New file. + * config/i386/nbsd.mh: Remove. + * config/i386/nbsd.mt: Remove. + * config/i386/nbsdaout.mh: New file. + * config/i386/nbsdaout.mt: New file. + * config/i386/nbsdelf.mh (NAT_FILE): Use nm-nbsd.h. + * config/i386/nbsdelf.mt (TM_FILE): Use tm-nbsd.h. + * config/i386/nm-nbsd.h (REGISTER_U_ADDR, + i386_register_u_addr): Remove. + * config/i386/nm-nbsdaout.h: New file. + * config/i386/nm-nbsdelf.h: Remove. + * config/i386/tm-nbsd.h: Don't include config/tm-nbsd.h. + (USE_STRUCT_CONVENTION): Remove. + * config/i386/tm-nbsdaout.h: New file. + * config/i386/tm-nbsdelf.h: Remove. + * config/m68k/nbsd.mh: Remove. + * config/m68k/nbsd.mt: Remove. + * config/m68k/nbsdaout.mh: New file. + * config/m68k/nbsdaout.mt: New file. + * config/m68k/nm-nbsd.h: Use config/nm-nbsd.h. + * config/m68k/nm-nbsdaout.h: New file. + * config/m68k/tm-nbsd.h: Don't include config/tm-nbsd.h. + (IN_SOLIB_CALL_TRAMPOLINE): Define. + * config/ns32k/nbsd.mh: Remove. + * config/ns32k/nbsd.mt: Remove. + * config/ns32k/nbsdaout.mh: New file. + * config/ns32k/nbsdaout.mt: New file. + * config/ns32k/nm-nbsd.h: Include config/nm-nbsd.h. + * config/ns32k/nm-nbsdaout.h: New file. + * config/ns32k/tm-nbsd.h: Don't include config/tm-nbsd.h. + (IN_SOLIB_CALL_TRAMPOLINE): Define. + * config/powerpc/nm-nbsd.h: Include config/nm-nbsd.h. + (SVR4_SHARED_LIBS): Remove. + * config/powerpc/tm-nbsd.h: Dont' include config/tm-nbsd.h. + * config/sparc/nbsd.mh: Remove. + * config/sparc/nbsd.mt: Remove. + * config/sparc/nbsdaout.mh: New file. + * config/sparc/nbsdaout.mt: New file. + * config/sparc/nbsdelf.mh (NAT_FILE): Use nm-nbsd.h. + * config/sparc/nbsdelf.mt: New file. + * config/sparc/nm-nbsdaout.h: New file. + * config/sparc/nm-nbsdelf.h: Remove. + * config/sparc/tm-nbsd.h: Don't include config/tm-nbsd.h. + * config/sparc/tm-nbsdaout.h: New file. + +2002-05-21 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Add mipsnbsd-nat.c and + mipsnbsd-tdep.c + (mipsnbsd-nat.o, mipsnbsd-tdep.o): New dependency lists. + +2002-05-21 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Add shnbsd-tdep.c and + shnbsd-nat.c. + (shnbsd-tdep.o, shnbsd-nat.o): New dependency lists. + +2002-05-21 Jason Thorpe + + * NEWS: Note new MIPS NetBSD native configuration. + * configure.host (mips*-*-netbsd*): New host. + * configure.tgt (mips*-*-netbsd*): New target. + * mipsnbsd-nat.c: New file. + * mipsnbsd-tdep.c: New file. + * mipsnbsd-tdep.h: New file. + * config/mips/nbsd.mh: New file. + * config/mips/nbsd.mt: New file. + * config/mips/nm-nbsd.h: New file. + * config/mips/tm-nbsd.h: New file. + +2002-05-21 Jason Thorpe + + * Makefile.in (SFILES): Add osabi.c. + (COMMON_OBS): Add osabi.o. + (osabi.o): New dependency list. + * osabi.c: New file. + * osabi.h: New file. + * doc/gdbint.texinfo: Document new generic OS ABI framework. + + * Makefile.in (alpha_tdep_h): Define and use instead of + alpha-tdep.h. + * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections, + get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi): + Remove. + (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework. + * alpha-tdep.h: Include osabi.h. + (alpha_abi): Remove. + (gdbarch_tdep): Use generic OS ABI framework. + * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use + gdbarch_register_osabi. + * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. + * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. + * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. + + * Makefile.in (sh_tdep_h): Add osabi.h. + * sh-tdep.h (sh_osabi): Remove. + (gdbarch_tdep): Use generic OS ABI framework. + * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections, + sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove. + (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework. + * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi. + + * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h. + * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use + gdbarch_register_osabi. + * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections, + arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove. + (get_elfosabi): Rename to... + (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS + ABI framework support routines. + (arm_gdbarch_init): Use generic OS ABI framework. + (arm_dump_tdep): Likewise. + (_initialize_arm_tdep): Likewise. + * arm-tdep.h: Include osabi.h. + (arm_abi): Remove. + (gdbarch_tdep): Remove arm_abi and abi_name members. Add + osabi member. + (arm_gdbarch_register_os_abi): Remove prototype. + * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function. + (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi. + + * Makefile.in (mips-tdep.o): Add osabi.h to dependency list. + * mips-tdep.c: Include osabi.h. + (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic + OS ABI framework. + +2002-05-20 Kazu Hirata + + * h8300-tdep.c: Fix formatting. + +2002-05-20 Elena Zannoni + + * rs6000-tdep.c (rs6000_do_registers_info): Simplify code for + printing vector registers. + +2002-05-19 Andrew Cagney + + From Fernando Nasser: + * remote.c (remote_async_open_1): Re-throw the exception when the + connection fails. + (remote_cisco_open): Ditto. + (remote_open_1): Ditto. + +2002-05-19 Andrew Cagney + + * remote.c (remote_start_remote_dummy): Add uiout parameter. + (remote_start_remote): Add uiout parameter. Pass through to + remote_start_remote_dummy. + (remote_open_1): Use catch_exception instead of catch_errors. + (remote_async_open_1): Ditto. + (remote_cisco_open): Ditto. + +2002-05-19 Andrew Cagney + + * remote.c (remote_start_remote): Replace PTR with void pointer. + (sigint_remote_twice_token, sigint_remote_token): Ditto. Make + static. + +2002-05-18 Andrew Cagney + + * gdb_indent.sh: Allow the script to be run in the sim directory. + +2002-05-18 Mark Kettenis + + * config/i386/nm-cygwin.h (NO_PTRACE_H): Remove define. + * config/i386/nm-go32.h (NO_PTRACE_H): Remove define. + + * corelow.c (core_open): Only call set_gdbarch_from_file if + exec_bfd is NULL. + +2002-05-17 Andrey Volkov + + * h8300-tdep.c: Add support of EXR register + * config/h8300/tm-h8300.h: Ditto. + +2002-05-17 Andrey Volkov + + * h8300-tdep.c: Add additional CCR flags (I,UI,H,U) + +2002-05-17 Andrey Volkov + + * h8300-tdep.c: Change literal regnums to REGNO. + +2002-05-17 Jim Blandy + + * NEWS: Note addition of macro support. + + Expand preprocessor macros in C expressions. + * c-lang.h: #include "macroexp.h", for macro_lookup_ftype. + (scan_macro_expansion, scanning_macro_expansion, + finished_macro_expansion): New function declarations. + (expression_macro_lookup_func, expression_macro_lookup_baton): New + variable declarations. + * parser-defs.h (expression_context_pc): New declaration. + * parse.c (expression_context_pc): New variable. + (parse_exp_1): Set expression_context_pc, as well as + expression_context_block. + * c-exp.y (yylex): If we're not already reading the result of a + macro expansion, try to macro-expand the next token. When we're + done scanning a macro expansion, switch back to the mainline text. + Commas and `if's in a macro's expansion don't terminate the input. + * c-lang.c: #include "macroscope.h" and "gdb_assert.h". + (macro_original_text, macro_expanded_text, + expression_macro_lookup_func, expression_macro_lookup_baton): New + variables. + (scan_macro_expansion, scanning_macro_expansion, + finished_macro_expansion, scan_macro_cleanup, null_macro_lookup, + c_preprocess_and_parse): New functions. + (c_language_defn, cplus_language_defn, asm_language_defn): Call + c_preprocess_and_parse, instead of c_parse. + * Makefile.in (c_lang_h): Note that this #includes macroexp.h. + (c-lang.o): Note dependency on macroscope.h and gdb_assert.h. + +Fri May 17 14:26:19 2002 J"orn Rennecke + + * sh-tdep.c (gdb_print_insn_sh64): Delete. + (gdb_print_insn_sh): Just set info->endian and use print_insn_sh. + (sh_gdbarch_init): Always use gdb_print_insn_sh. + +2002-05-17 Corinna Vinschen + + * NEWS: Add section for multi-arched targets. Add v850 to that section. + +2002-05-17 Jason Thorpe + + * Makefile.in (sh_tdep_h): Define and use. + * config/sh/tm-sh.h (sh_osabi, sh_abi, gdbarch_tdep, + register enum): Move to... + * * sh-tdep.h: ...here. + * sh-tdep.c: Include sh-tdep.h. + * sh3-rom.c: Likewise. + * shnbsd-tdep.c: Likewise. + +2002-05-16 Michael Snyder + + * arm-tdep.c: Spelling fix in comment. + +2002-05-16 Jim Blandy + + Add commands for manually expanding macros and showing their + definitions. + * macrocmd.c, macroscope.c, macroscope.h: New files. + * Makefile.in (SFILES): Add macrocmd.c, macroscope.c. + (macroscope_h): New variable. + (HFILES_NO_SRCDIR): Add macroscope.h. + (COMMON_OBS): Add macrocmd.o, macroscope.o. + (macroscope.o, macrocmd.o): New rules. + + Teach the Dwarf 2 reader to read macro information. + * dwarf2read.c: #include "macrotab.h". + (dwarf_macinfo_buffer): New variable. + (struct dwarf2_pinfo): New members: dwarf_macinfo_buffer, and + dwarf_macinfo_size. + (DWARF_MACINFO_BUFFER, DWARF_MACINFO_SIZE): New macros. + (dwarf2_missing_macinfo_section, dwarf2_macros_too_long, + dwarf2_macros_not_terminated, dwarf2_macro_outside_file, + dwarf2_macro_unmatched_end_file, dwarf2_macro_malformed_definition, + dwarf2_macro_spaces_in_definition): New complaints. + (dwarf2_has_info): Initialize dwarf_macinfo_offset. + (dwarf2_build_psymtabs): Read the .dwarf_macinfo section. + (dwarf2_build_psymtabs_hard): Record the buffer and its size in + the partial symbol table. + (psymtab_to_symtab_1): Set the macinfo buffer and size globals + from what's recorded in the partial symbol table. + (read_file_scope): If the compilation unit has a + `DW_AT_macro_info' attribute, read its macro information. + * Makefile.in (dwarf2read.o): Depend on macrotab.h. + +2002-05-16 Daniel Jacobowitz + + Fix PR gdb/546 + * ser-tcp.c: Don't include . + +2002-05-16 Stephane Carrez + + * MAINTAINERS: Update my email address. + +2002-05-16 Richard Earnshaw + + * config/arm/nm-nbsd.h: Use "config/nm-nbsd.h" to include generic + include file of the same name. + +2002-05-16 Corinna Vinschen + + * configure.tgt: Mark v850 as multi-arched. + * config/v850/tm-v850.h: Remove file. + * config/v850/v850.mt: Eliminate TM_FILE. + +2002-05-16 Corinna Vinschen + + * v850-tdep.c: Full multi-arch. + * config/v850/tm-v850.h: Eliminate or move to v850-tdep.c everything. + Define GDB_MULTI_ARCH to 2. + +2002-05-16 Pierre Muller + + * p-exp.y (current_type): New static variable. + Carries the type of the expression at the position that is parsed. + (push_current_type, pop_current_type): Two new functions. Used + to store/restore current_type in expression on specific tokens. + (search_field): New static variable. Set to one after parsing a point + as at that point only a FIELDNAME token should be searched. + (FIELDNAME): New token. After a point only a token belonging to + current_type type definition is allowed. + (all over token rules): reset and change current_type according + to rules. + (exp '[' rule): insert implicit array index field if + exp is a pascal string type. + +2002-05-16 Corinna Vinschen + + * v850-tdep.c: Fix comment for v850_scan_prologue. Remove extra + frame info. Use frame_info's saved_regs instead of matching member + in extra_frame_info throughout. + (v850_frame_init_saved_regs): New function. + (v850_init_extra_frame_info): Move most functionality into + v850_frame_init_saved_regs(). + * config/v850/tm-v850.h (EXTRA_FRAME_INFO): Remove definition. + (v850_frame_find_saved_regs): Remove declaration. + (FRAME_FIND_SAVED_REGS): Remove definition. + (v850_frame_init_saved_regs): Add declaration. + (FRAME_INIT_SAVED_REGS): Add definition. + +2002-05-16 Corinna Vinschen + + * v850-tdep.c: Begin multi-arch'ing v850. + (v850_target_architecture_hook): Remove function. + (v850_gdbarch_init): New function. Add code previously in + v850_target_architecture_hook(). + (_initialize_v850_tdep): Don't set target_architecture_hook. + Call register_gdbarch_init() instead. + +2002-05-16 Daniel Jacobowitz + + * gdbtypes.h (struct cplus_struct_type): Remove args field. + * hpread.c (hpread_read_struct_type): Remove assignments to args. + (fixup_class_method_type): Likewise. + +2002-05-15 Daniel Jacobowitz + + From Martin Pool : + * gdbserver/server.c (gdbserver_usage): New function. + (main): Call it. + 2002-05-15 Jim Blandy Add macro structures to GDB's symbol tables. Nobody puts anything diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 0a4236c5ee5..f86c42c484f 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -112,7 +112,7 @@ maintainer works with the native maintainer when resolving API issues. Not multi-arch m68hc11 --target=m68hc11-elf ,-Werror - Stephane Carrez Stephane.Carrez@worldnet.fr + Stephane Carrez stcarrez@nerim.fr m68k --target=m68k-elf ,-Werror Maintenance only @@ -139,7 +139,6 @@ maintainer works with the native maintainer when resolving API issues. ns32k --target=ns32k-netbsd ,-Werror Maintenance only - OBSOLETE candidate, not multi-arch pa (--target=hppa1.1-hp-proelf broken) Maintenance only @@ -164,7 +163,6 @@ maintainer works with the native maintainer when resolving API issues. v850 --target=v850-elf ,-Werror Maintenance only - OBSOLETE candidate, not multi-arch vax --target=vax-dec-vms5.5 ,-Werror Maintenance only @@ -192,21 +190,36 @@ All recognized developers can make mechanical changes (by virtue of the obvious fix rule) to ``maintenance only'' targets. The change shall be sanity checked by compiling with one of the listed targets. -The GAWK segment: - - awk < "${maintainers}" ' - $2 ~ /--target=.*/ { - targets = gensub (/^.*--target=/, "", 1, $2) - warnings = gensub (/[)]*$/, "", 1, $3) - split (targets, targ, /,/) - for (i in targ) { - print targ[i], warnings - } - }' - -can be used to generate a full list of --target= ---enable-gdb-build-warnings= pairs. - +The Bourne shell script: + +cat MAINTAINERS | tr -s '[\t]' '[ ]' | sed -n ' +/^[ ]*[-a-z0-9\.]*[ ]*[(]*--target=.*/ !d +s/^.*--target=// +s/).*$// +h +:loop + g + /^[^ ]*,/ !b end + s/,[^ ]*// + p + g + s/^[^,]*,// + h +b loop +:end +p +' + +can be used to generate a complete list of --target= +--enable-gdb-build-warnings= pairs of the form: + + arc-elf ,-Werror + ... + hppa1.1-hp-proelf broken + ... + +While the ``broken'' targets are included in the listing, the are not +expected to build. Host/Native: @@ -269,6 +282,8 @@ generic symtabs Jim Blandy jimb@redhat.com linespec Jim Blandy jimb@redhat.com Elena Zannoni ezannoni@redhat.com Fernando Nasser fnasser@redhat.com + HP/UX readers Any [past] maintainer can modify this. + Please send tricky ones to the symtabs maintainers. tracing bytecode stuff Jim Blandy jimb@redhat.com tracing Michael Snyder msnyder@redhat.com @@ -335,6 +350,8 @@ Makefile.in, configure* ALL mmalloc/ ALL Host maintainers +NEWS ALL + sim/ See sim/MAINTAINERS readline/ Master version: ftp://ftp.cwru.edu/pub/bash/ @@ -351,16 +368,32 @@ To get recommended for the Write After Approval list you need a valid FSF assignment and have submitted one good patch. David Anderson davea@sgi.com +Scott Bambrough scottb@netwinder.org +Jim Blandy jimb@redhat.com Philip Blundell philb@gnu.org +Per Bothner per@bothner.com Joel Brobecker brobecker@act-europe.fr +Kevin Buettner kevinb@redhat.com +Andrew Cagney ac131313@redhat.com +Stephane Carrez stcarrez@nerim.fr +Michael Chastain mec@shout.net +Eric Christopher echristo@redhat.com Nick Clifton nickc@redhat.com +Philippe De Muyter phdm@macqel.be Chris G. Demetriou cgd@broadcom.com Klee Dienes kdienes@apple.com +DJ Delorie dj@redhat.com Richard Earnshaw rearnsha@arm.com +Frank Ch. Eigler fche@redhat.com +Ben Elliston bje@redhat.com +Anthony Green green@redhat.com Matthew Green mrg@eterna.com.au +Chris Faylor cgf@redhat.com +Fred Fish fnf@ninemoons.com Orjan Friberg orjanf@axis.com Ben Harris bjh21@netbsd.org Richard Henderson rth@redhat.com +Aldy Hernandez aldyh@redhat.com Paul Hilfinger hilfinger@gnat.com Matt Hiller hiller@redhat.com Kazu Hirata kazu@hxi.com @@ -371,33 +404,43 @@ Jim Ingham jingham@apple.com Daniel Jacobowitz dan@debian.org Andreas Jaeger aj@suse.de Geoff Keating geoffk@redhat.com +Mark Kettenis kettenis@gnu.org Jim Kingdon jkingdon@engr.sgi.com ++ +Jeff Law law@redhat.com Jonathan Larmour jlarmour@redhat.co.uk +Robert Lipe rjl@sco.com H.J. Lu hjl@lucon.org +Michal Ludvig mludvig@suse.cz Glen McCready gkm@redhat.com Greg McGary greg@mcgary.org Jason Merrill jason@redhat.com +David S. Miller davem@redhat.com Jason Molenda jmolenda@apple.com Pierre Muller muller@sources.redhat.com +Fernando Nasser fnasser@redhat.com +David O'Brien obrien@freebsd.org Alexandre Oliva aoliva@redhat.com Tom Rix trix@redhat.com Theodore A. Roth troth@verinet.com +Ian Roxborough irox@redhat.com Mark Salter msalter@redhat.com +Peter Schauer Peter.Schauer@regent Andreas Schwab schwab@suse.de Keith Seitz keiths@redhat.com Jiri Smid smid@suse.cz David Smith dsmith@redhat.com Stephen P. Smith ischis2@home.com Jackie Smith Cashion jsmith@redhat.com +Stan Shebs shebs@apple.com +Michael Snyder msnyder@redhat.com Petr Sorfa petrs@caldera.com Gary Thomas gthomas@redhat.com Jason Thorpe thorpej@wasabisystems.com Tom Tromey tromey@redhat.com Corinna Vinschen vinschen@redhat.com Keith Walker keith.walker@arm.com -Michal Ludvig mludvig@suse.cz -David S. Miller davem@redhat.com -Eric Christopher echristo@redhat.com +Elena Zannoni ezannoni@redhat.com +Eli Zaretskii eliz@gnu.org diff --git a/gdb/Makefile.in b/gdb/Makefile.in index e6d43ad25af..7b353bf74c6 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -530,7 +530,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ demangle.c dwarfread.c dwarf2read.c elfread.c environ.c eval.c \ event-loop.c event-top.c \ expprint.c f-exp.y f-lang.c f-typeprint.c f-valprint.c \ - findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c \ + findvar.c regcache.c gdbarch.c arch-utils.c gdbtypes.c osabi.c \ inf-loop.c infcmd.c inflow.c infrun.c language.c \ kod.c kod-cisco.c \ ui-out.c cli-out.c \ @@ -539,7 +539,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \ memattr.c mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \ p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \ - macrotab.c macroexp.c \ + macrotab.c macroexp.c macrocmd.c macroscope.c \ printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \ scm-valprint.c source.c stabsread.c stack.c symfile.c \ symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \ @@ -568,11 +568,13 @@ LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c getopt_h = $(INCLUDE_DIR)/getopt.h floatformat_h = $(INCLUDE_DIR)/floatformat.h bfd_h = $(BFD_DIR)/bfd.h +callback_h = $(INCLUDE_DIR)/gdb/callback.h dis_asm_h = $(INCLUDE_DIR)/dis-asm.h -remote_sim_h = $(INCLUDE_DIR)/remote-sim.h +remote_sim_h = $(INCLUDE_DIR)/gdb/remote-sim.h demangle_h = $(INCLUDE_DIR)/demangle.h obstack_h = $(INCLUDE_DIR)/obstack.h -sim_d10v_h = $(INCLUDE_DIR)/sim-d10v.h +sim_arm_h = $(INCLUDE_DIR)/gdb/sim-arm.h +sim_d10v_h = $(INCLUDE_DIR)/gdb/sim-d10v.h splay_tree_h = $(INCLUDE_DIR)/splay-tree.h readline_headers = \ @@ -593,14 +595,16 @@ xm_h = @xm_h@ tm_h = @tm_h@ nm_h = @nm_h@ +alpha_tdep_h = alpha-tdep.h osabi.h annotate_h = annotate.h $(symtab_h) $(gdbtypes_h) arch_utils_h = arch-utils.h +arm_tdep_h = arm-tdep.h osabi.h ax_h = ax.h $(doublest_h) bcache_h = bcache.h builtin_regs_h = builtin-regs.h breakpoint_h = breakpoint.h $(frame_h) $(value_h) buildsym_h = buildsym.h -c_lang_h = c-lang.h $(value_h) +c_lang_h = c-lang.h $(value_h) $(macroexp_h) call_cmds_h = call-cmds.h cli_cmds_h = $(srcdir)/cli/cli-cmds.h cli_decode_h = $(srcdir)/cli/cli-decode.h $(command_h) @@ -633,21 +637,28 @@ gdbcmd_h = gdbcmd.h $(command_h) $(ui_out_h) gdbcore_h = gdbcore.h $(bfd_h) gdbthread_h = gdbthread.h $(breakpoint_h) gdbtypes_h = gdbtypes.h +i386_tdep_h = i386-tdep.h +i386_linux_tdep_h = i386-linux-tdep.h +i387_tdep_h = i387-tdep.h inf_loop_h = inf-loop.h inferior_h = inferior.h $(breakpoint_h) language_h = language.h linespec_h = linespec.h macroexp_h = macroexp.h macrotab_h = macrotab.h $(obstack_h) $(bcache_h) +macroscope_h = macroscope.h $(macrotab_h) $(symtab_h) memattr_h = memattr.h monitor_h = monitor.h objfiles_h = objfiles.h parser_defs_h = parser-defs.h $(doublest_h) +ppc_tdep_h = ppc-tdep.h osabi.h regcache_h = regcache.h remote_h = remote.h remote_utils_h = remote-utils.h $(target_h) ser_unix_h = ser-unix.h serial_h = serial.h +sh_tdep_h = sh-tdep.h osabi.h +sim_regno_h = sim-regno.h solist_h = solist.h source_h = source.h stabsread_h = stabsread.h @@ -677,7 +688,7 @@ HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h coff-solib.h defs.h \ gdb-stabs.h $(inferior_h) language.h minimon.h monitor.h \ objfiles.h parser-defs.h serial.h solib.h \ symfile.h stabsread.h target.h terminal.h typeprint.h xcoffsolib.h \ - macrotab.h macroexp.h \ + macrotab.h macroexp.h macroscope.h \ c-lang.h ch-lang.h f-lang.h \ jv-lang.h \ m2-lang.h p-lang.h \ @@ -720,9 +731,9 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \ symtab.o symfile.o symmisc.o linespec.o infcmd.o infrun.o \ expprint.o environ.o stack.o thread.o \ - macrotab.o macroexp.o \ + macrotab.o macrocmd.o macroexp.o macroscope.o \ event-loop.o event-top.o inf-loop.o completer.o \ - gdbarch.o arch-utils.o gdbtypes.o copying.o $(DEPFILES) \ + gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o $(DEPFILES) \ memattr.o mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \ builtin-regs.o std-regs.o \ signals.o \ @@ -837,7 +848,16 @@ uninstall: force $(CONFIG_UNINSTALL) # list includes a file twice (because of some mistake somewhere else) # the _initialize_* function will be included twice in init.c. Second, # init.c may force unnecessary files to be linked in. -# + +# FIXME: cagney/2002-06-09: gdb/564: gdb/563: Force the order so that +# the first call is to _initialize_gdbtypes. This is a hack to ensure +# that all the architecture dependant global builtin_type_* variables +# are initialized before anything else (per-architecture code is +# called in the same order that it is registered). The ``correct +# fix'' is to have all the builtin types made part of the architecture +# and initialize them on-demand (using gdbarch_data) just like +# everything else. The catch is that other modules still take the +# address of these builtin types forcing them to be variables, sigh! INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS) init.c: $(INIT_FILES) @@ -862,7 +882,8 @@ init.c: $(INIT_FILES) -e 's,signals\.c,signals/signals\.c,' \ -e 's|\([^ ][^ ]*\)|$(srcdir)/\1|g' | \ while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \ - sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' > init.l-tmp + sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \ + ( echo _initialize_gdbtypes ; grep -v -e '^_initialize_gdbtypes$$' ) > init.l-tmp @echo '/* Do not modify this file. */' >>init.c-tmp @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp @echo '#include "defs.h"' >>init.c-tmp @@ -1215,12 +1236,14 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ mips-linux-nat.c mips-linux-tdep.c \ mips-nat.c \ mips-tdep.c mipsm3-nat.c mipsv4-nat.c \ + mipsnbsd-nat.c mipsnbsd-tdep.c \ nbsd-tdep.c \ nindy-share/Onindy.c nindy-share/nindy.c \ nindy-share/ttyflush.c nindy-tdep.c \ ns32k-tdep.c solib-osf.c \ somread.c somsolib.c $(HPREAD_SOURCE) \ - ppc-linux-nat.c ppc-linux-tdep.c \ + ppc-sysv-tdep.o ppc-linux-nat.c ppc-linux-tdep.c \ + ppcnbsd-nat.o ppcnbsd-tdep.o \ procfs.c \ remote-adapt.c remote-array.c remote-bug.c remote-e7000.c remote-eb.c \ remote-es.c remote-hms.c remote-mips.c \ @@ -1230,8 +1253,10 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ rs6000-nat.c rs6000-tdep.c \ s390-tdep.c s390-nat.c \ ser-go32.c ser-pipe.c ser-tcp.c \ - sh-tdep.c solib.c solib-svr4.c solib-sunos.c sparc-linux-nat.c \ + sh-tdep.c shnbsd-tdep.c shnbsd-nat.c \ + solib.c solib-svr4.c solib-sunos.c sparc-linux-nat.c \ sparc-nat.c \ + sparc64nbsd-nat.c sparcnbsd-nat.c sparcnbsd-tdep.c \ sparc-tdep.c sparcl-tdep.c sun3-nat.c \ symm-tdep.c symm-nat.c \ vax-tdep.c \ @@ -1254,44 +1279,45 @@ a68v-nat.o: a68v-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) alpha-nat.o: alpha-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \ - $(regcache_h) alpha-tdep.h + $(regcache_h) $(alpha_tdep_h) alphabsd-nat.o: alphabsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ - alpha-tdep.h alphabsd-tdep.h + $(alpha_tdep_h) alphabsd-tdep.h alpha-tdep.o: alpha-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) $(symtab_h) $(dis_asm_h) $(gdb_string_h) $(linespec_h) \ - $(regcache_h) $(doublest_h) $(BFD_SRC)/elf-bfd.h alpha-tdep.h + $(regcache_h) $(doublest_h) $(BFD_SRC)/elf-bfd.h $(alpha_tdep_h) -alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(value_h) alpha-tdep.h +alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h) -alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) alpha-tdep.h +alpha-osf1-tdep.o: alpha-osf1-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h) alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) alphabsd-tdep.h -alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) alpha-tdep.h +alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(alpha_tdep_h) alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ - $(value_h) alpha-tdep.h alphabsd-tdep.h nbsd-tdep.h + $(value_h) $(alpha_tdep_h) solib-svr4.h alphabsd-tdep.h nbsd-tdep.h annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) $(gdbtypes_h) arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ - $(gdb_string_h) $(regcache_h) arm-tdep.h + $(gdb_string_h) $(regcache_h) $(arm_tdep_h) arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ - $(gdbtypes_h) $(floatformat_h) $(regcache_h) $(doublest_h) arm-tdep.h + $(gdbtypes_h) $(floatformat_h) $(regcache_h) $(doublest_h) $(arm_tdep_h) arm-tdep.o: arm-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(gdbcmd_h) \ $(gdbcore_h) $(gdb_string_h) $(dis_asm_h) $(regcache_h) $(doublest_h) \ - $(value_h) $(arch_utils_h) $(solib_svr4_h) arm-tdep.h \ + $(value_h) $(arch_utils_h) $(solib_svr4_h) $(arm_tdep_h) \ $(BFD_SRC)/elf-bfd.h $(INCLUDE_DIR)/coff/internal.h \ - $(INCLUDE_DIR)/elf/arm.h + $(INCLUDE_DIR)/elf/arm.h $(sim_arm_h) $(gdb_assert_h) -armnbsd-nat.o: armnbsd-nat.c $(defs_h) arm-tdep.h $(inferior_h) $(regcache_h) \ - $(gdbcore_h) +armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(arm_tdep_h) $(inferior_h) \ + $(regcache_h) $(gdbcore_h) -armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) arm-tdep.h +armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(arm_tdep_h) solib-svr4.h \ + nbsd-tdep.h avr-tdep.o: avr-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \ $(symfile_h) $(regcache_h) $(arch_utils_h) @@ -1316,7 +1342,8 @@ builtin-regs.o: builtin-regs.c $(defs.h) $(builtin_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(value_h) $(frame_h) c-lang.o: c-lang.c $(c_lang_h) $(defs_h) $(expression_h) $(gdbtypes_h) \ - $(language_h) $(parser_defs_h) $(symtab_h) + $(language_h) $(parser_defs_h) $(symtab_h) $(macroscope_h) \ + gdb_assert.h c-typeprint.o: c-typeprint.c $(c_lang_h) $(defs_h) $(expression_h) \ $(gdbcmd_h) $(gdbcore_h) $(gdbtypes_h) $(language_h) $(symtab_h) \ @@ -1397,7 +1424,8 @@ dcache.o: dcache.c $(dcache_h) $(defs_h) $(gdbcmd_h) $(gdb_string_h) \ d10v-tdep.o: d10v-tdep.c $(defs_h) $(frame_h) $(obstack_h) $(symtab_h) \ $(gdbtypes_h) $(gdbcmd_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \ $(inferior_h) $(dis-asm_h) $(symfile_h) $(objfiles_h) $(language_h) \ - $(arch_utils_h) $(regcache_h) $(floatformat_h) $(sim_d10v_h) + $(arch_utils_h) $(regcache_h) $(floatformat_h) $(sim_d10v_h) \ + $(sim_regno_h) dbxread.o: dbxread.c $(breakpoint_h) $(buildsym_h) $(command_h) \ $(complaints_h) $(defs_h) $(expression_h) $(gdb_stabs_h) $(gdbcore_h) \ @@ -1426,7 +1454,7 @@ dwarfread.o: dwarfread.c $(bfd_h) $(buildsym_h) $(complaints_h) $(defs_h) \ dwarf2read.o: dwarf2read.c $(bfd_h) $(buildsym_h) $(defs_h) \ $(expression_h) $(gdbtypes_h) $(language_h) $(objfiles_h) \ - $(symfile_h) $(symtab_h) $(gdb_string_h) + $(symfile_h) $(symtab_h) $(gdb_string_h) $(macrotab_h) elfread.o: elfread.c $(bfd_h) $(buildsym_h) $(complaints_h) $(defs_h) \ $(gdb_stabs_h) $(objfiles_h) $(symfile_h) $(symtab_h) $(gdb_string_h) \ @@ -1576,12 +1604,14 @@ arch-utils.o: arch-utils.c $(defs_h) $(bfd_h) $(gdbcmd_h) \ $(arch_utils_h) $(gdb_assert_h) $(inferior_h) \ $(gdb_string_h) $(symtab.h) $(frame_h) $(breakpoint_h) $(gdb_wait_h) \ $(gdbcore_h) $(target_h) $(annotate_h) $(regcache_h) $(gdb_assert_h) \ - $(version_h) $(floatformat_h) + $(version_h) $(floatformat_h) $(sim_regno_h) gdbtypes.o: gdbtypes.c $(bfd_h) $(complaints_h) $(defs_h) $(expression_h) \ $(gdbtypes_h) $(language_h) $(objfiles_h) $(symfile_h) $(symtab_h) \ $(target_h) $(value_h) $(gdb_string_h) $(wrapper_h) $(cp_abi_h) +osabi.o: osabi.c $(defs_h) $(BFD_SRC)/elf-bfd.h + go32-nat.o: go32-nat.c $(defs_h) $(inferior_h) $(gdb_wait_h) $(gdbcore_h) \ $(command_h) $(floatformat_h) $(target_h) i387-tdep.h $(regcache_h) @@ -1650,7 +1680,8 @@ i386v-nat.o: i386v-nat.c $(floatformat_h) $(defs_h) $(gdbcore_h) \ $(inferior_h) $(language_h) $(target_h) i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ - $(symtab_h) $(symfile_h) $(objfiles_h) $(regcache_h) + $(symtab_h) $(symfile_h) $(objfiles_h) $(regcache_h) \ + $(i386_linux_tdep_h) $(i386_tdep_h) $(i387_tdep_h) i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \ $(value_h) $(regcache_h) @@ -1808,7 +1839,8 @@ mips-nat.o: mips-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) mips-tdep.o: mips-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(arch_utils_h) $(regcache_h) \ - $(inferior_h) $(language_h) $(objfiles_h) $(symfile_h) $(gdb_string_h) + $(inferior_h) $(language_h) $(objfiles_h) $(symfile_h) \ + $(gdb_string_h) osabi.h mipsread.o: mipsread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \ $(expression_h) $(gdb_stabs_h) $(gdbcore_h) $(gdbtypes_h) \ @@ -1818,6 +1850,12 @@ mipsread.o: mipsread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \ mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(target_h) \ $(regcache_h) +mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ + mipsnbsd-tdep.h + +mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ + $(target_h) $(value_h) osabi.h solib-svr4.h mipsnbsd-tdep.h + mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ $(obstack_h) $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) \ $(gdbcore_h) $(symfile_h) $(regcache_h) $(arch-utils.h) @@ -1882,10 +1920,20 @@ ppc-bdm.o: ppc-bdm.c $(defs_h) $(gdbcore_h) $(gdb_string_h) $(frame_h) \ $(objfiles_h) $(gdb_stabs_h) $(serial_h) ocd.h $(regcache_h) ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdbcore_h) $(frame_h) \ - $(inferior_h) $(target_h) $(regcache_h) ppc-tdep.h + $(inferior_h) $(target_h) $(regcache_h) $(ppc_tdep_h) ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ - $(target_h) ppc-tdep.h $(regcache_h) $(value_h) + $(target_h) $(ppc_tdep_h) $(regcache_h) $(value_h) + +ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ + $(value_h) $(regcache_h) $(ppc_tdep_h) + +ppcnbsd-nat.o: ppcnbsd-nat.c $(defs_h) $(inferior_h) $(ppc_tdep_h) \ + ppcnbsd-tdep.h + +ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ + $(target_h) $(breakpoint_h) $(value_h) $(ppc_tdep_t) ppcnbsd-tdep.h \ + nbsd-tdep.h ppcbug-rom.o: ppcbug-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \ $(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h) \ @@ -1930,7 +1978,7 @@ remote-array.o: remote-array.c $(defs_h) $(gdbcore_h) $(target_h) \ $(version_h) $(regcache_h) remote-rdi.o: remote-rdi.c $(defs_h) $(gdbcore_h) \ - $(inferior_h) $(gdb_string_h) $(completer_h) arm-tdep.h + $(inferior_h) $(gdb_string_h) $(completer_h) $(arm_tdep_h) rdi-share/libangsd.a: force @dir=rdi-share; \ @@ -1943,7 +1991,7 @@ rdi-share/libangsd.a: force fi remote-rdp.o: remote-rdp.c $(defs_h) $(gdbcore_h) \ - $(inferior_h) $(gdb_string_h) arm-tdep.h + $(inferior_h) $(gdb_string_h) $(arm_tdep_h) $(callback_h) remote-bug.o: remote-bug.c $(defs_h) $(gdbcore_h) $(serial_h) \ $(inferior_h) $(target_h) $(terminal_h) $(remote_utils_h) \ @@ -1980,8 +2028,9 @@ remote-sds.o: remote-sds.c $(bfd_h) $(defs_h) $(gdbcmd_h) \ $(gdb_string_h) $(regcache_h) remote-sim.o: remote-sim.c $(defs_h) $(inferior_h) $(value_h) $(gdb_string_h) \ - $(terminal_h) $(target_h) $(gdbcore_h) $(INCLUDE_DIR)/callback.h \ - $(remote_sim_h) $(remote_utils_h) $(command_h) $(regcache_h) + $(terminal_h) $(target_h) $(gdbcore_h) $(callback_h) \ + $(remote_sim_h) $(remote_utils_h) $(command_h) $(regcache_h) \ + $(sim_regno_h) remote-st.o: remote-st.c $(defs_h) $(gdbcore_h) $(serial_h) \ $(target_h) $(gdb_string_h) $(regcache_h) @@ -2021,7 +2070,7 @@ rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(target_h) \ $(gdb_stabs_h) $(regcache_h) $(arch_utils_h) rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ - $(target_h) ppc-tdep.h $(regcache_h) $(value_h) $(parser_defs_h) + $(target_h) $(ppc_tdep_h) $(regcache_h) $(value_h) $(parser_defs_h) s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \ $(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \ @@ -2051,11 +2100,16 @@ serial.o: serial.c $(defs_h) $(serial_h) $(gdb_string_h) sh-tdep.o: sh-tdep.c $(bfd_h) $(dis_asm_h) \ $(srcdir)/../opcodes/sh-opc.h $(defs_h) $(expression_h) $(frame_h) \ $(gdbcmd_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(arch_utils_h) \ - $(regcache_h) $(doublest_h) + $(regcache_h) $(doublest_h) $(sh_tdep_h) + +shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ + $(value_h) $(sh_tdep_h) solib-svr4.h shnbsd-tdep.h nbsd-tdep.h + +shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) shnbsd-tdep.h sh3-rom.o: sh3-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(arch_utils_h) \ - $(regcache_h) + $(regcache_h) $(sh_tdep_h) signals.o: signals/signals.c $(defs_h) $(target_h) $(CC) -c $(INTERNAL_CFLAGS) $< @@ -2087,10 +2141,20 @@ sparc-nat.o: sparc-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(gdbcore_h) \ sparc-tdep.o: sparc-tdep.c $(floatformat_h) $(defs_h) $(gdbcore_h) \ $(inferior_h) $(objfiles_h) $(symfile_h) $(target_h) $(gdb_string_h) \ - $(arch_utils_h) $(regcache_h) + $(arch_utils_h) $(regcache_h) osabi.h sparcl-tdep.o: sparcl-tdep.c $(defs_h) $(gdbcore_h) $(target_h) $(regcache_h) +sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ + sparcnbsd-tdep.h + +sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ + sparcnbsd-tdep.h + +sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ + $(target_h) $(value_h) osabi.h sparcnbsd-tdep.h nbsd-tdep.h \ + solib-svr4.h + xstormy16-tdep.o: xstormy16-tdep.c $(defs_h) $(value_h) $(inferior_h) \ $(symfile_h) $(arch_utils_h) $(regcache_h) $(gdbcore_h) @@ -2142,6 +2206,11 @@ macroexp.o: macroexp.c $(defs_h) $(macrotab_h) macrotab.o: macrotab.c $(defs_h) $(obstack_h) $(objfiles_h) $(symtab_h) \ $(macrotab_h) $(splay_tree_h) gdb_assert.h $(bcache_h) +macroscope.o: macroscope.c $(defs_h) $(macroscope_h) + +macrocmd.o: macrocmd.c $(defs_h) $(macrotab_h) $(macroexp_h) \ + $(macroscope_h) $(command_h) $(gdbcmd_h) + target.o: target.c $(bfd_h) $(defs_h) $(gdbcmd_h) $(inferior_h) \ $(objfiles_h) $(symfile_h) $(target_h) $(gdb_string_h) $(regcache_h) diff --git a/gdb/NEWS b/gdb/NEWS index 7e84b2f785a..95dcf3cab0f 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,41 @@ *** Changes since GDB 5.2: +* ``gdbserver'' now supports multithreaded applications on some targets + +Support for multithreaded applications using LinuxThreads has been added +for arm*-*-linux*, i[3456]86-*-linux*, mips*-*-linux*, powerpc*-*-linux*, +and sh*-*-linux*. + +* GDB now supports C/C++ preprocessor macros. + +GDB now expands preprocessor macro invocations in C/C++ expressions, +and provides various commands for showing macro definitions and how +they expand. + +Most compilers don't include information about macros in the debugging +information by default. In GCC 3.1, for example, you need to compile +your program with the options `-gdwarf-2 -g3'. If the macro +information is present in the executable, GDB will read it. + +Here are the new commands for working with macros: + +** macro expand EXPRESSION + +Expand any macro invocations in expression, and show the result. + +** show macro MACRO-NAME + +Show the definition of the macro named MACRO-NAME, and where it was +defined. + +* Multi-arched targets. + +DEC Alpha (partial) alpha*-*-* +DEC VAX (partial) vax-*-* +NEC V850 v850-*-* +National Semiconductor NS32000 (partial) ns32k-*-* + * New targets. Atmel AVR avr*-*-* @@ -11,6 +46,8 @@ Atmel AVR avr*-*-* Alpha NetBSD alpha*-*-netbsd* SH NetBSD sh*-*-netbsdelf* +MIPS NetBSD mips*-*-netbsd* +UltraSPARC NetBSD sparc64-*-netbsd* * OBSOLETE configurations and files @@ -29,14 +66,6 @@ AMD 29000 embedded with a.out a29k-none-aout testsuite/gdb.hp/gdb.threads-hp/ directory -* Changes in VAX configurations. - -Multi-arch support is enabled for all VAX configurations. - -* Changes in Alpha configurations. - -Multi-arch support is enabled for all Alpha configurations. - * New command "set max-user-call-depth " This command allows the user to limit the call depth of user-defined diff --git a/gdb/PROBLEMS b/gdb/PROBLEMS index 09c62e1712f..49d27967daa 100644 --- a/gdb/PROBLEMS +++ b/gdb/PROBLEMS @@ -18,3 +18,15 @@ can be specified as part of the configuration vis: $ 'CC=cc -Ae' ./configure +s390*-*-* +--------- + +gdb/513: GDB does not build on s390 GNU/Linux. The problem should be +fixed in more recent sources. + + +i386-*-freebsd4.4* +------------------ + +gdb/455: GDB doesn't build on a FreeBSD 4.4-STABLE system. The +problem is still being investigated. diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c index d467840e920..4596d37e327 100644 --- a/gdb/alpha-linux-tdep.c +++ b/gdb/alpha-linux-tdep.c @@ -116,5 +116,6 @@ alpha_linux_init_abi (struct gdbarch_info info, void _initialize_alpha_linux_tdep (void) { - alpha_gdbarch_register_os_abi (ALPHA_ABI_LINUX, alpha_linux_init_abi); + gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_LINUX, + alpha_linux_init_abi); } diff --git a/gdb/alpha-osf1-tdep.c b/gdb/alpha-osf1-tdep.c index 67c56cf9d36..12320519ae8 100644 --- a/gdb/alpha-osf1-tdep.c +++ b/gdb/alpha-osf1-tdep.c @@ -69,5 +69,5 @@ alpha_osf1_init_abi (struct gdbarch_info info, void _initialize_alpha_osf1_tdep (void) { - alpha_gdbarch_register_os_abi (ALPHA_ABI_OSF1, alpha_osf1_init_abi); + gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_OSF1, alpha_osf1_init_abi); } diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index f354036dda4..8a87a8a5e50 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -53,9 +53,9 @@ static gdbarch_register_convert_to_virtual_ftype alpha_register_convert_to_virtual; static gdbarch_register_convert_to_raw_ftype alpha_register_convert_to_raw; static gdbarch_store_struct_return_ftype alpha_store_struct_return; -static gdbarch_extract_return_value_ftype alpha_extract_return_value; +static gdbarch_deprecated_extract_return_value_ftype alpha_extract_return_value; static gdbarch_store_return_value_ftype alpha_store_return_value; -static gdbarch_extract_struct_value_address_ftype +static gdbarch_deprecated_extract_struct_value_address_ftype alpha_extract_struct_value_address; static gdbarch_use_struct_convention_ftype alpha_use_struct_convention; @@ -1766,186 +1766,6 @@ alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p) } -/* This table matches the indices assigned to enum alpha_abi. Keep - them in sync. */ -static const char * const alpha_abi_names[] = -{ - "", - "OSF/1", - "GNU/Linux", - "FreeBSD", - "NetBSD", - NULL -}; - -static void -process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) -{ - enum alpha_abi *os_ident_ptr = obj; - const char *name; - unsigned int sectsize; - - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); - - if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) - { - unsigned int name_length, data_length, note_type; - char *note; - - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; - - note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - data_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 4 && data_length == 16 && note_type == 1 - && strcmp (note + 12, "GNU") == 0) - { - int os_number = bfd_h_get_32 (abfd, note + 16); - - /* The case numbers are from abi-tags in glibc. */ - switch (os_number) - { - case 0 : - *os_ident_ptr = ALPHA_ABI_LINUX; - break; - - case 1 : - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: Hurd objects not supported"); - break; - - case 2 : - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: Solaris objects not supported"); - break; - - default : - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: unknown OS number %d", - os_number); - break; - } - } - } - /* NetBSD uses a similar trick. */ - else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0) - { - unsigned int name_length, desc_length, note_type; - char *note; - - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; - - note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - desc_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 7 && desc_length == 4 && note_type == 1 - && strcmp (note + 12, "NetBSD") == 0) - /* XXX Should we check the version here? - Probably not necessary yet. */ - *os_ident_ptr = ALPHA_ABI_NETBSD; - } -} - -static int -get_elfosabi (bfd *abfd) -{ - int elfosabi; - enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN; - - elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; - - /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate - what we're on a SYSV system. However, GNU/Linux uses a note section - to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we - have to check the note sections too. */ - if (elfosabi == 0) - { - bfd_map_over_sections (abfd, - process_note_abi_tag_sections, - &alpha_abi); - } - - if (alpha_abi != ALPHA_ABI_UNKNOWN) - return alpha_abi; - - switch (elfosabi) - { - case ELFOSABI_NONE: - /* Leave it as unknown. */ - break; - - case ELFOSABI_NETBSD: - return ALPHA_ABI_NETBSD; - - case ELFOSABI_FREEBSD: - return ALPHA_ABI_FREEBSD; - - case ELFOSABI_LINUX: - return ALPHA_ABI_LINUX; - } - - return ALPHA_ABI_UNKNOWN; -} - -struct alpha_abi_handler -{ - struct alpha_abi_handler *next; - enum alpha_abi abi; - void (*init_abi)(struct gdbarch_info, struct gdbarch *); -}; - -struct alpha_abi_handler *alpha_abi_handler_list = NULL; - -void -alpha_gdbarch_register_os_abi (enum alpha_abi abi, - void (*init_abi)(struct gdbarch_info, - struct gdbarch *)) -{ - struct alpha_abi_handler **handler_p; - - for (handler_p = &alpha_abi_handler_list; *handler_p != NULL; - handler_p = &(*handler_p)->next) - { - if ((*handler_p)->abi == abi) - { - internal_error - (__FILE__, __LINE__, - "alpha_gdbarch_register_os_abi: A handler for this ABI variant " - "(%d) has already been registered", (int) abi); - /* If user wants to continue, override previous definition. */ - (*handler_p)->init_abi = init_abi; - return; - } - } - - (*handler_p) - = (struct alpha_abi_handler *) xmalloc (sizeof (struct alpha_abi_handler)); - (*handler_p)->next = NULL; - (*handler_p)->abi = abi; - (*handler_p)->init_abi = init_abi; -} /* Initialize the current architecture based on INFO. If possible, re-use an architecture from ARCHES, which is a list of architectures already created @@ -1959,27 +1779,18 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch_tdep *tdep; struct gdbarch *gdbarch; - enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN; - struct alpha_abi_handler *abi_handler; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; /* Try to determine the ABI of the object we are loading. */ if (info.abfd != NULL) { - switch (bfd_get_flavour (info.abfd)) + osabi = gdbarch_lookup_osabi (info.abfd); + if (osabi == GDB_OSABI_UNKNOWN) { - case bfd_target_elf_flavour: - alpha_abi = get_elfosabi (info.abfd); - break; - - case bfd_target_ecoff_flavour: - /* Assume it's OSF/1. */ - alpha_abi = ALPHA_ABI_OSF1; - break; - - default: - /* Not sure what to do here, leave the ABI as unknown. */ - break; + /* If it's an ECOFF file, assume it's OSF/1. */ + if (bfd_get_flavour (info.abfd) == bfd_target_ecoff_flavour) + osabi = GDB_OSABI_OSF1; } } @@ -1990,22 +1801,14 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { /* Make sure the ABI selection matches. */ tdep = gdbarch_tdep (arches->gdbarch); - if (tdep && tdep->alpha_abi == alpha_abi) + if (tdep && tdep->osabi == osabi) return arches->gdbarch; } tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); - tdep->alpha_abi = alpha_abi; - if (alpha_abi < ALPHA_ABI_INVALID) - tdep->abi_name = alpha_abi_names[alpha_abi]; - else - { - internal_error (__FILE__, __LINE__, "Invalid setting of alpha_abi %d", - (int) alpha_abi); - tdep->abi_name = ""; - } + tdep->osabi = osabi; /* Lowest text address. This is used by heuristic_proc_start() to decide when to stop looking. */ @@ -2069,11 +1872,11 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_get_saved_register (gdbarch, alpha_get_saved_register); set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention); - set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, alpha_extract_return_value); set_gdbarch_store_struct_return (gdbarch, alpha_store_struct_return); set_gdbarch_store_return_value (gdbarch, alpha_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, alpha_extract_struct_value_address); /* Settings for calling functions in the inferior. */ @@ -2122,38 +1925,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 0); /* Hook in ABI-specific overrides, if they have been registered. */ - if (alpha_abi == ALPHA_ABI_UNKNOWN) - { - /* Don't complain about not knowing the ABI variant if we don't - have an inferior. */ - if (info.abfd) - fprintf_filtered - (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. " - "Attempting to continue with the default Alpha settings"); - } - else - { - for (abi_handler = alpha_abi_handler_list; abi_handler != NULL; - abi_handler = abi_handler->next) - if (abi_handler->abi == alpha_abi) - break; - - if (abi_handler) - abi_handler->init_abi (info, gdbarch); - else - { - /* We assume that if GDB_MULTI_ARCH is less than - GDB_MULTI_ARCH_TM that an ABI variant can be supported by - overriding definitions in this file. */ - if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - fprintf_filtered - (gdb_stderr, - "A handler for the ABI variant \"%s\" is not built into this " - "configuration of GDB. " - "Attempting to continue with the default Alpha settings", - alpha_abi_names[alpha_abi]); - } - } + gdbarch_init_osabi (info, gdbarch, osabi); /* Now that we have tuned the configuration, set a few final things based on what the OS ABI has told us. */ @@ -2172,12 +1944,8 @@ alpha_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) if (tdep == NULL) return; - if (tdep->abi_name != NULL) - fprintf_unfiltered (file, "alpha_dump_tdep: ABI = %s\n", tdep->abi_name); - else - internal_error (__FILE__, __LINE__, - "alpha_dump_tdep: illegal setting of tdep->alpha_abi (%d)", - (int) tdep->alpha_abi); + fprintf_unfiltered (file, "alpha_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); fprintf_unfiltered (file, "alpha_dump_tdep: vm_min_address = 0x%lx\n", diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h index c3ee007c6ac..cea232b502c 100644 --- a/gdb/alpha-tdep.h +++ b/gdb/alpha-tdep.h @@ -22,6 +22,8 @@ #ifndef ALPHA_TDEP_H #define ALPHA_TDEP_H +#include "osabi.h" + /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ @@ -76,24 +78,10 @@ pointer, the value of localoff is obtained from the PDR. */ #define ALPHA_NUM_ARG_REGS 6 -/* ABI variants that we know about. If you add to this enum, please - update the table of names in alpha-tdep.c. */ -enum alpha_abi -{ - ALPHA_ABI_UNKNOWN = 0, - ALPHA_ABI_OSF1, - ALPHA_ABI_LINUX, - ALPHA_ABI_FREEBSD, - ALPHA_ABI_NETBSD, - - ALPHA_ABI_INVALID /* Keep this last. */ -}; - /* Target-dependent structure in gdbarch. */ struct gdbarch_tdep { - enum alpha_abi alpha_abi; /* OS/ABI of inferior. */ - const char *abi_name; /* Name of the above. */ + enum gdb_osabi osabi; /* OS/ABI of inferior. */ CORE_ADDR vm_min_address; /* used by heuristic_proc_start */ @@ -118,8 +106,4 @@ struct gdbarch_tdep void alpha_software_single_step (enum target_signal, int); -void alpha_gdbarch_register_os_abi (enum alpha_abi, - void (*init_abi)(struct gdbarch_info, - struct gdbarch *)); - #endif /* ALPHA_TDEP_H */ diff --git a/gdb/alphafbsd-tdep.c b/gdb/alphafbsd-tdep.c index 3c1e64da3e8..f8f515d3cc8 100644 --- a/gdb/alphafbsd-tdep.c +++ b/gdb/alphafbsd-tdep.c @@ -78,5 +78,6 @@ alphafbsd_init_abi (struct gdbarch_info info, void _initialize_alphafbsd_tdep (void) { - alpha_gdbarch_register_os_abi (ALPHA_ABI_FREEBSD, alphafbsd_init_abi); + gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_FREEBSD_ELF, + alphafbsd_init_abi); } diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index d10a3cab159..519d8164ca3 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -24,6 +24,8 @@ #include "regcache.h" #include "value.h" +#include "solib-svr4.h" + #include "alpha-tdep.h" #include "alphabsd-tdep.h" #include "nbsd-tdep.h" @@ -133,29 +135,29 @@ static struct core_fns alphanbsd_elfcore_fns = sequence and can then check whether we really are executing in the signal trampoline. If not, -1 is returned, otherwise the offset from the start of the return sequence is returned. */ -static const unsigned int sigtramp_retcode[] = +static const unsigned char sigtramp_retcode[] = { - 0xa61e0000, /* ldq a0, 0(sp) */ - 0x23de0010, /* lda sp, 16(sp) */ - 0x201f0127, /* lda v0, 295(zero) */ - 0x00000083, /* call_pal callsys */ + 0x00, 0x00, 0x1e, 0xa6, /* ldq a0, 0(sp) */ + 0x10, 0x00, 0xde, 0x23, /* lda sp, 16(sp) */ + 0x27, 0x01, 0x1f, 0x20, /* lda v0, 295(zero) */ + 0x83, 0x00, 0x00, 0x00, /* call_pal callsys */ }; -#define RETCODE_NWORDS \ - (sizeof (sigtramp_retcode) / sizeof (sigtramp_retcode[0])) +#define RETCODE_NWORDS 4 +#define RETCODE_SIZE (RETCODE_NWORDS * 4) LONGEST alphanbsd_sigtramp_offset (CORE_ADDR pc) { - unsigned int ret[4], w; + unsigned char ret[RETCODE_SIZE], w[4]; LONGEST off; int i; - if (read_memory_nobpt (pc, (char *) &w, 4) != 0) + if (read_memory_nobpt (pc, (char *) w, 4) != 0) return -1; for (i = 0; i < RETCODE_NWORDS; i++) { - if (w == sigtramp_retcode[i]) + if (memcmp (w, sigtramp_retcode + (i * 4), 4) == 0) break; } if (i == RETCODE_NWORDS) @@ -167,7 +169,7 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc) if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0) return -1; - if (memcmp (ret, sigtramp_retcode, sizeof (sigtramp_retcode)) == 0) + if (memcmp (ret, sigtramp_retcode, RETCODE_SIZE) == 0) return off; return -1; @@ -203,7 +205,8 @@ alphanbsd_init_abi (struct gdbarch_info info, void _initialize_alphanbsd_tdep (void) { - alpha_gdbarch_register_os_abi (ALPHA_ABI_NETBSD, alphanbsd_init_abi); + gdbarch_register_osabi (bfd_arch_alpha, GDB_OSABI_NETBSD_ELF, + alphanbsd_init_abi); add_core_fns (&alphanbsd_core_fns); add_core_fns (&alphanbsd_elfcore_fns); diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index bde89a8fa8e..887aa9d7223 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -42,6 +42,7 @@ #endif #include "regcache.h" #include "gdb_assert.h" +#include "sim-regno.h" #include "version.h" @@ -90,6 +91,22 @@ legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr) return NULL; } +int +legacy_register_sim_regno (int regnum) +{ + /* Only makes sense to supply raw registers. */ + gdb_assert (regnum >= 0 && regnum < NUM_REGS); + /* NOTE: cagney/2002-05-13: The old code did it this way and it is + suspected that some GDB/SIM combinations may rely on this + behavour. The default should be one2one_register_sim_regno + (below). */ + if (REGISTER_NAME (regnum) != NULL + && REGISTER_NAME (regnum)[0] != '\0') + return regnum; + else + return LEGACY_SIM_REGNO_IGNORE; +} + int generic_frameless_function_invocation_not (struct frame_info *fi) { @@ -224,7 +241,8 @@ default_double_format (struct gdbarch *gdbarch) } void -default_print_float_info (void) +default_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, + struct frame_info *frame) { #ifdef FLOAT_INFO #if GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL @@ -232,7 +250,8 @@ default_print_float_info (void) #endif FLOAT_INFO; #else - printf_filtered ("No floating point info available for this processor.\n"); + fprintf_filtered (file, "\ +No floating point info available for this processor.\n"); #endif } @@ -267,13 +286,6 @@ generic_cannot_extract_struct_value_address (char *dummy) return 0; } -int -default_register_sim_regno (int num) -{ - return num; -} - - CORE_ADDR core_addr_identity (CORE_ADDR addr) { diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 594a83209a3..0b397af82d4 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -94,11 +94,6 @@ extern void set_architecture_from_arch_mach (enum bfd_architecture, unsigned lon extern int (*target_architecture_hook) (const struct bfd_arch_info *); - -/* Default raw->sim register re-numbering - does nothing. */ - -extern int default_register_sim_regno (int reg_nr); - /* Identity function on a CORE_ADDR. Just returns its parameter. */ extern CORE_ADDR core_addr_identity (CORE_ADDR addr); @@ -147,7 +142,9 @@ extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name); extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); -extern void default_print_float_info (void); +extern void default_print_float_info (struct gdbarch *gdbarch, + struct ui_file *file, + struct frame_info *frame); /* Assume that the world is sane, a registers raw and virtual size both match its type. */ @@ -166,6 +163,12 @@ extern int legacy_convert_register_p (int regnum); extern void legacy_register_to_value (int regnum, struct type *type, char *from, char *to); extern void legacy_value_to_register (struct type *type, int regnum, char *from, char *to); +/* For compatibility with older architectures, returns + (LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid + name. */ + +extern int legacy_register_sim_regno (int regnum); + /* Initialize a ``struct info''. Can't use memset(0) since some default values are not zero. */ extern void gdbarch_info_init (struct gdbarch_info *info); diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 29f11ae91bf..cb930b64068 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -532,7 +532,7 @@ arm_linux_init_abi (struct gdbarch_info info, sizeof (arm_linux_call_dummy_words)); /* The following two overrides shouldn't be needed. */ - set_gdbarch_extract_return_value (gdbarch, arm_linux_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value); set_gdbarch_push_arguments (gdbarch, arm_linux_push_arguments); /* Shared library handling. */ @@ -543,5 +543,5 @@ arm_linux_init_abi (struct gdbarch_info info, void _initialize_arm_linux_tdep (void) { - arm_gdbarch_register_os_abi (ARM_ABI_LINUX, arm_linux_init_abi); + gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_LINUX, arm_linux_init_abi); } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 646d5c6ea9c..e316cf7c2a2 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -36,11 +36,16 @@ #include "solib-svr4.h" #include "arm-tdep.h" +#include "gdb/sim-arm.h" #include "elf-bfd.h" #include "coff/internal.h" #include "elf/arm.h" +#include "gdb_assert.h" + +static int arm_debug; + /* Each OS has a different mechanism for accessing the various registers stored in the sigcontext structure. @@ -93,23 +98,6 @@ #define MSYMBOL_SIZE(msym) \ ((long) MSYMBOL_INFO (msym) & 0x7fffffff) -/* This table matches the indicees assigned to enum arm_abi. - Keep them in sync. */ - -static const char * const arm_abi_names[] = -{ - "", - "ARM EABI (version 1)", - "ARM EABI (version 2)", - "GNU/Linux", - "NetBSD (a.out)", - "NetBSD (ELF)", - "APCS", - "FreeBSD", - "Windows CE", - NULL -}; - /* Number of different reg name sets (options). */ static int num_flavor_options; @@ -1424,104 +1412,125 @@ static CORE_ADDR arm_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { - char *fp; - int argnum, argreg, nstack_size; + CORE_ADDR fp; + int argnum; + int argreg; + int nstack; + int simd_argreg; + int second_pass; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); /* Walk through the list of args and determine how large a temporary stack is required. Need to take care here as structs may be - passed on the stack, and we have to to push them. */ - nstack_size = -4 * REGISTER_SIZE; /* Some arguments go into A1-A4. */ - if (struct_return) /* The struct address goes in A1. */ - nstack_size += REGISTER_SIZE; - - /* Walk through the arguments and add their size to nstack_size. */ - for (argnum = 0; argnum < nargs; argnum++) - { - int len; - struct type *arg_type; - - arg_type = check_typedef (VALUE_TYPE (args[argnum])); - len = TYPE_LENGTH (arg_type); - - nstack_size += len; - } - - /* Allocate room on the stack, and initialize our stack frame - pointer. */ - fp = NULL; - if (nstack_size > 0) + passed on the stack, and we have to to push them. On the second + pass, do the store. */ + nstack = 0; + fp = sp; + for (second_pass = 0; second_pass < 2; second_pass++) { - sp -= nstack_size; - fp = (char *) sp; - } - - /* Initialize the integer argument register pointer. */ - argreg = ARM_A1_REGNUM; - - /* The struct_return pointer occupies the first parameter passing - register. */ - if (struct_return) - write_register (argreg++, struct_addr); - - /* Process arguments from left to right. Store as many as allowed - in the parameter passing registers (A1-A4), and save the rest on - the temporary stack. */ - for (argnum = 0; argnum < nargs; argnum++) - { - int len; - char *val; - CORE_ADDR regval; - enum type_code typecode; - struct type *arg_type, *target_type; - - arg_type = check_typedef (VALUE_TYPE (args[argnum])); - target_type = TYPE_TARGET_TYPE (arg_type); - len = TYPE_LENGTH (arg_type); - typecode = TYPE_CODE (arg_type); - val = (char *) VALUE_CONTENTS (args[argnum]); - -#if 1 - /* I don't know why this code was disable. The only logical use - for a function pointer is to call that function, so setting - the mode bit is perfectly fine. FN */ - /* If the argument is a pointer to a function, and it is a Thumb - function, set the low bit of the pointer. */ - if (TYPE_CODE_PTR == typecode - && NULL != target_type - && TYPE_CODE_FUNC == TYPE_CODE (target_type)) + /* Compute the FP using the information computed during the + first pass. */ + if (second_pass) + fp = sp - nstack; + + simd_argreg = 0; + argreg = ARM_A1_REGNUM; + nstack = 0; + + /* The struct_return pointer occupies the first parameter + passing register. */ + if (struct_return) { - CORE_ADDR regval = extract_address (val, len); - if (arm_pc_is_thumb (regval)) - store_address (val, len, MAKE_THUMB_ADDR (regval)); + if (second_pass) + { + if (arm_debug) + fprintf_unfiltered (gdb_stdlog, + "struct return in %s = 0x%s\n", + REGISTER_NAME (argreg), + paddr (struct_addr)); + write_register (argreg, struct_addr); + } + argreg++; } -#endif - /* Copy the argument to general registers or the stack in - register-sized pieces. Large arguments are split between - registers and stack. */ - while (len > 0) - { - int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE; - if (argreg <= ARM_LAST_ARG_REGNUM) + for (argnum = 0; argnum < nargs; argnum++) + { + int len; + struct type *arg_type; + struct type *target_type; + enum type_code typecode; + char *val; + + arg_type = check_typedef (VALUE_TYPE (args[argnum])); + len = TYPE_LENGTH (arg_type); + target_type = TYPE_TARGET_TYPE (arg_type); + typecode = TYPE_CODE (arg_type); + val = VALUE_CONTENTS (args[argnum]); + + /* If the argument is a pointer to a function, and it is a + Thumb function, create a LOCAL copy of the value and set + the THUMB bit in it. */ + if (second_pass + && TYPE_CODE_PTR == typecode + && target_type != NULL + && TYPE_CODE_FUNC == TYPE_CODE (target_type)) { - /* It's an argument being passed in a general register. */ - regval = extract_address (val, partial_len); - write_register (argreg++, regval); + CORE_ADDR regval = extract_address (val, len); + if (arm_pc_is_thumb (regval)) + { + val = alloca (len); + store_address (val, len, MAKE_THUMB_ADDR (regval)); + } } - else + + /* Copy the argument to general registers or the stack in + register-sized pieces. Large arguments are split between + registers and stack. */ + while (len > 0) { - /* Push the arguments onto the stack. */ - write_memory ((CORE_ADDR) fp, val, REGISTER_SIZE); - fp += REGISTER_SIZE; + int partial_len = len < REGISTER_SIZE ? len : REGISTER_SIZE; + + if (argreg <= ARM_LAST_ARG_REGNUM) + { + /* The argument is being passed in a general purpose + register. */ + if (second_pass) + { + CORE_ADDR regval = extract_address (val, + partial_len); + if (arm_debug) + fprintf_unfiltered (gdb_stdlog, + "arg %d in %s = 0x%s\n", + argnum, + REGISTER_NAME (argreg), + phex (regval, REGISTER_SIZE)); + write_register (argreg, regval); + } + argreg++; + } + else + { + if (second_pass) + { + /* Push the arguments onto the stack. */ + if (arm_debug) + fprintf_unfiltered (gdb_stdlog, + "arg %d @ 0x%s + %d\n", + argnum, paddr (fp), nstack); + write_memory (fp + nstack, val, REGISTER_SIZE); + } + nstack += REGISTER_SIZE; + } + + len -= partial_len; + val += partial_len; } - len -= partial_len; - val += partial_len; } } - /* Return adjusted stack pointer. */ - return sp; + /* Return the botom of the argument list (pointed to by fp). */ + return fp; } /* Pop the current frame. So long as the frame info has been @@ -1575,7 +1584,8 @@ print_fpu_flags (int flags) /* Print interesting information about the floating point processor (if present) or emulator. */ static void -arm_print_float_info (void) +arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, + struct frame_info *frame) { register unsigned long status = read_register (ARM_FPS_REGNUM); int type; @@ -1652,6 +1662,27 @@ arm_register_virtual_size (int regnum) return STATUS_REGISTER_SIZE; } +/* Map GDB internal REGNUM onto the Arm simulator register numbers. */ +static int +arm_register_sim_regno (int regnum) +{ + int reg = regnum; + gdb_assert (reg >= 0 && reg < NUM_REGS); + + if (reg < NUM_GREGS) + return SIM_ARM_R0_REGNUM + reg; + reg -= NUM_GREGS; + + if (reg < NUM_FREGS) + return SIM_ARM_FP0_REGNUM + reg; + reg -= NUM_FREGS; + + if (reg < NUM_SREGS) + return SIM_ARM_FPS_REGNUM + reg; + reg -= NUM_SREGS; + + internal_error (__FILE__, __LINE__, "Bad REGNUM %d", regnum); +} /* NOTE: cagney/2001-08-20: Both convert_from_extended() and convert_to_extended() use floatformat_arm_ext_littlebyte_bigword. @@ -2608,208 +2639,82 @@ arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym) } -static void -process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) +static enum gdb_osabi +arm_elf_osabi_sniffer (bfd *abfd) { - enum arm_abi *os_ident_ptr = obj; - const char *name; - unsigned int sectsize; + unsigned int elfosabi, eflags; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); + elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; - if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) + switch (elfosabi) { - unsigned int name_length, data_length, note_type; - char *note; - - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; - - note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - data_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 4 && data_length == 16 && note_type == 1 - && strcmp (note + 12, "GNU") == 0) + case ELFOSABI_NONE: + /* When elfosabi is ELFOSABI_NONE (0), then the ELF structures in the + file are conforming to the base specification for that machine + (there are no OS-specific extensions). In order to determine the + real OS in use we must look for OS notes that have been added. */ + bfd_map_over_sections (abfd, + generic_elf_osabi_sniff_abi_tag_sections, + &osabi); + if (osabi == GDB_OSABI_UNKNOWN) { - int os_number = bfd_h_get_32 (abfd, note + 16); - - /* The case numbers are from abi-tags in glibc. */ - switch (os_number) + /* Existing ARM tools don't set this field, so look at the EI_FLAGS + field for more information. */ + eflags = EF_ARM_EABI_VERSION(elf_elfheader(abfd)->e_flags); + switch (eflags) { - case 0 : - *os_ident_ptr = ARM_ABI_LINUX; + case EF_ARM_EABI_VER1: + osabi = GDB_OSABI_ARM_EABI_V1; break; - case 1 : - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: Hurd objects not supported"); + case EF_ARM_EABI_VER2: + osabi = GDB_OSABI_ARM_EABI_V2; break; - case 2 : - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: Solaris objects not supported"); + case EF_ARM_EABI_UNKNOWN: + /* Assume GNU tools. */ + osabi = GDB_OSABI_ARM_APCS; break; - default : - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: unknown OS number %d", - os_number); - break; + default: + internal_error (__FILE__, __LINE__, + "arm_elf_osabi_sniffer: Unknown ARM EABI " + "version 0x%x", eflags); } } - } - /* NetBSD uses a similar trick. */ - else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0) - { - unsigned int name_length, desc_length, note_type; - char *note; - - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; - - note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - desc_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 7 && desc_length == 4 && note_type == 1 - && strcmp (note + 12, "NetBSD") == 0) - /* XXX Should we check the version here? - Probably not necessary yet. */ - *os_ident_ptr = ARM_ABI_NETBSD_ELF; - } -} - -/* Return one of the ELFOSABI_ constants for BFDs representing ELF - executables. If it's not an ELF executable or if the OS/ABI couldn't - be determined, simply return -1. */ - -static int -get_elfosabi (bfd *abfd) -{ - int elfosabi; - enum arm_abi arm_abi = ARM_ABI_UNKNOWN; - - elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; - - /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate - that we're on a SYSV system. However, GNU/Linux uses a note section - to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we - have to check the note sections too. + break; - GNU/ARM tools set the EI_OSABI field to ELFOSABI_ARM, so handle that - as well. */ - if (elfosabi == 0 || elfosabi == ELFOSABI_ARM) - { + case ELFOSABI_ARM: + /* GNU tools use this value. Check note sections in this case, + as well. */ bfd_map_over_sections (abfd, - process_note_abi_tag_sections, - &arm_abi); - } - - if (arm_abi != ARM_ABI_UNKNOWN) - return arm_abi; - - switch (elfosabi) - { - case ELFOSABI_NONE: - /* Existing ARM Tools don't set this field, so look at the EI_FLAGS - field for more information. */ - - switch (EF_ARM_EABI_VERSION(elf_elfheader(abfd)->e_flags)) + generic_elf_osabi_sniff_abi_tag_sections, + &osabi); + if (osabi == GDB_OSABI_UNKNOWN) { - case EF_ARM_EABI_VER1: - return ARM_ABI_EABI_V1; - - case EF_ARM_EABI_VER2: - return ARM_ABI_EABI_V2; - - case EF_ARM_EABI_UNKNOWN: - /* Assume GNU tools. */ - return ARM_ABI_APCS; - - default: - internal_error (__FILE__, __LINE__, - "get_elfosabi: Unknown ARM EABI version 0x%lx", - EF_ARM_EABI_VERSION(elf_elfheader(abfd)->e_flags)); - + /* Assume APCS ABI. */ + osabi = GDB_OSABI_ARM_APCS; } break; - case ELFOSABI_NETBSD: - return ARM_ABI_NETBSD_ELF; - case ELFOSABI_FREEBSD: - return ARM_ABI_FREEBSD; - - case ELFOSABI_LINUX: - return ARM_ABI_LINUX; - - case ELFOSABI_ARM: - /* Assume GNU tools with the old APCS abi. */ - return ARM_ABI_APCS; - - default: - } - - return ARM_ABI_UNKNOWN; -} - -struct arm_abi_handler -{ - struct arm_abi_handler *next; - enum arm_abi abi; - void (*init_abi)(struct gdbarch_info, struct gdbarch *); -}; - -struct arm_abi_handler *arm_abi_handler_list = NULL; + osabi = GDB_OSABI_FREEBSD_ELF; + break; -void -arm_gdbarch_register_os_abi (enum arm_abi abi, - void (*init_abi)(struct gdbarch_info, - struct gdbarch *)) -{ - struct arm_abi_handler **handler_p; + case ELFOSABI_NETBSD: + osabi = GDB_OSABI_NETBSD_ELF; + break; - for (handler_p = &arm_abi_handler_list; *handler_p != NULL; - handler_p = &(*handler_p)->next) - { - if ((*handler_p)->abi == abi) - { - internal_error - (__FILE__, __LINE__, - "arm_gdbarch_register_os_abi: A handler for this ABI variant (%d)" - " has already been registered", (int)abi); - /* If user wants to continue, override previous definition. */ - (*handler_p)->init_abi = init_abi; - return; - } + case ELFOSABI_LINUX: + osabi = GDB_OSABI_LINUX; + break; } - (*handler_p) - = (struct arm_abi_handler *) xmalloc (sizeof (struct arm_abi_handler)); - (*handler_p)->next = NULL; - (*handler_p)->abi = abi; - (*handler_p)->init_abi = init_abi; + return osabi; } + /* Initialize the current architecture based on INFO. If possible, re-use an architecture from ARCHES, which is a list of architectures already created during this debugging session. @@ -2822,36 +2727,31 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch_tdep *tdep; struct gdbarch *gdbarch; - enum arm_abi arm_abi = ARM_ABI_UNKNOWN; - struct arm_abi_handler *abi_handler; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; /* Try to deterimine the ABI of the object we are loading. */ if (info.abfd != NULL) { - switch (bfd_get_flavour (info.abfd)) + osabi = gdbarch_lookup_osabi (info.abfd); + if (osabi == GDB_OSABI_UNKNOWN) { - case bfd_target_elf_flavour: - arm_abi = get_elfosabi (info.abfd); - break; - - case bfd_target_aout_flavour: - if (strcmp (bfd_get_target(info.abfd), "a.out-arm-netbsd") == 0) - arm_abi = ARM_ABI_NETBSD_AOUT; - else - /* Assume it's an old APCS-style ABI. */ - arm_abi = ARM_ABI_APCS; - break; + switch (bfd_get_flavour (info.abfd)) + { + case bfd_target_aout_flavour: + /* Assume it's an old APCS-style ABI. */ + osabi = GDB_OSABI_ARM_APCS; + break; - case bfd_target_coff_flavour: - /* Assume it's an old APCS-style ABI. */ - /* XXX WinCE? */ - arm_abi = ARM_ABI_APCS; - break; + case bfd_target_coff_flavour: + /* Assume it's an old APCS-style ABI. */ + /* XXX WinCE? */ + osabi = GDB_OSABI_ARM_APCS; + break; - default: - /* Not sure what to do here, leave the ABI as unknown. */ - break; + default: + /* Leave it as "unknown". */ + } } } @@ -2862,22 +2762,14 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { /* Make sure the ABI selection matches. */ tdep = gdbarch_tdep (arches->gdbarch); - if (tdep && tdep->arm_abi == arm_abi) + if (tdep && tdep->osabi == osabi) return arches->gdbarch; } tdep = xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); - tdep->arm_abi = arm_abi; - if (arm_abi < ARM_ABI_INVALID) - tdep->abi_name = arm_abi_names[arm_abi]; - else - { - internal_error (__FILE__, __LINE__, "Invalid setting of arm_abi %d", - (int) arm_abi); - tdep->abi_name = ""; - } + tdep->osabi = osabi; /* This is the way it has always defaulted. */ tdep->fp_model = ARM_FLOAT_FPA; @@ -3025,16 +2917,19 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_max_register_virtual_size (gdbarch, FP_REGISTER_VIRTUAL_SIZE); set_gdbarch_register_virtual_type (gdbarch, arm_register_type); + /* Internal <-> external register number maps. */ + set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno); + /* Integer registers are 4 bytes. */ set_gdbarch_register_size (gdbarch, 4); set_gdbarch_register_name (gdbarch, arm_register_name); /* Returning results. */ - set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, arm_extract_return_value); set_gdbarch_store_return_value (gdbarch, arm_store_return_value); set_gdbarch_store_struct_return (gdbarch, arm_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention); - set_gdbarch_extract_struct_value_address (gdbarch, + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, arm_extract_struct_value_address); /* Single stepping. */ @@ -3047,38 +2942,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) arm_coff_make_msymbol_special); /* Hook in the ABI-specific overrides, if they have been registered. */ - if (arm_abi == ARM_ABI_UNKNOWN) - { - /* Don't complain about not knowing the ABI variant if we don't - have an inferior. */ - if (info.abfd) - fprintf_filtered - (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. " - "Attempting to continue with the default ARM settings"); - } - else - { - for (abi_handler = arm_abi_handler_list; abi_handler != NULL; - abi_handler = abi_handler->next) - if (abi_handler->abi == arm_abi) - break; - - if (abi_handler) - abi_handler->init_abi (info, gdbarch); - else - { - /* We assume that if GDB_MULTI_ARCH is less than - GDB_MULTI_ARCH_TM that an ABI variant can be supported by - overriding definitions in this file. */ - if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - fprintf_filtered - (gdb_stderr, - "A handler for the ABI variant \"%s\" is not built into this " - "configuration of GDB. " - "Attempting to continue with the default ARM settings", - arm_abi_names[arm_abi]); - } - } + gdbarch_init_osabi (info, gdbarch, osabi); /* Now we have tuned the configuration, set a few final things, based on what the OS ABI has told us. */ @@ -3144,12 +3008,8 @@ arm_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) if (tdep == NULL) return; - if (tdep->abi_name != NULL) - fprintf_unfiltered (file, "arm_dump_tdep: ABI = %s\n", tdep->abi_name); - else - internal_error (__FILE__, __LINE__, - "arm_dump_tdep: illegal setting of tdep->arm_abi (%d)", - (int) tdep->arm_abi); + fprintf_unfiltered (file, "arm_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); fprintf_unfiltered (file, "arm_dump_tdep: Lowest pc = 0x%lx", (unsigned long) tdep->lowest_pc); @@ -3191,10 +3051,18 @@ _initialize_arm_tdep (void) if (GDB_MULTI_ARCH) gdbarch_register (bfd_arch_arm, arm_gdbarch_init, arm_dump_tdep); + /* Register an ELF OS ABI sniffer for ARM binaries. */ + gdbarch_register_osabi_sniffer (bfd_arch_arm, + bfd_target_elf_flavour, + arm_elf_osabi_sniffer); + /* Register some ABI variants for embedded systems. */ - arm_gdbarch_register_os_abi (ARM_ABI_EABI_V1, arm_init_abi_eabi_v1); - arm_gdbarch_register_os_abi (ARM_ABI_EABI_V2, arm_init_abi_eabi_v2); - arm_gdbarch_register_os_abi (ARM_ABI_APCS, arm_init_abi_apcs); + gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_ARM_EABI_V1, + arm_init_abi_eabi_v1); + gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_ARM_EABI_V2, + arm_init_abi_eabi_v2); + gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_ARM_APCS, + arm_init_abi_apcs); tm_print_insn = gdb_print_insn_arm; @@ -3259,4 +3127,10 @@ The valid values are:\n"); prologue_cache.saved_regs = NULL; prologue_cache.extra_info = (struct frame_extra_info *) xcalloc (1, sizeof (struct frame_extra_info)); + + /* Debugging flag. */ + add_show_from_set (add_set_cmd ("arm", class_maintenance, var_zinteger, + &arm_debug, "Set arm debugging.\n\ +When non-zero, arm specific debugging is enabled.", &setdebuglist), + &showdebuglist); } diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index e7c56515a95..a8f15148364 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "osabi.h" + /* Register numbers of various important registers. Note that some of these values are "real" register numbers, and correspond to the general registers of the machine, and some are "phony" register @@ -104,23 +106,6 @@ enum gdb_regnum { #define FLAG_C 0x20000000 #define FLAG_V 0x10000000 -/* ABI variants that we know about. If you add to this enum, please - update the table of names in tm-arm.c. */ -enum arm_abi -{ - ARM_ABI_UNKNOWN = 0, - ARM_ABI_EABI_V1, - ARM_ABI_EABI_V2, - ARM_ABI_LINUX, - ARM_ABI_NETBSD_AOUT, - ARM_ABI_NETBSD_ELF, - ARM_ABI_APCS, - ARM_ABI_FREEBSD, - ARM_ABI_WINCE, - - ARM_ABI_INVALID /* Keep this last. */ -}; - /* Type of floating-point code in use by inferior. There are really 3 models that are traditionally supported (plus the endianness issue), but gcc can only generate 2 of those. The third is APCS_FLOAT, where arguments to @@ -139,8 +124,7 @@ enum arm_float_model /* Target-dependent structure in gdbarch. */ struct gdbarch_tdep { - enum arm_abi arm_abi; /* OS/ABI of inferior. */ - const char *abi_name; /* Name of the above. */ + enum gdb_osabi osabi; /* OS/ABI of inferior. */ enum arm_float_model fp_model; /* Floating point calling conventions. */ @@ -170,10 +154,3 @@ int arm_pc_is_thumb (CORE_ADDR); CORE_ADDR thumb_get_next_pc (CORE_ADDR); CORE_ADDR arm_get_next_pc (CORE_ADDR); - -/* How a OS variant tells the ARM generic code that it can handle an ABI - type. */ -void -arm_gdbarch_register_os_abi (enum arm_abi abi, - void (*init_abi)(struct gdbarch_info, - struct gdbarch *)); diff --git a/gdb/armnbsd-tdep.c b/gdb/armnbsd-tdep.c index 7f6e63992e2..ea920207d32 100644 --- a/gdb/armnbsd-tdep.c +++ b/gdb/armnbsd-tdep.c @@ -21,6 +21,8 @@ #include "defs.h" #include "arm-tdep.h" +#include "nbsd-tdep.h" +#include "solib-svr4.h" /* Description of the longjmp buffer. */ #define JB_PC 24 @@ -74,12 +76,29 @@ arm_netbsd_elf_init_abi (struct gdbarch_info info, arm_netbsd_init_abi_common (info, gdbarch); + set_solib_svr4_fetch_link_map_offsets (gdbarch, + nbsd_ilp32_solib_svr4_fetch_link_map_offsets); + tdep->fp_model = ARM_FLOAT_SOFT_VFP; } +static enum gdb_osabi +arm_netbsd_aout_osabi_sniffer (bfd *abfd) +{ + if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0) + return GDB_OSABI_NETBSD_AOUT; + + return GDB_OSABI_UNKNOWN; +} + void _initialize_arm_netbsd_tdep (void) { - arm_gdbarch_register_os_abi (ARM_ABI_NETBSD_AOUT, arm_netbsd_aout_init_abi); - arm_gdbarch_register_os_abi (ARM_ABI_NETBSD_ELF, arm_netbsd_elf_init_abi); + gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour, + arm_netbsd_aout_osabi_sniffer); + + gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_NETBSD_AOUT, + arm_netbsd_aout_init_abi); + gdbarch_register_osabi (bfd_arch_arm, GDB_OSABI_NETBSD_ELF, + arm_netbsd_elf_init_abi); } diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 71c7796443f..43ac3098c72 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1230,7 +1230,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer); set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address); - set_gdbarch_extract_return_value (gdbarch, avr_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, avr_extract_return_value); set_gdbarch_push_arguments (gdbarch, avr_push_arguments); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); /* set_gdbarch_push_return_address (gdbarch, avr_push_return_address); */ @@ -1240,8 +1240,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_use_struct_convention (gdbarch, generic_use_struct_convention); set_gdbarch_store_struct_return (gdbarch, avr_store_struct_return); - set_gdbarch_extract_struct_value_address (gdbarch, - avr_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address + (gdbarch, avr_extract_struct_value_address); set_gdbarch_frame_init_saved_regs (gdbarch, avr_scan_prologue); set_gdbarch_init_extra_frame_info (gdbarch, avr_init_extra_frame_info); diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 78b31eff438..39038a8f6f3 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -34,9 +34,28 @@ #include "inferior.h" /* for read_pc */ #include "annotate.h" #include "regcache.h" +#include "gdb_assert.h" /* Prototypes for exported functions. */ +static void generic_call_dummy_register_unwind (struct frame_info *frame, + void **cache, + int regnum, + int *optimized, + enum lval_type *lval, + CORE_ADDR *addrp, + int *realnum, + void *raw_buffer); +static void frame_saved_regs_register_unwind (struct frame_info *frame, + void **cache, + int regnum, + int *optimized, + enum lval_type *lval, + CORE_ADDR *addrp, + int *realnum, + void *buffer); + + void _initialize_blockframe (void); /* A default FRAME_CHAIN_VALID, in the form that is suitable for most @@ -208,6 +227,27 @@ set_current_frame (struct frame_info *frame) current_frame = frame; } + +/* Using the PC, select a mechanism for unwinding a frame returning + the previous frame. The register unwind function should, on + demand, initialize the ->context object. */ + +static void +set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp, + frame_register_unwind_ftype **unwind) +{ + if (!USE_GENERIC_DUMMY_FRAMES) + /* Still need to set this to something. The ``info frame'' code + calls this function to find out where the saved registers are. + Hopefully this is robust enough to stop any core dumps and + return vaguely correct values.. */ + *unwind = frame_saved_regs_register_unwind; + else if (PC_IN_CALL_DUMMY (pc, fp, fp)) + *unwind = generic_call_dummy_register_unwind; + else + *unwind = frame_saved_regs_register_unwind; +} + /* Create an arbitrary (i.e. address specified by user) or innermost frame. Always returns a non-NULL value. */ @@ -232,6 +272,9 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc) if (INIT_EXTRA_FRAME_INFO_P ()) INIT_EXTRA_FRAME_INFO (0, fi); + /* Select/initialize an unwind function. */ + set_unwind_by_pc (fi->pc, fi->frame, &fi->register_unwind); + return fi; } @@ -371,6 +414,15 @@ get_prev_frame (struct frame_info *next_frame) start go curfluy than have an abort called from main not show main. */ address = FRAME_CHAIN (next_frame); + + /* FIXME: cagney/2002-06-08: There should be two tests here. + The first would check for a valid frame chain based on a user + selectable policy. The default being ``stop at main'' (as + implemented by generic_func_frame_chain_valid()). Other + policies would be available - stop at NULL, .... The second + test, if provided by the target architecture, would check for + more exotic cases - most target architectures wouldn't bother + with this second case. */ if (!FRAME_CHAIN_VALID (address, next_frame)) return 0; } @@ -456,6 +508,12 @@ get_prev_frame (struct frame_info *next_frame) } } + /* Initialize the code used to unwind the frame PREV based on the PC + (and probably other architectural information). The PC lets you + check things like the debug info at that point (dwarf2cfi?) and + use that to decide how the frame should be unwound. */ + set_unwind_by_pc (prev->pc, prev->frame, &prev->register_unwind); + find_pc_partial_function (prev->pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL); if (PC_IN_SIGTRAMP (prev->pc, name)) @@ -1248,7 +1306,8 @@ generic_file_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) int generic_func_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) { - if (PC_IN_CALL_DUMMY ((fi)->pc, fp, fp)) + if (USE_GENERIC_DUMMY_FRAMES + && PC_IN_CALL_DUMMY ((fi)->pc, 0, 0)) return 1; /* don't prune CALL_DUMMY frames */ else /* fall back to default algorithm (see frame.h) */ return (fp != 0 @@ -1268,6 +1327,141 @@ generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, return; } +/* Given a call-dummy dummy-frame, return the registers. Here the + register value is taken from the local copy of the register buffer. */ + +static void +generic_call_dummy_register_unwind (struct frame_info *frame, void **cache, + int regnum, int *optimized, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnum, void *bufferp) +{ + gdb_assert (frame != NULL); + gdb_assert (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)); + + /* Describe the register's location. Generic dummy frames always + have the register value in an ``expression''. */ + *optimized = 0; + *lvalp = not_lval; + *addrp = 0; + *realnum = -1; + + /* If needed, find and return the value of the register. */ + if (bufferp != NULL) + { + char *registers; +#if 1 + /* Get the address of the register buffer that contains all the + saved registers for this dummy frame. Cache that address. */ + registers = (*cache); + if (registers == NULL) + { + registers = generic_find_dummy_frame (frame->pc, frame->frame); + (*cache) = registers; + } +#else + /* Get the address of the register buffer that contains the + saved registers and then extract the value from that. */ + registers = generic_find_dummy_frame (frame->pc, frame->frame); +#endif + gdb_assert (registers != NULL); + /* Return the actual value. */ + memcpy (bufferp, registers + REGISTER_BYTE (regnum), + REGISTER_RAW_SIZE (regnum)); + } +} + +/* Return the register saved in the simplistic ``saved_regs'' cache. + If the value isn't here AND a value is needed, try the next inner + most frame. */ + +static void +frame_saved_regs_register_unwind (struct frame_info *frame, void **cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *bufferp) +{ + /* There is always a frame at this point. And THIS is the frame + we're interested in. */ + gdb_assert (frame != NULL); + gdb_assert (!PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)); + + /* Load the saved_regs register cache. */ + if (frame->saved_regs == NULL) + FRAME_INIT_SAVED_REGS (frame); + + if (frame->saved_regs != NULL + && frame->saved_regs[regnum] != 0) + { + if (regnum == SP_REGNUM) + { + /* SP register treated specially. */ + *optimizedp = 0; + *lvalp = not_lval; + *addrp = 0; + *realnump = -1; + if (bufferp != NULL) + store_address (bufferp, REGISTER_RAW_SIZE (regnum), + frame->saved_regs[regnum]); + } + else + { + /* Any other register is saved in memory, fetch it but cache + a local copy of its value. */ + *optimizedp = 0; + *lvalp = lval_memory; + *addrp = frame->saved_regs[regnum]; + *realnump = -1; + if (bufferp != NULL) + { +#if 1 + /* Save each register value, as it is read in, in a + frame based cache. */ + void **regs = (*cache); + if (regs == NULL) + { + int sizeof_cache = ((NUM_REGS + NUM_PSEUDO_REGS) + * sizeof (void *)); + regs = frame_obstack_alloc (sizeof_cache); + memset (regs, 0, sizeof_cache); + (*cache) = regs; + } + if (regs[regnum] == NULL) + { + regs[regnum] + = frame_obstack_alloc (REGISTER_RAW_SIZE (regnum)); + read_memory (frame->saved_regs[regnum], regs[regnum], + REGISTER_RAW_SIZE (regnum)); + } + memcpy (bufferp, regs[regnum], REGISTER_RAW_SIZE (regnum)); +#else + /* Read the value in from memory. */ + read_memory (frame->saved_regs[regnum], bufferp, + REGISTER_RAW_SIZE (regnum)); +#endif + } + } + return; + } + + /* No luck, assume this and the next frame have the same register + value. If a value is needed, pass the request on down the chain; + otherwise just return an indication that the value is in the same + register as the next frame. */ + if (bufferp == NULL) + { + *optimizedp = 0; + *lvalp = lval_register; + *addrp = 0; + *realnump = regnum; + } + else + { + frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp, + realnump, bufferp); + } +} + /* Function: get_saved_register Find register number REGNUM relative to FRAME and put its (raw, target format) contents in *RAW_BUFFER. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6f604f1961a..1861370eaa7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -909,13 +909,7 @@ insert_breakpoints (void) else { struct frame_info *fi; - - /* There might be no current frame at this moment if we are - resuming from a step over a breakpoint. - Set up current frame before trying to find the watchpoint - frame. */ - get_current_frame (); - fi = find_frame_addr_in_frame_chain (b->watchpoint_frame); + fi = frame_find_by_id (b->watchpoint_frame); within_current_scope = (fi != NULL); if (within_current_scope) select_frame (fi); @@ -2320,7 +2314,7 @@ watchpoint_check (PTR p) any chance of handling watchpoints on local variables, we'll need the frame chain (so we can determine if we're in scope). */ reinit_frame_cache (); - fr = find_frame_addr_in_frame_chain (b->watchpoint_frame); + fr = frame_find_by_id (b->watchpoint_frame); within_current_scope = (fr != NULL); /* in_function_epilogue_p() returns a non-zero value if we're still in the function but the stack frame has already been invalidated. @@ -5321,10 +5315,12 @@ watch_command_1 (char *arg, int accessflag, int from_tty) if (frame) { prev_frame = get_prev_frame (frame); - b->watchpoint_frame = frame->frame; + get_frame_id (frame, &b->watchpoint_frame); } else - b->watchpoint_frame = (CORE_ADDR) 0; + { + memset (&b->watchpoint_frame, 0, sizeof (b->watchpoint_frame)); + } /* If the expression is "local", then set up a "watchpoint scope" breakpoint at the point where we've left the scope of the watchpoint @@ -7266,12 +7262,7 @@ do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition) if (bpt->exp_valid_block != NULL) { struct frame_info *fr = - - /* Ensure that we have the current frame. Else, this - next query may pessimistically be answered as, "No, - not within current scope". */ - get_current_frame (); - fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame); + fr = frame_find_by_id (bpt->watchpoint_frame); if (fr == NULL) { printf_filtered ("\ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 3a58aad2487..7ab300ffb65 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -270,10 +270,10 @@ struct breakpoint it the watchpoint_scope breakpoint or something like that. FIXME). */ struct breakpoint *related_breakpoint; - /* Holds the frame address which identifies the frame this watchpoint - should be evaluated in, or NULL if the watchpoint should be evaluated - on the outermost frame. */ - CORE_ADDR watchpoint_frame; + /* Holds the frame address which identifies the frame this + watchpoint should be evaluated in, or `null' if the watchpoint + should be evaluated on the outermost frame. */ + struct frame_id watchpoint_frame; /* Thread number for thread-specific breakpoint, or -1 if don't care */ int thread; diff --git a/gdb/c-exp.y b/gdb/c-exp.y index a15a4456bce..f555518ea00 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1246,6 +1246,17 @@ yylex () retry: + /* Check if this is a macro invocation that we need to expand. */ + if (! scanning_macro_expansion ()) + { + char *expanded = macro_expand_next (&lexptr, + expression_macro_lookup_func, + expression_macro_lookup_baton); + + if (expanded) + scan_macro_expansion (expanded); + } + prev_lexptr = lexptr; unquoted_expr = 1; @@ -1271,7 +1282,17 @@ yylex () switch (c = *tokstart) { case 0: - return 0; + /* If we were just scanning the result of a macro expansion, + then we need to resume scanning the original text. + Otherwise, we were already scanning the original text, and + we're really done. */ + if (scanning_macro_expansion ()) + { + finished_macro_expansion (); + goto retry; + } + else + return 0; case ' ': case '\t': @@ -1324,7 +1345,9 @@ yylex () return c; case ',': - if (comma_terminates && paren_depth == 0) + if (comma_terminates + && paren_depth == 0 + && ! scanning_macro_expansion ()) return 0; lexptr++; return c; @@ -1503,9 +1526,13 @@ yylex () c = tokstart[++namelen]; } - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + /* The token "if" terminates the expression and is NOT removed from + the input stream. It doesn't count if it appears in the + expansion of a macro. */ + if (namelen == 2 + && tokstart[0] == 'i' + && tokstart[1] == 'f' + && ! scanning_macro_expansion ()) { return 0; } diff --git a/gdb/c-lang.c b/gdb/c-lang.c index f98548a63af..09a2e6a968a 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -27,6 +27,8 @@ #include "language.h" #include "c-lang.h" #include "valprint.h" +#include "macroscope.h" +#include "gdb_assert.h" extern void _initialize_c_language (void); static void c_emit_char (int c, struct ui_file * stream, int quoter); @@ -371,7 +373,128 @@ c_create_fundamental_type (struct objfile *objfile, int typeid) return (type); } +/* Preprocessing and parsing C and C++ expressions. */ + +/* When we find that lexptr (the global var defined in parse.c) is + pointing at a macro invocation, we expand the invocation, and call + scan_macro_expansion to save the old lexptr here and point lexptr + into the expanded text. When we reach the end of that, we call + end_macro_expansion to pop back to the value we saved here. The + macro expansion code promises to return only fully-expanded text, + so we don't need to "push" more than one level. + + This is disgusting, of course. It would be cleaner to do all macro + expansion beforehand, and then hand that to lexptr. But we don't + really know where the expression ends. Remember, in a command like + + (gdb) break *ADDRESS if CONDITION + + we evaluate ADDRESS in the scope of the current frame, but we + evaluate CONDITION in the scope of the breakpoint's location. So + it's simply wrong to try to macro-expand the whole thing at once. */ +static char *macro_original_text; +static char *macro_expanded_text; + + +void +scan_macro_expansion (char *expansion) +{ + /* We'd better not be trying to push the stack twice. */ + gdb_assert (! macro_original_text); + gdb_assert (! macro_expanded_text); + + /* Save the old lexptr value, so we can return to it when we're done + parsing the expanded text. */ + macro_original_text = lexptr; + lexptr = expansion; + + /* Save the expanded text, so we can free it when we're finished. */ + macro_expanded_text = expansion; +} + + +int +scanning_macro_expansion () +{ + return macro_original_text != 0; +} + + +void +finished_macro_expansion () +{ + /* There'd better be something to pop back to, and we better have + saved a pointer to the start of the expanded text. */ + gdb_assert (macro_original_text); + gdb_assert (macro_expanded_text); + + /* Pop back to the original text. */ + lexptr = macro_original_text; + macro_original_text = 0; + + /* Free the expanded text. */ + xfree (macro_expanded_text); + macro_expanded_text = 0; +} + + +static void +scan_macro_cleanup (void *dummy) +{ + if (macro_original_text) + finished_macro_expansion (); +} + + +/* We set these global variables before calling c_parse, to tell it + how it to find macro definitions for the expression at hand. */ +macro_lookup_ftype *expression_macro_lookup_func; +void *expression_macro_lookup_baton; + + +static struct macro_definition * +null_macro_lookup (const char *name, void *baton) +{ + return 0; +} + + +static int +c_preprocess_and_parse () +{ + /* Set up a lookup function for the macro expander. */ + struct macro_scope *scope = 0; + struct cleanup *back_to = make_cleanup (free_current_contents, &scope); + + if (expression_context_block) + scope = sal_macro_scope (find_pc_line (expression_context_pc, 0)); + else + scope = default_macro_scope (); + + if (scope) + { + expression_macro_lookup_func = standard_macro_lookup; + expression_macro_lookup_baton = (void *) scope; + } + else + { + expression_macro_lookup_func = null_macro_lookup; + expression_macro_lookup_baton = 0; + } + + gdb_assert (! macro_original_text); + make_cleanup (scan_macro_cleanup, 0); + + { + int result = c_parse (); + do_cleanups (back_to); + return result; + } +} + + + /* Table mapping opcodes into strings for printing operators and precedences of the operators. */ @@ -439,7 +562,7 @@ const struct language_defn c_language_defn = range_check_off, type_check_off, case_sensitive_on, - c_parse, + c_preprocess_and_parse, c_error, evaluate_subexp_standard, c_printchar, /* Print a character constant */ @@ -491,7 +614,7 @@ const struct language_defn cplus_language_defn = range_check_off, type_check_off, case_sensitive_on, - c_parse, + c_preprocess_and_parse, c_error, evaluate_subexp_standard, c_printchar, /* Print a character constant */ @@ -520,7 +643,7 @@ const struct language_defn asm_language_defn = range_check_off, type_check_off, case_sensitive_on, - c_parse, + c_preprocess_and_parse, c_error, evaluate_subexp_standard, c_printchar, /* Print a character constant */ diff --git a/gdb/c-lang.h b/gdb/c-lang.h index b1925e1e2d6..e64d4c69e90 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -24,6 +24,7 @@ #define C_LANG_H 1 #include "value.h" +#include "macroexp.h" extern int c_parse (void); /* Defined in c-exp.y */ @@ -49,6 +50,13 @@ extern void c_printstr (struct ui_file * stream, char *string, unsigned int length, int width, int force_ellipses); +extern void scan_macro_expansion (char *expansion); +extern int scanning_macro_expansion (void); +extern void finished_macro_expansion (void); + +extern macro_lookup_ftype *expression_macro_lookup_func; +extern void *expression_macro_lookup_baton; + extern struct type *c_create_fundamental_type (struct objfile *, int); extern struct type **const (c_builtin_types[]); diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 430d5674f24..41eb0ad1a5f 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -41,7 +41,7 @@ /* Flag indicating target was compiled by HP compiler */ extern int hp_som_som_object_present; -static void cp_type_print_method_args (struct type ** args, char *prefix, +static void cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, int staticp, struct ui_file *stream); @@ -147,40 +147,40 @@ cp_type_print_derivation_info (struct ui_file *stream, struct type *type) fputs_filtered (" ", stream); } } + /* Print the C++ method arguments ARGS to the file STREAM. */ static void -cp_type_print_method_args (struct type **args, char *prefix, char *varstring, +cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, int staticp, struct ui_file *stream) { + struct field *args = TYPE_FIELDS (mtype); + int nargs = TYPE_NFIELDS (mtype); + int varargs = TYPE_VARARGS (mtype); int i; fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI); fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI); fputs_filtered ("(", stream); - if (args && args[!staticp] && TYPE_CODE (args[!staticp]) != TYPE_CODE_VOID) + + /* Skip the class variable. */ + i = staticp ? 0 : 1; + if (nargs > i) { - i = !staticp; /* skip the class variable */ - while (1) + while (i < nargs) { - type_print (args[i++], "", stream, 0); - if (!args[i]) - { - fprintf_filtered (stream, " ..."); - break; - } - else if (TYPE_CODE (args[i]) != TYPE_CODE_VOID) - { - fprintf_filtered (stream, ", "); - } - else - break; + type_print (args[i++].type, "", stream, 0); + + if (i == nargs && varargs) + fprintf_filtered (stream, ", ..."); + else if (i < nargs) + fprintf_filtered (stream, ", "); } } + else if (varargs) + fprintf_filtered (stream, "..."); else if (current_language->la_language == language_cplus) - { - fprintf_filtered (stream, "void"); - } + fprintf_filtered (stream, "void"); fprintf_filtered (stream, ")"); } @@ -336,39 +336,31 @@ static void c_type_print_args (struct type *type, struct ui_file *stream) { int i; - struct type **args; + struct field *args; fprintf_filtered (stream, "("); - args = TYPE_ARG_TYPES (type); + args = TYPE_FIELDS (type); if (args != NULL) { - if (args[1] == NULL) - { - fprintf_filtered (stream, "..."); - } - else if ((TYPE_CODE (args[1]) == TYPE_CODE_VOID) && - (current_language->la_language == language_cplus)) - { - fprintf_filtered (stream, "void"); - } - else + int i; + + /* FIXME drow/2002-05-31: Always skips the first argument, + should we be checking for static members? */ + + for (i = 1; i < TYPE_NFIELDS (type); i++) { - for (i = 1; - args[i] != NULL && TYPE_CODE (args[i]) != TYPE_CODE_VOID; - i++) + c_print_type (args[i].type, "", stream, -1, 0); + if (i != TYPE_NFIELDS (type)) { - c_print_type (args[i], "", stream, -1, 0); - if (args[i + 1] == NULL) - { - fprintf_filtered (stream, "..."); - } - else if (TYPE_CODE (args[i + 1]) != TYPE_CODE_VOID) - { - fprintf_filtered (stream, ","); - wrap_here (" "); - } + fprintf_filtered (stream, ","); + wrap_here (" "); } } + if (TYPE_VARARGS (type)) + fprintf_filtered (stream, "..."); + else if (i == 1 + && (current_language->la_language == language_cplus)) + fprintf_filtered (stream, "void"); } else if (current_language->la_language == language_cplus) { @@ -1010,10 +1002,15 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show, Let's try to reconstruct the function signature from the symbol information */ if (!TYPE_FN_FIELD_STUB (f, j)) - cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "", - method_name, - TYPE_FN_FIELD_STATIC_P (f, j), - stream); + { + int staticp = TYPE_FN_FIELD_STATIC_P (f, j); + struct type *mtype = TYPE_FN_FIELD_TYPE (f, j); + cp_type_print_method_args (mtype, + "", + method_name, + staticp, + stream); + } else fprintf_filtered (stream, "", mangled_name); diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 1edcfe26d1b..36c1d2db2be 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -623,18 +623,16 @@ restore_command (char *args, int from_tty) /* Parse offset (optional). */ if (args != NULL && *args != '\0') data.load_offset = - parse_and_eval_address (scan_expression_with_cleanup (&args, - NULL)); + parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); if (args != NULL && *args != '\0') { /* Parse start address (optional). */ data.load_start = - parse_and_eval_address (scan_expression_with_cleanup (&args, - NULL)); + parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); if (args != NULL && *args != '\0') { /* Parse end address (optional). */ - data.load_end = parse_and_eval_address (args); + data.load_end = parse_and_eval_long (args); if (data.load_end <= data.load_start) error ("Start must be less than end."); } diff --git a/gdb/config/alpha/nm-linux.h b/gdb/config/alpha/nm-linux.h index c59b88cb21e..990ccb45d97 100644 --- a/gdb/config/alpha/nm-linux.h +++ b/gdb/config/alpha/nm-linux.h @@ -23,7 +23,7 @@ #ifndef NM_LINUX_H #define NM_LINUX_H -#include "nm-linux.h" +#include "config/nm-linux.h" /* ptrace register ``addresses'' are absolute. */ diff --git a/gdb/config/alpha/nm-nbsd.h b/gdb/config/alpha/nm-nbsd.h index ef6ab313a6f..caf1c237cfb 100644 --- a/gdb/config/alpha/nm-nbsd.h +++ b/gdb/config/alpha/nm-nbsd.h @@ -22,8 +22,6 @@ #ifndef NM_NBSD_H #define NM_NBSD_H -#define SVR4_SHARED_LIBS - /* Get generic NetBSD native definitions. */ #include "config/nm-nbsd.h" diff --git a/gdb/config/alpha/tm-alphalinux.h b/gdb/config/alpha/tm-alphalinux.h index 27ff45722af..4858b90eba2 100644 --- a/gdb/config/alpha/tm-alphalinux.h +++ b/gdb/config/alpha/tm-alphalinux.h @@ -40,6 +40,6 @@ extern LONGEST alpha_linux_sigtramp_offset (CORE_ADDR); #undef START_INFERIOR_TRAPS_EXPECTED #define START_INFERIOR_TRAPS_EXPECTED 2 -#include "tm-linux.h" +#include "config/tm-linux.h" #endif /* TM_LINUXALPHA_H */ diff --git a/gdb/config/alpha/tm-nbsd.h b/gdb/config/alpha/tm-nbsd.h index 9e926566538..90a75a78fd6 100644 --- a/gdb/config/alpha/tm-nbsd.h +++ b/gdb/config/alpha/tm-nbsd.h @@ -22,6 +22,7 @@ #define TM_NBSD_H #include "alpha/tm-alpha.h" +#include "solib.h" /* Number of traps that happen between exec'ing the shell to run an inferior, and when we finally get to the inferior code. The diff --git a/gdb/config/arc/tm-arc.h b/gdb/config/arc/tm-arc.h index cbdcf41e0e9..af183b60f44 100644 --- a/gdb/config/arc/tm-arc.h +++ b/gdb/config/arc/tm-arc.h @@ -204,14 +204,14 @@ extern void arc_software_single_step (enum target_signal, int); into VALBUF. This is only called if USE_STRUCT_CONVENTION for this type is 0. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy(VALBUF, REGBUF+REGISTER_BYTE(R0_REGNUM), TYPE_LENGTH (TYPE)) /* If USE_STRUCT_CONVENTION produces a 1, extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ (error("Don't know where large structure is returned on arc"), 0) /* Write into appropriate registers a function return value diff --git a/gdb/config/arm/nbsd.mh b/gdb/config/arm/nbsd.mh deleted file mode 100644 index 481d5cc92a5..00000000000 --- a/gdb/config/arm/nbsd.mh +++ /dev/null @@ -1,4 +0,0 @@ -# Host ARM running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o armnbsd-nat.o -XM_FILE=xm-nbsd.h -NAT_FILE=nm-nbsd.h diff --git a/gdb/config/arm/nbsd.mt b/gdb/config/arm/nbsd.mt index dad2717bfc8..94971369506 100644 --- a/gdb/config/arm/nbsd.mt +++ b/gdb/config/arm/nbsd.mt @@ -1,2 +1,2 @@ # Target: ARM running NetBSD -TDEPFILES= arm-tdep.o armnbsd-tdep.o solib.o solib-svr4.o solib-sunos.o +TDEPFILES= arm-tdep.o armnbsd-tdep.o solib.o solib-svr4.o nbsd-tdep.o diff --git a/gdb/config/arm/nm-linux.h b/gdb/config/arm/nm-linux.h index 2a0ebb3804b..7e0156db43c 100644 --- a/gdb/config/arm/nm-linux.h +++ b/gdb/config/arm/nm-linux.h @@ -21,7 +21,7 @@ #ifndef NM_ARMLINUX_H #define NM_ARMLINUX_H -#include "nm-linux.h" +#include "config/nm-linux.h" /* ptrace register ``addresses'' are absolute. */ diff --git a/gdb/config/arm/nm-nbsd.h b/gdb/config/arm/nm-nbsd.h index 435c5e75954..63be920092f 100644 --- a/gdb/config/arm/nm-nbsd.h +++ b/gdb/config/arm/nm-nbsd.h @@ -22,6 +22,6 @@ #define NM_NBSD_H /* Get generic NetBSD native definitions. */ -#include +#include "config/nm-nbsd.h" #endif /* NM_NBSD_H */ diff --git a/gdb/config/arm/tm-linux.h b/gdb/config/arm/tm-linux.h index 6a0d0e42c96..bbf566d2d83 100644 --- a/gdb/config/arm/tm-linux.h +++ b/gdb/config/arm/tm-linux.h @@ -28,7 +28,7 @@ /* Include the common ARM target definitions. */ #include "arm/tm-arm.h" -#include "tm-linux.h" +#include "config/tm-linux.h" /* Use target-specific function to define link map offsets. */ extern struct link_map_offsets *arm_linux_svr4_fetch_link_map_offsets (void); diff --git a/gdb/config/arm/xm-nbsd.h b/gdb/config/arm/xm-nbsd.h index c5348d39629..d3f76a7dd01 100644 --- a/gdb/config/arm/xm-nbsd.h +++ b/gdb/config/arm/xm-nbsd.h @@ -19,4 +19,4 @@ Boston, MA 02111-1307, USA. */ /* Get generic NetBSD host definitions. */ -#include "xm-nbsd.h" +#include "config/xm-nbsd.h" diff --git a/gdb/config/d30v/tm-d30v.h b/gdb/config/d30v/tm-d30v.h index 7a14e39132c..e233630bae8 100644 --- a/gdb/config/d30v/tm-d30v.h +++ b/gdb/config/d30v/tm-d30v.h @@ -188,7 +188,7 @@ void d30v_do_registers_info (int regnum, int fpregs); /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (((CORE_ADDR *)(REGBUF))[2]) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (((CORE_ADDR *)(REGBUF))[2]) /* Define other aspects of the stack frame. @@ -291,7 +291,7 @@ extern CORE_ADDR d30v_push_arguments (int, struct value **, CORE_ADDR, int, a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ d30v_extract_return_value(TYPE, REGBUF, VALBUF) extern void d30v_extract_return_value (struct type *, char *, char *); diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index eb5052f2c75..3c28052c1e6 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -10,13 +10,18 @@ @V@/bfd/cpu-m68hc12.c @V@/bfd/cm68hc12.c @V@/bfd/efi-app-ia32.c @V@/bfd/efi-ia32-app.c @V@/bfd/efi-app-ia64.c @V@/bfd/efi-ia64-app.c -@V@/bfd/elf32-i370.c @V@/bfd/elf32-i7.c +@V@/bfd/elf32-i370.c @V@/bfd/e32i370.c +@V@/bfd/elf32-i386.c @V@/bfd/e32i86.c +@V@/bfd/elf32-i386qnx.c @V@/bfd/e32i86q.c @V@/bfd/elf32-m68hc11.c @V@/bfd/em68hc11.c @V@/bfd/elf32-m68hc12.c @V@/bfd/em68hc12.c @V@/bfd/elf32-m68k.c @V@/bfd/em68k.c -@V@/bfd/elf32-sh-lin.c @V@/bfd/elf32shlin.c -@V@/bfd/elf32-sh-nbsd.c @V@/bfd/elf32shnb.c -@V@/bfd/elf32-sh64.c @V@/bfd/elf32sh64.c +@V@/bfd/elf32-sh-lin.c @V@/bfd/e32shlin.c +@V@/bfd/elf32-sh-nbsd.c @V@/bfd/e32shn.c +@V@/bfd/elf32-sh64.c @V@/bfd/e32sh64.c +@V@/bfd/elf32-sh64-nbsd.c @V@/bfd/e32sh64n.c +@V@/bfd/elf64-sh64.c @V@/bfd/e64sh64.c +@V@/bfd/elf64-sh64-nbsd.c @V@/bfd/e64sh64n.c @V@/dejagnu/baseboards/mn10200-cygmon.exp @V@/dejagnu/baseboards/mn10200cygmon.exp @V@/dejagnu/baseboards/mn10200-sim.exp @V@/dejagnu/baseboards/mn10200sim.exp @V@/dejagnu/baseboards/mn10300-cygmon.exp @V@/dejagnu/baseboards/mn10300cygmon.exp @@ -52,6 +57,8 @@ @V@/gdb/ChangeLog-2000 @V@/gdb/ChangeLog.000 @V@/gdb/ChangeLog-2001 @V@/gdb/ChangeLog.001 @V@/gdb/ChangeLog-3.x @V@/gdb/ChangeLog.3-x +@V@/gdb/alphabsd-nat.c @V@/gdb/alphb-nat.c +@V@/gdb/alphabsd-tdep.c @V@/gdb/alphb-tdep.c @V@/gdb/alphanbsd-nat.c @V@/gdb/alphnb-nat.c @V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c @V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c @@ -126,10 +133,16 @@ @V@/gdb/m68knbsd-tdep.c @V@/gdb/m6nbsd-tdep.c @V@/gdb/mips-linux-nat.c @V@/gdb/mipslnxnat.c @V@/gdb/mips-linux-tdep.c @V@/gdb/mipslnxtdep.c +@V@/gdb/mipsnbsd-nat.c @V@/gdb/mipsnbnat.c +@V@/gdb/mipsnbsd-tdep.c @V@/gdb/mipsnbtdep.c @V@/gdb/nindy-share/b.out.h @V@/gdb/nindy-share/b_out.h +@V@/gdb/ns32knbsd-nat.c @V@/gdb/ns32nb-nat.c +@V@/gdb/ns32knbsd-tdep.c @V@/gdb/ns32nb-tdep.c @V@/gdb/osf-share/cma_stack_int.h @V@/gdb/osf-share/cma_stkint.h @V@/gdb/p-exp.tab.c @V@/gdb/p-exp_tab.c @V@/gdb/ppc-linux-tdep.c @V@/gdb/ppc-linx-tdep.c +@V@/gdb/ppcnbsd-nat.c @V@/gdb/ppcnb-nat.c +@V@/gdb/ppcnbsd-tdep.c @V@/gdb/ppcnb-tdep.c @V@/gdb/regformats/reg-i386-linux.dat @V@/gdb/regformats/r-i386-lnx.dat @V@/gdb/regformats/reg-s390x.dat @V@/gdb/regformats/r-s390x.dat @V@/gdb/remote-adapt.c @V@/gdb/rmt-adapt.c @@ -156,7 +169,13 @@ @V@/gdb/remote-vxsparc.c @V@/gdb/rmt-vxsparc.c @V@/gdb/sparclet-rom.c @V@/gdb/splet-rom.c @V@/gdb/sparclet-stub.c @V@/gdb/splet-stub.c +@V@/gdb/sparcnbsd-nat.c @V@/gdb/spnb-nat.c +@V@/gdb/sparcnbsd-tdep.c @V@/gdb/spnb-tdep.c @V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini +@V@/gdb/testsuite/gdb.arch/altivec-abi.c @V@/gdb/testsuite/gdb.arch/av-abi.c +@V@/gdb/testsuite/gdb.arch/altivec-abi.exp @V@/gdb/testsuite/gdb.arch/av-abi.exp +@V@/gdb/testsuite/gdb.arch/altivec-regs.c @V@/gdb/testsuite/gdb.arch/av-regs.c +@V@/gdb/testsuite/gdb.arch/altivec-regs.exp @V@/gdb/testsuite/gdb.arch/av-regs.exp @V@/gdb/testsuite/gdb.base/coremaker2.c @V@/gdb/testsuite/gdb.base/core2maker.c @V@/gdb/testsuite/gdb.c++ @V@/gdb/testsuite/gdb.cxx @V@/gdb/testsuite/gdb.c++/Makefile.in @V@/gdb/testsuite/gdb.cxx/Makefile.in diff --git a/gdb/config/fr30/tm-fr30.h b/gdb/config/fr30/tm-fr30.h index 22ddd046a8e..e54154a2203 100644 --- a/gdb/config/fr30/tm-fr30.h +++ b/gdb/config/fr30/tm-fr30.h @@ -117,14 +117,14 @@ extern void fr30_pop_frame (void); /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy (VALBUF, REGBUF + REGISTER_BYTE(RETVAL_REG) + \ (TYPE_LENGTH(TYPE) < 4 ? 4 - TYPE_LENGTH(TYPE) : 0), TYPE_LENGTH (TYPE)) /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ extract_address (REGBUF + REGISTER_BYTE (RETVAL_REG), \ REGISTER_RAW_SIZE (RETVAL_REG)) diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index d43c80914ab..c70f4af542e 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -100,7 +100,7 @@ extern CORE_ADDR h8300_skip_prologue (); #define REGISTER_SIZE 4 -#define NUM_REGS 13 +#define NUM_REGS 14 #define REGISTER_BYTES (NUM_REGS * 4) @@ -137,7 +137,7 @@ extern CORE_ADDR h8300_skip_prologue (); Entries beyond the first NUM_REGS are ignored. */ #define REGISTER_NAMES \ - {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles","tick","inst"} + {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "ccr","pc","cycles","tick","inst",""} /* An array of names of registers. */ @@ -157,6 +157,7 @@ extern char **h8300_register_names; #define SP_REGNUM 7 /* Contains address of top of stack */ #define CCR_REGNUM 8 /* Contains processor status */ #define PC_REGNUM 9 /* Contains program counter */ +#define EXR_REGNUM 11 /* Contains processor status */ /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, @@ -165,7 +166,7 @@ extern char **h8300_register_names; /* FIXME: Won't work with both h8/300's. */ extern void h8300_extract_return_value (struct type *, char *, char *); -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ h8300_extract_return_value (TYPE, (char *)(REGBUF), (char *)(VALBUF)) /* Write into appropriate registers a function return value @@ -187,7 +188,7 @@ extern void h8300_store_return_value (struct type *, char *); the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ extract_address (REGBUF + REGISTER_BYTE (0), \ REGISTER_RAW_SIZE (0)) @@ -272,7 +273,7 @@ extern void h8300_print_register_hook (int); #define GDB_TARGET_IS_H8300 -#define NUM_REALREGS 10 +#define NUM_REALREGS (h8300smode?11:10) #define NOP { 0x01, 0x80} /* A sleep insn */ #define BELIEVE_PCC_PROMOTION 1 diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h index fae6704c637..96a93b5e75d 100644 --- a/gdb/config/h8500/tm-h8500.h +++ b/gdb/config/h8500/tm-h8500.h @@ -162,7 +162,7 @@ extern struct type *h8500_register_virtual_type (int regno); a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE)) /* Write into appropriate registers a function return value @@ -175,7 +175,7 @@ extern struct type *h8500_register_virtual_type (int regno); the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) /* Define other aspects of the stack frame. */ diff --git a/gdb/config/i386/i386nw.mt b/gdb/config/i386/i386nw.mt index 3109c42149e..9eafe7dcfd7 100644 --- a/gdb/config/i386/i386nw.mt +++ b/gdb/config/i386/i386nw.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running NetWare TDEPFILES= i386-tdep.o i387-tdep.o -TM_FILE= tm-i386nw.h +TM_FILE= tm-i386.h diff --git a/gdb/config/i386/i386sol2.mh b/gdb/config/i386/i386sol2.mh index ec93f4a75b9..931cc132bbb 100644 --- a/gdb/config/i386/i386sol2.mh +++ b/gdb/config/i386/i386sol2.mh @@ -5,4 +5,5 @@ XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-i386sol2.h NATDEPFILES= core-regset.o fork-child.o i386v4-nat.o corelow.o \ - procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o + procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o gcore.o \ + solib.o solib-svr4.o solib-legacy.o diff --git a/gdb/config/i386/i386sol2.mt b/gdb/config/i386/i386sol2.mt index 86d93a378b1..f8fabd494b7 100644 --- a/gdb/config/i386/i386sol2.mt +++ b/gdb/config/i386/i386sol2.mt @@ -1,3 +1,3 @@ -# Target: Intel 386 running SVR4 -TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o solib-legacy.o +# Target: Intel 386 running Solaris 2 (SVR4) +TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o i386bsd-tdep.o TM_FILE= tm-i386sol2.h diff --git a/gdb/config/i386/nbsd.mh b/gdb/config/i386/nbsd.mh deleted file mode 100644 index bf957b58745..00000000000 --- a/gdb/config/i386/nbsd.mh +++ /dev/null @@ -1,6 +0,0 @@ -# Host: Intel 386 running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ - solib.o solib-sunos.o - -XM_FILE= xm-nbsd.h -NAT_FILE= nm-nbsd.h diff --git a/gdb/config/i386/nbsd.mt b/gdb/config/i386/nbsd.mt deleted file mode 100644 index fc80608e01e..00000000000 --- a/gdb/config/i386/nbsd.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Intel 386 running NetBSD -TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o -TM_FILE= tm-nbsd.h diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh index d0cbe786d68..0d1c4d1badc 100644 --- a/gdb/config/i386/nbsdelf.mh +++ b/gdb/config/i386/nbsdelf.mh @@ -2,4 +2,4 @@ NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ solib.o solib-svr4.o solib-legacy.o XM_FILE= xm-nbsd.h -NAT_FILE= nm-nbsdelf.h +NAT_FILE= nm-nbsd.h diff --git a/gdb/config/i386/nbsdelf.mt b/gdb/config/i386/nbsdelf.mt index e5cdc255677..fc80608e01e 100644 --- a/gdb/config/i386/nbsdelf.mt +++ b/gdb/config/i386/nbsdelf.mt @@ -1,3 +1,3 @@ # Target: Intel 386 running NetBSD TDEPFILES= i386-tdep.o i387-tdep.o i386bsd-tdep.o i386nbsd-tdep.o corelow.o -TM_FILE= tm-nbsdelf.h +TM_FILE= tm-nbsd.h diff --git a/gdb/config/i386/nm-cygwin.h b/gdb/config/i386/nm-cygwin.h index b5e48907013..7eac99ba3fd 100644 --- a/gdb/config/i386/nm-cygwin.h +++ b/gdb/config/i386/nm-cygwin.h @@ -1,5 +1,5 @@ /* Native definitions for Intel x86 running CYGWIN. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define NO_PTRACE_H - #define I386_USE_GENERIC_WATCHPOINTS #include "i386/nm-i386.h" diff --git a/gdb/config/i386/nm-gnu.h b/gdb/config/i386/nm-gnu.h index fa6d829345d..e721ce6478d 100644 --- a/gdb/config/i386/nm-gnu.h +++ b/gdb/config/i386/nm-gnu.h @@ -20,4 +20,4 @@ /* Include the generic hurd definitions. */ -#include "nm-gnu.h" +#include "config/nm-gnu.h" diff --git a/gdb/config/i386/nm-go32.h b/gdb/config/i386/nm-go32.h index 70b1907b67e..5947b745c0e 100644 --- a/gdb/config/i386/nm-go32.h +++ b/gdb/config/i386/nm-go32.h @@ -1,5 +1,5 @@ /* Native definitions for Intel x86 running DJGPP. - Copyright (C) 1997, 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define NO_PTRACE_H - #define I386_USE_GENERIC_WATCHPOINTS #include "i386/nm-i386.h" diff --git a/gdb/config/i386/nm-i386lynx.h b/gdb/config/i386/nm-i386lynx.h index 5d0d41de267..bc6a23410f2 100644 --- a/gdb/config/i386/nm-i386lynx.h +++ b/gdb/config/i386/nm-i386lynx.h @@ -21,6 +21,6 @@ #ifndef NM_I386LYNX_H #define NM_I386LYNX_H -#include "nm-lynx.h" +#include "config/nm-lynx.h" #endif /* NM_I386LYNX_H */ diff --git a/gdb/config/i386/nm-i386sol2.h b/gdb/config/i386/nm-i386sol2.h index 0e6b3ef4c7f..8a51942791f 100644 --- a/gdb/config/i386/nm-i386sol2.h +++ b/gdb/config/i386/nm-i386sol2.h @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" #ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */ diff --git a/gdb/config/i386/nm-i386v4.h b/gdb/config/i386/nm-i386v4.h index 02d445e8bc3..356d3cba0ca 100644 --- a/gdb/config/i386/nm-i386v4.h +++ b/gdb/config/i386/nm-i386v4.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" /* Poll causes GDB to hang, at least under Unixware 1.1.2. */ #define LOSING_POLL diff --git a/gdb/config/i386/nm-i386v42mp.h b/gdb/config/i386/nm-i386v42mp.h index 72e440d0cc4..7ded36148f2 100644 --- a/gdb/config/i386/nm-i386v42mp.h +++ b/gdb/config/i386/nm-i386v42mp.h @@ -20,4 +20,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h index 8ae3eceec98..f751517d738 100644 --- a/gdb/config/i386/nm-linux.h +++ b/gdb/config/i386/nm-linux.h @@ -27,7 +27,7 @@ #define I386_USE_GENERIC_WATCHPOINTS #include "i386/nm-i386.h" -#include "nm-linux.h" +#include "config/nm-linux.h" /* Support for the user area. */ diff --git a/gdb/config/i386/nm-m3.h b/gdb/config/i386/nm-m3.h index 00128cf9ce8..5ff74024942 100644 --- a/gdb/config/i386/nm-m3.h +++ b/gdb/config/i386/nm-m3.h @@ -20,4 +20,4 @@ /* Include the generic Mach 3 definitions. */ -#include "nm-m3.h" +#include "config/nm-m3.h" diff --git a/gdb/config/i386/nm-nbsd.h b/gdb/config/i386/nm-nbsd.h index f926f9bc273..2e5adb82b3d 100644 --- a/gdb/config/i386/nm-nbsd.h +++ b/gdb/config/i386/nm-nbsd.h @@ -1,5 +1,5 @@ /* Native-dependent definitions for Intel 386 running NetBSD, for GDB. - Copyright 1986, 1987, 1989, 1992, 1994, 1996, 2000 + Copyright 1986, 1987, 1989, 1992, 1994, 2000, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -25,9 +25,4 @@ /* Get generic NetBSD native definitions. */ #include "config/nm-nbsd.h" -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = i386_register_u_addr ((blockend),(regno)); - -extern int i386_register_u_addr (int, int); - #endif /* NM_NBSD_H */ diff --git a/gdb/config/i386/nm-nbsdelf.h b/gdb/config/i386/nm-nbsdelf.h deleted file mode 100644 index 1aee1c7fd60..00000000000 --- a/gdb/config/i386/nm-nbsdelf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Native-dependent definitions for Intel 386 running NetBSD, for GDB. - Copyright 1986, 1987, 1989, 1992, 1994, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef NM_NBSDELF_H -#define NM_NBSDELF_H - -#define SVR4_SHARED_LIBS -#include "i386/nm-nbsd.h" - -#endif /* NM_NBSDELF_H */ diff --git a/gdb/config/i386/nm-ptx4.h b/gdb/config/i386/nm-ptx4.h index 32b76d24256..253b1944e9c 100644 --- a/gdb/config/i386/nm-ptx4.h +++ b/gdb/config/i386/nm-ptx4.h @@ -22,11 +22,11 @@ #include "regcache.h" -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" #undef USE_PROC_FS -#include "nm-symmetry.h" +#include "i386/nm-symmetry.h" #define PTRACE_READ_REGS(pid,regaddr) mptrace (XPT_RREGS, (pid), (regaddr), 0) #define PTRACE_WRITE_REGS(pid,regaddr) \ diff --git a/gdb/config/i386/nm-x86-64.h b/gdb/config/i386/nm-x86-64.h index 30e37310222..4430fcba5db 100644 --- a/gdb/config/i386/nm-x86-64.h +++ b/gdb/config/i386/nm-x86-64.h @@ -23,7 +23,7 @@ #ifndef NM_X86_64_H #define NM_X86_64_H -#include "nm-linux.h" +#include "config/nm-linux.h" #define I386_USE_GENERIC_WATCHPOINTS #include "i386/nm-i386.h" diff --git a/gdb/config/i386/tm-fbsd.h b/gdb/config/i386/tm-fbsd.h index 61f5de57f4a..f51859d0b46 100644 --- a/gdb/config/i386/tm-fbsd.h +++ b/gdb/config/i386/tm-fbsd.h @@ -24,56 +24,17 @@ #define HAVE_I387_REGS #include "i386/tm-i386.h" -/* FreeBSD/ELF uses stabs-in-ELF with the DWARF register numbering - scheme by default, so we must redefine STAB_REG_TO_REGNUM. This - messes up the floating-point registers for a.out, but there is not - much we can do about that. */ - -#undef STAB_REG_TO_REGNUM -#define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) - -/* FreeBSD uses the old gcc convention for struct returns. */ - -#define USE_STRUCT_CONVENTION(gcc_p, type) \ - generic_use_struct_convention (1, type) - - -/* Support for longjmp. */ - -/* Details about jmp_buf. It's supposed to be an array of integers. */ - -#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ -#define JB_PC 0 /* Array index of saved PC. */ - -/* Figure out where the longjmp will land. Store the address that - longjmp will jump to in *ADDR, and return non-zero if successful. */ - -#define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) -extern int get_longjmp_target (CORE_ADDR *addr); - - -/* Support for signal handlers. */ - -#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name) -extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name); - /* These defines allow the recognition of sigtramps as a function name . - FIXME: kettenis/2001-07-13: These should be added to the target - vector and turned into functions when we go "multi-arch". */ - -#define SIGTRAMP_START(pc) i386bsd_sigtramp_start -#define SIGTRAMP_END(pc) i386bsd_sigtramp_end -extern CORE_ADDR i386bsd_sigtramp_start; -extern CORE_ADDR i386bsd_sigtramp_end; - -/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */ + FIXME: kettenis/2002-05-12: Of course these defines will have to go + if we go truly "multi-arch", but I don't know yet how to get rid of + them. */ -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame) -extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame); - +#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc) +#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc) +extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc); +extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc); /* Shared library support. */ diff --git a/gdb/config/i386/tm-go32.h b/gdb/config/i386/tm-go32.h index b660827bd66..79370e778a2 100644 --- a/gdb/config/i386/tm-go32.h +++ b/gdb/config/i386/tm-go32.h @@ -26,43 +26,4 @@ #include "i386/tm-i386.h" -/* FRAME_CHAIN takes a frame's nominal address and produces the frame's - chain-pointer. - In the case of the i386, the frame's nominal address - is the address of a 4-byte word containing the calling frame's address. - DJGPP doesn't have any special frames for signal handlers, they are - just normal C functions. */ -#undef FRAME_CHAIN -#define FRAME_CHAIN(thisframe) \ - (!inside_entry_file ((thisframe)->pc) ? \ - read_memory_integer ((thisframe)->frame, 4) :\ - 0) - -/* A macro that tells us whether the function invocation represented - by FI does not have a frame on the stack associated with it. If it - does not, FRAMELESS is set to 1, else 0. */ -#undef FRAMELESS_FUNCTION_INVOCATION -#define FRAMELESS_FUNCTION_INVOCATION(FI) \ - (frameless_look_for_prologue(FI)) - -extern CORE_ADDR i386go32_frame_saved_pc (struct frame_info *frame); -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(FRAME) (i386go32_frame_saved_pc ((FRAME))) - -/* Support for longjmp. */ - -/* Details about jmp_buf. It's supposed to be an array of integers. */ - -#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ -#define JB_PC 8 /* Array index of saved PC inside jmp_buf. */ - -/* Figure out where the longjmp will land. Slurp the args out of the - stack. We expect the first arg to be a pointer to the jmp_buf - structure from which we extract the pc (JB_PC) that we will land - at. The pc is copied into ADDR. This routine returns true on - success. */ - -#define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) -extern int get_longjmp_target (CORE_ADDR *addr); - #endif /* TM_GO32_H */ diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index f9326fecb9a..0ea151b4a14 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -32,25 +32,6 @@ struct frame_saved_regs; struct value; struct type; -/* The format used for `long double' on almost all i386 targets is the - i387 extended floating-point format. In fact, of all targets in the - GCC 2.95 tree, only OSF/1 does it different, and insists on having - a `long double' that's not `long' at all. */ - -#define TARGET_LONG_DOUBLE_FORMAT &floatformat_i387_ext - -/* Although the i386 extended floating-point has only 80 significant - bits, a `long double' actually takes up 96, probably to enforce - alignment. */ - -#define TARGET_LONG_DOUBLE_BIT 96 - -/* Number of traps that happen between exec'ing the shell to run an - inferior, and when we finally get to the inferior code. This is 2 - on most implementations. */ - -#define START_INFERIOR_TRAPS_EXPECTED 2 - /* Offset from address of function to start of its code. Zero on most machines. */ @@ -63,11 +44,6 @@ struct type; extern int i386_skip_prologue (int); -/* Immediately after a function call, return the saved pc. */ - -#define SAVED_PC_AFTER_CALL(frame) i386_saved_pc_after_call (frame) -extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame); - /* Stack grows downward. */ #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) @@ -118,7 +94,7 @@ extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame); #endif /* Largest number of registers we could have in any configuration. */ -#define MAX_NUM_REGS (16 + 16 + 9) +#define MAX_NUM_REGS (16 + 16 + 9 + 1) /* Register numbers of various important registers. Note that some of these values are "real" register numbers, @@ -139,60 +115,8 @@ extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame); #else #define FP0_REGNUM 0 #endif - -/* Return the name of register REG. */ - -#define REGISTER_NAME(reg) i386_register_name ((reg)) -extern char *i386_register_name (int reg); - -/* Use the "default" register numbering scheme for stabs and COFF. */ - -#define STAB_REG_TO_REGNUM(reg) i386_stab_reg_to_regnum ((reg)) -#define SDB_REG_TO_REGNUM(reg) i386_stab_reg_to_regnum ((reg)) -extern int i386_stab_reg_to_regnum (int reg); - -/* Use the DWARF register numbering scheme for DWARF and DWARF 2. */ - -#define DWARF_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) -#define DWARF2_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) -extern int i386_dwarf_reg_to_regnum (int reg); - -/* We don't define ECOFF_REG_TO_REGNUM, since ECOFF doesn't seem to be - in use on any of the supported i386 targets. */ -/* Sizes of individual register sets. These cover the entire register - file, so summing up the sizes of those portions actually present - yields REGISTER_BYTES. */ -#define SIZEOF_GREGS (NUM_GREGS * 4) -#define SIZEOF_FPU_REGS (8 * 10) -#define SIZEOF_FPU_CTRL_REGS (8 * 4) -#define SIZEOF_SSE_REGS (8 * 16 + 4) - - -/* Total amount of space needed to store our copies of the machine's register - state, the array `registers'. */ -#ifdef HAVE_SSE_REGS -#define REGISTER_BYTES \ - (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS) -#else -#ifdef HAVE_I387_REGS -#define REGISTER_BYTES (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS) -#else -#define REGISTER_BYTES (SIZEOF_GREGS) -#endif -#endif - -/* Return the offset into the register array of the start of register - number REG. */ -#define REGISTER_BYTE(reg) i386_register_byte ((reg)) -extern int i386_register_byte (int reg); - -/* Return the number of bytes of storage in GDB's register array - occupied by register REG. */ -#define REGISTER_RAW_SIZE(reg) i386_register_raw_size ((reg)) -extern int i386_register_raw_size (int reg); - /* Largest value REGISTER_RAW_SIZE can have. */ #define MAX_REGISTER_RAW_SIZE 16 @@ -255,7 +179,7 @@ extern void i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(type, regbuf, valbuf) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf) \ i386_extract_return_value ((type), (regbuf), (valbuf)) extern void i386_extract_return_value (struct type *type, char *regbuf, char *valbuf); @@ -271,22 +195,10 @@ extern void i386_store_return_value (struct type *type, char *valbuf); the address in which a function should return its structure value, as a CORE_ADDR. */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) \ i386_extract_struct_value_address ((regbuf)) extern CORE_ADDR i386_extract_struct_value_address (char *regbuf); -/* The following redefines make backtracing through sigtramp work. - They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp - from the sigcontext structure which is pushed by the kernel on the - user stack, along with a pointer to it. */ - -/* Return the chain-pointer for FRAME. In the case of the i386, the - frame's nominal address is the address of a 4-byte word containing - the calling frame's address. */ - -#define FRAME_CHAIN(frame) i386_frame_chain ((frame)) -extern CORE_ADDR i386_frame_chain (struct frame_info *frame); - /* Determine whether the function invocation represented by FRAME does not have a from on the stack associated with it. If it does not, return non-zero, otherwise return zero. */ @@ -295,11 +207,6 @@ extern CORE_ADDR i386_frame_chain (struct frame_info *frame); i386_frameless_function_invocation (frame) extern int i386_frameless_function_invocation (struct frame_info *frame); -/* Return the saved program counter for FRAME. */ - -#define FRAME_SAVED_PC(frame) i386_frame_saved_pc (frame) -extern CORE_ADDR i386_frame_saved_pc (struct frame_info *frame); - #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) diff --git a/gdb/config/i386/tm-i386gnu.h b/gdb/config/i386/tm-i386gnu.h index 00cb5a9f100..f1835423a72 100644 --- a/gdb/config/i386/tm-i386gnu.h +++ b/gdb/config/i386/tm-i386gnu.h @@ -24,7 +24,7 @@ /* Include common definitions for GNU systems. FIXME: This does not belong here since this is supposed to contain only native-dependent information. */ -#include "nm-gnu.h" +#include "config/nm-gnu.h" /* Thread flavors used in re-setting the T bit. FIXME: This is native-dependent. */ @@ -51,6 +51,6 @@ #define SIGCONTEXT_PC_OFFSET 68 /* We need this file for the SOLIB_TRAMPOLINE stuff. */ -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" #endif /* TM_I386GNU_H */ diff --git a/gdb/config/i386/tm-i386lynx.h b/gdb/config/i386/tm-i386lynx.h index 842f9a7738d..2da0b7c8dee 100644 --- a/gdb/config/i386/tm-i386lynx.h +++ b/gdb/config/i386/tm-i386lynx.h @@ -21,7 +21,7 @@ #ifndef TM_I386LYNX_H #define TM_I386LYNX_H -#include "tm-lynx.h" +#include "config/tm-lynx.h" /* Most definitions from sysv could be used. */ #include "i386/tm-i386.h" diff --git a/gdb/config/i386/tm-i386m3.h b/gdb/config/i386/tm-i386m3.h index edc301da446..40f09016fbe 100644 --- a/gdb/config/i386/tm-i386m3.h +++ b/gdb/config/i386/tm-i386m3.h @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. */ /* Include common definitions for Mach3 systems */ -#include "nm-m3.h" +#include "config/nm-m3.h" /* Define offsets to access CPROC stack when it does not have * a kernel thread. diff --git a/gdb/config/i386/tm-i386nw.h b/gdb/config/i386/tm-i386nw.h deleted file mode 100644 index 9ede2c040e0..00000000000 --- a/gdb/config/i386/tm-i386nw.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Macro definitions for i386 running NetWare. - Copyright 1993, 1994, 1995, 1998, 1999, 2000 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_I386NW_H -#define TM_I386NW_H 1 - -#include "i386/tm-i386.h" - -/* Stop backtracing when we wander into main. */ - -#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) - - -/* Offsets (in target ints) into jmp_buf. Not defined in any system header - file, so we have to step through setjmp/longjmp with a debugger and figure - them out. */ - -#define JB_ELEMENT_SIZE 4 /* jmp_buf[] is array of ints */ - -#define JB_PC 6 /* Setjmp()'s return PC saved here */ - -/* Figure out where the longjmp will land. Slurp the args out of the stack. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -extern int get_longjmp_target (CORE_ADDR *); - -#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) - -#endif /* ifndef TM_I386NW_H */ diff --git a/gdb/config/i386/tm-i386sco5.h b/gdb/config/i386/tm-i386sco5.h index e4cb014e990..dc1bb26ffa8 100644 --- a/gdb/config/i386/tm-i386sco5.h +++ b/gdb/config/i386/tm-i386sco5.h @@ -28,7 +28,7 @@ /* Pick up more stuff from the generic SYSV and SVR4 host include files. */ #include "i386/tm-i386v.h" -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" #define KERNEL_U_SIZE kernel_u_size() diff --git a/gdb/config/i386/tm-i386sol2.h b/gdb/config/i386/tm-i386sol2.h index c90e0d475ae..7473f3bbc91 100644 --- a/gdb/config/i386/tm-i386sol2.h +++ b/gdb/config/i386/tm-i386sol2.h @@ -24,11 +24,6 @@ #define HAVE_I387_REGS #include "i386/tm-i386v4.h" -/* We use stabs-in-ELF with the DWARF register numbering scheme. */ - -#undef STAB_REG_TO_REGNUM -#define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) - /* If the current gcc for for this target does not produce correct debugging information for float parameters, both prototyped and unprototyped, then define this macro. This forces gdb to always @@ -37,15 +32,6 @@ #define COERCE_FLOAT_TO_DOUBLE(formal, actual) (1) -/* Signal handler frames under Solaris 2 are recognized by a return address - of 0xFFFFFFFF, the third parameter on the signal handler stack is - a pointer to an ucontext. */ -#undef sigtramp_saved_pc -#undef I386V4_SIGTRAMP_SAVED_PC -#define SIGCONTEXT_PC_OFFSET (36 + 14 * 4) -#undef IN_SIGTRAMP -#define IN_SIGTRAMP(pc, name) (pc == 0xFFFFFFFF) - /* The SunPRO compiler puts out 0 instead of the address in N_SO symbols, and for SunPRO 3.0, N_FUN symbols too. */ #define SOFUN_ADDRESS_MAYBE_MISSING diff --git a/gdb/config/i386/tm-i386v4.h b/gdb/config/i386/tm-i386v4.h index 2003b96de2e..7ebd27d7660 100644 --- a/gdb/config/i386/tm-i386v4.h +++ b/gdb/config/i386/tm-i386v4.h @@ -29,51 +29,6 @@ /* Pick up more stuff from the generic SVR4 host include file. */ -#include "tm-sysv4.h" - -/* Use the alternate method of determining valid frame chains. */ - -#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) - -/* Offsets (in target ints) into jmp_buf. Not defined in any system header - file, so we have to step through setjmp/longjmp with a debugger and figure - them out. Note that defines _JBLEN as 10, which is the default - if no specific machine is selected, even though we only use 6 slots. */ - -#define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ - -#define JB_EBX 0 -#define JB_ESI 1 -#define JB_EDI 2 -#define JB_EBP 3 -#define JB_ESP 4 -#define JB_EDX 5 - -#define JB_PC JB_EDX /* Setjmp()'s return PC saved in EDX */ - -/* Figure out where the longjmp will land. Slurp the args out of the stack. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -extern int get_longjmp_target (CORE_ADDR *); - -#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) - -/* The following redefines make backtracing through sigtramp work. - They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp - from the ucontext structure which is pushed by the kernel on the - user stack. Unfortunately there are three variants of sigtramp handlers. */ - -#define I386V4_SIGTRAMP_SAVED_PC -#define IN_SIGTRAMP(pc, name) ((name) \ - && (STREQ ("_sigreturn", name) \ - || STREQ ("_sigacthandler", name) \ - || STREQ ("sigvechandler", name))) - -/* Saved Pc. Get it from ucontext if within sigtramp. */ - -#define sigtramp_saved_pc i386v4_sigtramp_saved_pc -extern CORE_ADDR i386v4_sigtramp_saved_pc (struct frame_info *); +#include "config/tm-sysv4.h" #endif /* ifndef TM_I386V4_H */ diff --git a/gdb/config/i386/tm-linux.h b/gdb/config/i386/tm-linux.h index 60c4b1e3e39..7bfdf03895c 100644 --- a/gdb/config/i386/tm-linux.h +++ b/gdb/config/i386/tm-linux.h @@ -31,74 +31,11 @@ #endif #include "i386/tm-i386.h" -#include "tm-linux.h" - -/* Register number for the "orig_eax" pseudo-register. If this - pseudo-register contains a value >= 0 it is interpreted as the - system call number that the kernel is supposed to restart. */ -#define I386_LINUX_ORIG_EAX_REGNUM (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS) - -/* Adjust a few macros to deal with this extra register. */ - -#undef NUM_REGS -#define NUM_REGS (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS + 1) - -#undef MAX_NUM_REGS -#define MAX_NUM_REGS (16 + 16 + 9 + 1) - -#undef REGISTER_BYTES -#define REGISTER_BYTES \ - (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS + 4) - -#undef REGISTER_NAME -#define REGISTER_NAME(reg) i386_linux_register_name ((reg)) -extern char *i386_linux_register_name (int reg); - -#undef REGISTER_BYTE -#define REGISTER_BYTE(reg) i386_linux_register_byte ((reg)) -extern int i386_linux_register_byte (int reg); - -#undef REGISTER_RAW_SIZE -#define REGISTER_RAW_SIZE(reg) i386_linux_register_raw_size ((reg)) -extern int i386_linux_register_raw_size (int reg); - -/* GNU/Linux ELF uses stabs-in-ELF with the DWARF register numbering - scheme by default, so we must redefine STAB_REG_TO_REGNUM. This - messes up the floating-point registers for a.out, but there is not - much we can do about that. */ -#undef STAB_REG_TO_REGNUM -#define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) - -/* Use target_specific function to define link map offsets. */ -extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void); -#define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets () +#include "config/tm-linux.h" /* The following works around a problem with /usr/include/sys/procfs.h */ #define sys_quotactl 1 -/* When the i386 Linux kernel calls a signal handler, the return - address points to a bit of code on the stack. These definitions - are used to identify this bit of code as a signal trampoline in - order to support backtracing through calls to signal handlers. */ - -#define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name) -extern int i386_linux_in_sigtramp (CORE_ADDR, char *); - -#undef FRAME_CHAIN -#define FRAME_CHAIN(frame) i386_linux_frame_chain (frame) -extern CORE_ADDR i386_linux_frame_chain (struct frame_info *frame); - -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(frame) i386_linux_frame_saved_pc (frame) -extern CORE_ADDR i386_linux_frame_saved_pc (struct frame_info *frame); - -#undef SAVED_PC_AFTER_CALL -#define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame) -extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *); - -#define TARGET_WRITE_PC(pc, ptid) i386_linux_write_pc (pc, ptid) -extern void i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid); - /* When we call a function in a shared library, and the PLT sends us into the dynamic linker to find the function's real address, we need to skip over the dynamic linker call. This function decides @@ -110,22 +47,5 @@ extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc); /* N_FUN symbols in shared libaries have 0 for their values and need to be relocated. */ #define SOFUN_ADDRESS_MAYBE_MISSING - - -/* Support for longjmp. */ - -/* Details about jmp_buf. It's supposed to be an array of integers. */ - -#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ -#define JB_PC 5 /* Array index of saved PC. */ - -/* Figure out where the longjmp will land. Slurp the args out of the - stack. We expect the first arg to be a pointer to the jmp_buf - structure from which we extract the pc (JB_PC) that we will land - at. The pc is copied into ADDR. This routine returns true on - success. */ - -#define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) -extern int get_longjmp_target (CORE_ADDR *addr); #endif /* #ifndef TM_LINUX_H */ diff --git a/gdb/config/i386/tm-nbsd.h b/gdb/config/i386/tm-nbsd.h index 8f1295efe6e..55ef6fa56fc 100644 --- a/gdb/config/i386/tm-nbsd.h +++ b/gdb/config/i386/tm-nbsd.h @@ -25,46 +25,17 @@ #define HAVE_SSE_REGS #include "i386/tm-i386.h" -#include "config/tm-nbsd.h" - -extern use_struct_convention_fn i386nbsd_aout_use_struct_convention; -#define USE_STRUCT_CONVENTION(gcc_p, type) \ - i386nbsd_aout_use_struct_convention(gcc_p, type) - - -#define JB_ELEMENT_SIZE sizeof(int) /* jmp_buf[_JBLEN] is array of ints */ -#define JB_PC 0 /* Setjmp()'s return PC saved here */ - -/* Figure out where the longjmp will land. Slurp the args out of the stack. - We expect the first arg to be a pointer to the jmp_buf structure from which - we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -extern int get_longjmp_target (CORE_ADDR *); - -#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) - - -/* Support for signal handlers. */ - -#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name) -extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name); /* These defines allow the recognition of sigtramps as a function name . - FIXME: kettenis/2001-07-13: These should be added to the target - vector and turned into functions when we go "multi-arch". */ - -#define SIGTRAMP_START(pc) i386bsd_sigtramp_start -#define SIGTRAMP_END(pc) i386bsd_sigtramp_end -extern CORE_ADDR i386bsd_sigtramp_start; -extern CORE_ADDR i386bsd_sigtramp_end; - -/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */ + FIXME: kettenis/2002-05-12: Of course these defines will have to go + if we go truly "multi-arch", but I don't know yet how to get rid of + them. */ -#undef FRAME_SAVED_PC -#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame) -extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame); +#define SIGTRAMP_START(pc) i386bsd_sigtramp_start (pc) +#define SIGTRAMP_END(pc) i386bsd_sigtramp_end (pc) +extern CORE_ADDR i386bsd_sigtramp_start (CORE_ADDR pc); +extern CORE_ADDR i386bsd_sigtramp_end (CORE_ADDR pc); #endif /* TM_NBSD_H */ diff --git a/gdb/config/i386/tm-nbsdelf.h b/gdb/config/i386/tm-nbsdelf.h deleted file mode 100644 index 4d802c5302d..00000000000 --- a/gdb/config/i386/tm-nbsdelf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Macro definitions for i386 running under NetBSD. - Copyright 2000 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_NBSDELF_H -#define TM_NBSDELF_H - -#include "i386/tm-nbsd.h" - -#undef USE_STRUCT_CONVENTION - -#endif /* TM_NBSD_H */ diff --git a/gdb/config/i386/tm-ptx.h b/gdb/config/i386/tm-ptx.h index 2a1731a161c..ff0d56e6174 100644 --- a/gdb/config/i386/tm-ptx.h +++ b/gdb/config/i386/tm-ptx.h @@ -220,8 +220,8 @@ extern const struct floatformat floatformat_i387_ext; /* from floatformat.h */ a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#undef EXTRACT_RETURN_VALUE -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#undef DEPRECATED_EXTRACT_RETURN_VALUE +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ symmetry_extract_return_value(TYPE, REGBUF, VALBUF) /* diff --git a/gdb/config/i386/tm-ptx4.h b/gdb/config/i386/tm-ptx4.h index 1f221ba8e2b..a13d4a63a7f 100644 --- a/gdb/config/i386/tm-ptx4.h +++ b/gdb/config/i386/tm-ptx4.h @@ -23,4 +23,4 @@ #define SEQUENT_PTX4 -#include "tm-ptx.h" +#include "i386/tm-ptx.h" diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h index 78281819dfa..e7a989b19c2 100644 --- a/gdb/config/i386/tm-symmetry.h +++ b/gdb/config/i386/tm-symmetry.h @@ -308,8 +308,8 @@ switch (regno) { \ a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#undef EXTRACT_RETURN_VALUE -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#undef DEPRECATED_EXTRACT_RETURN_VALUE +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ symmetry_extract_return_value(TYPE, REGBUF, VALBUF) /* The following redefines make backtracing through sigtramp work. diff --git a/gdb/config/i386/tm-vxworks.h b/gdb/config/i386/tm-vxworks.h index 6434a6ea2f5..ffaea49306f 100644 --- a/gdb/config/i386/tm-vxworks.h +++ b/gdb/config/i386/tm-vxworks.h @@ -23,6 +23,6 @@ #define TM_VXWORKS_H #include "i386/tm-i386v.h" -#include "tm-vxworks.h" +#include "config/tm-vxworks.h" #endif /* ifndef TM_VXWORKS_H */ diff --git a/gdb/config/i386/x86-64linux.mt b/gdb/config/i386/x86-64linux.mt index 85f1972531d..58a9cee1889 100644 --- a/gdb/config/i386/x86-64linux.mt +++ b/gdb/config/i386/x86-64linux.mt @@ -1,3 +1,3 @@ # Target: AMD x86-64 running GNU/Linux -TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o i387-tdep.o dwarf2cfi.o \ +TDEPFILES= x86-64-tdep.o x86-64-linux-tdep.o dwarf2cfi.o \ solib.o solib-svr4.o solib-legacy.o diff --git a/gdb/config/i386/xm-i386v4.h b/gdb/config/i386/xm-i386v4.h index c3241100bf7..154986c1880 100644 --- a/gdb/config/i386/xm-i386v4.h +++ b/gdb/config/i386/xm-i386v4.h @@ -25,4 +25,4 @@ /* Pick up more stuff from the generic SVR4 host include file. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" diff --git a/gdb/config/i386/xm-nbsd.h b/gdb/config/i386/xm-nbsd.h index 415d0fa4ffd..4a998cde4ee 100644 --- a/gdb/config/i386/xm-nbsd.h +++ b/gdb/config/i386/xm-nbsd.h @@ -19,6 +19,6 @@ Boston, MA 02111-1307, USA. */ /* Get generic NetBSD host definitions. */ -#include "xm-nbsd.h" +#include "config/xm-nbsd.h" #define HOST_LONG_DOUBLE_FORMAT &floatformat_i387_ext diff --git a/gdb/config/i386/xm-ptx.h b/gdb/config/i386/xm-ptx.h index 6dfb9d6d4e3..8987f297133 100644 --- a/gdb/config/i386/xm-ptx.h +++ b/gdb/config/i386/xm-ptx.h @@ -23,7 +23,7 @@ /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ #ifdef _SEQUENT_PTX4_ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" #endif /* _SEQUENT_PTX4_ */ /* This machine doesn't have the siginterrupt call. */ diff --git a/gdb/config/i386/xm-ptx4.h b/gdb/config/i386/xm-ptx4.h index 2f466e62d70..605941315c9 100644 --- a/gdb/config/i386/xm-ptx4.h +++ b/gdb/config/i386/xm-ptx4.h @@ -22,6 +22,6 @@ /* Symmetry version by Jay Vosburgh (fubar@sequent.com) */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" -#include "xm-ptx.h" +#include "i386/xm-ptx.h" diff --git a/gdb/config/i960/tm-i960.h b/gdb/config/i960/tm-i960.h index a62e35da7e7..a0ae164a658 100644 --- a/gdb/config/i960/tm-i960.h +++ b/gdb/config/i960/tm-i960.h @@ -182,7 +182,7 @@ extern use_struct_convention_fn i960_use_struct_convention; On the i960 we just take as many bytes as we need from G0 through G3. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy(VALBUF, REGBUF+REGISTER_BYTE(G0_REGNUM), TYPE_LENGTH (TYPE)) /* If USE_STRUCT_CONVENTION produces a 1, @@ -195,7 +195,7 @@ extern use_struct_convention_fn i960_use_struct_convention; (..., 0) below is to make it appear to return a value, though actually all it does is call error(). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ (error("Don't know where large structure is returned on i960"), 0) /* Write into appropriate registers a function return value diff --git a/gdb/config/i960/tm-vx960.h b/gdb/config/i960/tm-vx960.h index 16fc62ac6bb..a2e07cc7b0d 100644 --- a/gdb/config/i960/tm-vx960.h +++ b/gdb/config/i960/tm-vx960.h @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. */ #include "i960/tm-i960.h" -#include "tm-vxworks.h" +#include "config/tm-vxworks.h" /* Under VxWorks the IP isn't filled in. Skip it, go with RIP, which has the real value. */ diff --git a/gdb/config/ia64/nm-aix.h b/gdb/config/ia64/nm-aix.h index 3f6764c3027..8a2d66f7c28 100644 --- a/gdb/config/ia64/nm-aix.h +++ b/gdb/config/ia64/nm-aix.h @@ -21,7 +21,7 @@ #ifndef NM_AIX_H #define NM_AIX_H -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" #ifndef AIX5 #define AIX5 1 diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h index 2c980c0ad9a..e00d561b6a3 100644 --- a/gdb/config/ia64/nm-linux.h +++ b/gdb/config/ia64/nm-linux.h @@ -22,7 +22,7 @@ #ifndef NM_LINUX_H #define NM_LINUX_H -#include "nm-linux.h" +#include "config/nm-linux.h" /* Note: It seems likely that we'll have to eventually define FETCH_INFERIOR_REGISTERS. But until that time, we'll make do diff --git a/gdb/config/ia64/tm-aix.h b/gdb/config/ia64/tm-aix.h index 0160140c680..b59d6dd11cd 100644 --- a/gdb/config/ia64/tm-aix.h +++ b/gdb/config/ia64/tm-aix.h @@ -22,7 +22,7 @@ #define TM_AIX_H #include "ia64/tm-ia64.h" -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" #define TARGET_ELF64 diff --git a/gdb/config/ia64/tm-linux.h b/gdb/config/ia64/tm-linux.h index f716d83ae41..60517525467 100644 --- a/gdb/config/ia64/tm-linux.h +++ b/gdb/config/ia64/tm-linux.h @@ -24,7 +24,7 @@ #define IA64_GNULINUX_TARGET #include "ia64/tm-ia64.h" -#include "tm-linux.h" +#include "config/tm-linux.h" #define TARGET_ELF64 diff --git a/gdb/config/ia64/xm-aix.h b/gdb/config/ia64/xm-aix.h index 6ca026d493f..ad717d5c01c 100644 --- a/gdb/config/ia64/xm-aix.h +++ b/gdb/config/ia64/xm-aix.h @@ -23,6 +23,6 @@ /* Pick up more stuff from the generic SVR4 host include file. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" #endif /* #ifndef XM_AIX_H */ diff --git a/gdb/config/m32r/tm-m32r.h b/gdb/config/m32r/tm-m32r.h index 75bc7b231a6..9477478c26c 100644 --- a/gdb/config/m32r/tm-m32r.h +++ b/gdb/config/m32r/tm-m32r.h @@ -137,8 +137,8 @@ extern CORE_ADDR m32r_frame_saved_pc (struct frame_info *); /* mvs_check FRAME_SAVED_PC */ #define FRAME_SAVED_PC(fi) m32r_frame_saved_pc (fi) -/* mvs_check EXTRACT_RETURN_VALUE */ -#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ +/* mvs_check DEPRECATED_EXTRACT_RETURN_VALUE */ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ memcpy ((VALBUF), \ (char *)(REGBUF) + REGISTER_BYTE (V0_REGNUM) + \ ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \ @@ -181,7 +181,7 @@ extern void m32r_write_sp (CORE_ADDR val); extern use_struct_convention_fn m32r_use_struct_convention; #define USE_STRUCT_CONVENTION(GCC_P, TYPE) m32r_use_struct_convention (GCC_P, TYPE) -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ REGISTER_RAW_SIZE (V0_REGNUM)) diff --git a/gdb/config/m68k/nbsd.mh b/gdb/config/m68k/nbsd.mh deleted file mode 100644 index 30c800abd9a..00000000000 --- a/gdb/config/m68k/nbsd.mh +++ /dev/null @@ -1,5 +0,0 @@ -# Host: Motorola m68k running NetBSD -NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o \ - solib.o solib-sunos.o -XM_FILE= xm-nbsd.h -NAT_FILE= nm-nbsd.h diff --git a/gdb/config/m68k/nbsd.mt b/gdb/config/m68k/nbsd.mt deleted file mode 100644 index b6ac5a000e1..00000000000 --- a/gdb/config/m68k/nbsd.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Motorola m68k running NetBSD -TDEPFILES= m68k-tdep.o m68knbsd-tdep.o -TM_FILE= tm-nbsd.h diff --git a/gdb/config/m68k/nm-linux.h b/gdb/config/m68k/nm-linux.h index 5c37af9ca12..26aa19768ad 100644 --- a/gdb/config/m68k/nm-linux.h +++ b/gdb/config/m68k/nm-linux.h @@ -21,7 +21,7 @@ #ifndef NM_LINUX_H #define NM_LINUX_H -#include "nm-linux.h" +#include "config/nm-linux.h" /* Return sizeof user struct to callers in less machine dependent routines */ diff --git a/gdb/config/m68k/nm-m68klynx.h b/gdb/config/m68k/nm-m68klynx.h index 49114fc4df9..9d95d3728dd 100644 --- a/gdb/config/m68k/nm-m68klynx.h +++ b/gdb/config/m68k/nm-m68klynx.h @@ -21,6 +21,6 @@ #ifndef NM_M68KLYNX_H #define NM_M68KLYNX_H -#include "nm-lynx.h" +#include "config/nm-lynx.h" #endif /* NM_M68KLYNX_H */ diff --git a/gdb/config/m68k/nm-nbsd.h b/gdb/config/m68k/nm-nbsd.h index b73b0ef71e5..72c98895a78 100644 --- a/gdb/config/m68k/nm-nbsd.h +++ b/gdb/config/m68k/nm-nbsd.h @@ -18,5 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef NM_NBSD_H +#define NM_NBSD_H + /* Get generic NetBSD native definitions. */ -#include "nm-nbsd.h" +#include "config/nm-nbsd.h" + +#endif /* NM_NBSD_H */ diff --git a/gdb/config/m68k/nm-sysv4.h b/gdb/config/m68k/nm-sysv4.h index a7d0bdd3bda..b9cb591f389 100644 --- a/gdb/config/m68k/nm-sysv4.h +++ b/gdb/config/m68k/nm-sysv4.h @@ -20,4 +20,4 @@ /* Include the generic SVR4 definitions. */ -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" diff --git a/gdb/config/m68k/tm-delta68.h b/gdb/config/m68k/tm-delta68.h index a38baea2020..7697bc41321 100644 --- a/gdb/config/m68k/tm-delta68.h +++ b/gdb/config/m68k/tm-delta68.h @@ -45,7 +45,7 @@ /* When it returns a float/double value, use fp0 in sysV68. */ /* When it returns a pointer value, use a0 in sysV68. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \ ®BUF[REGISTER_BYTE (FP0_REGNUM)], \ @@ -91,8 +91,8 @@ extern int delta68_frame_num_args (struct frame_info *fi); the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#undef EXTRACT_STRUCT_VALUE_ADDRESS -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)\ +#undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)\ (*(CORE_ADDR *)((char*)(REGBUF) + 8 * 4)) extern int delta68_in_sigtramp (CORE_ADDR pc, char *name); diff --git a/gdb/config/m68k/tm-linux.h b/gdb/config/m68k/tm-linux.h index 94b2c2c3504..8a7d3a5b46c 100644 --- a/gdb/config/m68k/tm-linux.h +++ b/gdb/config/m68k/tm-linux.h @@ -36,7 +36,7 @@ function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ { \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ { \ @@ -76,15 +76,15 @@ } \ } -#include "tm-linux.h" +#include "config/tm-linux.h" #include "m68k/tm-m68k.h" /* Extract from an array REGBUF containing the (raw) register state the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#undef EXTRACT_STRUCT_VALUE_ADDRESS -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ (*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (A0_REGNUM))) /* Offsets (in target ints) into jmp_buf. */ diff --git a/gdb/config/m68k/tm-m68k.h b/gdb/config/m68k/tm-m68k.h index 5b23df0a0be..40bd25aa626 100644 --- a/gdb/config/m68k/tm-m68k.h +++ b/gdb/config/m68k/tm-m68k.h @@ -201,8 +201,8 @@ extern void m68k_find_saved_regs (struct frame_info *, into VALBUF. This is assuming that floating point values are returned as doubles in d0/d1. */ -#if !defined (EXTRACT_RETURN_VALUE) -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#if !defined (DEPRECATED_EXTRACT_RETURN_VALUE) +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy ((VALBUF), \ (char *)(REGBUF) + \ (TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)), \ @@ -222,7 +222,7 @@ extern void m68k_find_saved_regs (struct frame_info *, the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ diff --git a/gdb/config/m68k/tm-m68klynx.h b/gdb/config/m68k/tm-m68klynx.h index cfc462f54a4..ed1f6f0f05e 100644 --- a/gdb/config/m68k/tm-m68klynx.h +++ b/gdb/config/m68k/tm-m68klynx.h @@ -21,7 +21,7 @@ #ifndef TM_M68KLYNX_H #define TM_M68KLYNX_H -#include "tm-lynx.h" +#include "config/tm-lynx.h" /* If PC-2 contains this instruction, then we know what we are in a system call stub, and the return PC is is at SP+4, instead of SP. */ diff --git a/gdb/config/m68k/tm-m68kv4.h b/gdb/config/m68k/tm-m68kv4.h index 18bf5a2187a..275ab62dd98 100644 --- a/gdb/config/m68k/tm-m68kv4.h +++ b/gdb/config/m68k/tm-m68kv4.h @@ -34,7 +34,7 @@ #define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" #include "m68k/tm-m68k.h" /* Offsets (in target ints) into jmp_buf. Not defined in any system header diff --git a/gdb/config/m68k/tm-nbsd.h b/gdb/config/m68k/tm-nbsd.h index 354632a32f5..62f008c7249 100644 --- a/gdb/config/m68k/tm-nbsd.h +++ b/gdb/config/m68k/tm-nbsd.h @@ -37,7 +37,10 @@ #define SIGTRAMP_END(pc) (STACK_END_ADDR) #include "m68k/tm-m68k.h" -#include "tm-nbsd.h" + +/* Return non-zero if we are in a shared library trampoline code stub. */ +#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ + (name && !strcmp(name, "_DYNAMIC")) extern use_struct_convention_fn m68knbsd_use_struct_convention; #define USE_STRUCT_CONVENTION(gcc_p, type) \ diff --git a/gdb/config/m68k/tm-sun2os4.h b/gdb/config/m68k/tm-sun2os4.h index 496c32955b3..d5fe5315267 100644 --- a/gdb/config/m68k/tm-sun2os4.h +++ b/gdb/config/m68k/tm-sun2os4.h @@ -18,4 +18,4 @@ Boston, MA 02111-1307, USA. */ #include "m68k/tm-sun2.h" -#include "tm-sunos.h" +#include "config/tm-sunos.h" diff --git a/gdb/config/m68k/tm-sun3os4.h b/gdb/config/m68k/tm-sun3os4.h index d4bc74fd8e7..ced43761b38 100644 --- a/gdb/config/m68k/tm-sun3os4.h +++ b/gdb/config/m68k/tm-sun3os4.h @@ -19,4 +19,4 @@ Boston, MA 02111-1307, USA. */ #include "m68k/tm-sun3.h" -#include "tm-sunos.h" +#include "config/tm-sunos.h" diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h index 988b4bb4b9e..ea27ac45d02 100644 --- a/gdb/config/m68k/tm-vx68.h +++ b/gdb/config/m68k/tm-vx68.h @@ -30,7 +30,7 @@ #define DECR_PC_AFTER_BREAK 0 #include "m68k/tm-m68k.h" -#include "tm-vxworks.h" +#include "config/tm-vxworks.h" /* Takes the current frame-struct pointer and returns the chain-pointer to get to the calling frame. diff --git a/gdb/config/m68k/xm-m68kv4.h b/gdb/config/m68k/xm-m68kv4.h index 11679a965eb..542cd106814 100644 --- a/gdb/config/m68k/xm-m68kv4.h +++ b/gdb/config/m68k/xm-m68kv4.h @@ -26,4 +26,4 @@ /* Pick up more stuff from the generic SVR4 host include file. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" diff --git a/gdb/config/m68k/xm-nbsd.h b/gdb/config/m68k/xm-nbsd.h index c266a99e628..6c735fa1a8c 100644 --- a/gdb/config/m68k/xm-nbsd.h +++ b/gdb/config/m68k/xm-nbsd.h @@ -19,4 +19,4 @@ Boston, MA 02111-1307, USA. */ /* Get generic NetBSD host definitions. */ -#include "xm-nbsd.h" +#include "config/xm-nbsd.h" diff --git a/gdb/config/m88k/nm-delta88v4.h b/gdb/config/m88k/nm-delta88v4.h index 90ee391b2b6..97f75f2c981 100644 --- a/gdb/config/m88k/nm-delta88v4.h +++ b/gdb/config/m88k/nm-delta88v4.h @@ -20,4 +20,4 @@ Boston, MA 02111-1307, USA. */ #include "m88k/nm-m88k.h" -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" diff --git a/gdb/config/m88k/tm-delta88v4.h b/gdb/config/m88k/tm-delta88v4.h index 35a605d3536..44e488fb18f 100644 --- a/gdb/config/m88k/tm-delta88v4.h +++ b/gdb/config/m88k/tm-delta88v4.h @@ -22,7 +22,7 @@ #define DELTA88 #include "m88k/tm-m88k.h" -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" /* If we don't define this, backtraces go on forever. */ #define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h index 7405c1294f1..22e069db925 100644 --- a/gdb/config/m88k/tm-m88k.h +++ b/gdb/config/m88k/tm-m88k.h @@ -385,10 +385,10 @@ struct type *m88k_register_type (int regnum); /* The 88k call/return conventions call for "small" values to be returned into consecutive registers starting from r2. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy ((VALBUF), &(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), TYPE_LENGTH (TYPE)) -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) /* Write into appropriate registers a function return value of type TYPE, given in virtual format. */ diff --git a/gdb/config/m88k/xm-delta88v4.h b/gdb/config/m88k/xm-delta88v4.h index b09a02dd335..932b9022a89 100644 --- a/gdb/config/m88k/xm-delta88v4.h +++ b/gdb/config/m88k/xm-delta88v4.h @@ -19,4 +19,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" diff --git a/gdb/config/mcore/tm-mcore.h b/gdb/config/mcore/tm-mcore.h index 1da21b76e64..9806708e14e 100644 --- a/gdb/config/mcore/tm-mcore.h +++ b/gdb/config/mcore/tm-mcore.h @@ -94,13 +94,13 @@ extern void mcore_store_return_value (struct type *type, char *valbuf); #define STORE_RETURN_VALUE(TYPE, VALBUF) mcore_store_return_value ((TYPE), (VALBUF)) extern void mcore_extract_return_value (struct type *type, char *regbut, char *valbuf); -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ mcore_extract_return_value ((TYPE), (REGBUF), (VALBUF)); #define STORE_STRUCT_RETURN(ADDR, SP) /* handled by mcore_push_arguments */ extern CORE_ADDR mcore_extract_struct_value_address (char *regbuf); -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ mcore_extract_struct_value_address (REGBUF) extern CORE_ADDR mcore_skip_prologue (CORE_ADDR pc); diff --git a/gdb/config/mips/nm-irix5.h b/gdb/config/mips/nm-irix5.h index bed3144530d..8e31b592811 100644 --- a/gdb/config/mips/nm-irix5.h +++ b/gdb/config/mips/nm-irix5.h @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "nm-sysv4.h" +#include "config/nm-sysv4.h" #undef IN_SOLIB_DYNSYM_RESOLVE_CODE #define TARGET_HAS_HARDWARE_WATCHPOINTS diff --git a/gdb/config/mips/nm-linux.h b/gdb/config/mips/nm-linux.h index c43ecd68393..426dd5523b6 100644 --- a/gdb/config/mips/nm-linux.h +++ b/gdb/config/mips/nm-linux.h @@ -24,7 +24,7 @@ #define MIPS_GNULINUX_TARGET -#include "nm-linux.h" +#include "config/nm-linux.h" /* Return sizeof user struct to callers in less machine dependent routines. Hard coded for cross-compilation friendliness. */ diff --git a/gdb/config/mips/tm-irix5.h b/gdb/config/mips/tm-irix5.h index 49b842fb7f1..1a88de04b8d 100644 --- a/gdb/config/mips/tm-irix5.h +++ b/gdb/config/mips/tm-irix5.h @@ -48,18 +48,6 @@ : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \ : builtin_type_int) -#undef MIPS_LAST_ARG_REGNUM -#define MIPS_LAST_ARG_REGNUM 11 /* N32 uses R4 through R11 for args */ - -/* MIPS_STACK_ARGSIZE -- how many bytes does a pushed function arg take - up on the stack? For the n32 ABI, eight bytes are reserved for each - register. Like MIPS_SAVED_REGSIZE but different. */ -#define MIPS_DEFAULT_STACK_ARGSIZE 8 - -/* N32 does not reserve home space for registers used to carry - parameters. */ -#define MIPS_REGS_HAVE_HOME_P 0 - /* Force N32 ABI as the default. */ #define MIPS_DEFAULT_ABI MIPS_ABI_N32 diff --git a/gdb/config/mips/tm-irix6.h b/gdb/config/mips/tm-irix6.h index 2d90b2ef998..70b5f6fb7fc 100644 --- a/gdb/config/mips/tm-irix6.h +++ b/gdb/config/mips/tm-irix6.h @@ -95,18 +95,6 @@ : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \ : builtin_type_int) -#undef MIPS_LAST_ARG_REGNUM -#define MIPS_LAST_ARG_REGNUM 11 /* N32 uses R4 through R11 for args */ - -/* MIPS_STACK_ARGSIZE -- how many bytes does a pushed function arg take - up on the stack? For the n32 ABI, eight bytes are reserved for each - register. Like MIPS_SAVED_REGSIZE but different. */ -#define MIPS_DEFAULT_STACK_ARGSIZE 8 - -/* N32 does not reserve home space for registers used to carry - parameters. */ -#define MIPS_REGS_HAVE_HOME_P 0 - /* Force N32 ABI as the default. */ #define MIPS_DEFAULT_ABI MIPS_ABI_N32 diff --git a/gdb/config/mips/tm-linux.h b/gdb/config/mips/tm-linux.h index 0e9de3cbb26..4236ea8bec4 100644 --- a/gdb/config/mips/tm-linux.h +++ b/gdb/config/mips/tm-linux.h @@ -36,7 +36,7 @@ #define REALTIME_LO 32 #define REALTIME_HI 128 -#include "tm-linux.h" +#include "config/tm-linux.h" /* There's an E_MIPS_ABI_O32 flag in e_flags, but we don't use it - in fact, using it may violate the o32 ABI. */ diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index 8403ef87153..f573e96fd58 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -38,10 +38,6 @@ struct value; #include "coff/sym.h" /* Needed for PDR below. */ #include "coff/symconst.h" -#if !defined (MIPS_EABI) -#define MIPS_EABI 0 -#endif - /* PC should be masked to remove possible MIPS16 flag */ #if !defined (GDB_TARGET_MASK_DISAS_PC) #define GDB_TARGET_MASK_DISAS_PC(addr) UNMAKE_MIPS16_ADDR(addr) @@ -130,11 +126,6 @@ extern char *mips_register_name (int regnr); #define ZERO_REGNUM 0 /* read-only register, always 0 */ #define V0_REGNUM 2 /* Function integer return value */ #define A0_REGNUM 4 /* Loc of first arg during a subr call */ -#if MIPS_EABI -#define MIPS_LAST_ARG_REGNUM 11 /* EABI uses R4 through R11 for args */ -#else -#define MIPS_LAST_ARG_REGNUM 7 /* old ABI uses R4 through R7 for args */ -#endif #define T9_REGNUM 25 /* Contains address of callee in PIC */ #define SP_REGNUM 29 /* Contains address of top of stack */ #define RA_REGNUM 31 /* Contains return address value */ @@ -146,11 +137,6 @@ extern char *mips_register_name (int regnr); #define PC_REGNUM 37 /* Contains program counter */ #define FP0_REGNUM 38 /* Floating point register 0 (single float) */ #define FPA0_REGNUM (FP0_REGNUM+12) /* First float argument register */ -#if MIPS_EABI /* EABI uses F12 through F19 for args */ -#define MIPS_LAST_FP_ARG_REGNUM (FP0_REGNUM+19) -#else /* old ABI uses F12 through F15 for args */ -#define MIPS_LAST_FP_ARG_REGNUM (FP0_REGNUM+15) -#endif #define FCRCS_REGNUM 70 /* FP control/status */ #define FCRIR_REGNUM 71 /* FP implementation/revision */ #define FP_REGNUM 72 /* Pseudo register that contains true address of executing stack frame */ @@ -256,7 +242,7 @@ void mips_register_convert_to_raw (struct type *virtual_type, int reg_nr, a function return value of type TYPE, and copy that, in virtual format, into VALBUF. XXX floats */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ mips_extract_return_value(TYPE, REGBUF, VALBUF) extern void mips_extract_return_value (struct type *, char[], char *); @@ -275,7 +261,7 @@ extern void mips_store_return_value (struct type *, char *); convention is specified by the System V ABI, so I think we can rely on it. */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ REGISTER_RAW_SIZE (V0_REGNUM))) diff --git a/gdb/config/mips/tm-mips64.h b/gdb/config/mips/tm-mips64.h index 510ad05c0bc..13e62d2acf3 100644 --- a/gdb/config/mips/tm-mips64.h +++ b/gdb/config/mips/tm-mips64.h @@ -34,4 +34,4 @@ #define OP_LDGPR 067 /* ld */ /* Get the basic MIPS definitions. */ -#include "tm-mips.h" +#include "mips/tm-mips.h" diff --git a/gdb/config/mips/tm-mipsm3.h b/gdb/config/mips/tm-mipsm3.h index 19ae028c604..9e2f4901d7a 100644 --- a/gdb/config/mips/tm-mipsm3.h +++ b/gdb/config/mips/tm-mipsm3.h @@ -25,7 +25,7 @@ */ /* Include common definitions for Mach3 systems */ -#include "nm-m3.h" +#include "config/nm-m3.h" /* Define offsets to access CPROC stack when it does not have * a kernel thread. diff --git a/gdb/config/mips/tm-mipsv4.h b/gdb/config/mips/tm-mipsv4.h index d1cc21ca1e8..3a362f05a3a 100644 --- a/gdb/config/mips/tm-mipsv4.h +++ b/gdb/config/mips/tm-mipsv4.h @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. */ #include "mips/tm-bigmips.h" -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" /* The signal handler trampoline is called _sigtramp. */ #undef IN_SIGTRAMP diff --git a/gdb/config/mips/tm-vxmips.h b/gdb/config/mips/tm-vxmips.h index e4ef2b6a2bd..5475fb57259 100644 --- a/gdb/config/mips/tm-vxmips.h +++ b/gdb/config/mips/tm-vxmips.h @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "mips/tm-mips.h" -#include "tm-vxworks.h" +#include "config/tm-vxworks.h" /* FIXME: These are almost certainly wrong. */ diff --git a/gdb/config/mips/xm-irix5.h b/gdb/config/mips/xm-irix5.h index 78c3a071e10..7d61ff059cc 100644 --- a/gdb/config/mips/xm-irix5.h +++ b/gdb/config/mips/xm-irix5.h @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" /* Override register locations in upage for SGI machines */ #undef REGISTER_U_ADDR diff --git a/gdb/config/mips/xm-mipsv4.h b/gdb/config/mips/xm-mipsv4.h index 76fa5da19db..eccb2964d05 100644 --- a/gdb/config/mips/xm-mipsv4.h +++ b/gdb/config/mips/xm-mipsv4.h @@ -19,4 +19,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" diff --git a/gdb/config/mn10200/tm-mn10200.h b/gdb/config/mn10200/tm-mn10200.h index 4402b78ba79..7f961301c0d 100644 --- a/gdb/config/mn10200/tm-mn10200.h +++ b/gdb/config/mn10200/tm-mn10200.h @@ -125,7 +125,7 @@ extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *); a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ { \ if (TYPE_LENGTH (TYPE) > 8) \ internal_error (__FILE__, __LINE__, "failed internal consistency check"); \ @@ -144,7 +144,7 @@ extern CORE_ADDR mn10200_frame_saved_pc (struct frame_info *); } \ } -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ extract_address (REGBUF + REGISTER_BYTE (4), \ REGISTER_RAW_SIZE (4)) diff --git a/gdb/config/nm-nbsd.h b/gdb/config/nm-nbsd.h index 402f606fd26..5078c567968 100644 --- a/gdb/config/nm-nbsd.h +++ b/gdb/config/nm-nbsd.h @@ -25,63 +25,3 @@ #define ATTACH_DETACH #include "solib.h" /* Support for shared libraries. */ -#if defined (SVR4_SHARED_LIBS) -#include "elf/common.h" /* Additional ELF shared library info. */ -#endif - -#if !defined (SVR4_SHARED_LIBS) - -/* make structure definitions match up with those expected in solib.c */ -#define link_object sod -#define lo_name sod_name -#define lo_library sod_library -#define lo_unused sod_reserved -#define lo_major sod_major -#define lo_minor sod_minor -#define lo_next sod_next - -#define link_map so_map -#define lm_addr som_addr -#define lm_name som_path -#define lm_next som_next -#define lm_lop som_sod -#define lm_lob som_sodbase -#define lm_rwt som_write -#define lm_ld som_dynamic -#define lm_lpd som_spd - -#define link_dynamic_2 section_dispatch_table -#define ld_loaded sdt_loaded -#define ld_need sdt_sods -#define ld_rules sdt_filler1 -#define ld_got sdt_got -#define ld_plt sdt_plt -#define ld_rel sdt_rel -#define ld_hash sdt_hash -#define ld_stab sdt_nzlist -#define ld_stab_hash sdt_filler2 -#define ld_buckets sdt_buckets -#define ld_symbols sdt_strings -#define ld_symb_size sdt_str_sz -#define ld_text sdt_text_sz -#define ld_plt_sz sdt_plt_sz - -#define rtc_symb rt_symbol -#define rtc_sp rt_sp -#define rtc_next rt_next - -#define ld_debug so_debug -#define ldd_version dd_version -#define ldd_in_debugger dd_in_debugger -#define ldd_sym_loaded dd_sym_loaded -#define ldd_bp_addr dd_bpt_addr -#define ldd_bp_inst dd_bpt_shadow -#define ldd_cp dd_cc - -#define link_dynamic _dynamic -#define ld_version d_version -#define ldd d_debug -#define ld_un d_un -#define ld_2 d_sdt - -#endif diff --git a/gdb/config/ns32k/nbsd.mh b/gdb/config/ns32k/nbsd.mh deleted file mode 100644 index e39c657a4de..00000000000 --- a/gdb/config/ns32k/nbsd.mh +++ /dev/null @@ -1,5 +0,0 @@ -# Host: PC532 running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o \ - solib.o solib-sunos.o -XM_FILE= xm-nbsd.h -NAT_FILE= nm-nbsd.h diff --git a/gdb/config/ns32k/nbsd.mt b/gdb/config/ns32k/nbsd.mt deleted file mode 100644 index 14d37f9a40f..00000000000 --- a/gdb/config/ns32k/nbsd.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: PC532 running NetBSD -TDEPFILES= ns32k-tdep.o -TM_FILE= tm-nbsd.h diff --git a/gdb/config/ns32k/nm-nbsd.h b/gdb/config/ns32k/nm-nbsd.h index c2c81b7203f..4e1e13b9e3e 100644 --- a/gdb/config/ns32k/nm-nbsd.h +++ b/gdb/config/ns32k/nm-nbsd.h @@ -23,7 +23,7 @@ #define NM_NBSD_H /* Get generic NetBSD native definitions. */ -#include "nm-nbsd.h" +#include "config/nm-nbsd.h" #if 0 #define FLOAT_INFO { extern ns32k_float_info(); ns32k_float_info(); } diff --git a/gdb/config/ns32k/tm-nbsd.h b/gdb/config/ns32k/tm-nbsd.h index 4766d61dca2..88b4e226942 100644 --- a/gdb/config/ns32k/tm-nbsd.h +++ b/gdb/config/ns32k/tm-nbsd.h @@ -19,62 +19,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef TM_NBSD_H +#define TM_NBSD_H + /* Override number of expected traps from sysv. */ #define START_INFERIOR_TRAPS_EXPECTED 2 /* Most definitions from umax could be used. */ -#include "ns32k/tm-umax.h" - -/* Generic NetBSD definitions. */ - -#include "tm-nbsd.h" +#include "ns32k/tm-ns32k.h" /* Saved Pc. Get it from sigcontext if within sigtramp. */ /* Offset to saved PC in sigcontext, from . */ #define SIGCONTEXT_PC_OFFSET 20 -#undef FRAME_SAVED_PC(FRAME) -#define FRAME_SAVED_PC(FRAME) \ - (((FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - ) - - -/* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ -#undef REGISTER_NAMES -#undef NUM_REGS -#undef REGISTER_BYTES -#undef REGISTER_BYTE -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "sp", "fp", "pc", "ps", \ - "fsr", \ - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \ - } - -#define NUM_REGS 29 - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -#define REGISTER_BYTES \ - ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ - + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) - -/* Index within `registers' of the first byte of the space for - register N. */ - -/* This is a bit yuck. The even numbered double precision floating - point long registers occupy the same space as the even:odd numbered - single precision floating point registers, but the extra 32381 fpu - registers are at the end. Doing it this way is compatable for both - 32081 and 32381 equiped machines. */ - -#define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\ - : ((N) - LP0_REGNUM) & 1? (N) - 1 \ - : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4) +#endif /* TM_NBSD_H */ diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h deleted file mode 100644 index 354349ee912..00000000000 --- a/gdb/config/ns32k/tm-umax.h +++ /dev/null @@ -1,319 +0,0 @@ -/* Definitions to make GDB run on an encore under umax 4.2 - Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "regcache.h" - -/* Need to get function ends by adding this to epilogue address from .bf - record, not using x_fsize field. */ -#define FUNCTION_EPILOGUE_SIZE 4 - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -extern CORE_ADDR umax_skip_prologue (CORE_ADDR); -#define SKIP_PROLOGUE(pc) (umax_skip_prologue (pc)) - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -#define SAVED_PC_AFTER_CALL(frame) \ - read_memory_integer (read_register (SP_REGNUM), 4) - -/* Address of end of stack space. */ - -#ifndef STACK_END_ADDR -#define STACK_END_ADDR (0xfffff000) -#endif - -/* Stack grows downward. */ - -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -/* Sequence of bytes for breakpoint instruction. */ - -#define BREAKPOINT {0xf2} - -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ - -#define DECR_PC_AFTER_BREAK 0 - -/* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ - -#define REGISTER_SIZE 4 - -/* Number of machine registers */ - -#define NUM_REGS 25 - -#define NUM_GENERAL_REGS 8 - -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "sp", "fp", "pc", "ps", \ - "fsr", \ - "l0", "l1", "l2", "l3", "xx", \ - } - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define R0_REGNUM 0 /* General register 0 */ -#define FP0_REGNUM 8 /* Floating point register 0 */ -#define SP_REGNUM 16 /* Contains address of top of stack */ -#define AP_REGNUM FP_REGNUM -#define FP_REGNUM 17 /* Contains address of executing stack frame */ -#define PC_REGNUM 18 /* Contains program counter */ -#define PS_REGNUM 19 /* Contains processor status */ -#define FPS_REGNUM 20 /* Floating point status register */ -#define LP0_REGNUM 21 /* Double register 0 (same as FP0) */ - -/* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ -#define REGISTER_BYTES \ - ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ - + 4 * REGISTER_RAW_SIZE(LP0_REGNUM)) - -/* Index within `registers' of the first byte of the space for - register N. */ - -#define REGISTER_BYTE(N) ((N) >= LP0_REGNUM ? \ - LP0_REGNUM * 4 + ((N) - LP0_REGNUM) * 8 : (N) * 4) - -/* Number of bytes of storage in the actual machine representation - for register N. On the 32000, all regs are 4 bytes - except for the doubled floating registers. */ - -#define REGISTER_RAW_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4) - -/* Number of bytes of storage in the program's representation - for register N. On the 32000, all regs are 4 bytes - except for the doubled floating registers. */ - -#define REGISTER_VIRTUAL_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4) - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE 8 - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ - -#define MAX_REGISTER_VIRTUAL_SIZE 8 - -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -#define REGISTER_VIRTUAL_TYPE(N) \ - (((N) < FP0_REGNUM) ? \ - builtin_type_int : \ - ((N) < FP0_REGNUM + 8) ? \ - builtin_type_float : \ - ((N) < LP0_REGNUM) ? \ - builtin_type_int : \ - builtin_type_double) - -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. - - On this machine this is a no-op, because gcc isn't used on it - yet. So this calling convention is not used. */ - -#define STORE_STRUCT_RETURN(ADDR, SP) - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - memcpy (VALBUF, REGBUF+REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), TYPE_LENGTH (TYPE)) - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ - -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), VALBUF, TYPE_LENGTH (TYPE)) - -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) - -/* Describe the pointer in each stack frame to the previous stack frame - (its caller). */ - -/* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. */ - -/* In the case of the ns32000 series, the frame's nominal address is the FP - value, and at that address is saved previous FP value as a 4-byte word. */ - -#define FRAME_CHAIN(thisframe) \ - (!inside_entry_file ((thisframe)->pc) ? \ - read_memory_integer ((thisframe)->frame, 4) :\ - 0) - -/* Define other aspects of the stack frame. */ - -#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4)) - -/* Compute base of arguments. */ - -#define FRAME_ARGS_ADDRESS(fi) \ - ((ns32k_get_enter_addr ((fi)->pc) > 1) ? \ - ((fi)->frame) : (read_register (SP_REGNUM) - 4)) - -#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) - -/* Get the address of the enter opcode for this function, if it is active. - Returns positive address > 1 if pc is between enter/exit, - 1 if pc before enter or after exit, 0 otherwise. */ - -extern CORE_ADDR ns32k_get_enter_addr (); - -/* Return number of args passed to a frame. - Can return -1, meaning no way to tell. */ - -extern int umax_frame_num_args (struct frame_info *fi); -#define FRAME_NUM_ARGS(fi) (umax_frame_num_args ((fi))) - -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 8 - -/* Put here the code to store, into a struct frame_saved_regs, - the addresses of the saved registers of frame described by FRAME_INFO. - This includes special registers such as pc and fp saved in special - ways in the stack frame. sp is even more special: - the address we return for it IS the sp for the next frame. */ - -extern int ns32k_localcount (CORE_ADDR enter_pc); - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ -{ \ - register int regmask, regnum; \ - int localcount; \ - register CORE_ADDR enter_addr; \ - register CORE_ADDR next_addr; \ - \ - memset (&(frame_saved_regs), '\0', sizeof (frame_saved_regs)); \ - enter_addr = ns32k_get_enter_addr ((frame_info)->pc); \ - if (enter_addr > 1) \ - { \ - regmask = read_memory_integer (enter_addr+1, 1) & 0xff; \ - localcount = ns32k_localcount (enter_addr); \ - next_addr = (frame_info)->frame + localcount; \ - for (regnum = 0; regnum < 8; regnum++, regmask >>= 1) \ - (frame_saved_regs).regs[regnum] = (regmask & 1) ? \ - (next_addr -= 4) : 0; \ - (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 4;\ - (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4;\ - (frame_saved_regs).regs[FP_REGNUM] = \ - (read_memory_integer ((frame_info)->frame, 4));\ - } \ - else if (enter_addr == 1) \ - { \ - CORE_ADDR sp = read_register (SP_REGNUM); \ - (frame_saved_regs).regs[PC_REGNUM] = sp; \ - (frame_saved_regs).regs[SP_REGNUM] = sp + 4; \ - } \ -} - -/* Things needed for making the inferior call functions. */ - -/* Push an empty stack frame, to record the current PC, etc. */ - -#define PUSH_DUMMY_FRAME \ -{ register CORE_ADDR sp = read_register (SP_REGNUM);\ - register int regnum; \ - sp = push_word (sp, read_register (PC_REGNUM)); \ - sp = push_word (sp, read_register (FP_REGNUM)); \ - write_register (FP_REGNUM, sp); \ - for (regnum = 0; regnum < 8; regnum++) \ - sp = push_word (sp, read_register (regnum)); \ - write_register (SP_REGNUM, sp); \ -} - -/* Discard from the stack the innermost frame, restoring all registers. */ - -#define POP_FRAME \ -{ register struct frame_info *frame = get_current_frame (); \ - register CORE_ADDR fp; \ - register int regnum; \ - struct frame_saved_regs fsr; \ - struct frame_info *fi; \ - fp = frame->frame; \ - get_frame_saved_regs (frame, &fsr); \ - for (regnum = 0; regnum < 8; regnum++) \ - if (fsr.regs[regnum]) \ - write_register (regnum, read_memory_integer (fsr.regs[regnum], 4)); \ - write_register (FP_REGNUM, read_memory_integer (fp, 4)); \ - write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \ - write_register (SP_REGNUM, fp + 8); \ - flush_cached_frames (); \ -} - -/* This sequence of words is the instructions - enter 0xff,0 82 ff 00 - jsr @0x00010203 7f ae c0 01 02 03 - adjspd 0x69696969 7f a5 01 02 03 04 - bpt f2 - Note this is 16 bytes. */ - -#define CALL_DUMMY { 0x7f00ff82, 0x0201c0ae, 0x01a57f03, 0xf2040302 } - -#define CALL_DUMMY_START_OFFSET 3 -#define CALL_DUMMY_LENGTH 16 -#define CALL_DUMMY_ADDR 5 -#define CALL_DUMMY_NARGS 11 - -/* Insert the specified number of args and function address - into a call sequence of the above form stored at DUMMYNAME. */ - -void flip_bytes (void *ptr, int count); - -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ -{ \ - int flipped; \ - flipped = fun | 0xc0000000; \ - flip_bytes (&flipped, 4); \ - *((int *) (((char *) dummyname)+CALL_DUMMY_ADDR)) = flipped; \ - flipped = - nargs * 4; \ - flip_bytes (&flipped, 4); \ - *((int *) (((char *) dummyname)+CALL_DUMMY_NARGS)) = flipped; \ -} diff --git a/gdb/config/ns32k/xm-nbsd.h b/gdb/config/ns32k/xm-nbsd.h index 23a0650d280..962664b70b9 100644 --- a/gdb/config/ns32k/xm-nbsd.h +++ b/gdb/config/ns32k/xm-nbsd.h @@ -19,4 +19,4 @@ Boston, MA 02111-1307, USA. */ /* Get generic NetBSD host definitions. */ -#include "xm-nbsd.h" +#include "config/xm-nbsd.h" diff --git a/gdb/config/pa/hpux11w.mh b/gdb/config/pa/hpux11w.mh index b784263a4fb..cd897aa866b 100644 --- a/gdb/config/pa/hpux11w.mh +++ b/gdb/config/pa/hpux11w.mh @@ -9,6 +9,6 @@ MH_CFLAGS = -D__HP_CURSES -Dvfork=fork XM_FILE= xm-hppah.h NAT_FILE= nm-hppah11.h -NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hpread.o pa64solib.o +NATDEPFILES= hppah-nat.o corelow.o core-aout.o inftarg.o fork-child.o infttrace.o hpread.o pa64solib.o solib.o HOST_IPC=-DBSD_IPC -DPOSIX_WAIT diff --git a/gdb/config/pa/nm-hppao.h b/gdb/config/pa/nm-hppao.h index 11e13e7dbca..6650a4bd19a 100644 --- a/gdb/config/pa/nm-hppao.h +++ b/gdb/config/pa/nm-hppao.h @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "nm-m3.h" +#include "config/nm-m3.h" #define U_REGS_OFFSET 0 #define KERNEL_U_ADDR 0 diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 227108f49ef..0570e6fdf84 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -310,7 +310,7 @@ extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precis a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ hppa_extract_return_value (TYPE, REGBUF, VALBUF); /* elz: decide whether the function returning a value of type type @@ -337,20 +337,19 @@ extern use_struct_convention_fn hppa_use_struct_convention; the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ (*(int *)((REGBUF) + REGISTER_BYTE (28))) /* elz: Return a large value, which is stored on the stack at addr. - This is defined only for the hppa, at this moment. - The above macro EXTRACT_STRUCT_VALUE_ADDRESS is not called anymore, - because it assumes that on exit from a called function which returns - a large structure on the stack, the address of the ret structure is - still in register 28. Unfortunately this register is usually overwritten - by the called function itself, on hppa. This is specified in the calling - convention doc. As far as I know, the only way to get the return value - is to have the caller tell us where it told the callee to put it, rather - than have the callee tell us. - */ + This is defined only for the hppa, at this moment. The above macro + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS is not called anymore, + because it assumes that on exit from a called function which + returns a large structure on the stack, the address of the ret + structure is still in register 28. Unfortunately this register is + usually overwritten by the called function itself, on hppa. This is + specified in the calling convention doc. As far as I know, the only + way to get the return value is to have the caller tell us where it + told the callee to put it, rather than have the callee tell us. */ #define VALUE_RETURNED_FROM_STACK(valtype,addr) \ hppa_value_returned_from_stack (valtype, addr) diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index 10fdeede69d..10790e6bb01 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -221,13 +221,13 @@ call_dummy #undef REG_STRUCT_HAS_ADDR -#undef EXTRACT_RETURN_VALUE +#undef DEPRECATED_EXTRACT_RETURN_VALUE /* RM: floats are returned in FR4R, doubles in FR4 * integral values are in r28, padded on the left * aggregates less that 65 bits are in r28, right padded * aggregates upto 128 bits are in r28 and r29, right padded */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ { \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT && !SOFT_FLOAT) \ memcpy ((VALBUF), \ diff --git a/gdb/config/powerpc/aix.mt b/gdb/config/powerpc/aix.mt index 706129ae2c7..d7ba624da91 100644 --- a/gdb/config/powerpc/aix.mt +++ b/gdb/config/powerpc/aix.mt @@ -1,3 +1,3 @@ # Target: PowerPC running AIX -TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppc-aix.h diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt index 01160b98704..a1d08c2d38e 100644 --- a/gdb/config/powerpc/linux.mt +++ b/gdb/config/powerpc/linux.mt @@ -1,5 +1,6 @@ # Target: Motorola PPC on Linux -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o solib-legacy.o +TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o solib.o \ + solib-svr4.o solib-legacy.o TM_FILE= tm-linux.h SIM_OBS = remote-sim.o diff --git a/gdb/config/powerpc/nbsd.mh b/gdb/config/powerpc/nbsd.mh index a6de76de6f1..26ba24d9860 100644 --- a/gdb/config/powerpc/nbsd.mh +++ b/gdb/config/powerpc/nbsd.mh @@ -1,4 +1,3 @@ # Host: PowerPC, running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o \ - solib.o solib-svr4.o solib-legacy.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o ppcnbsd-nat.o NAT_FILE= nm-nbsd.h diff --git a/gdb/config/powerpc/nbsd.mt b/gdb/config/powerpc/nbsd.mt index 40a2a993571..d492f9d763c 100644 --- a/gdb/config/powerpc/nbsd.mt +++ b/gdb/config/powerpc/nbsd.mt @@ -1,5 +1,6 @@ # Target: PowerPC, running NetBSD -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o ppcnbsd-tdep.o nbsd-tdep.o corelow.o \ + solib.o solib-svr4.o TM_FILE= tm-nbsd.h SIM_OBS = remote-sim.o diff --git a/gdb/config/powerpc/nm-linux.h b/gdb/config/powerpc/nm-linux.h index dee39b4efaf..6e3f3a0a5c2 100644 --- a/gdb/config/powerpc/nm-linux.h +++ b/gdb/config/powerpc/nm-linux.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef NM_LINUX_H -#include "nm-linux.h" +#include "config/nm-linux.h" #define NM_LINUX_H diff --git a/gdb/config/powerpc/nm-nbsd.h b/gdb/config/powerpc/nm-nbsd.h index 0ff53094e0b..5de6c9a0d21 100644 --- a/gdb/config/powerpc/nm-nbsd.h +++ b/gdb/config/powerpc/nm-nbsd.h @@ -1,5 +1,5 @@ /* Native-dependent definitions for PowerPC running NetBSD ELF, for GDB. - Copyright 2000 Free Software Foundation, Inc. + Copyright 2000, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -21,9 +21,7 @@ #ifndef NM_NBSD_H #define NM_NBSD_H -#define SVR4_SHARED_LIBS - /* Get generic NetBSD native definitions. */ -#include "nm-nbsd.h" +#include "config/nm-nbsd.h" #endif diff --git a/gdb/config/powerpc/ppc-eabi.mt b/gdb/config/powerpc/ppc-eabi.mt index 2d4a77fcdef..5ef8cd9befb 100644 --- a/gdb/config/powerpc/ppc-eabi.mt +++ b/gdb/config/powerpc/ppc-eabi.mt @@ -1,3 +1,3 @@ # Target: PowerPC running eabi -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppc-eabi.h diff --git a/gdb/config/powerpc/ppc-sim.mt b/gdb/config/powerpc/ppc-sim.mt index f2ad1f0b2c4..187bf39e8d5 100644 --- a/gdb/config/powerpc/ppc-sim.mt +++ b/gdb/config/powerpc/ppc-sim.mt @@ -1,5 +1,5 @@ # Target: PowerPC running eabi and including the simulator -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o diff --git a/gdb/config/powerpc/ppcle-eabi.mt b/gdb/config/powerpc/ppcle-eabi.mt index e7480975730..ee05f163797 100644 --- a/gdb/config/powerpc/ppcle-eabi.mt +++ b/gdb/config/powerpc/ppcle-eabi.mt @@ -1,3 +1,3 @@ # Target: PowerPC running eabi in little endian mode -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppcle-eabi.h diff --git a/gdb/config/powerpc/ppcle-sim.mt b/gdb/config/powerpc/ppcle-sim.mt index 558c0dc885e..31cb9006a30 100644 --- a/gdb/config/powerpc/ppcle-sim.mt +++ b/gdb/config/powerpc/ppcle-sim.mt @@ -1,5 +1,5 @@ # Target: PowerPC running eabi in little endian mode under the simulator -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppcle-eabi.h SIM_OBS = remote-sim.o diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h index 5fe8d76bce0..d69dfc1f5bf 100644 --- a/gdb/config/powerpc/tm-linux.h +++ b/gdb/config/powerpc/tm-linux.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "powerpc/tm-ppc-eabi.h" /* Avoid warning from redefinition in tm-sysv4.h (included from tm-linux.h) */ #undef SKIP_TRAMPOLINE_CODE -#include "tm-linux.h" +#include "config/tm-linux.h" /* We can single step on linux */ #undef SOFTWARE_SINGLE_STEP diff --git a/gdb/config/powerpc/tm-nbsd.h b/gdb/config/powerpc/tm-nbsd.h index ae3418f4fdb..2b7acb8b4b8 100644 --- a/gdb/config/powerpc/tm-nbsd.h +++ b/gdb/config/powerpc/tm-nbsd.h @@ -22,6 +22,5 @@ #define TM_NBSD_H #include "powerpc/tm-ppc-eabi.h" -#include "tm-nbsd.h" #endif /* TM_NBSD_H */ diff --git a/gdb/config/powerpc/tm-vxworks.h b/gdb/config/powerpc/tm-vxworks.h index a31846a802f..69e2ddec3b0 100644 --- a/gdb/config/powerpc/tm-vxworks.h +++ b/gdb/config/powerpc/tm-vxworks.h @@ -23,6 +23,6 @@ #define TM_VXWORKS_H #include "powerpc/tm-ppc-eabi.h" -#include "tm-vxworks.h" +#include "config/tm-vxworks.h" #endif /* ifndef TM_VXWORKS_H */ diff --git a/gdb/config/powerpc/vxworks.mt b/gdb/config/powerpc/vxworks.mt index ba6e17bcb1c..eca028f80aa 100644 --- a/gdb/config/powerpc/vxworks.mt +++ b/gdb/config/powerpc/vxworks.mt @@ -1,3 +1,3 @@ # Target: Powerpc running VxWorks -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-vxworks.h diff --git a/gdb/config/powerpc/xm-aix.h b/gdb/config/powerpc/xm-aix.h index cc986502b77..e663453f40e 100644 --- a/gdb/config/powerpc/xm-aix.h +++ b/gdb/config/powerpc/xm-aix.h @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "xm-aix4.h" +#include "config/xm-aix4.h" /* This doesn't seem to be declared in any header file I can find. */ char *termdef (int, int); diff --git a/gdb/config/rs6000/aix4.mt b/gdb/config/rs6000/aix4.mt index fb9d0033fef..388c4f237d8 100644 --- a/gdb/config/rs6000/aix4.mt +++ b/gdb/config/rs6000/aix4.mt @@ -1,3 +1,3 @@ # Target: IBM RS/6000 running AIX4 -TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-rs6000-aix4.h diff --git a/gdb/config/rs6000/nm-rs6000ly.h b/gdb/config/rs6000/nm-rs6000ly.h index 7bc1267d266..51d12f8ac70 100644 --- a/gdb/config/rs6000/nm-rs6000ly.h +++ b/gdb/config/rs6000/nm-rs6000ly.h @@ -21,6 +21,6 @@ #ifndef NM_RS6000LYNX_H #define NM_RS6000LYNX_H -#include "nm-lynx.h" +#include "config/nm-lynx.h" #endif /* NM_RS6000LYNX_H */ diff --git a/gdb/config/rs6000/rs6000.mt b/gdb/config/rs6000/rs6000.mt index 5ffcc0165a4..86b4c58b5e3 100644 --- a/gdb/config/rs6000/rs6000.mt +++ b/gdb/config/rs6000/rs6000.mt @@ -1,3 +1,3 @@ # Target: IBM RS/6000 running AIX -TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= rs6000-tdep.o xcoffread.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-rs6000.h diff --git a/gdb/config/rs6000/rs6000lynx.mt b/gdb/config/rs6000/rs6000lynx.mt index 69aeb60c221..89ed7a288f8 100644 --- a/gdb/config/rs6000/rs6000lynx.mt +++ b/gdb/config/rs6000/rs6000lynx.mt @@ -1,3 +1,3 @@ # Target: IBM RS6000 running LynxOS -TDEPFILES= coff-solib.o rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o +TDEPFILES= coff-solib.o rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o TM_FILE= tm-rs6000ly.h diff --git a/gdb/config/rs6000/tm-rs6000ly.h b/gdb/config/rs6000/tm-rs6000ly.h index ca7dc0d41ee..73ef7f06337 100644 --- a/gdb/config/rs6000/tm-rs6000ly.h +++ b/gdb/config/rs6000/tm-rs6000ly.h @@ -21,7 +21,7 @@ #ifndef TM_RS6000LYNX_H #define TM_RS6000LYNX_H -#include "tm-lynx.h" +#include "config/tm-lynx.h" /* Use generic RS6000 definitions. */ #include "rs6000/tm-rs6000.h" diff --git a/gdb/config/rs6000/xm-aix4.h b/gdb/config/rs6000/xm-aix4.h index 5f7aa778f45..4ca0abb8cf1 100644 --- a/gdb/config/rs6000/xm-aix4.h +++ b/gdb/config/rs6000/xm-aix4.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "xm-aix4.h" +#include "config/xm-aix4.h" /* AIX 4.x uses nonstandard "int *" as type of third argument to ptrace() */ diff --git a/gdb/config/sh/tm-linux.h b/gdb/config/sh/tm-linux.h index ab1d4d86f21..e8272d02e37 100644 --- a/gdb/config/sh/tm-linux.h +++ b/gdb/config/sh/tm-linux.h @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. */ /* Pull in GNU/Linux generic defs. */ -#include "tm-linux.h" +#include "config/tm-linux.h" /* Pull in sh-target defs */ #include "sh/tm-sh.h" diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index bae87b8bbe5..6ae6085d9b7 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -23,100 +23,6 @@ #define GDB_MULTI_ARCH 1 -/* Information that is dependent on the processor variant. */ - -/* ABI variants that we know about. If you add to this enum, please - update the table of names in sh-tdep.c. */ -enum sh_osabi -{ - SH_OSABI_UNKNOWN = 0, - SH_OSABI_LINUX, - SH_OSABI_NETBSD_ELF, - - SH_OSABI_INVALID /* Keep this last. */ -}; - -enum sh_abi - { - SH_ABI_UNKNOWN, - SH_ABI_32, - SH_ABI_64 - }; - -struct gdbarch_tdep - { - int PR_REGNUM; - int FPUL_REGNUM; /* sh3e, sh4 */ - int FPSCR_REGNUM; /* sh3e, sh4 */ - int SR_REGNUM; /* sh-dsp, sh3, sh3-dsp, sh3e, sh4 */ - int DSR_REGNUM; /* sh-dsp, sh3-dsp */ - int FP_LAST_REGNUM; /* sh3e, sh4 */ - int A0G_REGNUM; /* sh-dsp, sh3-dsp */ - int A0_REGNUM; /* sh-dsp, sh3-dsp */ - int A1G_REGNUM; /* sh-dsp, sh3-dsp */ - int A1_REGNUM; /* sh-dsp, sh3-dsp */ - int M0_REGNUM; /* sh-dsp, sh3-dsp */ - int M1_REGNUM; /* sh-dsp, sh3-dsp */ - int X0_REGNUM; /* sh-dsp, sh3-dsp */ - int X1_REGNUM; /* sh-dsp, sh3-dsp */ - int Y0_REGNUM; /* sh-dsp, sh3-dsp */ - int Y1_REGNUM; /* sh-dsp, sh3-dsp */ - int MOD_REGNUM; /* sh-dsp, sh3-dsp */ - int SSR_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */ - int SPC_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */ - int RS_REGNUM; /* sh-dsp, sh3-dsp */ - int RE_REGNUM; /* sh-dsp, sh3-dsp */ - int DR0_REGNUM; /* sh4 */ - int DR_LAST_REGNUM; /* sh4 */ - int FV0_REGNUM; /* sh4 */ - int FV_LAST_REGNUM; /* sh4 */ - /* FPP stands for Floating Point Pair, to avoid confusion with - GDB's FP0_REGNUM, which is the number of the first Floating - point register. Unfortunately on the sh5, the floating point - registers are called FR, and the floating point pairs are called FP. */ - int TR7_REGNUM; /* sh5-media*/ - int FPP0_REGNUM; /* sh5-media*/ - int FPP_LAST_REGNUM; /* sh5-media*/ - int R0_C_REGNUM; /* sh5-compact*/ - int R_LAST_C_REGNUM; /* sh5-compact*/ - int PC_C_REGNUM; /* sh5-compact*/ - int GBR_C_REGNUM; /* sh5-compact*/ - int MACH_C_REGNUM; /* sh5-compact*/ - int MACL_C_REGNUM; /* sh5-compact*/ - int PR_C_REGNUM; /* sh5-compact*/ - int T_C_REGNUM; /* sh5-compact*/ - int FPSCR_C_REGNUM; /* sh5-compact*/ - int FPUL_C_REGNUM; /* sh5-compact*/ - int FP0_C_REGNUM; /* sh5-compact*/ - int FP_LAST_C_REGNUM; /* sh5-compact*/ - int DR0_C_REGNUM; /* sh5-compact*/ - int DR_LAST_C_REGNUM; /* sh5-compact*/ - int FV0_C_REGNUM; /* sh5-compact*/ - int FV_LAST_C_REGNUM; /* sh5-compact*/ - int ARG0_REGNUM; - int ARGLAST_REGNUM; - int FLOAT_ARGLAST_REGNUM; - int RETURN_REGNUM; - enum sh_osabi sh_osabi; /* OS/ABI of the inferior */ - const char *osabi_name; /* Name of the above */ - enum sh_abi sh_abi; - }; - -/* Registers common to all the SH variants. */ -enum - { - R0_REGNUM = 0, - STRUCT_RETURN_REGNUM = 2, - ARG0_REGNUM = 4, /* Used in h8300-tdep.c */ - ARGLAST_REGNUM = 7, /* Used in h8300-tdep.c */ - PR_REGNUM = 17, /* used in sh3-rom.c */ - GBR_REGNUM = 18, - VBR_REGNUM = 19, - MACH_REGNUM = 20, - MACL_REGNUM = 21, - SR_REGNUM = 22 - }; - #define NUM_REALREGS 59 /* used in remote-e7000.c which is not multiarched. */ #define REGISTER_TYPE long /* used in standalone.c */ diff --git a/gdb/config/sparc/nbsd.mh b/gdb/config/sparc/nbsd.mh deleted file mode 100644 index bf645922d33..00000000000 --- a/gdb/config/sparc/nbsd.mh +++ /dev/null @@ -1,6 +0,0 @@ -# Host: Sun 4 or Sparcstation, running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \ - solib.o solib-sunos.o -XM_FILE= xm-nbsd.h -NAT_FILE= nm-nbsd.h -HOST_IPC=-DBSD_IPC diff --git a/gdb/config/sparc/nbsd.mt b/gdb/config/sparc/nbsd.mt index 5c89318bfe9..b04dd42fabb 100644 --- a/gdb/config/sparc/nbsd.mt +++ b/gdb/config/sparc/nbsd.mt @@ -1,3 +1,4 @@ -# Target: Sun 4 or Sparcstation, running NetBSD -TDEPFILES= sparc-tdep.o +# Target: SPARC running NetBSD +TDEPFILES= sparc-tdep.o sparcnbsd-tdep.o nbsd-tdep.o corelow.o solib.o \ + solib-svr4.o TM_FILE= tm-nbsd.h diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh index f2599fdd388..1042d91b9dd 100644 --- a/gdb/config/sparc/nbsdelf.mh +++ b/gdb/config/sparc/nbsdelf.mh @@ -1,6 +1,4 @@ # Host: Sun 4 or Sparcstation, running NetBSD -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \ - solib.o solib-svr4.o solib-legacy.o +NATDEPFILES= fork-child.o infptrace.o inftarg.o sparcnbsd-nat.o XM_FILE= xm-nbsd.h -NAT_FILE= nm-nbsdelf.h -HOST_IPC=-DBSD_IPC +NAT_FILE= nm-nbsd.h diff --git a/gdb/config/sparc/nm-linux.h b/gdb/config/sparc/nm-linux.h index 80ab0423cd0..a156eba0707 100644 --- a/gdb/config/sparc/nm-linux.h +++ b/gdb/config/sparc/nm-linux.h @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include "nm-linux.h" +#include "config/nm-sysv4.h" +#include "config/nm-linux.h" #include "solib.h" #define FETCH_INFERIOR_REGISTERS diff --git a/gdb/config/sparc/nm-nbsd.h b/gdb/config/sparc/nm-nbsd.h index 653be852d85..957a34ed141 100644 --- a/gdb/config/sparc/nm-nbsd.h +++ b/gdb/config/sparc/nm-nbsd.h @@ -1,5 +1,5 @@ /* Native-dependent definitions for Sparc running NetBSD, for GDB. - Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1999, 2000 + Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -32,30 +32,4 @@ #define CHILD_PREPARE_TO_STORE() read_register_bytes (0, NULL, REGISTER_BYTES) -/* Make things match up with what is expected in sparc-nat.c. */ - -#define regs trapframe -#define fp_status fpstate - -#define r_g1 tf_global[1] -#define r_ps tf_psr -#define r_pc tf_pc -#define r_npc tf_npc -#define r_y tf_y - -#define fpu fpstate -#define fpu_regs fs_regs -#define fpu_fsr fs_fsr -#define fpu_fr fs_regs -#define Fpu_fsr fs_fsr -#define FPU_FSR_TYPE int - -#define PTRACE_GETREGS PT_GETREGS -#define PTRACE_GETFPREGS PT_GETFPREGS -#define PTRACE_SETREGS PT_SETREGS -#define PTRACE_SETFPREGS PT_SETFPREGS - -#define GDB_GREGSET_T struct reg -#define GDB_FPREGSET_T struct fpreg - #endif /* NM_NBSD_H */ diff --git a/gdb/config/sparc/nm-nbsdelf.h b/gdb/config/sparc/nm-nbsdelf.h deleted file mode 100644 index e1eddddd092..00000000000 --- a/gdb/config/sparc/nm-nbsdelf.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Native-dependent definitions for Sparc running NetBSD ELF, for GDB. - Copyright 1999 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef NM_NBSDELF_H -#define NM_NBSDELF_H - -#define SVR4_SHARED_LIBS -#include "sparc/nm-nbsd.h" - -#endif diff --git a/gdb/config/sparc/nm-sparclynx.h b/gdb/config/sparc/nm-sparclynx.h index 74304be36d3..a231ba4cce1 100644 --- a/gdb/config/sparc/nm-sparclynx.h +++ b/gdb/config/sparc/nm-sparclynx.h @@ -21,6 +21,6 @@ #ifndef NM_SPARCLYNX_H #define NM_SPARCLYNX_H -#include "nm-lynx.h" +#include "config/nm-lynx.h" #endif /* NM_SPARCLYNX_H */ diff --git a/gdb/config/sparc/nm-sun4sol2.h b/gdb/config/sparc/nm-sun4sol2.h index adc8231f8e8..f8aeda07ccc 100644 --- a/gdb/config/sparc/nm-sun4sol2.h +++ b/gdb/config/sparc/nm-sun4sol2.h @@ -22,7 +22,7 @@ /* Include the generic SVR4 definitions. */ -#include +#include "config/nm-sysv4.h" /* Before storing, we need to read all the registers. */ diff --git a/gdb/config/sparc/tm-linux.h b/gdb/config/sparc/tm-linux.h index 34d901f5f9b..31eeff9e206 100644 --- a/gdb/config/sparc/tm-linux.h +++ b/gdb/config/sparc/tm-linux.h @@ -29,6 +29,6 @@ #define SIGCONTEXT_PC_OFFSET 12 -#include "tm-linux.h" +#include "config/tm-linux.h" #endif /* TM_SPARCLINUX_H */ diff --git a/gdb/config/sparc/tm-nbsd.h b/gdb/config/sparc/tm-nbsd.h index b434efe8dbd..bd9845029b5 100644 --- a/gdb/config/sparc/tm-nbsd.h +++ b/gdb/config/sparc/tm-nbsd.h @@ -1,5 +1,5 @@ /* Macro definitions for Sparc running under NetBSD. - Copyright 1994 Free Software Foundation, Inc. + Copyright 1994, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -21,8 +21,9 @@ #ifndef TM_NBSD_H #define TM_NBSD_H -#include "sparc/tm-sparc.h" +#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL -#include "tm-nbsd.h" +#include "sparc/tm-sparc.h" +#include "solib.h" #endif /* TM_NBSD_H */ diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index 8486c860831..4c07f1fc1ba 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -273,8 +273,8 @@ extern void sparc64_write_sp (CORE_ADDR); #define TARGET_READ_FP() (sparc64_read_fp ()) #define TARGET_WRITE_SP(X) (sparc64_write_sp (X)) -#undef EXTRACT_RETURN_VALUE -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#undef DEPRECATED_EXTRACT_RETURN_VALUE +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ sp64_extract_return_value(TYPE, REGBUF, VALBUF, 0) extern void sp64_extract_return_value (struct type *, char[], char *, int); diff --git a/gdb/config/sparc/tm-sp64linux.h b/gdb/config/sparc/tm-sp64linux.h index 56b56208652..c7ba03d3fbb 100644 --- a/gdb/config/sparc/tm-sp64linux.h +++ b/gdb/config/sparc/tm-sp64linux.h @@ -31,6 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define GDB_PTRACE_REGS64 -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" #endif TM_SPARC_LIN64_H diff --git a/gdb/config/sparc/tm-sp64sim.h b/gdb/config/sparc/tm-sp64sim.h index c8d115cd635..bb1263b40db 100644 --- a/gdb/config/sparc/tm-sp64sim.h +++ b/gdb/config/sparc/tm-sp64sim.h @@ -22,7 +22,7 @@ but it's a good start. */ #include "sparc/tm-sp64.h" -#include "tm-sunos.h" +#include "config/tm-sunos.h" /* Offsets into jmp_buf. Not defined by Sun, but at least documented in a comment in ! */ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 4a5358036be..07c9e44d2ad 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -275,7 +275,7 @@ extern void sparc_store_return_value (struct type *, char *); the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ sparc_extract_struct_value_address (REGBUF) extern CORE_ADDR sparc_extract_struct_value_address (char *); @@ -717,7 +717,7 @@ sparc32_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ -#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ sparc32_extract_return_value (TYPE, REGBUF, VALBUF) extern void sparc32_extract_return_value (struct type *, char[], char *); diff --git a/gdb/config/sparc/tm-sparclet.h b/gdb/config/sparc/tm-sparclet.h index cc52d5a26d5..7771b2779b8 100644 --- a/gdb/config/sparc/tm-sparclet.h +++ b/gdb/config/sparc/tm-sparclet.h @@ -108,8 +108,8 @@ enum { /* sparclet register numbers */ #define CCSR_REGNUM 72 -#undef EXTRACT_RETURN_VALUE -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#undef DEPRECATED_EXTRACT_RETURN_VALUE +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ { \ memcpy ((VALBUF), \ (char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \ diff --git a/gdb/config/sparc/tm-sparclynx.h b/gdb/config/sparc/tm-sparclynx.h index 1a28621c065..3d196539beb 100644 --- a/gdb/config/sparc/tm-sparclynx.h +++ b/gdb/config/sparc/tm-sparclynx.h @@ -21,7 +21,7 @@ #ifndef TM_SPARCLYNX_H #define TM_SPARCLYNX_H -#include "tm-lynx.h" +#include "config/tm-lynx.h" /* Use generic Sparc definitions. */ #include "sparc/tm-sparc.h" diff --git a/gdb/config/sparc/tm-sun4os4.h b/gdb/config/sparc/tm-sun4os4.h index b561b13adc7..e080904d927 100644 --- a/gdb/config/sparc/tm-sun4os4.h +++ b/gdb/config/sparc/tm-sun4os4.h @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "sparc/tm-sparc.h" -#include "tm-sunos.h" +#include "config/tm-sunos.h" /* Redefine SKIP_TRAMPOLINE_CODE to handle PIC compiled modules in main executables. */ diff --git a/gdb/config/sparc/tm-sun4sol2.h b/gdb/config/sparc/tm-sun4sol2.h index e3c59f630de..eb253b1c29f 100644 --- a/gdb/config/sparc/tm-sun4sol2.h +++ b/gdb/config/sparc/tm-sun4sol2.h @@ -22,7 +22,7 @@ #define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL #include "sparc/tm-sparc.h" -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" /* With Sol2 it is no longer necessary to enable software single-step, since the /proc interface can take care of it for us in hardware. */ diff --git a/gdb/config/sparc/tm-vxsparc.h b/gdb/config/sparc/tm-vxsparc.h index b6529f75b7f..f32f70daf73 100644 --- a/gdb/config/sparc/tm-vxsparc.h +++ b/gdb/config/sparc/tm-vxsparc.h @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "sparc/tm-spc-em.h" -#include "tm-vxworks.h" +#include "config/tm-vxworks.h" /* FIXME: These are almost certainly wrong. */ diff --git a/gdb/config/sparc/xm-sun4sol2.h b/gdb/config/sparc/xm-sun4sol2.h index b775f7cdba0..490962d4495 100644 --- a/gdb/config/sparc/xm-sun4sol2.h +++ b/gdb/config/sparc/xm-sun4sol2.h @@ -21,7 +21,7 @@ /* Pick up more stuff from the generic SVR4 host include file. */ -#include "xm-sysv4.h" +#include "config/xm-sysv4.h" /* These are not currently used in SVR4 (but should be, FIXME!). */ #undef DO_DEFERRED_STORES diff --git a/gdb/config/tm-linux.h b/gdb/config/tm-linux.h index 938987270b7..caf008a9cb1 100644 --- a/gdb/config/tm-linux.h +++ b/gdb/config/tm-linux.h @@ -30,7 +30,7 @@ /* We need this file for the SOLIB_TRAMPOLINE stuff. */ -#include "tm-sysv4.h" +#include "config/tm-sysv4.h" /* We define SVR4_SHARED_LIBS unconditionally, on the assumption that link.h is available on all linux platforms. For I386 and SH3/4, diff --git a/gdb/config/tm-nbsd.h b/gdb/config/tm-nbsd.h deleted file mode 100644 index d002d6bb2b5..00000000000 --- a/gdb/config/tm-nbsd.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Target machine sub-description for NetBSD. - This is included by other tm-*.h files to specify NetBSD-specific stuff. - Copyright 1993, 1994 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 SVR4_SHARED_LIBS - -/* Return non-zero if we are in a shared library trampoline code stub. */ - -#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) \ - (name && !strcmp(name, "_DYNAMIC")) - -#endif /* !SVR4_SHARED_LIBS */ diff --git a/gdb/config/v850/tm-v850.h b/gdb/config/v850/tm-v850.h deleted file mode 100644 index c085cb51ca3..00000000000 --- a/gdb/config/v850/tm-v850.h +++ /dev/null @@ -1,176 +0,0 @@ -/* Parameters for execution on an NEC V850 processor. - - Copyright 1996, 1997, 1998, 1999, 2000, 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 "regcache.h" -#include "symtab.h" /* For namespace_enum. */ -#include "symfile.h" /* For entry_point_address(). */ - -#define NUM_REGS 66 - -#define REGISTER_NAMES \ -{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ - \ - "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", \ - "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", \ - "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", \ - "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", \ - \ - "pc", "fp" } - -/* Initializer for an array of names of registers. - Entries beyond the first NUM_REGS are ignored. */ - -extern char **v850_register_names; -#define REGISTER_NAME(i) v850_register_names[i] - - -#define REGISTER_BYTES (NUM_REGS * 4) - -#define REGISTER_SIZE 4 -#define MAX_REGISTER_RAW_SIZE 4 - -#define R0_REGNUM 0 -#define R1_REGNUM 1 -#define SAVE1_START_REGNUM 2 -#define SAVE1_END_REGNUM 2 -#define SP_REGNUM 3 -#define ARG0_REGNUM 6 -#define ARGLAST_REGNUM 9 -#define V0_REGNUM 10 -#define V1_REGNUM 11 -#define R12_REGNUM 12 -#define SAVE2_START_REGNUM 20 -#define SAVE2_END_REGNUM 29 -#define EP_REGNUM 30 -#define SAVE3_START_REGNUM 31 -#define SAVE3_END_REGNUM 31 -#define RP_REGNUM 31 -#define SR0_REGNUM 32 -#define PS_REGNUM (SR0_REGNUM+5) -#define CTBP_REGNUM (SR0_REGNUM+20) -#define PC_REGNUM 64 -#define FP_REGNUM 65 -#define FP_RAW_REGNUM 29 - -#define TARGET_READ_FP() read_register (FP_RAW_REGNUM) - -#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int - -#define REGISTER_BYTE(REG) ((REG) * 4) -#define REGISTER_VIRTUAL_SIZE(REG) 4 -#define REGISTER_RAW_SIZE(REG) 4 - -#define MAX_REGISTER_VIRTUAL_SIZE 4 - -#define BREAKPOINT {0x85, 0x05} /* little-ended */ - -#define FUNCTION_START_OFFSET 0 - -#define DECR_PC_AFTER_BREAK 0 - -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -#define SAVED_PC_AFTER_CALL(fi) read_register (RP_REGNUM) - -struct frame_info; -struct frame_saved_regs; -struct type; -struct value; - -#define EXTRA_FRAME_INFO struct frame_saved_regs fsr; - -extern void v850_init_extra_frame_info (struct frame_info *fi); -#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) v850_init_extra_frame_info (fi) -#define INIT_FRAME_PC /* Not necessary */ - -extern void v850_frame_find_saved_regs (struct frame_info *fi, - struct frame_saved_regs *regaddr); -#define FRAME_FIND_SAVED_REGS(fi, regaddr) regaddr = fi->fsr - -extern CORE_ADDR v850_frame_chain (struct frame_info *fi); -#define FRAME_CHAIN(fi) v850_frame_chain (fi) -#define FRAME_CHAIN_VALID(FP, FI) generic_file_frame_chain_valid (FP, FI) - -extern CORE_ADDR v850_find_callers_reg (struct frame_info *fi, int regnum); -extern CORE_ADDR v850_frame_saved_pc (struct frame_info *); -#define FRAME_SAVED_PC(FI) (v850_frame_saved_pc (FI)) - -#define EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ - memcpy (VALBUF, REGBUF + REGISTER_BYTE (V0_REGNUM), TYPE_LENGTH (TYPE)) - -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \ - REGISTER_RAW_SIZE (V0_REGNUM)) - -#define STORE_RETURN_VALUE(TYPE, VALBUF) \ - write_register_bytes(REGISTER_BYTE (V0_REGNUM), VALBUF, TYPE_LENGTH (TYPE)); - -extern CORE_ADDR v850_skip_prologue (CORE_ADDR pc); -#define SKIP_PROLOGUE(pc) (v850_skip_prologue (pc)) - -#define FRAME_ARGS_SKIP 0 - -#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame) -#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame) -#define FRAME_NUM_ARGS(fi) (-1) - -extern void v850_pop_frame (struct frame_info *frame); -#define POP_FRAME v850_pop_frame (get_current_frame ()) - -#define USE_GENERIC_DUMMY_FRAMES 1 -#define CALL_DUMMY {0} -#define CALL_DUMMY_START_OFFSET (0) -#define CALL_DUMMY_BREAKPOINT_OFFSET (0) -#define CALL_DUMMY_LOCATION AT_ENTRY_POINT -#define FIX_CALL_DUMMY(DUMMY, START, FUNADDR, NARGS, ARGS, TYPE, GCCP) -#define CALL_DUMMY_ADDRESS() entry_point_address () -extern CORE_ADDR v850_push_return_address (CORE_ADDR, CORE_ADDR); -#define PUSH_RETURN_ADDRESS(PC, SP) v850_push_return_address (PC, SP) - - -#define PUSH_DUMMY_FRAME generic_push_dummy_frame () - -extern CORE_ADDR -v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - unsigned char struct_return, CORE_ADDR struct_addr); -#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \ - (v850_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)) - -#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) - - -#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP) - -extern use_struct_convention_fn v850_use_struct_convention; -#define USE_STRUCT_CONVENTION(GCC_P, TYPE) v850_use_struct_convention (GCC_P, TYPE); - -/* override the default get_saved_register function with - one that takes account of generic CALL_DUMMY frames */ -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ - generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval) - -/* Define this for Wingdb */ - -#define TARGET_V850 diff --git a/gdb/config/v850/v850.mt b/gdb/config/v850/v850.mt index 848bc8d043b..867f8e68429 100644 --- a/gdb/config/v850/v850.mt +++ b/gdb/config/v850/v850.mt @@ -1,5 +1,5 @@ # Target: NEC V850 processor TDEPFILES= v850-tdep.o -TM_FILE= tm-v850.h +# TM_FILE= tm-v850.h SIM_OBS = remote-sim.o SIM = ../sim/v850/libsim.a diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index 44058554627..194a257c44f 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -142,7 +142,7 @@ extern int z8k_saved_pc_after_call (struct frame_info *frame); as doubles in d0/d1. */ -#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ memcpy(VALBUF, REGBUF + REGISTER_BYTE(2), TYPE_LENGTH(TYPE)); /* Write into appropriate registers a function return value @@ -154,7 +154,7 @@ extern int z8k_saved_pc_after_call (struct frame_info *frame); the address in which a function should return its structure value, as a CORE_ADDR (or an expression that can be used as one). */ -#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF)) /* Describe the pointer in each stack frame to the previous stack frame (its caller). */ diff --git a/gdb/configure.host b/gdb/configure.host index 511ea76f275..4256db32134 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -38,7 +38,8 @@ alpha*-*-freebsd*) gdb_host=fbsd ;; alpha*-*-netbsd*) gdb_host=nbsd ;; arm*-*-linux*) gdb_host=linux ;; -arm*-*-netbsd*) gdb_host=nbsd ;; +arm*-*-netbsdelf*) gdb_host=nbsdelf ;; +arm*-*-netbsd*) gdb_host=nbsdaout ;; arm*-*-*) gdb_host=arm ;; hppa*-*-bsd*) gdb_host=hppabsd ;; @@ -58,8 +59,8 @@ i[3456]86-*-bsd*) gdb_host=i386bsd ;; i[3456]86-*-dgux*) gdb_host=i386dgux ;; i[3456]86-*-freebsd*) gdb_host=fbsd ;; i[3456]86-*-netbsdelf*) gdb_host=nbsdelf ;; -i[3456]86-*-netbsdaout*) gdb_host=nbsd ;; -i[3456]86-*-netbsd*) gdb_host=nbsd ;; +i[3456]86-*-netbsdaout*) gdb_host=nbsdaout ;; +i[3456]86-*-netbsd*) gdb_host=nbsdaout ;; i[3456]86-*-go32*) gdb_host=go32 ;; i[3456]86-*-msdosdjgpp*) gdb_host=go32 ;; i[3456]86-*-linux*) gdb_host=linux ;; @@ -98,7 +99,7 @@ m68*-hp-bsd*) gdb_host=hp300bsd ;; m68*-hp-hpux*) gdb_host=hp300hpux ;; m68*-*-linux*) gdb_host=linux ;; m68*-*-lynxos*) gdb_host=m68klynx ;; -m68*-*-netbsd*) gdb_host=nbsd ;; +m68*-*-netbsd*) gdb_host=nbsdaout ;; m68*-*-sysv4*) gdb_host=m68kv4 ;; m68*-motorola-*) gdb_host=delta68 ;; m68*-sun-sunos3*) gdb_host=sun3os3 ;; @@ -118,6 +119,7 @@ mips-sgi-irix5*) gdb_host=irix5 ;; mips-sgi-irix6*) gdb_host=irix6 ;; mips-sony-*) gdb_host=news-mips ;; mips*-*-linux*) gdb_host=linux ;; +mips*-*-netbsd*) gdb_host=nbsd ;; mips-*-mach3*) gdb_host=mipsm3 ;; mips-*-sysv4*) gdb_host=mipsv4 ;; mips-*-sysv*) gdb_host=riscos ;; @@ -125,7 +127,7 @@ mips-*-riscos*) gdb_host=riscos ;; none-*-*) gdb_host=none ;; -ns32k-*-netbsd*) gdb_host=nbsd ;; +ns32k-*-netbsd*) gdb_host=nbsdaout ;; powerpc-*-aix*) gdb_host=aix ;; powerpc-*-linux*) gdb_host=linux ;; @@ -142,8 +144,8 @@ sh*-*-netbsdelf*) gdb_host=nbsd ;; sparc-*-linux*) gdb_host=linux ;; sparc-*-lynxos*) gdb_host=sparclynx ;; sparc-*-netbsdelf*) gdb_host=nbsdelf ;; -sparc-*-netbsdaout*) gdb_host=nbsd ;; -sparc-*-netbsd*) gdb_host=nbsd ;; +sparc-*-netbsdaout*) gdb_host=nbsdaout ;; +sparc-*-netbsd*) gdb_host=nbsdaout ;; sparc-*-solaris2*) gdb_host=sun4sol2 ;; sparc-*-sunos4*) gdb_host=sun4os4 ;; sparc-*-sunos5*) gdb_host=sun4sol2 ;; @@ -151,6 +153,7 @@ sparc-*-*) gdb_host=sun4os4 ;; sparc64-*-freebsd*|ultrasparc-*-freebsd*|sparcv9-*-freebsd*) gdb_host=fbsd ;; sparc64-*-linux*) gdb_host=linux ;; +sparc64-*-netbsd*) gdb_host=nbsd64 ;; sparcv9-*-* | sparc64-*-*) gdb_host=sun4sol2 ;; strongarm-*-*) gdb_host=arm ;; diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 322312c5903..129fa49ee8c 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -93,7 +93,7 @@ i[3456]86-*-aix*) gdb_target=i386aix ;; i[3456]86-*-bsd*) gdb_target=i386bsd ;; i[3456]86-*-freebsd*) gdb_target=fbsd ;; i[3456]86-*-netbsdelf*) gdb_target=nbsdelf ;; -i[3456]86-*-netbsd*) gdb_target=nbsd ;; +i[3456]86-*-netbsd*) gdb_target=nbsdaout ;; i[3456]86-*-os9k) gdb_target=i386os9k ;; i[3456]86-*-go32*) gdb_target=i386aout ;; i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;; @@ -157,7 +157,7 @@ m68*-*-linux*) gdb_target=linux build_gdbserver=yes ;; m68*-*-lynxos*) gdb_target=m68klynx ;; -m68*-*-netbsd*) gdb_target=nbsd ;; +m68*-*-netbsd*) gdb_target=nbsdaout ;; m68*-*-os68k*) gdb_target=os68k ;; m68*-*-sunos3*) gdb_target=sun3os3 ;; m68*-*-sunos4*) gdb_target=sun3os4 ;; @@ -201,6 +201,7 @@ mips*-sony-*) gdb_target=bigmips ;; mips*-*-linux*) gdb_target=linux build_gdbserver=yes ;; +mips*-*-netbsd*) gdb_target=nbsd ;; mips*-*-mach3*) gdb_target=mipsm3 ;; mips*-*-sysv4*) gdb_target=mipsv4 ;; mips*-*-sysv*) gdb_target=bigmips ;; @@ -212,7 +213,7 @@ mn10300-*-*) gdb_target=mn10300 ;; none-*-*) gdb_target=none ;; -ns32k-*-netbsd*) gdb_target=nbsd ;; +ns32k-*-netbsd*) gdb_target=nbsdaout ;; powerpc-*-netbsd*) gdb_target=nbsd ;; powerpc-*-aix*) gdb_target=aix ;; @@ -276,6 +277,7 @@ sparc86x-*-*) gdb_target=sparclite ;; sparc64-*-freebsd*|ultrasparc-*-freebsd*|sparcv9-*-freebsd*) gdb_target=fbsd ;; sparc64-*-linux*) gdb_target=sp64linux ;; +sparc64-*-netbsd*) gdb_target=nbsd64 ;; sparcv9-*-* | sparc64-*-*) gdb_target=sp64 ;; xstormy16-*-*) gdb_target=xstormy16 ;; @@ -310,5 +312,6 @@ d10v) gdb_multi_arch=yes ;; m68hc11) gdb_multi_arch=yes ;; mn10300) gdb_multi_arch=yes ;; x86-64linux) gdb_multi_arch=yes ;; +v850) gdb_multi_arch=yes ;; xstormy16) gdb_multi_arch=yes ;; esac diff --git a/gdb/corefile.c b/gdb/corefile.c index 29eeac87ebe..4f6eef2ce72 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -260,7 +260,10 @@ dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) print_address (addr, info->stream); } -/* Read an integer from debugged memory, given address and number of bytes. */ +/* Argument / return result struct for use with + do_captured_read_memory_integer(). MEMADDR and LEN are filled in + by gdb_read_memory_integer(). RESULT is the contents that were + successfully read from MEMADDR of length LEN. */ struct captured_read_memory_integer_arguments { @@ -269,6 +272,13 @@ struct captured_read_memory_integer_arguments LONGEST result; }; +/* Helper function for gdb_read_memory_integer(). DATA must be a + pointer to a captured_read_memory_integer_arguments struct. + Return 1 if successful. Note that the catch_errors() interface + will return 0 if an error occurred while reading memory. This + choice of return code is so that we can distinguish between + success and failure. */ + static int do_captured_read_memory_integer (void *data) { @@ -278,9 +288,13 @@ do_captured_read_memory_integer (void *data) args->result = read_memory_integer (memaddr, len); - return 0; + return 1; } +/* Read memory at MEMADDR of length LEN and put the contents in + RETURN_VALUE. Return 0 if MEMADDR couldn't be read and non-zero + if successful. */ + int safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value) { @@ -291,7 +305,7 @@ safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value) status = catch_errors (do_captured_read_memory_integer, &args, "", RETURN_MASK_ALL); - if (!status) + if (status) *return_value = args.result; return status; diff --git a/gdb/corelow.c b/gdb/corelow.c index 657cdc8ffc9..785b8e14323 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -321,7 +321,12 @@ core_open (char *filename, int from_tty) error ("\"%s\": Can't find sections: %s", bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ())); - set_gdbarch_from_file (core_bfd); + /* If we have no exec file, try to set the architecture from the + core file. We don't do this unconditionally since an exec file + typically contains more information that helps us determine the + architecture than a core file. */ + if (!exec_bfd) + set_gdbarch_from_file (core_bfd); ontop = !push_target (&core_ops); discard_cleanups (old_chain); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index e85ac129f33..b28d3bb83f7 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4163,7 +4163,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_push_arguments (gdbarch, cris_abi_original_push_arguments); set_gdbarch_store_return_value (gdbarch, cris_abi_original_store_return_value); - set_gdbarch_extract_return_value + set_gdbarch_deprecated_extract_return_value (gdbarch, cris_abi_original_extract_return_value); set_gdbarch_reg_struct_has_addr (gdbarch, cris_abi_original_reg_struct_has_addr); @@ -4173,8 +4173,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_double_bit (gdbarch, 64); set_gdbarch_push_arguments (gdbarch, cris_abi_v2_push_arguments); set_gdbarch_store_return_value (gdbarch, cris_abi_v2_store_return_value); - set_gdbarch_extract_return_value (gdbarch, - cris_abi_v2_extract_return_value); + set_gdbarch_deprecated_extract_return_value + (gdbarch, cris_abi_v2_extract_return_value); set_gdbarch_reg_struct_has_addr (gdbarch, cris_abi_v2_reg_struct_has_addr); } @@ -4297,8 +4297,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pop_frame (gdbarch, cris_pop_frame); set_gdbarch_store_struct_return (gdbarch, cris_store_struct_return); - set_gdbarch_extract_struct_value_address (gdbarch, - cris_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address + (gdbarch, cris_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, cris_use_struct_convention); set_gdbarch_frame_init_saved_regs (gdbarch, cris_frame_init_saved_regs); diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 58600fb92ea..4fe1c6228be 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -40,7 +40,8 @@ #include "regcache.h" #include "floatformat.h" -#include "sim-d10v.h" +#include "gdb/sim-d10v.h" +#include "sim-regno.h" struct frame_extra_info { @@ -60,33 +61,44 @@ struct gdbarch_tdep /* These are the addresses the D10V-EVA board maps data and instruction memory to. */ -#define DMEM_START 0x2000000 -#define IMEM_START 0x1000000 -#define STACK_START 0x200bffe +enum memspace { + DMEM_START = 0x2000000, + IMEM_START = 0x1000000, + STACK_START = 0x200bffe +}; /* d10v register names. */ enum { R0_REGNUM = 0, + R3_REGNUM = 3, + _FP_REGNUM = 11, LR_REGNUM = 13, + _SP_REGNUM = 15, PSW_REGNUM = 16, + _PC_REGNUM = 18, NR_IMAP_REGS = 2, - NR_A_REGS = 2 + NR_A_REGS = 2, + TS2_NUM_REGS = 37, + TS3_NUM_REGS = 42, + /* d10v calling convention. */ + ARG1_REGNUM = R0_REGNUM, + ARGN_REGNUM = R3_REGNUM, + RET1_REGNUM = R0_REGNUM, }; + #define NR_DMAP_REGS (gdbarch_tdep (current_gdbarch)->nr_dmap_regs) #define A0_REGNUM (gdbarch_tdep (current_gdbarch)->a0_regnum) -/* d10v calling convention. */ - -#define ARG1_REGNUM R0_REGNUM -#define ARGN_REGNUM 3 -#define RET1_REGNUM R0_REGNUM - /* Local functions */ extern void _initialize_d10v_tdep (void); +static CORE_ADDR d10v_read_sp (void); + +static CORE_ADDR d10v_read_fp (void); + static void d10v_eva_prepare_to_trace (void); static void d10v_eva_get_trace_data (void); @@ -101,9 +113,14 @@ static void do_d10v_pop_frame (struct frame_info *fi); static int d10v_frame_chain_valid (CORE_ADDR chain, struct frame_info *frame) { - return ((chain) != 0 && (frame) != 0 - && (frame)->pc > IMEM_START - && !inside_entry_file (FRAME_SAVED_PC (frame))); + if (chain != 0 && frame != NULL) + { + if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + return 1; /* Path back from a call dummy must be valid. */ + return ((frame)->pc > IMEM_START + && !inside_main_func (frame->pc)); + } + else return 0; } static CORE_ADDR @@ -284,6 +301,8 @@ d10v_imap_register (int reg_nr) static int d10v_ts2_register_sim_regno (int nr) { + if (legacy_register_sim_regno (nr) < 0) + return legacy_register_sim_regno (nr); if (nr >= TS2_IMAP0_REGNUM && nr < TS2_IMAP0_REGNUM + NR_IMAP_REGS) return nr - TS2_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM; @@ -298,6 +317,8 @@ d10v_ts2_register_sim_regno (int nr) static int d10v_ts3_register_sim_regno (int nr) { + if (legacy_register_sim_regno (nr) < 0) + return legacy_register_sim_regno (nr); if (nr >= TS3_IMAP0_REGNUM && nr < TS3_IMAP0_REGNUM + NR_IMAP_REGS) return nr - TS3_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM; @@ -349,6 +370,8 @@ d10v_register_virtual_type (int reg_nr) { if (reg_nr == PC_REGNUM) return builtin_type_void_func_ptr; + if (reg_nr == _SP_REGNUM || reg_nr == _FP_REGNUM) + return builtin_type_void_data_ptr; else if (reg_nr >= A0_REGNUM && reg_nr < (A0_REGNUM + NR_A_REGS)) return builtin_type_int64; @@ -427,20 +450,16 @@ d10v_pointer_to_address (struct type *type, void *buf) return d10v_make_daddr (addr); } +/* Don't do anything if we have an integer, this way users can type 'x + ' w/o having gdb outsmart them. The internal gdb conversions + to the correct space are taken care of in the pointer_to_address + function. If we don't do this, 'x $fp' wouldn't work. */ static CORE_ADDR d10v_integer_to_address (struct type *type, void *buf) { LONGEST val; val = unpack_long (type, buf); - if (TYPE_CODE (type) == TYPE_CODE_INT - && TYPE_LENGTH (type) <= TYPE_LENGTH (builtin_type_void_data_ptr)) - /* Convert small integers that would would be directly copied into - a pointer variable into an address pointing into data space. */ - return d10v_make_daddr (val & 0xffff); - else - /* The value is too large to fit in a pointer. Assume this was - intentional and that the user in fact specified a raw address. */ - return val; + return val; } /* Store the address of the place in which to copy the structure the @@ -463,9 +482,20 @@ d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) static void d10v_store_return_value (struct type *type, char *valbuf) { - write_register_bytes (REGISTER_BYTE (RET1_REGNUM), - valbuf, - TYPE_LENGTH (type)); + char tmp = 0; + /* Only char return values need to be shifted right within R0. */ + if (TYPE_LENGTH (type) == 1 + && TYPE_CODE (type) == TYPE_CODE_INT) + { + write_register_bytes (REGISTER_BYTE (RET1_REGNUM), + &tmp, 1); /* zero the high byte */ + write_register_bytes (REGISTER_BYTE (RET1_REGNUM) + 1, + valbuf, 1); /* copy the low byte */ + } + else + write_register_bytes (REGISTER_BYTE (RET1_REGNUM), + valbuf, + TYPE_LENGTH (type)); } /* Extract from an array REGBUF containing the (raw) register state @@ -483,7 +513,12 @@ d10v_extract_struct_value_address (char *regbuf) static CORE_ADDR d10v_frame_saved_pc (struct frame_info *frame) { - return ((frame)->extra_info->return_pc); + if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + return d10v_make_iaddr (generic_read_register_dummy (frame->pc, + frame->frame, + PC_REGNUM)); + else + return ((frame)->extra_info->return_pc); } /* Immediately after a function call, return the saved pc. We can't @@ -650,11 +685,23 @@ d10v_skip_prologue (CORE_ADDR pc) static CORE_ADDR d10v_frame_chain (struct frame_info *fi) { + CORE_ADDR addr; + + /* A generic call dummy's frame is the same as caller's. */ + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) + return fi->frame; + d10v_frame_init_saved_regs (fi); + if (fi->extra_info->return_pc == IMEM_START || inside_entry_file (fi->extra_info->return_pc)) - return (CORE_ADDR) 0; + { + /* This is meant to halt the backtrace at "_start". + Make sure we don't halt it at a generic dummy frame. */ + if (!PC_IN_CALL_DUMMY (fi->extra_info->return_pc, 0, 0)) + return (CORE_ADDR) 0; + } if (!fi->saved_regs[FP_REGNUM]) { @@ -665,12 +712,12 @@ d10v_frame_chain (struct frame_info *fi) return fi->saved_regs[SP_REGNUM]; } - if (!read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM], - REGISTER_RAW_SIZE (FP_REGNUM))) + addr = read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM], + REGISTER_RAW_SIZE (FP_REGNUM)); + if (addr == 0) return (CORE_ADDR) 0; - return d10v_make_daddr (read_memory_unsigned_integer (fi->saved_regs[FP_REGNUM], - REGISTER_RAW_SIZE (FP_REGNUM))); + return d10v_make_daddr (addr); } static int next_addr, uses_frame; @@ -804,7 +851,8 @@ d10v_frame_init_saved_regs (struct frame_info *fi) op1 = (op & 0x3FFF8000) >> 15; op2 = op & 0x7FFF; } - if (!prologue_find_regs (op1, fi, pc) || !prologue_find_regs (op2, fi, pc)) + if (!prologue_find_regs (op1, fi, pc) + || !prologue_find_regs (op2, fi, pc)) break; } pc += 4; @@ -813,7 +861,7 @@ d10v_frame_init_saved_regs (struct frame_info *fi) fi->extra_info->size = -next_addr; if (!(fp & 0xffff)) - fp = d10v_make_daddr (read_register (SP_REGNUM)); + fp = d10v_read_sp (); for (i = 0; i < NUM_REGS - 1; i++) if (fi->saved_regs[i]) @@ -823,7 +871,9 @@ d10v_frame_init_saved_regs (struct frame_info *fi) if (fi->saved_regs[LR_REGNUM]) { - CORE_ADDR return_pc = read_memory_unsigned_integer (fi->saved_regs[LR_REGNUM], REGISTER_RAW_SIZE (LR_REGNUM)); + CORE_ADDR return_pc + = read_memory_unsigned_integer (fi->saved_regs[LR_REGNUM], + REGISTER_RAW_SIZE (LR_REGNUM)); fi->extra_info->return_pc = d10v_make_iaddr (return_pc); } else @@ -831,13 +881,14 @@ d10v_frame_init_saved_regs (struct frame_info *fi) fi->extra_info->return_pc = d10v_make_iaddr (read_register (LR_REGNUM)); } - /* th SP is not normally (ever?) saved, but check anyway */ + /* The SP is not normally (ever?) saved, but check anyway */ if (!fi->saved_regs[SP_REGNUM]) { /* if the FP was saved, that means the current FP is valid, */ /* otherwise, it isn't being used, so we use the SP instead */ if (uses_frame) - fi->saved_regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->extra_info->size; + fi->saved_regs[SP_REGNUM] + = d10v_read_fp () + fi->extra_info->size; else { fi->saved_regs[SP_REGNUM] = fp + fi->extra_info->size; @@ -858,6 +909,12 @@ d10v_init_extra_frame_info (int fromleaf, struct frame_info *fi) fi->extra_info->size = 0; fi->extra_info->return_pc = 0; + /* If fi->pc is zero, but this is not the outermost frame, + then let's snatch the return_pc from the callee, so that + PC_IN_CALL_DUMMY will work. */ + if (fi->pc == 0 && fi->level != 0 && fi->next != NULL) + fi->pc = d10v_frame_saved_pc (fi->next); + /* The call dummy doesn't save any registers on the stack, so we can return now. */ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) @@ -1029,6 +1086,15 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, int i; int regnum = ARG1_REGNUM; struct stack_item *si = NULL; + long val; + + /* If struct_return is true, then the struct return address will + consume one argument-passing register. No need to actually + write the value to the register -- that's done by + d10v_store_struct_return(). */ + + if (struct_return) + regnum++; /* Fill in registers and arg lists */ for (i = 0; i < nargs; i++) @@ -1037,39 +1103,38 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, struct type *type = check_typedef (VALUE_TYPE (arg)); char *contents = VALUE_CONTENTS (arg); int len = TYPE_LENGTH (type); + int aligned_regnum = (regnum + 1) & ~1; + /* printf ("push: type=%d len=%d\n", TYPE_CODE (type), len); */ + if (len <= 2 && regnum <= ARGN_REGNUM) + /* fits in a single register, do not align */ + { + val = extract_unsigned_integer (contents, len); + write_register (regnum++, val); + } + else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2) + /* value fits in remaining registers, store keeping left + aligned */ { - int aligned_regnum = (regnum + 1) & ~1; - if (len <= 2 && regnum <= ARGN_REGNUM) - /* fits in a single register, do not align */ + int b; + regnum = aligned_regnum; + for (b = 0; b < (len & ~1); b += 2) { - long val = extract_unsigned_integer (contents, len); + val = extract_unsigned_integer (&contents[b], 2); write_register (regnum++, val); } - else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2) - /* value fits in remaining registers, store keeping left - aligned */ + if (b < len) { - int b; - regnum = aligned_regnum; - for (b = 0; b < (len & ~1); b += 2) - { - long val = extract_unsigned_integer (&contents[b], 2); - write_register (regnum++, val); - } - if (b < len) - { - long val = extract_unsigned_integer (&contents[b], 1); - write_register (regnum++, (val << 8)); - } - } - else - { - /* arg will go onto stack */ - regnum = ARGN_REGNUM + 1; - si = push_stack_item (si, contents, len); + val = extract_unsigned_integer (&contents[b], 1); + write_register (regnum++, (val << 8)); } } + else + { + /* arg will go onto stack */ + regnum = ARGN_REGNUM + 1; + si = push_stack_item (si, contents, len); + } } while (si) @@ -1091,25 +1156,31 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES], char *valbuf) { int len; - /* printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */ +#if 0 + printf("RET: TYPE=%d len=%d r%d=0x%x\n", TYPE_CODE (type), + TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, + (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), + REGISTER_RAW_SIZE (RET1_REGNUM))); +#endif + len = TYPE_LENGTH (type); + if (len == 1) { - len = TYPE_LENGTH (type); - if (len == 1) - { - unsigned short c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM)); - store_unsigned_integer (valbuf, 1, c); - } - else if ((len & 1) == 0) - memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len); - else - { - /* For return values of odd size, the first byte is in the - least significant part of the first register. The - remaining bytes in remaining registers. Interestingly, - when such values are passed in, the last byte is in the - most significant byte of that same register - wierd. */ - memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len); - } + unsigned short c; + + c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), + REGISTER_RAW_SIZE (RET1_REGNUM)); + store_unsigned_integer (valbuf, 1, c); + } + else if ((len & 1) == 0) + memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len); + else + { + /* For return values of odd size, the first byte is in the + least significant part of the first register. The + remaining bytes in remaining registers. Interestingly, + when such values are passed in, the last byte is in the + most significant byte of that same register - wierd. */ + memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len); } } @@ -1536,14 +1607,14 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, d10v_extract_return_value); set_gdbarch_push_arguments (gdbarch, d10v_push_arguments); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); set_gdbarch_push_return_address (gdbarch, d10v_push_return_address); set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return); set_gdbarch_store_return_value (gdbarch, d10v_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention); set_gdbarch_frame_init_saved_regs (gdbarch, d10v_frame_init_saved_regs); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index bb46be3bb21..4d1fbb581f7 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,50 @@ +2002-06-11 Jim Blandy + + * gdb.texinfo (Symbols): Update documentation for `info source' + command. + + * gdb.texinfo (Macros): Call the command `info macro', not + `show macro'. + +2002-06-09 Andrew Cagney + + * gdbint.texinfo (Coding): Add section ``Per-architecture module + data''. + +2002-06-09 Mark Kettenis + + * gdbint.texinfo (Target Architecture Definition): Document + GDB_OSABI_GO32 and GDB_OSABI_NETWARE. + +2002-06-08 Andrew Cagney + + * gdbint.texinfo (Releasing GDB): Fix typos in @itemize @bullet + lists. + +2002-06-08 Andrew Cagney + + * gdbint.texinfo (Releasing GDB): Revise the section ``Cut the + Branch''. + +2002-06-01 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Add section + ``Converting an existing Target Architecture to Multi-arch''. + +2002-05-30 Andrew Cagney + + * gdbint.texinfo (Releasing GDB): Rename ``Obsoleting any code'' + to ``Obsoleting code''. Revise. + +2002-05-17 Jim Blandy + + * gdb.texinfo (C Preprocessor Macros): New chapter. + Include it in the main menu. + (Contributors): Credit Jim Blandy with macro support. + (Compilation): Explain how to get macro information into the + executable. + (Expressions): Note that preprocessor macros are expanded. + 2002-05-14 Daniel Jacobowitz * gdb.texinfo (Debug Session): Document new `udp:' and `tcp:' diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 1080b8b44f8..aa39d767530 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -128,6 +128,7 @@ Copyright (C) 1988-2002 Free Software Foundation, Inc. * Stack:: Examining the stack * Source:: Examining source files * Data:: Examining data +* Macros:: Preprocessor Macros * Tracepoints:: Debugging remote targets non-intrusively * Overlays:: Debugging programs that use overlays @@ -462,6 +463,8 @@ Romig-Koch, Rob Savoye, Jamie Smith, Mike Stump, Ian Taylor, Angela Thomas, Michael Tiemann, Tom Tromey, Ron Unrau, Jim Wilson, and David Zuhn have made contributions both large and small. +Jim Blandy added support for preprocessor macros, while working for Red +Hat. @node Sample Session @chapter A Sample @value{GDBN} Session @@ -1609,6 +1612,16 @@ and addresses in the executable code. To request debugging information, specify the @samp{-g} option when you run the compiler. +Most compilers do not include information about preprocessor macros in +the debugging information if you specify the @option{-g} flag alone, +because this information is rather large. Version 3.1 of @value{NGCC}, +the @sc{gnu} C compiler, provides macro information if you specify the +options @option{-gdwarf-2} and @option{-g3}; the former option requests +debugging information in the Dwarf 2 format, and the latter requests +``extra information''. In the future, we hope to find more compact ways +to represent macro information, so that it can be included with +@option{-g} alone. + Many C compilers are unable to handle the @samp{-g} and @samp{-O} options together. Using those compilers, you cannot generate optimized executables containing debugging information. @@ -4414,9 +4427,10 @@ Table}. @code{print} and many other @value{GDBN} commands accept an expression and compute its value. Any kind of constant, variable or operator defined by the programming language you are using is valid in an expression in -@value{GDBN}. This includes conditional expressions, function calls, casts -and string constants. It unfortunately does not include symbols defined -by preprocessor @code{#define} commands. +@value{GDBN}. This includes conditional expressions, function calls, +casts, and string constants. It also includes preprocessor macros, if +you compiled your program to include this information; see +@ref{Compilation}. @value{GDBN} supports array constants in expressions input by the user. The syntax is @{@var{element}, @var{element}@dots{}@}. For example, @@ -5774,6 +5788,230 @@ the @var{bias} argument is applied. @end table +@node Macros +@chapter C Preprocessor Macros + +Some languages, such as C and C++, provide a way to define and invoke +``preprocessor macros'' which expand into strings of tokens. +@value{GDBN} can evaluate expressions containing macro invocations, show +the result of macro expansion, and show a macro's definition, including +where it was defined. + +You may need to compile your program specially to provide @value{GDBN} +with information about preprocessor macros. Most compilers do not +include macros in their debugging information, even when you compile +with the @option{-g} flag. @xref{Compilation}. + +A program may define a macro at one point, remove that definition later, +and then provide a different definition after that. Thus, at different +points in the program, a macro may have different definitions, or have +no definition at all. If there is a current stack frame, @value{GDBN} +uses the macros in scope at that frame's source code line. Otherwise, +@value{GDBN} uses the macros in scope at the current listing location; +see @ref{List}. + +At the moment, @value{GDBN} does not support the @code{##} +token-splicing operator, the @code{#} stringification operator, or +variable-arity macros. + +Whenever @value{GDBN} evaluates an expression, it always expands any +macro invocations present in the expression. @value{GDBN} also provides +the following commands for working with macros explicitly. + +@table @code + +@kindex macro expand +@cindex macro expansion, showing the results of preprocessor +@cindex preprocessor macro expansion, showing the results of +@cindex expanding preprocessor macros +@item macro expand @var{expression} +@itemx macro exp @var{expression} +Show the results of expanding all preprocessor macro invocations in +@var{expression}. Since @value{GDBN} simply expands macros, but does +not parse the result, @var{expression} need not be a valid expression; +it can be any string of tokens. + +@kindex macro expand-once +@item macro expand-once @var{expression} +@itemx macro exp1 @var{expression} +@i{(This command is not yet implemented.)} Show the results of +expanding those preprocessor macro invocations that appear explicitly in +@var{expression}. Macro invocations appearing in that expansion are +left unchanged. This command allows you to see the effect of a +particular macro more clearly, without being confused by further +expansions. Since @value{GDBN} simply expands macros, but does not +parse the result, @var{expression} need not be a valid expression; it +can be any string of tokens. + +@kindex info macro +@cindex macro definition, showing +@cindex definition, showing a macro's +@item info macro @var{macro} +Show the definition of the macro named @var{macro}, and describe the +source location where that definition was established. + +@kindex macro define +@cindex user-defined macros +@cindex defining macros interactively +@cindex macros, user-defined +@item macro define @var{macro} @var{replacement-list} +@itemx macro define @var{macro}(@var{arglist}) @var{replacement-list} +@i{(This command is not yet implemented.)} Introduce a definition for a +preprocessor macro named @var{macro}, invocations of which are replaced +by the tokens given in @var{replacement-list}. The first form of this +command defines an ``object-like'' macro, which takes no arguments; the +second form defines a ``function-like'' macro, which takes the arguments +given in @var{arglist}. + +A definition introduced by this command is in scope in every expression +evaluated in @value{GDBN}, until it is removed with the @command{macro +undef} command, described below. The definition overrides all +definitions for @var{macro} present in the program being debugged, as +well as any previous user-supplied definition. + +@kindex macro undef +@item macro undef @var{macro} +@i{(This command is not yet implemented.)} Remove any user-supplied +definition for the macro named @var{macro}. This command only affects +definitions provided with the @command{macro define} command, described +above; it cannot remove definitions present in the program being +debugged. + +@end table + +@cindex macros, example of debugging with +Here is a transcript showing the above commands in action. First, we +show our source files: + +@smallexample +$ cat sample.c +#include +#include "sample.h" + +#define M 42 +#define ADD(x) (M + x) + +main () +@{ +#define N 28 + printf ("Hello, world!\n"); +#undef N + printf ("We're so creative.\n"); +#define N 1729 + printf ("Goodbye, world!\n"); +@} +$ cat sample.h +#define Q < +$ +@end smallexample + +Now, we compile the program using the @sc{gnu} C compiler, @value{NGCC}. +We pass the @option{-gdwarf-2} and @option{-g3} flags to ensure the +compiler includes information about preprocessor macros in the debugging +information. + +@smallexample +$ gcc -gdwarf-2 -g3 sample.c -o sample +$ +@end smallexample + +Now, we start @value{GDBN} on our sample program: + +@smallexample +$ gdb -nw sample +GNU gdb 2002-05-06-cvs +Copyright 2002 Free Software Foundation, Inc. +GDB is free software, @dots{} +(gdb) +@end smallexample + +We can expand macros and examine their definitions, even when the +program is not running. @value{GDBN} uses the current listing position +to decide which macro definitions are in scope: + +@smallexample +(gdb) list main +3 +4 #define M 42 +5 #define ADD(x) (M + x) +6 +7 main () +8 @{ +9 #define N 28 +10 printf ("Hello, world!\n"); +11 #undef N +12 printf ("We're so creative.\n"); +(gdb) info macro ADD +Defined at /home/jimb/gdb/macros/play/sample.c:5 +#define ADD(x) (M + x) +(gdb) info macro Q +Defined at /home/jimb/gdb/macros/play/sample.h:1 + included at /home/jimb/gdb/macros/play/sample.c:2 +#define Q < +(gdb) macro expand ADD(1) +expands to: (42 + 1) +(gdb) macro expand-once ADD(1) +expands to: once (M + 1) +(gdb) +@end smallexample + +In the example above, note that @command{macro expand-once} expands only +the macro invocation explicit in the original text --- the invocation of +@code{ADD} --- but does not expand the invocation of the macro @code{M}, +which was introduced by @code{ADD}. + +Once the program is running, GDB uses the macro definitions in force at +the source line of the current stack frame: + +@smallexample +(gdb) break main +Breakpoint 1 at 0x8048370: file sample.c, line 10. +(gdb) run +Starting program: /home/jimb/gdb/macros/play/sample + +Breakpoint 1, main () at sample.c:10 +10 printf ("Hello, world!\n"); +(gdb) +@end smallexample + +At line 10, the definition of the macro @code{N} at line 9 is in force: + +@smallexample +(gdb) info macro N +Defined at /home/jimb/gdb/macros/play/sample.c:9 +#define N 28 +(gdb) macro expand N Q M +expands to: 28 < 42 +(gdb) print N Q M +$1 = 1 +(gdb) +@end smallexample + +As we step over directives that remove @code{N}'s definition, and then +give it a new definition, @value{GDBN} finds the definition (or lack +thereof) in force at each point: + +@smallexample +(gdb) next +Hello, world! +12 printf ("We're so creative.\n"); +(gdb) info macro N +The symbol `N' has no definition as a C/C++ preprocessor macro +at /home/jimb/gdb/macros/play/sample.c:12 +(gdb) next +We're so creative. +14 printf ("Goodbye, world!\n"); +(gdb) info macro N +Defined at /home/jimb/gdb/macros/play/sample.c:13 +#define N 1729 +(gdb) macro expand N Q M +expands to: 1729 < 42 +(gdb) print N Q M +$2 = 0 +(gdb) +@end smallexample + + @node Tracepoints @chapter Tracepoints @c This chapter is based on the documentation written by Michael @@ -8782,9 +9020,25 @@ collect}. @kindex info source @item info source -Show the name of the current source file---that is, the source file for -the function containing the current point of execution---and the language -it was written in. +Show information about the current source file---that is, the source file for +the function containing the current point of execution: +@itemize @bullet +@item +the name of the source file, and the directory containing it, +@item +the directory it was compiled in, +@item +its length, in lines, +@item +which programming language it is written in, +@item +whether the executable includes debugging information for that file, and +if so, what format the information is in (e.g., STABS, Dwarf 2, etc.), and +@item +whether the debugging information includes information about +preprocessor macros. +@end itemize + @kindex info sources @item info sources diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 55442d44d4a..bb787a2b3f6 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -2312,6 +2312,135 @@ The target architecture object is implemented as the C structure @code{struct gdbarch *}. The structure, and its methods, are generated using the Bourne shell script @file{gdbarch.sh}. +@section Operating System ABI Variant Handling +@cindex OS ABI variants + +@value{GDBN} provides a mechanism for handling variations in OS +ABIs. An OS ABI variant may have influence over any number of +variables in the target architecture definition. There are two major +components in the OS ABI mechanism: sniffers and handlers. + +A @dfn{sniffer} examines a file matching a BFD architecture/flavour pair +(the architecture may be wildcarded) in an attempt to determine the +OS ABI of that file. Sniffers with a wildcarded architecture are considered +to be @dfn{generic}, while sniffers for a specific architecture are +considered to be @dfn{specific}. A match from a specific sniffer +overrides a match from a generic sniffer. Multiple sniffers for an +architecture/flavour may exist, in order to differentiate between two +different operating systems which use the same basic file format. The +OS ABI framework provides a generic sniffer for ELF-format files which +examines the @code{EI_OSABI} field of the ELF header, as well as note +sections known to be used by several operating systems. + +@cindex fine-tuning @code{gdbarch} structure +A @dfn{handler} is used to fine-tune the @code{gdbarch} structure for the +selected OS ABI. There may be only one handler for a given OS ABI +for each BFD architecture. + +The following OS ABI variants are defined in @file{osabi.h}: + +@table @code + +@findex GDB_OSABI_UNKNOWN +@item GDB_OSABI_UNKNOWN +The ABI of the inferior is unknown. The default @code{gdbarch} +settings for the architecture will be used. + +@findex GDB_OSABI_SVR4 +@item GDB_OSABI_SVR4 +UNIX System V Release 4 + +@findex GDB_OSABI_HURD +@item GDB_OSABI_HURD +GNU using the Hurd kernel + +@findex GDB_OSABI_SOLARIS +@item GDB_OSABI_SOLARIS +Sun Solaris + +@findex GDB_OSABI_OSF1 +@item GDB_OSABI_OSF1 +OSF/1, including Digital UNIX and Compaq Tru64 UNIX + +@findex GDB_OSABI_LINUX +@item GDB_OSABI_LINUX +GNU using the Linux kernel + +@findex GDB_OSABI_FREEBSD_AOUT +@item GDB_OSABI_FREEBSD_AOUT +FreeBSD using the a.out executable format + +@findex GDB_OSABI_FREEBSD_ELF +@item GDB_OSABI_FREEBSD_ELF +FreeBSD using the ELF executable format + +@findex GDB_OSABI_NETBSD_AOUT +@item GDB_OSABI_NETBSD_AOUT +NetBSD using the a.out executable format + +@findex GDB_OSABI_NETBSD_ELF +@item GDB_OSABI_NETBSD_ELF +NetBSD using the ELF executable format + +@findex GDB_OSABI_WINCE +@item GDB_OSABI_WINCE +Windows CE + +@findex GDB_OSABI_GO32 +@item GDB_OSABI_GO32 +DJGPP + +@findex GDB_OSABI_NETWARE +@item GDB_OSABI_NETWARE +Novell NetWare + +@findex GDB_OSABI_ARM_EABI_V1 +@item GDB_OSABI_ARM_EABI_V1 +ARM Embedded ABI version 1 + +@findex GDB_OSABI_ARM_EABI_V2 +@item GDB_OSABI_ARM_EABI_V2 +ARM Embedded ABI version 2 + +@findex GDB_OSABI_ARM_APCS +@item GDB_OSABI_ARM_APCS +Generic ARM Procedure Call Standard + +@end table + +Here are the functions that make up the OS ABI framework: + +@deftypefun const char *gdbarch_osabi_name (enum gdb_osabi @var{osabi}) +Return the name of the OS ABI corresponding to @var{osabi}. +@end deftypefun + +@deftypefun void gdbarch_register_osabi (enum bfd_architecture @var{arch}, enum gdb_osabi @var{osabi}, void (*@var{init_osabi})(struct gdbarch_info @var{info}, struct gdbarch *@var{gdbarch})) +Register the OS ABI handler specified by @var{init_osabi} for the +architecture/OS ABI pair specified by @var{arch} and @var{osabi}. +@end deftypefun + +@deftypefun void gdbarch_register_osabi_sniffer (enum bfd_architecture @var{arch}, enum bfd_flavour @var{flavour}, enum gdb_osabi (*@var{sniffer})(bfd *@var{abfd})) +Register the OS ABI file sniffer specified by @var{sniffer} for the +BFD architecture/flavour pair specified by @var{arch} and @var{flavour}. +If @var{arch} is @code{bfd_arch_unknown}, the sniffer is considered to +be generic, and is allowed to examine @var{flavour}-flavoured files for +any architecture. +@end deftypefun + +@deftypefun enum gdb_osabi gdbarch_lookup_osabi (bfd *@var{abfd}) +Examine the file described by @var{abfd} to determine its OS ABI. +The value @code{GDB_OSABI_UNKNOWN} is returned if the OS ABI cannot +be determined. +@end deftypefun + +@deftypefun void gdbarch_init_osabi (struct gdbarch info @var{info}, struct gdbarch *@var{gdbarch}, enum gdb_osabi @var{osabi}) +Invoke the OS ABI handler corresponding to @var{osabi} to fine-tune the +@code{gdbarch} structure specified by @var{gdbarch}. If a handler +corresponding to @var{osabi} has not been registered for @var{gdbarch}'s +architecture, a warning will be issued and the debugging session will continue +with the defaults already established for @var{gdbarch}. +@end deftypefun + @section Registers and Memory @value{GDBN}'s model of the target machine is rather simple. @@ -3764,6 +3893,168 @@ that just @code{#include}s @file{tm-@var{arch}.h} and @file{config/tm-@var{os}.h}. +@section Converting an existing Target Architecture to Multi-arch +@cindex converting targets to multi-arch + +This section describes the current accepted best practice for converting +an existing target architecture to the multi-arch framework. + +The process consists of generating, testing, posting and committing a +sequence of patches. Each patch must contain a single change, for +instance: + +@itemize @bullet + +@item +Directly convert a group of functions into macros (the conversion does +not change the behavior of any of the functions). + +@item +Replace a non-multi-arch with a multi-arch mechanism (e.g., +@code{FRAME_INFO}). + +@item +Enable multi-arch level one. + +@item +Delete one or more files. + +@end itemize + +@noindent +There isn't a size limit on a patch, however, a developer is strongly +encouraged to keep the patch size down. + +Since each patch is well defined, and since each change has been tested +and shows no regressions, the patches are considered @emph{fairly} +obvious. Such patches, when submitted by developers listed in the +@file{MAINTAINERS} file, do not need approval. Occasional steps in the +process may be more complicated and less clear. The developer is +expected to use their judgment and is encouraged to seek advice as +needed. + +@subsection Preparation + +The first step is to establish control. Build (with @option{-Werror} +enabled) and test the target so that there is a baseline against which +the debugger can be compared. + +At no stage can the test results regress or @value{GDBN} stop compiling +with @option{-Werror}. + +@subsection Add the multi-arch initialization code + +The objective of this step is to establish the basic multi-arch +framework. It involves + +@itemize @bullet + +@item +The addition of a @code{@var{arch}_gdbarch_init} function@footnote{The +above is from the original example and uses K&R C. @value{GDBN} +has since converted to ISO C but lets ignore that.} that creates +the architecture: +@smallexample +static struct gdbarch * +d10v_gdbarch_init (info, arches) + struct gdbarch_info info; + struct gdbarch_list *arches; +@{ + struct gdbarch *gdbarch; + /* there is only one d10v architecture */ + if (arches != NULL) + return arches->gdbarch; + gdbarch = gdbarch_alloc (&info, NULL); + return gdbarch; +@} +@end smallexample +@noindent +@emph{} + +@item +A per-architecture dump function to print any architecture specific +information: +@smallexample +static void +mips_dump_tdep (struct gdbarch *current_gdbarch, + struct ui_file *file) +@{ + @dots{} code to print architecture specific info @dots{} +@} +@end smallexample + +@item +A change to @code{_initialize_@var{arch}_tdep} to register this new +architecture: +@smallexample +void +_initialize_mips_tdep (void) +@{ + gdbarch_register (bfd_arch_mips, mips_gdbarch_init, + mips_dump_tdep); +@end smallexample + +@item +Add the macro @code{GDB_MULTI_ARCH}, defined as 0 (zero), to the file@* +@file{config/@var{arch}/tm-@var{arch}.h}. + +@end itemize + +@subsection Update multi-arch incompatible mechanisms + +Some mechanisms do not work with multi-arch. They include: + +@table @code +@item EXTRA_FRAME_INFO +Delete. +@item FRAME_FIND_SAVED_REGS +Replaced with @code{FRAME_INIT_SAVED_REGS} +@end table + +@noindent +At this stage you could also consider converting the macros into +functions. + +@subsection Prepare for multi-arch level to one + +Temporally set @code{GDB_MULTI_ARCH} to @code{GDB_MULTI_ARCH_PARTIAL} +and then build and start @value{GDBN} (the change should not be +committed). @value{GDBN} may not build, and once built, it may die with +an internal error listing the architecture methods that must be +provided. + +Fix any build problems (patch(es)). + +Convert all the architecture methods listed, which are only macros, into +functions (patch(es)). + +Update @code{@var{arch}_gdbarch_init} to set all the missing +architecture methods and wrap the corresponding macros in @code{#if +!GDB_MULTI_ARCH} (patch(es)). + +@subsection Set multi-arch level one + +Change the value of @code{GDB_MULTI_ARCH} to GDB_MULTI_ARCH_PARTIAL (a +single patch). + +Any problems with throwing ``the switch'' should have been fixed +already. + +@subsection Convert remaining macros + +Suggest converting macros into functions (and setting the corresponding +architecture method) in small batches. + +@subsection Set multi-arch level to two + +This should go smoothly. + +@subsection Delete the TM file + +The @file{tm-@var{arch}.h} can be deleted. @file{@var{arch}.mt} and +@file{configure.in} updated. + + @node Target Vector Definition @chapter Target Vector Definition @@ -4325,6 +4616,143 @@ interruption must be on the cleanup chain before you call these functions, since they might never return to your code (they @samp{longjmp} instead). +@section Per-architecture module data +@cindex per-architecture module data +@cindex multi-arch data +@cindex data-pointer, per-architecture/per-module + +The multi-arch framework includes a mechanism for adding module specific +per-architecture data-pointers to the @code{struct gdbarch} architecture +object. + +A module registers one or more per-architecture data-pointers using the +function @code{register_gdbarch_data}: + +@deftypefun struct gdbarch_data *register_gdbarch_data (gdbarch_data_init_ftype *@var{init}, gdbarch_data_free_ftype *@var{free}) + +The @var{init} function is used to obtain an initial value for a +per-architecture data-pointer. The function is called, after the +architecture has been created, when the data-pointer is still +uninitialized (@code{NULL}) and its value has been requested via a call +to @code{gdbarch_data}. A data-pointer can also be initialize +explicitly using @code{set_gdbarch_data}. + +The @var{free} function is called when a data-pointer needs to be +destroyed. This occurs when either the corresponding @code{struct +gdbarch} object is being destroyed or when @code{set_gdbarch_data} is +overriding a non-@code{NULL} data-pointer value. + +The function @code{register_gdbarch_data} returns a @code{struct +gdbarch_data} that is used to identify the data-pointer that was added +to the module. + +@end deftypefun + +A typical module has @code{init} and @code{free} functions of the form: + +@smallexample +static struct gdbarch_data *nozel_handle; +static void * +nozel_init (struct gdbarch *gdbarch) +@{ + struct nozel *data = XMALLOC (struct nozel); + @dots{} + return data; +@} +@dots{} +static void +nozel_free (struct gdbarch *gdbarch, void *data) +@{ + xfree (data); +@} +@end smallexample + +Since uninitialized (@code{NULL}) data-pointers are initialized +on-demand, an @code{init} function is free to call other modules that +use data-pointers. Those modules data-pointers will be initialized as +needed. Care should be taken to ensure that the @code{init} call graph +does not contain cycles. + +The data-pointer is registered with the call: + +@smallexample +void +_initialize_nozel (void) +@{ + nozel_handle = register_gdbarch_data (nozel_init, nozel_free); +@dots{} +@end smallexample + +The per-architecture data-pointer is accessed using the function: + +@deftypefun void *gdbarch_data (struct gdbarch *@var{gdbarch}, struct gdbarch_data *@var{data_handle}) +Given the architecture @var{arch} and module data handle +@var{data_handle} (returned by @code{register_gdbarch_data}, this +function returns the current value of the per-architecture data-pointer. +@end deftypefun + +The non-@code{NULL} data-pointer returned by @code{gdbarch_data} should +be saved in a local variable and then used directly: + +@smallexample +int +nozel_total (struct gdbarch *gdbarch) +@{ + int total; + struct nozel *data = gdbarch_data (gdbarch, nozel_handle); + @dots{} + return total; +@} +@end smallexample + +It is also possible to directly initialize the data-pointer using: + +@deftypefun void set_gdbarch_data (struct gdbarch *@var{gdbarch}, struct gdbarch_data *handle, void *@var{pointer}) +Update the data-pointer corresponding to @var{handle} with the value of +@var{pointer}. If the previous data-pointer value is non-NULL, then it +is freed using data-pointers @var{free} function. +@end deftypefun + +This function is used by modules that require a mechanism for explicitly +setting the per-architecture data-pointer during architecture creation: + +@smallexample +/* Called during architecture creation. */ +extern void +set_gdbarch_nozel (struct gdbarch *gdbarch, + int total) +@{ + struct nozel *data = XMALLOC (struct nozel); + @dots{} + set_gdbarch_data (gdbarch, nozel_handle, nozel); +@} +@end smallexample + +@smallexample +/* Default, called when nozel not set by set_gdbarch_nozel(). */ +static void * +nozel_init (struct gdbarch *gdbarch) +@{ + struct nozel *default_nozel = XMALLOC (struc nozel); + @dots{} + return default_nozel; +@} +@end smallexample + +@smallexample +void +_initialize_nozel (void) +@{ + nozel_handle = register_gdbarch_data (nozel_init, NULL); + @dots{} +@end smallexample + +@noindent +Note that an @code{init} function still needs to be registered. It is +used to initialize the data-pointer when the architecture creation phase +fail to set an initial value. + + @section Wrapping Output Lines @cindex line wrap in output @@ -5037,41 +5465,50 @@ This means that changes such as adding a new architectures or (within reason) support for a new host are considered acceptable.} -@section Obsolete any code +@section Obsoleting code Before anything else, poke the other developers (and around the source code) to see if there is anything that can be removed from @value{GDBN} (an old target, an unused file). Obsolete code is identified by adding an @code{OBSOLETE} prefix to every -line. Doing this means that it is easy to identify obsolete code when -grepping through the sources. +line. Doing this means that it is easy to identify something that has +been obsoleted when greping through the sources. -The process has a number of steps and is intentionally slow --- this is -to mainly ensure that people have had a reasonable chance to respond. -Remember, everything on the internet takes a week. +The process is done in stages --- this is mainly to ensure that the +wider @value{GDBN} community has a reasonable opportunity to respond. +Remember, everything on the Internet takes a week. -@itemize @bullet +@enumerate @item -announce the change on @email{gdb@@sources.redhat.com, GDB mailing list} +Post the proposal on @email{gdb@@sources.redhat.com, the GDB mailing +list} Creating a bug report to track the task's state, is also highly +recommended. @item -wait a week or so +Wait a week or so. @item -announce the change on @email{gdb-announce@@sources.redhat.com, GDB -Announcement mailing list} +Post the proposal on @email{gdb-announce@@sources.redhat.com, the GDB +Announcement mailing list}. @item -wait a week or so +Wait a week or so. @item -go through and edit all relevant files and lines (e.g., in -@file{configure.tgt}) so that they are prefixed with the word -@code{OBSOLETE}. -@end itemize +Go through and edit all relevant files and lines so that they are +prefixed with the word @code{OBSOLETE}. +@item +Wait until the next GDB version, containing this obsolete code, has been +released. +@item +Remove the obsolete code. +@end enumerate + +@noindent +@emph{Maintainer note: While removing old code is regrettable it is +hopefully better for @value{GDBN}'s long term development. Firstly it +helps the developers by removing code that is either no longer relevant +or simply wrong. Secondly since it removes any history associated with +the file (effectively clearing the slate) the developer has a much freer +hand when it comes to fixing broken files.} -@emph{Maintainer note: Removing old code, while regrettable, is a good -thing. Firstly it helps the developers by removing code that is either -no longer relevant or simply wrong. Secondly since it removes any -history associated with the file (effectively clearing the slate) the -developer has a much freer hand when it comes to fixing broken files.} @section Before the Branch @@ -5125,38 +5562,142 @@ Close anything obviously fixed. The targets are listed in @file{gdb/MAINTAINERS}. -@section Cut the branch - -@subheading The dirty work +@section Cut the Branch -I think something like the below was used: +@subheading Create the branch @smallexample -$ d=`date -u +%Y-%m-%d` -$ echo $d -2002-01-24 -$ cvs -f -d /cvs/src rtag -D $d-gmt \ -gdb_5_1-$d-branchpoint insight+dejagnu -$ cvs -f -d /cvs/src rtag -b -r gdb_V_V-$d-branchpoint \ -gdb_5_1-$d-branch insight+dejagnu +$ u=5.1 +$ v=5.2 +$ V=`echo $v | sed 's/\./_/g'` +$ D=`date -u +%Y-%m-%d` +$ echo $u $V $D +5.1 5_2 2002-03-03 +$ echo cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \ +-D $D-gmt gdb_$V-$D-branchpoint insight+dejagnu +cvs -f -d :ext:sources.redhat.com:/cvs/src rtag +-D 2002-03-03-gmt gdb_5_2-2002-03-03-branchpoint insight+dejagnu +$ ^echo ^^ +... +$ echo cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \ +-b -r gdb_$V-$D-branchpoint gdb_$V-branch insight+dejagnu +cvs -f -d :ext:sources.redhat.com:/cvs/src rtag \ +-b -r gdb_5_2-2002-03-03-branchpoint gdb_5_2-branch insight+dejagnu +$ ^echo ^^ +... $ @end smallexample @itemize @bullet @item -the @kbd{-D YYYY-MM-DD-gmt} forces the branch to an exact date/time. +by using @kbd{-D YYYY-MM-DD-gmt} the branch is forced to an exact +date/time. +@item +the trunk is first taged so that the branch point can easily be found @item -the trunk is first tagged so that the branch point can easily be found +Insight (which includes GDB) and dejagnu are all tagged at the same time @item -Insight (which includes GDB) and dejagnu are tagged at the same time +@file{version.in} gets bumped to avoid version number conflicts +@item +the reading of @file{.cvsrc} is disabled using @file{-f} +@end itemize + +@subheading Update @file{version.in} + +@smallexample +$ u=5.1 +$ v=5.2 +$ V=`echo $v | sed 's/\./_/g'` +$ echo $u $v$V +5.1 5_2 +$ cd /tmp +$ echo cvs -f -d :ext:sources.redhat.com:/cvs/src co \ +-r gdb_$V-branch src/gdb/version.in +cvs -f -d :ext:sources.redhat.com:/cvs/src co + -r gdb_5_2-branch src/gdb/version.in +$ ^echo ^^ +U src/gdb/version.in +$ cd src/gdb +$ echo $u.90-0000-00-00-cvs > version.in +$ cat version.in +5.1.90-0000-00-00-cvs +$ cvs -f commit version.in +@end smallexample + +@itemize @bullet +@item +@file{0000-00-00} is used as a date to pump prime the version.in update +mechanism +@item +@file{.90} and the previous branch version are used as fairly arbitrary +initial branch version number @end itemize -@subheading Post the branch info @subheading Update the web and news pages +Something? + @subheading Tweak cron to track the new branch +The file @file{gdbadmin/cron/crontab} contains gdbadmin's cron table. +This file needs to be updated so that: + +@itemize @bullet +@item +a daily timestamp is added to the file @file{version.in} +@item +the new branch is included in the snapshot process +@end itemize + +@noindent +See the file @file{gdbadmin/cron/README} for how to install the updated +cron table. + +The file @file{gdbadmin/ss/README} should also be reviewed to reflect +any changes. That file is copied to both the branch/ and current/ +snapshot directories. + + +@subheading Update the NEWS and README files + +The @file{NEWS} file needs to be updated so that on the branch it refers +to @emph{changes in the current release} while on the trunk it also +refers to @emph{changes since the current release}. + +The @file{README} file needs to be updated so that it refers to the +current release. + +@subheading Post the branch info + +Send an announcement to the mailing lists: + +@itemize @bullet +@item +@email{gdb-announce@@sources.redhat.com, GDB Announcement mailing list} +@item +@email{gdb@@sources.redhat.com, GDB Discsussion mailing list} and +@email{gdb-testers@@sources.redhat.com, GDB Discsussion mailing list} +@end itemize + +@emph{Pragmatics: The branch creation is sent to the announce list to +ensure that people people not subscribed to the higher volume discussion +list are alerted.} + +The announcement should include: + +@itemize @bullet +@item +the branch tag +@item +how to check out the branch using CVS +@item +the date/number of weeks until the release +@item +the branch commit policy +still holds. +@end itemize + @section Stabilize the branch Something goes here. diff --git a/gdb/dwarf2cfi.c b/gdb/dwarf2cfi.c index 0cc342fa93f..ea501551c8e 100644 --- a/gdb/dwarf2cfi.c +++ b/gdb/dwarf2cfi.c @@ -201,26 +201,27 @@ static void fde_chunks_need_space (); static struct context *context_alloc (); static struct frame_state *frame_state_alloc (); +static void unwind_tmp_obstack_init (); static void unwind_tmp_obstack_free (); static void context_cpy (struct context *dst, struct context *src); -static unsigned int read_1u (bfd *abfd, char **p); -static int read_1s (bfd *abfd, char **p); -static unsigned int read_2u (bfd *abfd, char **p); -static int read_2s (bfd *abfd, char **p); -static unsigned int read_4u (bfd *abfd, char **p); -static int read_4s (bfd *abfd, char **p); -static ULONGEST read_8u (bfd *abfd, char **p); -static LONGEST read_8s (bfd *abfd, char **p); - -static ULONGEST read_uleb128 (bfd *abfd, char **p); -static LONGEST read_sleb128 (bfd *abfd, char **p); -static CORE_ADDR read_pointer (bfd *abfd, char **p); -static CORE_ADDR read_encoded_pointer (bfd *abfd, char **p, +static unsigned int read_1u (bfd * abfd, char **p); +static int read_1s (bfd * abfd, char **p); +static unsigned int read_2u (bfd * abfd, char **p); +static int read_2s (bfd * abfd, char **p); +static unsigned int read_4u (bfd * abfd, char **p); +static int read_4s (bfd * abfd, char **p); +static ULONGEST read_8u (bfd * abfd, char **p); +static LONGEST read_8s (bfd * abfd, char **p); + +static ULONGEST read_uleb128 (bfd * abfd, char **p); +static LONGEST read_sleb128 (bfd * abfd, char **p); +static CORE_ADDR read_pointer (bfd * abfd, char **p); +static CORE_ADDR read_encoded_pointer (bfd * abfd, char **p, unsigned char encoding); -static LONGEST read_initial_length (bfd *abfd, char *buf, int *bytes_read); -static ULONGEST read_length (bfd *abfd, char *buf, int *bytes_read, +static LONGEST read_initial_length (bfd * abfd, char *buf, int *bytes_read); +static ULONGEST read_length (bfd * abfd, char *buf, int *bytes_read, int dwarf64); static int is_cie (ULONGEST cie_id, int dwarf64); @@ -235,11 +236,12 @@ static void frame_state_for (struct context *context, struct frame_state *fs); static void get_reg (char *reg, struct context *context, int regnum); static CORE_ADDR execute_stack_op (struct objfile *objfile, char *op_ptr, char *op_end, - struct context *context, CORE_ADDR initial); + struct context *context, + CORE_ADDR initial); static void update_context (struct context *context, struct frame_state *fs, int chain); - + /* Memory allocation functions. */ static struct fde_unit * fde_unit_alloc (void) @@ -301,17 +303,23 @@ frame_state_alloc () fs = (struct frame_state *) obstack_alloc (&unwind_tmp_obstack, sizeof (struct frame_state)); memset (fs, 0, sizeof (struct frame_state)); - fs->regs.reg = (struct frame_state_reg *) obstack_alloc (&unwind_tmp_obstack, - regs_size); + fs->regs.reg = + (struct frame_state_reg *) obstack_alloc (&unwind_tmp_obstack, regs_size); memset (fs->regs.reg, 0, regs_size); return fs; } +static void +unwind_tmp_obstack_init () +{ + obstack_init (&unwind_tmp_obstack); +} + static void unwind_tmp_obstack_free () { obstack_free (&unwind_tmp_obstack, NULL); - obstack_init (&unwind_tmp_obstack); + unwind_tmp_obstack_init (); } static void @@ -334,92 +342,92 @@ context_cpy (struct context *dst, struct context *src) dreg = dst->reg; *dst = *src; dst->reg = dreg; - + memcpy (dst->reg, src->reg, regs_size); } static unsigned int -read_1u (bfd *abfd, char **p) +read_1u (bfd * abfd, char **p) { unsigned ret; - ret= bfd_get_8 (abfd, (bfd_byte *) *p); - (*p) ++; + ret = bfd_get_8 (abfd, (bfd_byte *) * p); + (*p)++; return ret; } static int -read_1s (bfd *abfd, char **p) +read_1s (bfd * abfd, char **p) { int ret; - ret= bfd_get_signed_8 (abfd, (bfd_byte *) *p); - (*p) ++; + ret = bfd_get_signed_8 (abfd, (bfd_byte *) * p); + (*p)++; return ret; } static unsigned int -read_2u (bfd *abfd, char **p) +read_2u (bfd * abfd, char **p) { unsigned ret; - ret= bfd_get_16 (abfd, (bfd_byte *) *p); - (*p) ++; + ret = bfd_get_16 (abfd, (bfd_byte *) * p); + (*p)++; return ret; } static int -read_2s (bfd *abfd, char **p) +read_2s (bfd * abfd, char **p) { int ret; - ret= bfd_get_signed_16 (abfd, (bfd_byte *) *p); + ret = bfd_get_signed_16 (abfd, (bfd_byte *) * p); (*p) += 2; return ret; } static unsigned int -read_4u (bfd *abfd, char **p) +read_4u (bfd * abfd, char **p) { unsigned int ret; - ret= bfd_get_32 (abfd, (bfd_byte *) *p); + ret = bfd_get_32 (abfd, (bfd_byte *) * p); (*p) += 4; return ret; } static int -read_4s (bfd *abfd, char **p) +read_4s (bfd * abfd, char **p) { int ret; - ret= bfd_get_signed_32 (abfd, (bfd_byte *) *p); + ret = bfd_get_signed_32 (abfd, (bfd_byte *) * p); (*p) += 4; return ret; } static ULONGEST -read_8u (bfd *abfd, char **p) +read_8u (bfd * abfd, char **p) { ULONGEST ret; - ret = bfd_get_64 (abfd, (bfd_byte *) *p); + ret = bfd_get_64 (abfd, (bfd_byte *) * p); (*p) += 8; return ret; } static LONGEST -read_8s (bfd *abfd, char **p) +read_8s (bfd * abfd, char **p) { LONGEST ret; - ret = bfd_get_signed_64 (abfd, (bfd_byte *) *p); + ret = bfd_get_signed_64 (abfd, (bfd_byte *) * p); (*p) += 8; return ret; } static ULONGEST -read_uleb128 (bfd *abfd, char **p) +read_uleb128 (bfd * abfd, char **p) { ULONGEST ret; int i, shift; @@ -430,8 +438,8 @@ read_uleb128 (bfd *abfd, char **p) i = 0; while (1) { - byte = bfd_get_8 (abfd, (bfd_byte *) *p); - (*p) ++; + byte = bfd_get_8 (abfd, (bfd_byte *) * p); + (*p)++; ret |= ((unsigned long) (byte & 127) << shift); if ((byte & 128) == 0) { @@ -443,7 +451,7 @@ read_uleb128 (bfd *abfd, char **p) } static LONGEST -read_sleb128 (bfd *abfd, char **p) +read_sleb128 (bfd * abfd, char **p) { LONGEST ret; int i, shift, size, num_read; @@ -456,8 +464,8 @@ read_sleb128 (bfd *abfd, char **p) i = 0; while (1) { - byte = bfd_get_8 (abfd, (bfd_byte *) *p); - (*p) ++; + byte = bfd_get_8 (abfd, (bfd_byte *) * p); + (*p)++; ret |= ((long) (byte & 127) << shift); shift += 7; if ((byte & 128) == 0) @@ -473,7 +481,7 @@ read_sleb128 (bfd *abfd, char **p) } static CORE_ADDR -read_pointer (bfd *abfd, char **p) +read_pointer (bfd * abfd, char **p) { switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT) { @@ -487,7 +495,7 @@ read_pointer (bfd *abfd, char **p) } static CORE_ADDR -read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding) +read_encoded_pointer (bfd * abfd, char **p, unsigned char encoding) { CORE_ADDR ret; @@ -535,7 +543,7 @@ read_encoded_pointer (bfd *abfd, char **p, unsigned char encoding) case DW_EH_PE_absptr: break; case DW_EH_PE_pcrel: - ret += (CORE_ADDR) *p; + ret += (CORE_ADDR) * p; break; case DW_EH_PE_textrel: case DW_EH_PE_datarel: @@ -584,8 +592,8 @@ read_length (bfd * abfd, char *buf, int *bytes_read, int dwarf64) } static void -execute_cfa_program ( struct objfile *objfile, char *insn_ptr, char *insn_end, - struct context *context, struct frame_state *fs) +execute_cfa_program (struct objfile *objfile, char *insn_ptr, char *insn_end, + struct context *context, struct frame_state *fs) { struct frame_state_regs *unused_rs = NULL; @@ -604,7 +612,7 @@ execute_cfa_program ( struct objfile *objfile, char *insn_ptr, char *insn_end, { reg = insn & 0x3f; uoffset = read_uleb128 (objfile->obfd, &insn_ptr); - offset = (long) uoffset * fs->data_align; + offset = (long) uoffset *fs->data_align; fs->regs.reg[reg].how = REG_SAVED_OFFSET; fs->regs.reg[reg].loc.offset = offset; } @@ -802,11 +810,17 @@ frame_state_for (struct context *context, struct frame_state *fs) context->args_size = 0; context->lsda = 0; - if ((fde = get_fde_for_addr (context->ra - 1)) != NULL) - { - fs->pc = fde->initial_location; + fde = get_fde_for_addr (context->ra - 1); + if (fde == NULL) + return; + + fs->pc = fde->initial_location; + + if (fde->cie_ptr) + { cie = fde->cie_ptr; + fs->code_align = cie->code_align; fs->data_align = cie->data_align; fs->retaddr_column = cie->ra; @@ -818,6 +832,9 @@ frame_state_for (struct context *context, struct frame_state *fs) execute_cfa_program (cie->objfile, fde->data, fde->data + fde->data_length, context, fs); } + else + internal_error (__FILE__, __LINE__, + "%s(): Internal error: fde->cie_ptr==NULL !", __func__); } static void @@ -844,8 +861,7 @@ get_reg (char *reg, struct context *context, int regnum) REGISTER_RAW_SIZE (regnum)); break; default: - internal_error (__FILE__, __LINE__, - "get_reg: unknown register rule"); + internal_error (__FILE__, __LINE__, "get_reg: unknown register rule"); } } @@ -865,7 +881,8 @@ execute_stack_op (struct objfile *objfile, while (op_ptr < op_end) { enum dwarf_location_atom op = *op_ptr++; - ULONGEST result, reg; + CORE_ADDR result; + ULONGEST reg; LONGEST offset; switch (op) @@ -1197,8 +1214,8 @@ execute_stack_op (struct objfile *objfile, case DW_OP_ne: result = (LONGEST) first != (LONGEST) second; break; - default: /* This label is here just to avoid warning. */ - break; + default: /* This label is here just to avoid warning. */ + break; } } break; @@ -1244,8 +1261,11 @@ update_context (struct context *context, struct frame_state *fs, int chain) CORE_ADDR cfa; long i; + unwind_tmp_obstack_init (); + orig_context = context_alloc (); context_cpy (orig_context, context); + /* Compute this frame's CFA. */ switch (fs->cfa_how) { @@ -1256,9 +1276,9 @@ update_context (struct context *context, struct frame_state *fs, int chain) case CFA_EXP: /* ??? No way of knowing what register number is the stack pointer - to do the same sort of handling as above. Assume that if the - CFA calculation is so complicated as to require a stack program - that this will not be a problem. */ + to do the same sort of handling as above. Assume that if the + CFA calculation is so complicated as to require a stack program + that this will not be a problem. */ { char *exp = fs->cfa_exp; ULONGEST len; @@ -1367,8 +1387,9 @@ dwarf2_build_frame_info (struct objfile *objfile) bfd *abfd = objfile->obfd; char *start = NULL; char *end = NULL; + int from_eh = 0; - obstack_init (&unwind_tmp_obstack); + unwind_tmp_obstack_init (); dwarf_frame_buffer = 0; @@ -1389,6 +1410,8 @@ dwarf2_build_frame_info (struct objfile *objfile) start = dwarf_frame_buffer; end = dwarf_frame_buffer + dwarf_eh_frame_size; + + from_eh = 1; } if (start) @@ -1410,7 +1433,7 @@ dwarf2_build_frame_info (struct objfile *objfile) cie_id = read_length (abfd, start, &bytes_read, dwarf64); start += bytes_read; - if (is_cie (cie_id, dwarf64)) + if ((from_eh && cie_id == 0) || is_cie (cie_id, dwarf64)) { struct cie_unit *cie = cie_unit_alloc (); char *aug; @@ -1461,7 +1484,7 @@ dwarf2_build_frame_info (struct objfile *objfile) aug += 1; } else - warning ("unknown augmentation"); + warning ("%s(): unknown augmentation", __func__); } cie->data = start; @@ -1476,17 +1499,34 @@ dwarf2_build_frame_info (struct objfile *objfile) fde = fde_unit_alloc (); fde_chunks.array[fde_chunks.elems++] = fde; - fde->initial_location = read_pointer (abfd, &start); + + fde->initial_location = read_pointer (abfd, &start) + + ANOFFSET (objfile->section_offsets, + SECT_OFF_TEXT (objfile)); fde->address_range = read_pointer (abfd, &start); - for (cie = cie_chunks; - cie && (cie->offset != cie_id); cie = cie->next); + cie = cie_chunks; + while (cie) + { + if (cie->objfile == objfile) + { + if (from_eh + && (cie->offset == + (unit_offset + bytes_read - cie_id))) + break; + if (!from_eh && (cie->offset == cie_id)) + break; + } + + cie = cie->next; + } + if (!cie) - error ("dwarf cfi error: can't find CIE pointer"); + error ("%s(): can't find CIE pointer", __func__); fde->cie_ptr = cie; if (cie->augmentation[0] == 'z') - read_uleb128 (abfd, &start); + read_uleb128 (abfd, &start); fde->data = start; fde->data_length = block_end - start; @@ -1507,6 +1547,8 @@ cfi_read_fp () struct frame_state *fs; CORE_ADDR cfa; + unwind_tmp_obstack_init (); + context = context_alloc (); fs = frame_state_alloc (); @@ -1516,7 +1558,9 @@ cfi_read_fp () update_context (context, fs, 0); cfa = context->cfa; + unwind_tmp_obstack_free (); + return cfa; } @@ -1528,6 +1572,8 @@ cfi_write_fp (CORE_ADDR val) struct context *context; struct frame_state *fs; + unwind_tmp_obstack_init (); + context = context_alloc (); fs = frame_state_alloc (); @@ -1575,6 +1621,8 @@ cfi_frame_chain (struct frame_info *fi) struct frame_state *fs; CORE_ADDR cfa; + unwind_tmp_obstack_init (); + context = context_alloc (); fs = frame_state_alloc (); context_cpy (context, UNWIND_CONTEXT (fi)); @@ -1591,7 +1639,7 @@ cfi_frame_chain (struct frame_info *fi) cfa = context->cfa; unwind_tmp_obstack_free (); - + return cfa; } @@ -1611,6 +1659,8 @@ cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi) { struct frame_state *fs; + unwind_tmp_obstack_init (); + fs = frame_state_alloc (); fi->context = frame_obstack_alloc (sizeof (struct context)); UNWIND_CONTEXT (fi)->reg = @@ -1630,6 +1680,7 @@ cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi) frame_state_for (UNWIND_CONTEXT (fi), fs); update_context (UNWIND_CONTEXT (fi), fs, 0); } + unwind_tmp_obstack_free (); } @@ -1737,6 +1788,8 @@ cfi_virtual_frame_pointer (CORE_ADDR pc, int *frame_reg, struct context *context; struct frame_state *fs; + unwind_tmp_obstack_init (); + context = context_alloc (); fs = frame_state_alloc (); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 27938178325..9fa8fb3c463 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -37,6 +37,7 @@ #include "demangle.h" #include "expression.h" #include "filenames.h" /* for DOSish file names */ +#include "macrotab.h" #include "language.h" #include "complaints.h" @@ -350,6 +351,7 @@ static char *dwarf_info_buffer; static char *dwarf_abbrev_buffer; static char *dwarf_line_buffer; static char *dwarf_str_buffer; +static char *dwarf_macinfo_buffer; /* A zeroed version of a partial die for initialization purposes. */ static struct partial_die_info zeroed_partial_die; @@ -443,6 +445,15 @@ struct dwarf2_pinfo /* Size of dwarf string section for the objfile. */ unsigned int dwarf_str_size; + + /* Pointer to start of dwarf macro buffer for the objfile. */ + + char *dwarf_macinfo_buffer; + + /* Size of dwarf macinfo section for the objfile. */ + + unsigned int dwarf_macinfo_size; + }; #define PST_PRIVATE(p) ((struct dwarf2_pinfo *)(p)->read_symtab_private) @@ -454,6 +465,8 @@ struct dwarf2_pinfo #define DWARF_LINE_SIZE(p) (PST_PRIVATE(p)->dwarf_line_size) #define DWARF_STR_BUFFER(p) (PST_PRIVATE(p)->dwarf_str_buffer) #define DWARF_STR_SIZE(p) (PST_PRIVATE(p)->dwarf_str_size) +#define DWARF_MACINFO_BUFFER(p) (PST_PRIVATE(p)->dwarf_macinfo_buffer) +#define DWARF_MACINFO_SIZE(p) (PST_PRIVATE(p)->dwarf_macinfo_size) /* Maintain an array of referenced fundamental types for the current compilation unit being read. For DWARF version 1, we have to construct @@ -617,6 +630,34 @@ static struct complaint dwarf2_line_header_too_long = { "line number info header doesn't fit in `.debug_line' section", 0, 0 }; +static struct complaint dwarf2_missing_macinfo_section = +{ + "missing .debug_macinfo section", 0, 0 +}; +static struct complaint dwarf2_macros_too_long = +{ + "macro info runs off end of `.debug_macinfo' section", 0, 0 +}; +static struct complaint dwarf2_macros_not_terminated = +{ + "no terminating 0-type entry for macros in `.debug_macinfo' section", 0, 0 +}; +static struct complaint dwarf2_macro_outside_file = +{ + "debug info gives macro %s outside of any file: %s", 0, 0 +}; +static struct complaint dwarf2_macro_unmatched_end_file = +{ + "macro debug info has an unmatched `close_file' directive", 0, 0 +}; +static struct complaint dwarf2_macro_malformed_definition = +{ + "macro debug info contains a malformed macro definition:\n`%s'", 0, 0 +}; +static struct complaint dwarf2_macro_spaces_in_definition = +{ + "macro definition contains spaces in formal argument list:\n`%s'", 0, 0 +}; /* local function prototypes */ @@ -758,8 +799,7 @@ static void dwarf2_attach_fields_to_type (struct field_info *, struct type *, struct objfile *); static void dwarf2_add_member_fn (struct field_info *, - struct die_info *, struct type *, - struct objfile *objfile, + struct die_info *, struct objfile *objfile, const struct comp_unit_head *); static void dwarf2_attach_fn_fields_to_type (struct field_info *, @@ -862,15 +902,23 @@ static void initialize_cu_func_list (void); static void add_to_cu_func_list (const char *, CORE_ADDR, CORE_ADDR); +static void dwarf_decode_macros (struct line_header *, unsigned int, + char *, bfd *, const struct comp_unit_head *, + struct objfile *); + /* Try to locate the sections we need for DWARF 2 debugging information and return true if we have enough to do something. */ int dwarf2_has_info (bfd *abfd) { - dwarf_info_offset = dwarf_abbrev_offset = dwarf_line_offset = 0; + dwarf_info_offset = 0; + dwarf_abbrev_offset = 0; + dwarf_line_offset = 0; dwarf_str_offset = 0; - dwarf_frame_offset = dwarf_eh_frame_offset = 0; + dwarf_macinfo_offset = 0; + dwarf_frame_offset = 0; + dwarf_eh_frame_offset = 0; bfd_map_over_sections (abfd, dwarf2_locate_sections, NULL); if (dwarf_info_offset && dwarf_abbrev_offset) { @@ -966,6 +1014,13 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline) else dwarf_str_buffer = NULL; + if (dwarf_macinfo_offset) + dwarf_macinfo_buffer = dwarf2_read_section (objfile, + dwarf_macinfo_offset, + dwarf_macinfo_size); + else + dwarf_macinfo_buffer = NULL; + if (mainline || (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)) @@ -1174,6 +1229,8 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) DWARF_LINE_SIZE (pst) = dwarf_line_size; DWARF_STR_BUFFER (pst) = dwarf_str_buffer; DWARF_STR_SIZE (pst) = dwarf_str_size; + DWARF_MACINFO_BUFFER (pst) = dwarf_macinfo_buffer; + DWARF_MACINFO_SIZE (pst) = dwarf_macinfo_size; baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); /* Store the function that reads in the rest of the symbol table */ @@ -1476,6 +1533,8 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) dwarf_line_size = DWARF_LINE_SIZE (pst); dwarf_str_buffer = DWARF_STR_BUFFER (pst); dwarf_str_size = DWARF_STR_SIZE (pst); + dwarf_macinfo_buffer = DWARF_MACINFO_BUFFER (pst); + dwarf_macinfo_size = DWARF_MACINFO_SIZE (pst); baseaddr = ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (objfile)); cu_header_offset = offset; info_ptr = dwarf_info_buffer + offset; @@ -1738,6 +1797,17 @@ read_file_scope (struct die_info *die, struct objfile *objfile, } } + /* Decode macro information, if present. Dwarf 2 macro information + refers to information in the line number info statement program + header, so we can only read it if we've read the header + successfully. */ + attr = dwarf_attr (die, DW_AT_macro_info); + if (attr) + { + unsigned int macro_offset = DW_UNSND (attr); + dwarf_decode_macros (line_header, macro_offset, + comp_dir, abfd, cu_header, objfile); + } do_cleanups (back_to); } @@ -2162,7 +2232,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, static void dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - struct type *type, struct objfile *objfile, + struct objfile *objfile, const struct comp_unit_head *cu_header) { struct attribute *attr; @@ -2228,23 +2298,13 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC) { struct type *return_type = TYPE_TARGET_TYPE (die->type); - struct type **arg_types; int nparams = TYPE_NFIELDS (die->type); - int iparams; - /* Copy argument types from the subroutine type. */ - arg_types = (struct type **) - TYPE_ALLOC (fnp->type, (nparams + 1) * sizeof (struct type *)); - for (iparams = 0; iparams < nparams; iparams++) - arg_types[iparams] = TYPE_FIELD_TYPE (die->type, iparams); - - /* Set last entry in argument type vector. */ - if (TYPE_VARARGS (die->type)) - arg_types[nparams] = NULL; - else - arg_types[nparams] = dwarf2_fundamental_type (objfile, FT_VOID); - - smash_to_method_type (fnp->type, type, return_type, arg_types); + smash_to_method_type (fnp->type, die->type, + TYPE_TARGET_TYPE (die->type), + TYPE_FIELDS (die->type), + TYPE_NFIELDS (die->type), + TYPE_VARARGS (die->type)); /* Handle static member functions. Dwarf2 has no clean way to discern C++ static and non-static @@ -2414,7 +2474,7 @@ read_structure_scope (struct die_info *die, struct objfile *objfile, { /* C++ member function. */ process_die (child_die, objfile, cu_header); - dwarf2_add_member_fn (&fi, child_die, type, objfile, cu_header); + dwarf2_add_member_fn (&fi, child_die, objfile, cu_header); } else if (child_die->tag == DW_TAG_inheritance) { @@ -4012,18 +4072,18 @@ static void free_line_header (struct line_header *lh) { if (lh->standard_opcode_lengths) - free (lh->standard_opcode_lengths); + xfree (lh->standard_opcode_lengths); /* Remember that all the lh->file_names[i].name pointers are pointers into debug_line_buffer, and don't need to be freed. */ if (lh->file_names) - free (lh->file_names); + xfree (lh->file_names); /* Similarly for the include directory names. */ if (lh->include_dirs) - free (lh->include_dirs); + xfree (lh->include_dirs); - free (lh); + xfree (lh); } @@ -6367,3 +6427,376 @@ dwarf_alloc_die (void) memset (die, 0, sizeof (struct die_info)); return (die); } + + +/* Macro support. */ + + +/* Return the full name of file number I in *LH's file name table. + Use COMP_DIR as the name of the current directory of the + compilation. The result is allocated using xmalloc; the caller is + responsible for freeing it. */ +static char * +file_full_name (int file, struct line_header *lh, const char *comp_dir) +{ + struct file_entry *fe = &lh->file_names[file - 1]; + + if (IS_ABSOLUTE_PATH (fe->name)) + return xstrdup (fe->name); + else + { + const char *dir; + int dir_len; + char *full_name; + + if (fe->dir_index) + dir = lh->include_dirs[fe->dir_index - 1]; + else + dir = comp_dir; + + if (dir) + { + dir_len = strlen (dir); + full_name = xmalloc (dir_len + 1 + strlen (fe->name) + 1); + strcpy (full_name, dir); + full_name[dir_len] = '/'; + strcpy (full_name + dir_len + 1, fe->name); + return full_name; + } + else + return xstrdup (fe->name); + } +} + + +static struct macro_source_file * +macro_start_file (int file, int line, + struct macro_source_file *current_file, + const char *comp_dir, + struct line_header *lh, struct objfile *objfile) +{ + /* The full name of this source file. */ + char *full_name = file_full_name (file, lh, comp_dir); + + /* We don't create a macro table for this compilation unit + at all until we actually get a filename. */ + if (! pending_macros) + pending_macros = new_macro_table (&objfile->symbol_obstack, + &objfile->macro_cache); + + if (! current_file) + /* If we have no current file, then this must be the start_file + directive for the compilation unit's main source file. */ + current_file = macro_set_main (pending_macros, full_name); + else + current_file = macro_include (current_file, line, full_name); + + xfree (full_name); + + return current_file; +} + + +/* Copy the LEN characters at BUF to a xmalloc'ed block of memory, + followed by a null byte. */ +static char * +copy_string (const char *buf, int len) +{ + char *s = xmalloc (len + 1); + memcpy (s, buf, len); + s[len] = '\0'; + + return s; +} + + +static const char * +consume_improper_spaces (const char *p, const char *body) +{ + if (*p == ' ') + { + complain (&dwarf2_macro_spaces_in_definition, body); + + while (*p == ' ') + p++; + } + + return p; +} + + +static void +parse_macro_definition (struct macro_source_file *file, int line, + const char *body) +{ + const char *p; + + /* The body string takes one of two forms. For object-like macro + definitions, it should be: + + " " + + For function-like macro definitions, it should be: + + "() " + or + "(" ( "," ) * ") " + + Spaces may appear only where explicitly indicated, and in the + . + + The Dwarf 2 spec says that an object-like macro's name is always + followed by a space, but versions of GCC around March 2002 omit + the space when the macro's definition is the empty string. + + The Dwarf 2 spec says that there should be no spaces between the + formal arguments in a function-like macro's formal argument list, + but versions of GCC around March 2002 include spaces after the + commas. */ + + + /* Find the extent of the macro name. The macro name is terminated + by either a space or null character (for an object-like macro) or + an opening paren (for a function-like macro). */ + for (p = body; *p; p++) + if (*p == ' ' || *p == '(') + break; + + if (*p == ' ' || *p == '\0') + { + /* It's an object-like macro. */ + int name_len = p - body; + char *name = copy_string (body, name_len); + const char *replacement; + + if (*p == ' ') + replacement = body + name_len + 1; + else + { + complain (&dwarf2_macro_malformed_definition, body); + replacement = body + name_len; + } + + macro_define_object (file, line, name, replacement); + + xfree (name); + } + else if (*p == '(') + { + /* It's a function-like macro. */ + char *name = copy_string (body, p - body); + int argc = 0; + int argv_size = 1; + char **argv = xmalloc (argv_size * sizeof (*argv)); + + p++; + + p = consume_improper_spaces (p, body); + + /* Parse the formal argument list. */ + while (*p && *p != ')') + { + /* Find the extent of the current argument name. */ + const char *arg_start = p; + + while (*p && *p != ',' && *p != ')' && *p != ' ') + p++; + + if (! *p || p == arg_start) + complain (&dwarf2_macro_malformed_definition, + body); + else + { + /* Make sure argv has room for the new argument. */ + if (argc >= argv_size) + { + argv_size *= 2; + argv = xrealloc (argv, argv_size * sizeof (*argv)); + } + + argv[argc++] = copy_string (arg_start, p - arg_start); + } + + p = consume_improper_spaces (p, body); + + /* Consume the comma, if present. */ + if (*p == ',') + { + p++; + + p = consume_improper_spaces (p, body); + } + } + + if (*p == ')') + { + p++; + + if (*p == ' ') + /* Perfectly formed definition, no complaints. */ + macro_define_function (file, line, name, + argc, (const char **) argv, + p + 1); + else if (*p == '\0') + { + /* Complain, but do define it. */ + complain (&dwarf2_macro_malformed_definition, body); + macro_define_function (file, line, name, + argc, (const char **) argv, + p); + } + else + /* Just complain. */ + complain (&dwarf2_macro_malformed_definition, body); + } + else + /* Just complain. */ + complain (&dwarf2_macro_malformed_definition, body); + + xfree (name); + { + int i; + + for (i = 0; i < argc; i++) + xfree (argv[i]); + } + xfree (argv); + } + else + complain (&dwarf2_macro_malformed_definition, body); +} + + +static void +dwarf_decode_macros (struct line_header *lh, unsigned int offset, + char *comp_dir, bfd *abfd, + const struct comp_unit_head *cu_header, + struct objfile *objfile) +{ + char *mac_ptr, *mac_end; + struct macro_source_file *current_file = 0; + + if (dwarf_macinfo_buffer == NULL) + { + complain (&dwarf2_missing_macinfo_section); + return; + } + + mac_ptr = dwarf_macinfo_buffer + offset; + mac_end = dwarf_macinfo_buffer + dwarf_macinfo_size; + + for (;;) + { + enum dwarf_macinfo_record_type macinfo_type; + + /* Do we at least have room for a macinfo type byte? */ + if (mac_ptr >= mac_end) + { + complain (&dwarf2_macros_too_long); + return; + } + + macinfo_type = read_1_byte (abfd, mac_ptr); + mac_ptr++; + + switch (macinfo_type) + { + /* A zero macinfo type indicates the end of the macro + information. */ + case 0: + return; + + case DW_MACINFO_define: + case DW_MACINFO_undef: + { + int bytes_read; + int line; + char *body; + + line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + mac_ptr += bytes_read; + body = read_string (abfd, mac_ptr, &bytes_read); + mac_ptr += bytes_read; + + if (! current_file) + complain (&dwarf2_macro_outside_file, + macinfo_type == DW_MACINFO_define ? "definition" : + macinfo_type == DW_MACINFO_undef ? "undefinition" : + "something-or-other", + body); + else + { + if (macinfo_type == DW_MACINFO_define) + parse_macro_definition (current_file, line, body); + else if (macinfo_type == DW_MACINFO_undef) + macro_undef (current_file, line, body); + } + } + break; + + case DW_MACINFO_start_file: + { + int bytes_read; + int line, file; + + line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + mac_ptr += bytes_read; + file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + mac_ptr += bytes_read; + + current_file = macro_start_file (file, line, + current_file, comp_dir, + lh, objfile); + } + break; + + case DW_MACINFO_end_file: + if (! current_file) + complain (&dwarf2_macro_unmatched_end_file); + else + { + current_file = current_file->included_by; + if (! current_file) + { + enum dwarf_macinfo_record_type next_type; + + /* GCC circa March 2002 doesn't produce the zero + type byte marking the end of the compilation + unit. Complain if it's not there, but exit no + matter what. */ + + /* Do we at least have room for a macinfo type byte? */ + if (mac_ptr >= mac_end) + { + complain (&dwarf2_macros_too_long); + return; + } + + /* We don't increment mac_ptr here, so this is just + a look-ahead. */ + next_type = read_1_byte (abfd, mac_ptr); + if (next_type != 0) + complain (&dwarf2_macros_not_terminated); + + return; + } + } + break; + + case DW_MACINFO_vendor_ext: + { + int bytes_read; + int constant; + char *string; + + constant = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); + mac_ptr += bytes_read; + string = read_string (abfd, mac_ptr, &bytes_read); + mac_ptr += bytes_read; + + /* We don't recognize any vendor extensions. */ + } + break; + } + } +} diff --git a/gdb/frame.c b/gdb/frame.c index 24cd9071437..5c52ed1a0a2 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1,4 +1,4 @@ -/* Cache and manage the values of registers for GDB, the GNU debugger. +/* Cache and manage frames for GDB, the GNU debugger. Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. @@ -26,6 +26,57 @@ #include "value.h" #include "inferior.h" /* for inferior_ptid */ #include "regcache.h" +#include "gdb_assert.h" + +/* Return a frame uniq ID that can be used to, later re-find the + frame. */ + +void +get_frame_id (struct frame_info *fi, struct frame_id *id) +{ + if (fi == NULL) + { + id->base = 0; + id->pc = 0; + } + else + { + id->base = FRAME_FP (fi); + id->pc = fi->pc; + } +} + +struct frame_info * +frame_find_by_id (struct frame_id id) +{ + struct frame_info *frame; + + /* ZERO denotes the null frame, let the caller decide what to do + about it. Should it instead return get_current_frame()? */ + if (id.base == 0 && id.pc == 0) + return NULL; + + for (frame = get_current_frame (); + frame != NULL; + frame = get_prev_frame (frame)) + { + if (INNER_THAN (FRAME_FP (frame), id.base)) + /* ``inner/current < frame < id.base''. Keep looking along + the frame chain. */ + continue; + if (INNER_THAN (id.base, FRAME_FP (frame))) + /* ``inner/current < id.base < frame''. Oops, gone past it. + Just give up. */ + return NULL; + /* FIXME: cagney/2002-04-21: This isn't sufficient. It should + use id.pc to check that the two frames belong to the same + function. Otherwise we'll do things like match dummy frames + or mis-match frameless functions. However, until someone + notices, stick with the existing behavour. */ + return frame; + } + return NULL; +} /* FIND_SAVED_REGISTER () @@ -62,76 +113,95 @@ find_saved_register (struct frame_info *frame, int regnum) return addr; } -/* DEFAULT_GET_SAVED_REGISTER () - - Find register number REGNUM relative to FRAME and put its (raw, - target format) contents in *RAW_BUFFER. Set *OPTIMIZED if the - variable was optimized out (and thus can't be fetched). Set *LVAL - to lval_memory, lval_register, or not_lval, depending on whether - the value was fetched from memory, from a register, or in a strange - and non-modifiable way (e.g. a frame pointer which was calculated - rather than fetched). Set *ADDRP to the address, either in memory - on as a REGISTER_BYTE offset into the registers array. - - Note that this implementation never sets *LVAL to not_lval. But - it can be replaced by defining GET_SAVED_REGISTER and supplying - your own. - - The argument RAW_BUFFER must point to aligned memory. */ - -static void -default_get_saved_register (char *raw_buffer, - int *optimized, - CORE_ADDR *addrp, - struct frame_info *frame, - int regnum, - enum lval_type *lval) +void +frame_register_unwind (struct frame_info *frame, int regnum, + int *optimizedp, enum lval_type *lvalp, + CORE_ADDR *addrp, int *realnump, void *bufferp) { - CORE_ADDR addr; + struct frame_unwind_cache *cache; + + /* Require all but BUFFERP to be valid. A NULL BUFFERP indicates + that the value proper does not need to be fetched. */ + gdb_assert (optimizedp != NULL); + gdb_assert (lvalp != NULL); + gdb_assert (addrp != NULL); + gdb_assert (realnump != NULL); + /* gdb_assert (bufferp != NULL); */ + + /* NOTE: cagney/2002-04-14: It would be nice if, instead of a + special case, there was always an inner frame dedicated to the + hardware registers. Unfortunatly, there is too much unwind code + around that looks up/down the frame chain while making the + assumption that each frame level is using the same unwind code. */ + + if (frame == NULL) + { + /* We're in the inner-most frame, get the value direct from the + register cache. */ + *optimizedp = 0; + *lvalp = lval_register; + *addrp = 0; + /* Should this code test ``register_cached (regnum) < 0'' and do + something like set realnum to -1 when the register isn't + available? */ + *realnump = regnum; + if (bufferp) + read_register_gen (regnum, bufferp); + return; + } + + /* Ask this frame to unwind its register. */ + frame->register_unwind (frame, &frame->register_unwind_cache, regnum, + optimizedp, lvalp, addrp, realnump, bufferp); +} + + +void +generic_unwind_get_saved_register (char *raw_buffer, + int *optimizedp, + CORE_ADDR *addrp, + struct frame_info *frame, + int regnum, + enum lval_type *lvalp) +{ + int optimizedx; + CORE_ADDR addrx; + int realnumx; + enum lval_type lvalx; if (!target_has_registers) error ("No registers."); - /* Normal systems don't optimize out things with register numbers. */ - if (optimized != NULL) - *optimized = 0; - addr = find_saved_register (frame, regnum); - if (addr != 0) - { - if (lval != NULL) - *lval = lval_memory; - if (regnum == SP_REGNUM) - { - if (raw_buffer != NULL) - { - /* Put it back in target format. */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - (LONGEST) addr); - } - if (addrp != NULL) - *addrp = 0; - return; - } - if (raw_buffer != NULL) - target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum)); - } + /* Keep things simple, ensure that all the pointers (except valuep) + are non NULL. */ + if (optimizedp == NULL) + optimizedp = &optimizedx; + if (lvalp == NULL) + lvalp = &lvalx; + if (addrp == NULL) + addrp = &addrx; + + /* Reached the the bottom (youngest, inner most) of the frame chain + (youngest, inner most) frame, go direct to the hardware register + cache (do not pass go, do not try to cache the value, ...). The + unwound value would have been cached in frame->next but that + doesn't exist. This doesn't matter as the hardware register + cache is stopping any unnecessary accesses to the target. */ + + /* NOTE: cagney/2002-04-14: It would be nice if, instead of a + special case, there was always an inner frame dedicated to the + hardware registers. Unfortunatly, there is too much unwind code + around that looks up/down the frame chain while making the + assumption that each frame level is using the same unwind code. */ + + if (frame == NULL) + frame_register_unwind (NULL, regnum, optimizedp, lvalp, addrp, &realnumx, + raw_buffer); else - { - if (lval != NULL) - *lval = lval_register; - addr = REGISTER_BYTE (regnum); - if (raw_buffer != NULL) - read_register_gen (regnum, raw_buffer); - } - if (addrp != NULL) - *addrp = addr; + frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp, + &realnumx, raw_buffer); } -#if !defined (GET_SAVED_REGISTER) -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ - default_get_saved_register(raw_buffer, optimized, addrp, frame, regnum, lval) -#endif - void get_saved_register (char *raw_buffer, int *optimized, diff --git a/gdb/frame.h b/gdb/frame.h index ff9e9cfbb2a..03a71c7a097 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -23,6 +23,29 @@ #if !defined (FRAME_H) #define FRAME_H 1 +/* Return the location (and possibly value) of REGNUM for the previous + (older, up) frame. All parameters except VALUEP can be assumed to + be non NULL. When VALUEP is NULL, just the location of the + register should be returned. + + UNWIND_CACHE is provided as mechanism for implementing a per-frame + local cache. It's initial value being NULL. Memory for that cache + should be allocated using frame_obstack_alloc(). + + Register window architectures (eg SPARC) should note that REGNUM + identifies the register for the previous frame. For instance, a + request for the value of "o1" for the previous frame would be found + in the register "i1" in this FRAME. */ + +typedef void (frame_register_unwind_ftype) (struct frame_info *frame, + void **unwind_cache, + int regnum, + int *optimized, + enum lval_type *lvalp, + CORE_ADDR *addrp, + int *realnump, + void *valuep); + /* Describe the saved registers of a frame. */ #if defined (EXTRA_FRAME_INFO) || defined (FRAME_FIND_SAVED_REGS) @@ -112,6 +135,11 @@ struct frame_info related unwind data. */ struct unwind_contect *context; + /* See description above. Return the register value for the + previous frame. */ + frame_register_unwind_ftype *register_unwind; + void *register_unwind_cache; + /* Pointers to the next (down, inner) and previous (up, outer) frame_info's in the frame cache. */ struct frame_info *next; /* down, inner */ @@ -246,7 +274,21 @@ extern void show_stack_frame (struct frame_info *); extern void select_frame (struct frame_info *); -extern void record_selected_frame (CORE_ADDR *, int *); +/* Return an ID that can be used to re-find a frame. */ + +struct frame_id +{ + /* The frame's address. This should be constant through out the + lifetime of a frame. */ + CORE_ADDR base; + /* The frame's current PC. While this changes, the function that + the PC falls into, does not. */ + CORE_ADDR pc; +}; + +extern void get_frame_id (struct frame_info *fi, struct frame_id *id); + +extern struct frame_info *frame_find_by_id (struct frame_id id); extern void print_frame_info (struct frame_info *, int, int, int); @@ -278,6 +320,22 @@ extern void generic_get_saved_register (char *, int *, CORE_ADDR *, struct frame_info *, int, enum lval_type *); +extern void generic_unwind_get_saved_register (char *raw_buffer, + int *optimized, + CORE_ADDR * addrp, + struct frame_info *frame, + int regnum, + enum lval_type *lval); + +/* Unwind the stack frame so that the value of REGNUM, in the previous + frame is returned. If VALUEP is NULL, don't fetch/compute the + value. Instead just return the location of the value. */ + +extern void frame_register_unwind (struct frame_info *frame, int regnum, + int *optimizedp, enum lval_type *lvalp, + CORE_ADDR *addrp, int *realnump, + void *valuep); + extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); extern void get_saved_register (char *raw_buffer, int *optimized, diff --git a/gdb/gdb_indent.sh b/gdb/gdb_indent.sh index e54e08eac53..1e727fe2309 100755 --- a/gdb/gdb_indent.sh +++ b/gdb/gdb_indent.sh @@ -47,6 +47,7 @@ esac case `pwd` in */gdb ) ;; + */sim/* ) ;; * ) echo "Not in GDB directory" 1>&2 ; exit 1 ;; esac diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 5c57110c444..96737928234 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -68,7 +68,6 @@ static void verify_gdbarch (struct gdbarch *gdbarch); static void alloc_gdbarch_data (struct gdbarch *); -static void init_gdbarch_data (struct gdbarch *); static void free_gdbarch_data (struct gdbarch *); static void init_gdbarch_swap (struct gdbarch *); static void clear_gdbarch_swap (struct gdbarch *); @@ -87,6 +86,8 @@ int gdbarch_debug = GDBARCH_DEBUG; struct gdbarch { + /* Has this architecture been fully initialized? */ + int initialized_p; /* basic architectural information */ const struct bfd_arch_info * bfd_arch_info; int byte_order; @@ -209,6 +210,7 @@ struct gdbarch gdbarch_integer_to_address_ftype *integer_to_address; gdbarch_return_value_on_stack_ftype *return_value_on_stack; gdbarch_extract_return_value_ftype *extract_return_value; + gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value; gdbarch_push_arguments_ftype *push_arguments; gdbarch_push_dummy_frame_ftype *push_dummy_frame; gdbarch_push_return_address_ftype *push_return_address; @@ -216,6 +218,7 @@ struct gdbarch gdbarch_store_struct_return_ftype *store_struct_return; gdbarch_store_return_value_ftype *store_return_value; gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; + gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address; gdbarch_use_struct_convention_ftype *use_struct_convention; gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs; gdbarch_init_extra_frame_info_ftype *init_extra_frame_info; @@ -269,6 +272,7 @@ extern const struct bfd_arch_info bfd_default_arch_struct; struct gdbarch startup_gdbarch = { + 1, /* Always initialized. */ /* basic architecture information */ &bfd_default_arch_struct, BFD_ENDIAN_BIG, @@ -319,6 +323,9 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + default_print_float_info, + 0, + 0, 0, 0, 0, @@ -344,7 +351,6 @@ struct gdbarch startup_gdbarch = 0, 0, 0, - generic_get_saved_register, 0, 0, 0, @@ -423,7 +429,6 @@ initialize_non_multiarch () they are starting from scratch. */ clear_gdbarch_swap (&startup_gdbarch); init_gdbarch_swap (&startup_gdbarch); - init_gdbarch_data (&startup_gdbarch); } @@ -488,7 +493,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->max_register_virtual_size = -1; current_gdbarch->do_registers_info = do_registers_info; current_gdbarch->print_float_info = default_print_float_info; - current_gdbarch->register_sim_regno = default_register_sim_regno; + current_gdbarch->register_sim_regno = legacy_register_sim_regno; current_gdbarch->cannot_fetch_register = cannot_register_not; current_gdbarch->cannot_store_register = cannot_register_not; current_gdbarch->use_generic_dummy_frames = -1; @@ -503,6 +508,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->init_frame_pc_first = init_frame_pc_noop; current_gdbarch->init_frame_pc = init_frame_pc_default; current_gdbarch->coerce_float_to_double = default_coerce_float_to_double; + current_gdbarch->get_saved_register = generic_unwind_get_saved_register; current_gdbarch->register_convertible = generic_register_convertible_not; current_gdbarch->convert_register_p = legacy_convert_register_p; current_gdbarch->register_to_value = legacy_register_to_value; @@ -522,7 +528,7 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address; current_gdbarch->frame_args_skip = -1; current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not; - current_gdbarch->frame_chain_valid = func_frame_chain_valid; + current_gdbarch->frame_chain_valid = generic_func_frame_chain_valid; current_gdbarch->extra_stack_alignment_needed = 1; current_gdbarch->convert_from_func_ptr_addr = core_addr_identity; current_gdbarch->addr_bits_remove = core_addr_identity; @@ -681,9 +687,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of init_frame_pc_first, invalid_p == 0 */ /* Skip verify of init_frame_pc, invalid_p == 0 */ /* Skip verify of coerce_float_to_double, invalid_p == 0 */ - if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->get_saved_register == 0)) - fprintf_unfiltered (log, "\n\tget_saved_register"); + /* Skip verify of get_saved_register, invalid_p == 0 */ /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ @@ -699,6 +703,9 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->extract_return_value == 0)) fprintf_unfiltered (log, "\n\textract_return_value"); + if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) + && (gdbarch->deprecated_extract_return_value == 0)) + fprintf_unfiltered (log, "\n\tdeprecated_extract_return_value"); /* Skip verify of push_arguments, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->push_dummy_frame == 0)) @@ -714,6 +721,7 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->store_return_value == 0)) fprintf_unfiltered (log, "\n\tstore_return_value"); /* Skip verify of extract_struct_value_address, has predicate */ + /* Skip verify of deprecated_extract_struct_value_address, has predicate */ /* Skip verify of use_struct_convention, invalid_p == 0 */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && (gdbarch->frame_init_saved_regs == 0)) @@ -1038,6 +1046,31 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n", (long) DECR_PC_AFTER_BREAK); #endif +#ifdef DEPRECATED_EXTRACT_RETURN_VALUE +#if GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf)", + XSTRING (DEPRECATED_EXTRACT_RETURN_VALUE (type, regbuf, valbuf))); +#endif + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRACT_RETURN_VALUE = 0x%08lx\n", + (long) current_gdbarch->deprecated_extract_return_value + /*DEPRECATED_EXTRACT_RETURN_VALUE ()*/); +#endif +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf)", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regbuf))); + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n", + (long) current_gdbarch->deprecated_extract_struct_value_address + /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/); +#endif #ifdef DO_REGISTERS_INFO #if GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ @@ -1532,21 +1565,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: PREPARE_TO_PROCEED = 0x%08lx\n", (long) current_gdbarch->prepare_to_proceed /*PREPARE_TO_PROCEED ()*/); -#endif -#ifdef PRINT_FLOAT_INFO -#if GDB_MULTI_ARCH - /* Macro might contain `[{}]' when not multi-arch */ - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "PRINT_FLOAT_INFO()", - XSTRING (PRINT_FLOAT_INFO ())); #endif if (GDB_MULTI_ARCH) fprintf_unfiltered (file, - "gdbarch_dump: PRINT_FLOAT_INFO = 0x%08lx\n", - (long) current_gdbarch->print_float_info - /*PRINT_FLOAT_INFO ()*/); -#endif + "gdbarch_dump: print_float_info = 0x%08lx\n", + (long) current_gdbarch->print_float_info); #ifdef PROLOGUE_FRAMELESS_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -3007,7 +3030,7 @@ set_gdbarch_do_registers_info (struct gdbarch *gdbarch, } void -gdbarch_print_float_info (struct gdbarch *gdbarch) +gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame) { gdb_assert (gdbarch != NULL); if (gdbarch->print_float_info == 0) @@ -3015,7 +3038,7 @@ gdbarch_print_float_info (struct gdbarch *gdbarch) "gdbarch: gdbarch_print_float_info invalid"); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_print_float_info called\n"); - gdbarch->print_float_info (); + gdbarch->print_float_info (gdbarch, file, frame); } void @@ -3772,6 +3795,25 @@ set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch->extract_return_value = extract_return_value; } +void +gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_extract_return_value == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_extract_return_value invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_return_value called\n"); + gdbarch->deprecated_extract_return_value (type, regbuf, valbuf); +} + +void +set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, + gdbarch_deprecated_extract_return_value_ftype deprecated_extract_return_value) +{ + gdbarch->deprecated_extract_return_value = deprecated_extract_return_value; +} + CORE_ADDR gdbarch_push_arguments (struct gdbarch *gdbarch, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { @@ -3919,6 +3961,32 @@ set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch->extract_struct_value_address = extract_struct_value_address; } +int +gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->deprecated_extract_struct_value_address != 0; +} + +CORE_ADDR +gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf) +{ + gdb_assert (gdbarch != NULL); + if (gdbarch->deprecated_extract_struct_value_address == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_deprecated_extract_struct_value_address invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n"); + return gdbarch->deprecated_extract_struct_value_address (regbuf); +} + +void +set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, + gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address) +{ + gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address; +} + int gdbarch_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) { @@ -4771,6 +4839,7 @@ set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, struct gdbarch_data { unsigned index; + int init_p; gdbarch_data_init_ftype *init; gdbarch_data_free_ftype *free; }; @@ -4797,6 +4866,7 @@ register_gdbarch_data (gdbarch_data_init_ftype *init, gdbarch_data_free_ftype *free) { struct gdbarch_data_registration **curr; + /* Append the new registraration. */ for (curr = &gdbarch_data_registry.registrations; (*curr) != NULL; curr = &(*curr)->next); @@ -4805,31 +4875,12 @@ register_gdbarch_data (gdbarch_data_init_ftype *init, (*curr)->data = XMALLOC (struct gdbarch_data); (*curr)->data->index = gdbarch_data_registry.nr++; (*curr)->data->init = init; + (*curr)->data->init_p = 1; (*curr)->data->free = free; return (*curr)->data; } -/* Walk through all the registered users initializing each in turn. */ - -static void -init_gdbarch_data (struct gdbarch *gdbarch) -{ - struct gdbarch_data_registration *rego; - for (rego = gdbarch_data_registry.registrations; - rego != NULL; - rego = rego->next) - { - struct gdbarch_data *data = rego->data; - gdb_assert (data->index < gdbarch->nr_data); - if (data->init != NULL) - { - void *pointer = data->init (gdbarch); - set_gdbarch_data (gdbarch, data, pointer); - } - } -} - /* Create/delete the gdbarch data vector. */ static void @@ -4862,7 +4913,7 @@ free_gdbarch_data (struct gdbarch *gdbarch) } -/* Initialize the current value of thee specified per-architecture +/* Initialize the current value of the specified per-architecture data-pointer. */ void @@ -4871,8 +4922,11 @@ set_gdbarch_data (struct gdbarch *gdbarch, void *pointer) { gdb_assert (data->index < gdbarch->nr_data); - if (data->free != NULL && gdbarch->data[data->index] != NULL) - data->free (gdbarch, gdbarch->data[data->index]); + if (gdbarch->data[data->index] != NULL) + { + gdb_assert (data->free != NULL); + data->free (gdbarch, gdbarch->data[data->index]); + } gdbarch->data[data->index] = pointer; } @@ -4883,6 +4937,20 @@ void * gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) { gdb_assert (data->index < gdbarch->nr_data); + /* The data-pointer isn't initialized, call init() to get a value but + only if the architecture initializaiton has completed. Otherwise + punt - hope that the caller knows what they are doing. */ + if (gdbarch->data[data->index] == NULL + && gdbarch->initialized_p) + { + /* Be careful to detect an initialization cycle. */ + gdb_assert (data->init_p); + data->init_p = 0; + gdb_assert (data->init != NULL); + gdbarch->data[data->index] = data->init (gdbarch); + data->init_p = 1; + gdb_assert (gdbarch->data[data->index] != NULL); + } return gdbarch->data[data->index]; } @@ -5276,8 +5344,9 @@ gdbarch_update_p (struct gdbarch_info info) rego->arches = this; } - /* Switch to this new architecture. Dump it out. */ + /* Switch to this new architecture marking it initialized. */ current_gdbarch = new_gdbarch; + current_gdbarch->initialized_p = 1; if (gdbarch_debug) { fprintf_unfiltered (gdb_stdlog, @@ -5296,10 +5365,8 @@ gdbarch_update_p (struct gdbarch_info info) called. */ init_gdbarch_swap (new_gdbarch); - /* Initialize the per-architecture data-pointer of all parties that - registered an interest in this architecture. CURRENT_GDBARCH + /* Initialize the per-architecture data. CURRENT_GDBARCH must be updated before these modules are called. */ - init_gdbarch_data (new_gdbarch); architecture_changed_event (); if (gdbarch_debug) diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index ce3f93c0612..8b2736650cc 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -790,29 +790,16 @@ extern void set_gdbarch_do_registers_info (struct gdbarch *gdbarch, gdbarch_do_r #endif #endif -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (PRINT_FLOAT_INFO) -#define PRINT_FLOAT_INFO() (default_print_float_info ()) -#endif - -typedef void (gdbarch_print_float_info_ftype) (void); -extern void gdbarch_print_float_info (struct gdbarch *gdbarch); +typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame); +extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame); extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (PRINT_FLOAT_INFO) -#error "Non multi-arch definition of PRINT_FLOAT_INFO" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (PRINT_FLOAT_INFO) -#define PRINT_FLOAT_INFO() (gdbarch_print_float_info (current_gdbarch)) -#endif -#endif /* MAP a GDB RAW register number onto a simulator register number. See also include/...-sim.h. */ /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_SIM_REGNO) -#define REGISTER_SIM_REGNO(reg_nr) (default_register_sim_regno (reg_nr)) +#define REGISTER_SIM_REGNO(reg_nr) (legacy_register_sim_regno (reg_nr)) #endif typedef int (gdbarch_register_sim_regno_ftype) (int reg_nr); @@ -1185,18 +1172,19 @@ extern void set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, gdbarch #endif #endif -/* GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the - old code has strange #ifdef interaction. So far no one has found - that default_get_saved_register() is the default they are after. */ +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER) +#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)) +#endif typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) #error "Non multi-arch definition of GET_SAVED_REGISTER" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) #endif #endif @@ -1485,6 +1473,18 @@ extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_e #endif #endif +typedef void (gdbarch_deprecated_extract_return_value_ftype) (struct type *type, char *regbuf, char *valbuf); +extern void gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf); +extern void set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_RETURN_VALUE) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_RETURN_VALUE" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_RETURN_VALUE) +#define DEPRECATED_EXTRACT_RETURN_VALUE(type, regbuf, valbuf) (gdbarch_deprecated_extract_return_value (current_gdbarch, type, regbuf, valbuf)) +#endif +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (PUSH_ARGUMENTS) #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) (default_push_arguments (nargs, args, sp, struct_return, struct_addr)) @@ -1624,6 +1624,43 @@ extern void set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, g #endif #endif +#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */ +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (0) +#endif + +extern int gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (internal_error (__FILE__, __LINE__, "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS"), 0) +#endif + +typedef CORE_ADDR (gdbarch_deprecated_extract_struct_value_address_ftype) (char *regbuf); +extern CORE_ADDR gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, char *regbuf); +extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" +#endif +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regbuf) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regbuf)) +#endif +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (USE_STRUCT_CONVENTION) #define USE_STRUCT_CONVENTION(gcc_p, value_type) (generic_use_struct_convention (gcc_p, value_type)) @@ -1888,7 +1925,7 @@ extern void set_gdbarch_frame_chain (struct gdbarch *gdbarch, gdbarch_frame_chai /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (FRAME_CHAIN_VALID) -#define FRAME_CHAIN_VALID(chain, thisframe) (func_frame_chain_valid (chain, thisframe)) +#define FRAME_CHAIN_VALID(chain, thisframe) (generic_func_frame_chain_valid (chain, thisframe)) #endif typedef int (gdbarch_frame_chain_valid_ftype) (CORE_ADDR chain, struct frame_info *thisframe); @@ -2592,20 +2629,15 @@ extern int gdbarch_update_p (struct gdbarch_info info); for the reserved data-pointer is returned. That identifer should be saved in a local static variable. - The per-architecture data-pointer can be initialized in one of two - ways: The value can be set explicitly using a call to - set_gdbarch_data(); the value can be set implicitly using the value - returned by a non-NULL INIT() callback. INIT(), when non-NULL is - called after the basic architecture vector has been created. + The per-architecture data-pointer is either initialized explicitly + (set_gdbarch_data()) or implicitly (by INIT() via a call to + gdbarch_data()). FREE() is called to delete either an existing + data-pointer overridden by set_gdbarch_data() or when the + architecture object is being deleted. When a previously created architecture is re-selected, the per-architecture data-pointer for that previous architecture is - restored. INIT() is not called. - - During initialization, multiple assignments of the data-pointer are - allowed, non-NULL values are deleted by calling FREE(). If the - architecture is deleted using gdbarch_free() all non-NULL data - pointers are also deleted using FREE(). + restored. INIT() is not re-called. Multiple registrarants for any architecture are allowed (and strongly encouraged). */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index fd5ff659c92..ca3ac330ec0 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -468,10 +468,10 @@ f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_r v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1 f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0 f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0 -f:2:PRINT_FLOAT_INFO:void:print_float_info:void::::default_print_float_info::0 +m:2:PRINT_FLOAT_INFO:void:print_float_info:struct ui_file *file, struct frame_info *frame:file, frame:::default_print_float_info::0 # MAP a GDB RAW register number onto a simulator register number. See # also include/...-sim.h. -f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::default_register_sim_regno::0 +f:2:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::legacy_register_sim_regno::0 F:2:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes::0:0 f:2:CANNOT_FETCH_REGISTER:int:cannot_fetch_register:int regnum:regnum:::cannot_register_not::0 f:2:CANNOT_STORE_REGISTER:int:cannot_store_register:int regnum:regnum:::cannot_register_not::0 @@ -505,10 +505,7 @@ f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:froml v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double::0 -# GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the -# old code has strange #ifdef interaction. So far no one has found -# that default_get_saved_register() is the default they are after. -f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval::generic_get_saved_register:0 +f:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval:::generic_unwind_get_saved_register::0 # f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 @@ -532,6 +529,7 @@ F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf # f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0 f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, char *valbuf:type, regcache, valbuf::0:0 +f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0 f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0 f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0 F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 @@ -540,6 +538,7 @@ f:2:POP_FRAME:void:pop_frame:void:-:::0 f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0 f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, char *valbuf:type, valbuf:::0 F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache:::0 +F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf:::0 f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0 # f:2:FRAME_INIT_SAVED_REGS:void:frame_init_saved_regs:struct frame_info *frame:frame::0:0 @@ -567,7 +566,7 @@ f:2:FRAME_CHAIN:CORE_ADDR:frame_chain:struct frame_info *frame:frame::0:0 # XXXX - both default and alternate frame_chain_valid functions are # deprecated. New code should use dummy frames and one of the generic # functions. -f:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe:::func_frame_chain_valid::0 +f:2:FRAME_CHAIN_VALID:int:frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe:::generic_func_frame_chain_valid::0 f:2:FRAME_SAVED_PC:CORE_ADDR:frame_saved_pc:struct frame_info *fi:fi::0:0 f:2:FRAME_ARGS_ADDRESS:CORE_ADDR:frame_args_address:struct frame_info *fi:fi::0:0 f:2:FRAME_LOCALS_ADDRESS:CORE_ADDR:frame_locals_address:struct frame_info *fi:fi::0:0 @@ -1083,20 +1082,15 @@ extern int gdbarch_update_p (struct gdbarch_info info); for the reserved data-pointer is returned. That identifer should be saved in a local static variable. - The per-architecture data-pointer can be initialized in one of two - ways: The value can be set explicitly using a call to - set_gdbarch_data(); the value can be set implicitly using the value - returned by a non-NULL INIT() callback. INIT(), when non-NULL is - called after the basic architecture vector has been created. + The per-architecture data-pointer is either initialized explicitly + (set_gdbarch_data()) or implicitly (by INIT() via a call to + gdbarch_data()). FREE() is called to delete either an existing + data-pointer overridden by set_gdbarch_data() or when the + architecture object is being deleted. When a previously created architecture is re-selected, the per-architecture data-pointer for that previous architecture is - restored. INIT() is not called. - - During initialization, multiple assignments of the data-pointer are - allowed, non-NULL values are deleted by calling FREE(). If the - architecture is deleted using gdbarch_free() all non-NULL data - pointers are also deleted using FREE(). + restored. INIT() is not re-called. Multiple registrarants for any architecture are allowed (and strongly encouraged). */ @@ -1250,7 +1244,6 @@ cat <next); @@ -1782,31 +1779,12 @@ register_gdbarch_data (gdbarch_data_init_ftype *init, (*curr)->data = XMALLOC (struct gdbarch_data); (*curr)->data->index = gdbarch_data_registry.nr++; (*curr)->data->init = init; + (*curr)->data->init_p = 1; (*curr)->data->free = free; return (*curr)->data; } -/* Walk through all the registered users initializing each in turn. */ - -static void -init_gdbarch_data (struct gdbarch *gdbarch) -{ - struct gdbarch_data_registration *rego; - for (rego = gdbarch_data_registry.registrations; - rego != NULL; - rego = rego->next) - { - struct gdbarch_data *data = rego->data; - gdb_assert (data->index < gdbarch->nr_data); - if (data->init != NULL) - { - void *pointer = data->init (gdbarch); - set_gdbarch_data (gdbarch, data, pointer); - } - } -} - /* Create/delete the gdbarch data vector. */ static void @@ -1839,7 +1817,7 @@ free_gdbarch_data (struct gdbarch *gdbarch) } -/* Initialize the current value of thee specified per-architecture +/* Initialize the current value of the specified per-architecture data-pointer. */ void @@ -1848,8 +1826,11 @@ set_gdbarch_data (struct gdbarch *gdbarch, void *pointer) { gdb_assert (data->index < gdbarch->nr_data); - if (data->free != NULL && gdbarch->data[data->index] != NULL) - data->free (gdbarch, gdbarch->data[data->index]); + if (gdbarch->data[data->index] != NULL) + { + gdb_assert (data->free != NULL); + data->free (gdbarch, gdbarch->data[data->index]); + } gdbarch->data[data->index] = pointer; } @@ -1860,6 +1841,20 @@ void * gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data) { gdb_assert (data->index < gdbarch->nr_data); + /* The data-pointer isn't initialized, call init() to get a value but + only if the architecture initializaiton has completed. Otherwise + punt - hope that the caller knows what they are doing. */ + if (gdbarch->data[data->index] == NULL + && gdbarch->initialized_p) + { + /* Be careful to detect an initialization cycle. */ + gdb_assert (data->init_p); + data->init_p = 0; + gdb_assert (data->init != NULL); + gdbarch->data[data->index] = data->init (gdbarch); + data->init_p = 1; + gdb_assert (gdbarch->data[data->index] != NULL); + } return gdbarch->data[data->index]; } @@ -2253,8 +2248,9 @@ gdbarch_update_p (struct gdbarch_info info) rego->arches = this; } - /* Switch to this new architecture. Dump it out. */ + /* Switch to this new architecture marking it initialized. */ current_gdbarch = new_gdbarch; + current_gdbarch->initialized_p = 1; if (gdbarch_debug) { fprintf_unfiltered (gdb_stdlog, @@ -2273,10 +2269,8 @@ gdbarch_update_p (struct gdbarch_info info) called. */ init_gdbarch_swap (new_gdbarch); - /* Initialize the per-architecture data-pointer of all parties that - registered an interest in this architecture. CURRENT_GDBARCH + /* Initialize the per-architecture data. CURRENT_GDBARCH must be updated before these modules are called. */ - init_gdbarch_data (new_gdbarch); architecture_changed_event (); if (gdbarch_debug) diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 2c8cd3366b4..bc9256b79cd 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -126,6 +126,7 @@ OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \ utils.o \ mem-break.o \ $(DEPFILES) +GDBSERVER_LIBS = @GDBSERVER_LIBS@ # Prevent Sun make from putting in the machine type. Setting # TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1. @@ -231,6 +232,7 @@ MAKEOVERRIDES= ## with no dependencies and no actions. unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET : +gdb_proc_service_h = $(srcdir)/../gdb_proc_service.h $(srcdir)/../gregset.h regdat_sh = $(srcdir)/../regformats/regdat.sh regdef_h = $(srcdir)/../regformats/regdef.h regcache_h = $(srcdir)/regcache.h @@ -239,10 +241,12 @@ server_h = $(srcdir)/server.h $(regcache_h) config.h $(srcdir)/target.h \ inferiors.o: inferiors.c $(server_h) mem-break.o: mem-break.c $(server_h) +proc-service.o: proc-service.c $(server_h) $(gdb_proc_service_h) regcache.o: regcache.c $(server_h) $(regdef_h) remote-utils.o: remote-utils.c terminal.h $(server_h) server.o: server.c $(server_h) target.o: target.c $(server_h) +thread-db.o: thread-db.c $(server_h) $(gdb_proc_service_h) utils.o: utils.c $(server_h) signals.o: ../signals/signals.c $(server_h) @@ -253,6 +257,8 @@ i387-fp.o: i387-fp.c $(server_h) linux_low_h = $(srcdir)/linux-low.h linux-low.o: linux-low.c $(linux_low_h) $(server_h) + $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< @USE_THREAD_DB@ + linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h) linux-i386-low.o: linux-i386-low.c $(linux_low_h) $(server_h) linux-ia64-low.o: linux-ia64-low.c $(linux_low_h) $(server_h) diff --git a/gdb/gdbserver/acconfig.h b/gdb/gdbserver/acconfig.h index 968feb8b436..f0464b0a280 100644 --- a/gdb/gdbserver/acconfig.h +++ b/gdb/gdbserver/acconfig.h @@ -7,3 +7,18 @@ /* Define if the target supports PTRACE_GETFPXREGS for extended register access. */ #undef HAVE_PTRACE_GETFPXREGS + +/* Define if has prgregset_t. */ +#undef HAVE_PRGREGSET_T + +/* Define if has prfpregset_t. */ +#undef HAVE_PRFPREGSET_T + +/* Define if has lwpid_t. */ +#undef HAVE_LWPID_T + +/* Define if has psaddr_t. */ +#undef HAVE_PSADDR_T + +/* Define if the prfpregset_t type is broken. */ +#undef PRFPREGSET_T_BROKEN diff --git a/gdb/gdbserver/aclocal.m4 b/gdb/gdbserver/aclocal.m4 index 24b9ced2835..2fc6cf883da 100644 --- a/gdb/gdbserver/aclocal.m4 +++ b/gdb/gdbserver/aclocal.m4 @@ -10,91 +10,45 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. +dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE. +sinclude(../../bfd/acinclude.m4) -# serial 1 +AC_DEFUN([SRV_CHECK_THREAD_DB], +[AC_CACHE_CHECK([for libthread_db],[srv_cv_thread_db], + [old_LIBS="$LIBS" + LIBS="$LIBS -lthread_db" + AC_TRY_LINK( + [void ps_pglobal_lookup() {} + void ps_pdread() {} + void ps_pdwrite() {} + void ps_lgetregs() {} + void ps_lsetregs() {} + void ps_lgetfpregs() {} + void ps_lsetfpregs() {} + void ps_getpid() {}], + [td_ta_new();], + [srv_cv_thread_db="-lthread_db"], + [srv_cv_thread_db=no -# @defmac AC_PROG_CC_STDC -# @maindex PROG_CC_STDC -# @ovindex CC -# If the C compiler in not in ANSI C mode by default, try to add an option -# to output variable @code{CC} to make it so. This macro tries various -# options that select ANSI C on some system or another. It considers the -# compiler to be in ANSI C mode if it handles function prototypes correctly. -# -# If you use this macro, you should check after calling it whether the C -# compiler has been set to accept ANSI C; if not, the shell variable -# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source -# code in ANSI C, you can make an un-ANSIfied copy of it by using the -# program @code{ansi2knr}, which comes with Ghostscript. -# @end defmac - -AC_DEFUN(AM_PROG_CC_STDC, -[AC_REQUIRE([AC_PROG_CC]) -AC_BEFORE([$0], [AC_C_INLINE]) -AC_BEFORE([$0], [AC_C_CONST]) -dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require -dnl a magic option to avoid problems with ANSI preprocessor commands -dnl like #elif. -dnl FIXME: can't do this because then AC_AIX won't work due to a -dnl circular dependency. -dnl AC_BEFORE([$0], [AC_PROG_CPP]) -AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) -AC_CACHE_VAL(am_cv_prog_cc_stdc, -[am_cv_prog_cc_stdc=no -ac_save_CC="$CC" -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - AC_TRY_COMPILE( -[#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -], [ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -], -[am_cv_prog_cc_stdc="$ac_arg"; break]) -done -CC="$ac_save_CC" -]) -if test -z "$am_cv_prog_cc_stdc"; then - AC_MSG_RESULT([none needed]) -else - AC_MSG_RESULT($am_cv_prog_cc_stdc) -fi -case "x$am_cv_prog_cc_stdc" in - x|xno) ;; - *) CC="$CC $am_cv_prog_cc_stdc" ;; -esac -]) + if test "$prefix" = "/usr" || test "$prefix" = "NONE"; then + thread_db="/lib/libthread_db.so.1" + else + thread_db='$prefix/lib/libthread_db.so.1' + fi + LIBS="$old_LIBS `eval echo "$thread_db"`" + AC_TRY_LINK( + [void ps_pglobal_lookup() {} + void ps_pdread() {} + void ps_pdwrite() {} + void ps_lgetregs() {} + void ps_lsetregs() {} + void ps_lgetfpregs() {} + void ps_lsetfpregs() {} + void ps_getpid() {}], + [td_ta_new();], + [srv_cv_thread_db="$thread_db"], + [srv_cv_thread_db=no]) + LIBS="$old_LIBS" + ]]) +)]) diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index 9d553f220be..cdaeb8dfe39 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -1,4 +1,4 @@ -/* config.in. Generated automatically from configure.in by autoheader 2.13. */ +/* config.in. Generated automatically from configure.in by autoheader. */ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -13,12 +13,24 @@ register access. */ #undef HAVE_PTRACE_GETFPXREGS +/* Define if the prfpregset_t type is broken. */ +#undef PRFPREGSET_T_BROKEN + +/* Define if you have the header file. */ +#undef HAVE_LINUX_ELF_H + +/* Define if you have the header file. */ +#undef HAVE_PROC_SERVICE_H + /* Define if you have the header file. */ #undef HAVE_SGTTY_H /* Define if you have the header file. */ #undef HAVE_STRING_H +/* Define if you have the header file. */ +#undef HAVE_SYS_PROCFS_H + /* Define if you have the header file. */ #undef HAVE_SYS_REG_H @@ -27,3 +39,22 @@ /* Define if you have the header file. */ #undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_THREAD_DB_H + +/* Define if has lwpid_t. */ +#undef HAVE_LWPID_T + +/* Define if has psaddr_t. */ +#undef HAVE_PSADDR_T + +/* Define if has prgregset_t. */ +#undef HAVE_PRGREGSET_T + +/* Define if has prfpregset_t. */ +#undef HAVE_PRFPREGSET_T + +/* Define if has elf_fpregset_t. */ +#undef HAVE_ELF_FPREGSET_T + diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index 758d48383f1..d2575c0cc92 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -28,6 +28,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -142,6 +143,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -312,6 +314,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -477,12 +484,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -526,7 +537,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:530: checking for $ac_word" >&5 +echo "configure:541: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -556,7 +567,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:560: checking for $ac_word" >&5 +echo "configure:571: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -607,7 +618,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:611: checking for $ac_word" >&5 +echo "configure:622: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -639,7 +650,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:643: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:654: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -650,12 +661,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 654 "configure" +#line 665 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -681,12 +692,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:696: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:690: checking whether we are using GNU C" >&5 +echo "configure:701: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -695,7 +706,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -714,7 +725,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:718: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:729: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -793,7 +804,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:797: checking host system type" >&5 +echo "configure:808: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -814,7 +825,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:818: checking target system type" >&5 +echo "configure:829: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -832,7 +843,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:836: checking build system type" >&5 +echo "configure:847: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -867,7 +878,7 @@ test "$host_alias" != "$target_alias" && # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:871: checking for a BSD compatible install" >&5 +echo "configure:882: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -921,7 +932,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:925: checking how to run the C preprocessor" >&5 +echo "configure:936: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -936,13 +947,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:957: \"$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 : @@ -953,13 +964,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:974: \"$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 : @@ -970,13 +981,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:991: \"$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 : @@ -1001,12 +1012,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1005: checking for ANSI C header files" >&5 +echo "configure:1016: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1014,7 +1025,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1029: \"$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* @@ -1031,7 +1042,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1049,7 +1060,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1070,7 +1081,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1081,7 +1092,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1105,21 +1116,21 @@ EOF fi -for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h +for ac_hdr in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1113: checking for $ac_hdr" >&5 +echo "configure:1124: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1134: \"$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* @@ -1157,19 +1168,19 @@ fi if test "${srv_linux_regsets}" = "yes"; then echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:1161: checking for PTRACE_GETREGS" >&5 +echo "configure:1172: checking for PTRACE_GETREGS" >&5 if eval "test \"`echo '$''{'gdbsrv_cv_have_ptrace_getregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { PTRACE_GETREGS; ; return 0; } EOF -if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdbsrv_cv_have_ptrace_getregs=yes else @@ -1190,19 +1201,19 @@ EOF fi echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:1194: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:1205: checking for PTRACE_GETFPXREGS" >&5 if eval "test \"`echo '$''{'gdbsrv_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { PTRACE_GETFPXREGS; ; return 0; } EOF -if { (eval echo configure:1206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdbsrv_cv_have_ptrace_getfpxregs=yes else @@ -1223,7 +1234,328 @@ EOF fi fi -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj" +if test "$ac_cv_header_sys_procfs_h" = yes; then + echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1240: checking for lwpid_t in sys/procfs.h" >&5 + if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +lwpid_t avar +; return 0; } +EOF +if { (eval echo configure:1254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_have_sys_procfs_type_lwpid_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_have_sys_procfs_type_lwpid_t=no + +fi +rm -f conftest* +fi + + if test $bfd_cv_have_sys_procfs_type_lwpid_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LWPID_T 1 +EOF + + fi + echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6 + + echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1276: checking for psaddr_t in sys/procfs.h" >&5 + if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +psaddr_t avar +; return 0; } +EOF +if { (eval echo configure:1290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_have_sys_procfs_type_psaddr_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_have_sys_procfs_type_psaddr_t=no + +fi +rm -f conftest* +fi + + if test $bfd_cv_have_sys_procfs_type_psaddr_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PSADDR_T 1 +EOF + + fi + echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6 + + echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1312: checking for prgregset_t in sys/procfs.h" >&5 + if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +prgregset_t avar +; return 0; } +EOF +if { (eval echo configure:1326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_have_sys_procfs_type_prgregset_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_have_sys_procfs_type_prgregset_t=no + +fi +rm -f conftest* +fi + + if test $bfd_cv_have_sys_procfs_type_prgregset_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PRGREGSET_T 1 +EOF + + fi + echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6 + + echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1348: checking for prfpregset_t in sys/procfs.h" >&5 + if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +prfpregset_t avar +; return 0; } +EOF +if { (eval echo configure:1362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_have_sys_procfs_type_prfpregset_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_have_sys_procfs_type_prfpregset_t=no + +fi +rm -f conftest* +fi + + if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PRFPREGSET_T 1 +EOF + + fi + echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6 + + + + + if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then + echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6 +echo "configure:1388: checking whether prfpregset_t type is broken" >&5 + if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + gdb_cv_prfpregset_t_broken=yes +else + cat > conftest.$ac_ext < + int main () + { + if (sizeof (prfpregset_t) == sizeof (void *)) + return 1; + return 0; + } +EOF +if { (eval echo configure:1406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + gdb_cv_prfpregset_t_broken=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + gdb_cv_prfpregset_t_broken=yes +fi +rm -fr conftest* +fi + +fi + + echo "$ac_t""$gdb_cv_prfpregset_t_broken" 1>&6 + if test $gdb_cv_prfpregset_t_broken = yes; then + cat >> confdefs.h <<\EOF +#define PRFPREGSET_T_BROKEN 1 +EOF + + fi + fi + + echo $ac_n "checking for elf_fpregset_t in sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1430: checking for elf_fpregset_t in sys/procfs.h" >&5 + if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_elf_fpregset_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +elf_fpregset_t avar +; return 0; } +EOF +if { (eval echo configure:1444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_have_sys_procfs_type_elf_fpregset_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bfd_cv_have_sys_procfs_type_elf_fpregset_t=no + +fi +rm -f conftest* +fi + + if test $bfd_cv_have_sys_procfs_type_elf_fpregset_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ELF_FPREGSET_T 1 +EOF + + fi + echo "$ac_t""$bfd_cv_have_sys_procfs_type_elf_fpregset_t" 1>&6 + +fi + +srv_thread_depfiles= +srv_libs= +USE_THREAD_DB= + +if test "$srv_linux_thread_db" = "yes"; then + echo $ac_n "checking for libthread_db""... $ac_c" 1>&6 +echo "configure:1473: checking for libthread_db" >&5 +if eval "test \"`echo '$''{'srv_cv_thread_db'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + old_LIBS="$LIBS" + LIBS="$LIBS -lthread_db" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + srv_cv_thread_db="-lthread_db" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + srv_cv_thread_db=no + + if test "$prefix" = "/usr" || test "$prefix" = "NONE"; then + thread_db="/lib/libthread_db.so.1" + else + thread_db='$prefix/lib/libthread_db.so.1' + fi + LIBS="$old_LIBS `eval echo "$thread_db"`" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + srv_cv_thread_db="$thread_db" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + srv_cv_thread_db=no +fi +rm -f conftest* + LIBS="$old_LIBS" + +fi + +echo "$ac_t""$srv_cv_thread_db" 1>&6 + +fi +rm -f conftest* + if test "$srv_cv_thread_db" = no; then + echo "configure: warning: Could not find libthread_db." 1>&2 + echo "configure: warning: Disabling thread support in gdbserver." 1>&2 + srv_linux_thread_db=no + else + srv_libs="$srv_cv_thread_db" + fi +fi + +if test "$srv_linux_thread_db" = "yes"; then + srv_thread_depfiles="thread-db.o proc-service.o" + USE_THREAD_DB="-DUSE_THREAD_DB" +fi + +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" +GDBSERVER_LIBS="$srv_libs" + + @@ -1381,6 +1713,8 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CPP@%$CPP%g s%@GDBSERVER_DEPFILES@%$GDBSERVER_DEPFILES%g +s%@GDBSERVER_LIBS@%$GDBSERVER_LIBS%g +s%@USE_THREAD_DB@%$USE_THREAD_DB%g CEOF EOF diff --git a/gdb/gdbserver/configure.in b/gdb/gdbserver/configure.in index db7e301934b..7c94d408adf 100644 --- a/gdb/gdbserver/configure.in +++ b/gdb/gdbserver/configure.in @@ -30,7 +30,8 @@ AC_PROG_INSTALL AC_HEADER_STDC -AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h) +AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl + proc_service.h sys/procfs.h thread_db.h linux/elf.h) . ${srcdir}/configure.srv @@ -62,9 +63,67 @@ if test "${srv_linux_regsets}" = "yes"; then fi fi -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj" +if test "$ac_cv_header_sys_procfs_h" = yes; then + BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) + BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) + BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) + BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t) + + dnl Check for broken prfpregset_t type + + dnl For Linux/i386, glibc 2.1.3 was released with a bogus + dnl prfpregset_t type (it's a typedef for the pointer to a struct + dnl instead of the struct itself). We detect this here, and work + dnl around it in gdb_proc_service.h. + + if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then + AC_MSG_CHECKING(whether prfpregset_t type is broken) + AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, + [AC_TRY_RUN([#include + int main () + { + if (sizeof (prfpregset_t) == sizeof (void *)) + return 1; + return 0; + }], + gdb_cv_prfpregset_t_broken=no, + gdb_cv_prfpregset_t_broken=yes, + gdb_cv_prfpregset_t_broken=yes)]) + AC_MSG_RESULT($gdb_cv_prfpregset_t_broken) + if test $gdb_cv_prfpregset_t_broken = yes; then + AC_DEFINE(PRFPREGSET_T_BROKEN) + fi + fi + + BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t) +fi + +srv_thread_depfiles= +srv_libs= +USE_THREAD_DB= + +if test "$srv_linux_thread_db" = "yes"; then + SRV_CHECK_THREAD_DB + if test "$srv_cv_thread_db" = no; then + AC_WARN([Could not find libthread_db.]) + AC_WARN([Disabling thread support in gdbserver.]) + srv_linux_thread_db=no + else + srv_libs="$srv_cv_thread_db" + fi +fi + +if test "$srv_linux_thread_db" = "yes"; then + srv_thread_depfiles="thread-db.o proc-service.o" + USE_THREAD_DB="-DUSE_THREAD_DB" +fi + +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" +GDBSERVER_LIBS="$srv_libs" AC_SUBST(GDBSERVER_DEPFILES) +AC_SUBST(GDBSERVER_LIBS) +AC_SUBST(USE_THREAD_DB) AC_OUTPUT(Makefile, [case x$CONFIG_HEADERS in diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 3268cd77207..28dc2aad1f6 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -21,11 +21,13 @@ case "${target}" in arm*-*-linux*) srv_regobj=reg-arm.o srv_tgtobj="linux-low.o linux-arm-low.o" srv_linux_usrregs=yes + srv_linux_thread_db=yes ;; i[3456]86-*-linux*) srv_regobj=reg-i386-linux.o srv_tgtobj="linux-low.o linux-i386-low.o i387-fp.o" srv_linux_usrregs=yes srv_linux_regsets=yes + srv_linux_thread_db=yes ;; ia64-*-linux*) srv_regobj=reg-ia64.o srv_tgtobj="linux-low.o linux-ia64-low.o" @@ -38,10 +40,12 @@ case "${target}" in mips*-*-linux*) srv_regobj=reg-mips.o srv_tgtobj="linux-low.o linux-mips-low.o" srv_linux_usrregs=yes + srv_linux_thread_db=yes ;; powerpc*-*-linux*) srv_regobj=reg-ppc.o srv_tgtobj="linux-low.o linux-ppc-low.o" srv_linux_usrregs=yes + srv_linux_thread_db=yes ;; s390-*-linux*) srv_regobj=reg-s390.o srv_tgtobj="linux-low.o linux-s390-low.o" @@ -54,6 +58,7 @@ case "${target}" in sh*-*-linux*) srv_regobj=reg-sh.o srv_tgtobj="linux-low.o linux-sh-low.o" srv_linux_usrregs=yes + srv_linux_thread_db=yes ;; x86_64-*-linux*) srv_regobj=reg-x86-64.o srv_tgtobj="linux-low.o linux-x86-64-low.o i387-fp.o" diff --git a/gdb/gdbserver/i387-fp.c b/gdb/gdbserver/i387-fp.c index 3d1d6a6fd5c..19a9929debc 100644 --- a/gdb/gdbserver/i387-fp.c +++ b/gdb/gdbserver/i387-fp.c @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include "server.h" +#include "i387-fp.h" int num_xmm_registers = 8; @@ -108,7 +109,7 @@ i387_cache_to_fsave (void *buf) } void -i387_fsave_to_cache (void *buf) +i387_fsave_to_cache (const void *buf) { struct i387_fsave *fp = (struct i387_fsave *) buf; int i; @@ -240,7 +241,7 @@ i387_ftag (struct i387_fxsave *fp, int regno) } void -i387_fxsave_to_cache (void *buf) +i387_fxsave_to_cache (const void *buf) { struct i387_fxsave *fp = (struct i387_fxsave *) buf; int i, top; @@ -287,4 +288,3 @@ i387_fxsave_to_cache (void *buf) val = (fp->fop) & 0x7FF; supply_register_by_name ("fop", &val); } - diff --git a/gdb/gdbserver/i387-fp.h b/gdb/gdbserver/i387-fp.h index 90fe4ca6eb7..d28c4228830 100644 --- a/gdb/gdbserver/i387-fp.h +++ b/gdb/gdbserver/i387-fp.h @@ -23,10 +23,10 @@ #define I387_FP_H void i387_cache_to_fsave (void *buf); -void i387_fsave_to_cache (void *buf); +void i387_fsave_to_cache (const void *buf); void i387_cache_to_fxsave (void *buf); -void i387_fxsave_to_cache (void *buf); +void i387_fxsave_to_cache (const void *buf); extern int num_xmm_registers; diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 774798deae3..68c91c4efa9 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -25,81 +25,175 @@ #include "server.h" -struct inferior_info +struct thread_info { - int pid; + struct inferior_list_entry entry; void *target_data; void *regcache_data; - struct inferior_info *next; }; -static struct inferior_info *inferiors; -struct inferior_info *current_inferior; -int signal_pid; +struct inferior_list all_threads; + +struct thread_info *current_inferior; + +#define get_thread(inf) ((struct thread_info *)(inf)) + +void +add_inferior_to_list (struct inferior_list *list, + struct inferior_list_entry *new_inferior) +{ + new_inferior->next = NULL; + if (list->tail != NULL) + list->tail->next = new_inferior; + else + list->head = new_inferior; + list->tail = new_inferior; +} + +void +for_each_inferior (struct inferior_list *list, + void (*action) (struct inferior_list_entry *)) +{ + struct inferior_list_entry *cur = list->head, *next; + + while (cur != NULL) + { + next = cur->next; + (*action) (cur); + cur = next; + } +} void -add_inferior (int pid) +change_inferior_id (struct inferior_list *list, + int new_id) { - struct inferior_info *new_inferior - = (struct inferior_info *) malloc (sizeof (*new_inferior)); + if (list->head != list->tail) + error ("tried to change thread ID after multiple threads are created"); - memset (new_inferior, 0, sizeof (*new_inferior)); + list->head->id = new_id; +} - new_inferior->pid = pid; +void +remove_inferior (struct inferior_list *list, + struct inferior_list_entry *entry) +{ + struct inferior_list_entry **cur; - new_inferior->next = inferiors; - inferiors = new_inferior; + if (list->head == entry) + { + list->head = entry->next; + if (list->tail == entry) + list->tail = list->head; + return; + } + + cur = &list->head; + while (*cur && (*cur)->next != entry) + cur = &(*cur)->next; + + if (*cur == NULL) + return; + (*cur)->next = entry->next; + + if (list->tail == entry) + list->tail = *cur; +} + +void +add_thread (int thread_id, void *target_data) +{ + struct thread_info *new_thread + = (struct thread_info *) malloc (sizeof (*new_thread)); + + memset (new_thread, 0, sizeof (*new_thread)); + + new_thread->entry.id = thread_id; + + add_inferior_to_list (&all_threads, & new_thread->entry); + if (current_inferior == NULL) - current_inferior = inferiors; + current_inferior = new_thread; - create_register_cache (new_inferior); + new_thread->target_data = target_data; + set_inferior_regcache_data (new_thread, new_register_cache ()); +} - if (signal_pid == 0) - signal_pid = pid; +static void +free_one_thread (struct inferior_list_entry *inf) +{ + struct thread_info *thread = get_thread (inf); + free_register_cache (inferior_regcache_data (thread)); + free (thread); +} + +void +remove_thread (struct thread_info *thread) +{ + remove_inferior (&all_threads, (struct inferior_list_entry *) thread); + free_one_thread (&thread->entry); } void clear_inferiors (void) { - struct inferior_info *inf = inferiors, *next_inf; + for_each_inferior (&all_threads, free_one_thread); + + all_threads.head = all_threads.tail = NULL; +} + +struct inferior_list_entry * +find_inferior (struct inferior_list *list, + int (*func) (struct inferior_list_entry *, void *), void *arg) +{ + struct inferior_list_entry *inf = list->head; - while (inf) + while (inf != NULL) { - next_inf = inf->next; + if ((*func) (inf, arg)) + return inf; + inf = inf->next; + } - if (inf->target_data) - free (inf->target_data); - if (inf->regcache_data) - free_register_cache (inf); + return NULL; +} - free (inf); - inf = next_inf; +struct inferior_list_entry * +find_inferior_id (struct inferior_list *list, int id) +{ + struct inferior_list_entry *inf = list->head; + + while (inf != NULL) + { + if (inf->id == id) + return inf; + inf = inf->next; } - inferiors = NULL; + return NULL; } void * -inferior_target_data (struct inferior_info *inferior) +inferior_target_data (struct thread_info *inferior) { return inferior->target_data; } void -set_inferior_target_data (struct inferior_info *inferior, void *data) +set_inferior_target_data (struct thread_info *inferior, void *data) { inferior->target_data = data; } void * -inferior_regcache_data (struct inferior_info *inferior) +inferior_regcache_data (struct thread_info *inferior) { return inferior->regcache_data; } void -set_inferior_regcache_data (struct inferior_info *inferior, void *data) +set_inferior_regcache_data (struct thread_info *inferior, void *data) { inferior->regcache_data = data; } diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 2958fdf3129..07e2792837c 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -45,9 +45,49 @@ arm_cannot_fetch_register (int regno) return (regno >= arm_num_regs); } +static CORE_ADDR +arm_get_pc () +{ + unsigned long pc; + collect_register_by_name ("pc", &pc); + return pc; +} + +static void +arm_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. We do not support Thumb yet. */ +static const unsigned long arm_breakpoint = 0xef9f0001; +#define arm_breakpoint_len 4 + +static int +arm_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == arm_breakpoint) + return 1; + + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + struct linux_target_ops the_low_target = { arm_num_regs, arm_regmap, arm_cannot_fetch_register, arm_cannot_store_register, + arm_get_pc, + arm_set_pc, + (const char *) &arm_breakpoint, + arm_breakpoint_len, + NULL, + 0, + arm_breakpoint_at, }; diff --git a/gdb/gdbserver/linux-i386-low.c b/gdb/gdbserver/linux-i386-low.c index 71264321341..b79b601ae8f 100644 --- a/gdb/gdbserver/linux-i386-low.c +++ b/gdb/gdbserver/linux-i386-low.c @@ -72,7 +72,7 @@ i386_fill_gregset (void *buf) } static void -i386_store_gregset (void *buf) +i386_store_gregset (const void *buf) { int i; @@ -89,7 +89,7 @@ i386_fill_fpregset (void *buf) } static void -i386_store_fpregset (void *buf) +i386_store_fpregset (const void *buf) { i387_fsave_to_cache (buf); } @@ -101,7 +101,7 @@ i386_fill_fpxregset (void *buf) } static void -i386_store_fpxregset (void *buf) +i386_store_fpxregset (const void *buf) { i387_fxsave_to_cache (buf); } @@ -109,14 +109,17 @@ i386_store_fpxregset (void *buf) struct regset_info target_regsets[] = { { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), + GENERAL_REGS, i386_fill_gregset, i386_store_gregset }, #ifdef HAVE_PTRACE_GETFPXREGS { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t), + EXTENDED_REGS, i386_fill_fpxregset, i386_store_fpxregset }, #endif { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), + FP_REGS, i386_fill_fpregset, i386_store_fpregset }, - { 0, 0, -1, NULL, NULL } + { 0, 0, -1, -1, NULL, NULL } }; #endif /* HAVE_LINUX_REGSETS */ @@ -124,25 +127,38 @@ struct regset_info target_regsets[] = { static const char i386_breakpoint[] = { 0xCC }; #define i386_breakpoint_len 1 +extern int debug_threads; + static CORE_ADDR -i386_stop_pc () +i386_get_pc () { unsigned long pc; - /* Overkill */ - fetch_inferior_registers (0); - collect_register_by_name ("eip", &pc); - return pc - 1; + + if (debug_threads) + fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc); + return pc; } static void i386_set_pc (CORE_ADDR newpc) { + if (debug_threads) + fprintf (stderr, "set pc to %08lx\n", (long) newpc); supply_register_by_name ("eip", &newpc); +} + +static int +i386_breakpoint_at (CORE_ADDR pc) +{ + unsigned char c; + + read_inferior_memory (pc, &c, 1); + if (c == 0xCC) + return 1; - /* Overkill */ - store_inferior_registers (0); + return 0; } struct linux_target_ops the_low_target = { @@ -150,8 +166,11 @@ struct linux_target_ops the_low_target = { i386_regmap, i386_cannot_fetch_register, i386_cannot_store_register, - i386_stop_pc, + i386_get_pc, i386_set_pc, i386_breakpoint, i386_breakpoint_len, + NULL, + 1, + i386_breakpoint_at, }; diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 6cfe0d5aea5..c272fed2142 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -35,9 +35,32 @@ #include #include -static CORE_ADDR linux_bp_reinsert; +/* ``all_threads'' is keyed by the LWP ID - it should be the thread ID instead, + however. This requires changing the ID in place when we go from !using_threads + to using_threads, immediately. + ``all_processes'' is keyed by the process ID - which on Linux is (presently) + the same as the LWP ID. */ + +struct inferior_list all_processes; + +/* FIXME this is a bit of a hack, and could be removed. */ +int stopping_threads; + +/* FIXME make into a target method? */ +int using_threads; + +static void linux_resume_one_process (struct inferior_list_entry *entry, + int step, int signal); static void linux_resume (int step, int signal); +static void stop_all_processes (void); +static int linux_wait_for_event (struct thread_info *child); + +struct pending_signals +{ + int signal; + struct pending_signals *prev; +}; #define PTRACE_ARG3_TYPE long #define PTRACE_XFER_TYPE long @@ -48,12 +71,64 @@ static int use_regsets_p = 1; extern int errno; -static int inferior_pid; +int debug_threads = 0; + +#define pid_of(proc) ((proc)->head.id) + +/* FIXME: Delete eventually. */ +#define inferior_pid (pid_of (get_thread_process (current_inferior))) + +/* This function should only be called if the process got a SIGTRAP. + The SIGTRAP could mean several things. + + On i386, where decr_pc_after_break is non-zero: + If we were single-stepping this process using PTRACE_SINGLESTEP, + we will get only the one SIGTRAP (even if the instruction we + stepped over was a breakpoint). The value of $eip will be the + next instruction. + If we continue the process using PTRACE_CONT, we will get a + SIGTRAP when we hit a breakpoint. The value of $eip will be + the instruction after the breakpoint (i.e. needs to be + decremented). If we report the SIGTRAP to GDB, we must also + report the undecremented PC. If we cancel the SIGTRAP, we + must resume at the decremented PC. + + (Presumably, not yet tested) On a non-decr_pc_after_break machine + with hardware or kernel single-step: + If we single-step over a breakpoint instruction, our PC will + point at the following instruction. If we continue and hit a + breakpoint instruction, our PC will point at the breakpoint + instruction. */ + +static CORE_ADDR +get_stop_pc (void) +{ + CORE_ADDR stop_pc = (*the_low_target.get_pc) (); + + if (get_thread_process (current_inferior)->stepping) + return stop_pc; + else + return stop_pc - the_low_target.decr_pc_after_break; +} -struct inferior_linux_data +static void * +add_process (int pid) { - int pid; -}; + struct process_info *process; + + process = (struct process_info *) malloc (sizeof (*process)); + memset (process, 0, sizeof (*process)); + + process->head.id = pid; + + /* Default to tid == lwpid == pid. */ + process->tid = pid; + process->lwpid = pid; + + add_inferior_to_list (&all_processes, &process->head); + + return process; +} /* Start an inferior process and returns its pid. ALLARGS is a vector of program-name and args. */ @@ -61,7 +136,7 @@ struct inferior_linux_data static int linux_create_inferior (char *program, char **allargs) { - struct inferior_linux_data *tdata; + void *new_process; int pid; pid = fork (); @@ -72,6 +147,8 @@ linux_create_inferior (char *program, char **allargs) { ptrace (PTRACE_TRACEME, 0, 0, 0); + signal (SIGRTMIN + 1, SIG_DFL); + execv (program, allargs); fprintf (stderr, "Cannot exec %s: %s.\n", program, @@ -80,22 +157,18 @@ linux_create_inferior (char *program, char **allargs) _exit (0177); } - add_inferior (pid); - tdata = (struct inferior_linux_data *) malloc (sizeof (*tdata)); - tdata->pid = pid; - set_inferior_target_data (current_inferior, tdata); + new_process = add_process (pid); + add_thread (pid, new_process); - /* FIXME remove */ - inferior_pid = pid; return 0; } /* Attach to an inferior process. */ -static int -linux_attach (int pid) +void +linux_attach_lwp (int pid, int tid) { - struct inferior_linux_data *tdata; + struct process_info *new_process; if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0) { @@ -103,143 +176,712 @@ linux_attach (int pid) errno < sys_nerr ? sys_errlist[errno] : "unknown error", errno); fflush (stderr); - _exit (0177); + + /* If we fail to attach to an LWP, just return. */ + if (!using_threads) + _exit (0177); + return; } - add_inferior (pid); - tdata = (struct inferior_linux_data *) malloc (sizeof (*tdata)); - tdata->pid = pid; - set_inferior_target_data (current_inferior, tdata); + new_process = (struct process_info *) add_process (pid); + add_thread (tid, new_process); + + /* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH + brings it to a halt. We should ignore that SIGSTOP and resume the process + (unless this is the first process, in which case the flag will be cleared + in linux_attach). + + On the other hand, if we are currently trying to stop all threads, we + should treat the new thread as if we had sent it a SIGSTOP. This works + because we are guaranteed that add_process added us to the end of the + list, and so the new thread has not yet reached wait_for_sigstop (but + will). */ + if (! stopping_threads) + new_process->stop_expected = 1; +} + +int +linux_attach (int pid) +{ + struct process_info *process; + + linux_attach_lwp (pid, pid); + + /* Don't ignore the initial SIGSTOP if we just attached to this process. */ + process = (struct process_info *) find_inferior_id (&all_processes, pid); + process->stop_expected = 0; + return 0; } /* Kill the inferior process. Make us have no inferior. */ static void -linux_kill (void) +linux_kill_one_process (struct inferior_list_entry *entry) { - if (inferior_pid == 0) - return; - ptrace (PTRACE_KILL, inferior_pid, 0, 0); - wait (0); - clear_inferiors (); + struct thread_info *thread = (struct thread_info *) entry; + struct process_info *process = get_thread_process (thread); + int wstat; + + do + { + ptrace (PTRACE_KILL, pid_of (process), 0, 0); + + /* Make sure it died. The loop is most likely unnecessary. */ + wstat = linux_wait_for_event (thread); + } while (WIFSTOPPED (wstat)); } /* Return nonzero if the given thread is still alive. */ +static void +linux_kill (void) +{ + for_each_inferior (&all_threads, linux_kill_one_process); +} + +static int +linux_thread_alive (int tid) +{ + if (find_inferior_id (&all_threads, tid) != NULL) + return 1; + else + return 0; +} + +/* Return nonzero if this process stopped at a breakpoint which + no longer appears to be inserted. Also adjust the PC + appropriately to resume where the breakpoint used to be. */ static int -linux_thread_alive (int pid) +check_removed_breakpoint (struct process_info *event_child) { + CORE_ADDR stop_pc; + struct thread_info *saved_inferior; + + if (event_child->pending_is_breakpoint == 0) + return 0; + + if (debug_threads) + fprintf (stderr, "Checking for breakpoint.\n"); + + saved_inferior = current_inferior; + current_inferior = get_process_thread (event_child); + + stop_pc = get_stop_pc (); + + /* If the PC has changed since we stopped, then we shouldn't do + anything. This happens if, for instance, GDB handled the + decr_pc_after_break subtraction itself. */ + if (stop_pc != event_child->pending_stop_pc) + { + if (debug_threads) + fprintf (stderr, "Ignoring, PC was changed.\n"); + + event_child->pending_is_breakpoint = 0; + current_inferior = saved_inferior; + return 0; + } + + /* If the breakpoint is still there, we will report hitting it. */ + if ((*the_low_target.breakpoint_at) (stop_pc)) + { + if (debug_threads) + fprintf (stderr, "Ignoring, breakpoint is still present.\n"); + current_inferior = saved_inferior; + return 0; + } + + if (debug_threads) + fprintf (stderr, "Removed breakpoint.\n"); + + /* For decr_pc_after_break targets, here is where we perform the + decrement. We go immediately from this function to resuming, + and can not safely call get_stop_pc () again. */ + if (the_low_target.set_pc != NULL) + (*the_low_target.set_pc) (stop_pc); + + /* We consumed the pending SIGTRAP. */ + event_child->status_pending_p = 0; + event_child->status_pending = 0; + + current_inferior = saved_inferior; return 1; } +/* Return 1 if this process has an interesting status pending. This function + may silently resume an inferior process. */ static int -linux_wait_for_one_inferior (struct inferior_info *child) +status_pending_p (struct inferior_list_entry *entry, void *dummy) +{ + struct process_info *process = (struct process_info *) entry; + + if (process->status_pending_p) + if (check_removed_breakpoint (process)) + { + /* This thread was stopped at a breakpoint, and the breakpoint + is now gone. We were told to continue (or step...) all threads, + so GDB isn't trying to single-step past this breakpoint. + So instead of reporting the old SIGTRAP, pretend we got to + the breakpoint just after it was removed instead of just + before; resume the process. */ + linux_resume_one_process (&process->head, 0, 0); + return 0; + } + + return process->status_pending_p; +} + +static void +linux_wait_for_process (struct process_info **childp, int *wstatp) { - struct inferior_linux_data *child_data = inferior_target_data (child); - int pid, wstat; + int ret; + int to_wait_for = -1; + + if (*childp != NULL) + to_wait_for = (*childp)->lwpid; while (1) { - pid = waitpid (child_data->pid, &wstat, 0); + ret = waitpid (to_wait_for, wstatp, WNOHANG); + + if (ret == -1) + { + if (errno != ECHILD) + perror_with_name ("waitpid"); + } + else if (ret > 0) + break; + + ret = waitpid (to_wait_for, wstatp, WNOHANG | __WCLONE); + + if (ret == -1) + { + if (errno != ECHILD) + perror_with_name ("waitpid (WCLONE)"); + } + else if (ret > 0) + break; + + usleep (1000); + } + + if (debug_threads + && (!WIFSTOPPED (*wstatp) + || (WSTOPSIG (*wstatp) != 32 + && WSTOPSIG (*wstatp) != 33))) + fprintf (stderr, "Got an event from %d (%x)\n", ret, *wstatp); + + if (to_wait_for == -1) + *childp = (struct process_info *) find_inferior_id (&all_processes, ret); + + (*childp)->stopped = 1; + (*childp)->pending_is_breakpoint = 0; + + if (debug_threads + && WIFSTOPPED (*wstatp)) + { + current_inferior = (struct thread_info *) + find_inferior_id (&all_threads, (*childp)->tid); + /* For testing only; i386_stop_pc prints out a diagnostic. */ + if (the_low_target.get_pc != NULL) + get_stop_pc (); + } +} - if (pid != child_data->pid) - perror_with_name ("wait"); +static int +linux_wait_for_event (struct thread_info *child) +{ + CORE_ADDR stop_pc; + struct process_info *event_child; + int wstat; + + /* Check for a process with a pending status. */ + /* It is possible that the user changed the pending task's registers since + it stopped. We correctly handle the change of PC if we hit a breakpoint + (in check_removed_breakpoints); signals should be reported anyway. */ + if (child == NULL) + { + event_child = (struct process_info *) + find_inferior (&all_processes, status_pending_p, NULL); + if (debug_threads && event_child) + fprintf (stderr, "Got a pending child %d\n", event_child->lwpid); + } + else + { + event_child = get_thread_process (child); + if (event_child->status_pending_p + && check_removed_breakpoint (event_child)) + event_child = NULL; + } - /* If this target supports breakpoints, see if we hit one. */ - if (the_low_target.stop_pc != NULL - && WIFSTOPPED (wstat) - && WSTOPSIG (wstat) == SIGTRAP) + if (event_child != NULL) + { + if (event_child->status_pending_p) { - CORE_ADDR stop_pc; + if (debug_threads) + fprintf (stderr, "Got an event from pending child %d (%04x)\n", + event_child->lwpid, event_child->status_pending); + wstat = event_child->status_pending; + event_child->status_pending_p = 0; + event_child->status_pending = 0; + current_inferior = get_process_thread (event_child); + return wstat; + } + } + + /* We only enter this loop if no process has a pending wait status. Thus + any action taken in response to a wait status inside this loop is + responding as soon as we detect the status, not after any pending + events. */ + while (1) + { + if (child == NULL) + event_child = NULL; + else + event_child = get_thread_process (child); + + linux_wait_for_process (&event_child, &wstat); + + if (event_child == NULL) + error ("event from unknown child"); - if (linux_bp_reinsert != 0) + current_inferior = (struct thread_info *) + find_inferior_id (&all_threads, event_child->tid); + + if (using_threads) + { + /* Check for thread exit. */ + if (! WIFSTOPPED (wstat)) { - reinsert_breakpoint (linux_bp_reinsert); - linux_bp_reinsert = 0; - linux_resume (0, 0); + if (debug_threads) + fprintf (stderr, "Thread %d (LWP %d) exiting\n", + event_child->tid, event_child->head.id); + + /* If the last thread is exiting, just return. */ + if (all_threads.head == all_threads.tail) + return wstat; + + dead_thread_notify (event_child->tid); + + remove_inferior (&all_processes, &event_child->head); + free (event_child); + remove_thread (current_inferior); + current_inferior = (struct thread_info *) all_threads.head; + + /* If we were waiting for this particular child to do something... + well, it did something. */ + if (child != NULL) + return wstat; + + /* Wait for a more interesting event. */ continue; } - fetch_inferior_registers (0); - stop_pc = (*the_low_target.stop_pc) (); + if (WIFSTOPPED (wstat) + && WSTOPSIG (wstat) == SIGSTOP + && event_child->stop_expected) + { + if (debug_threads) + fprintf (stderr, "Expected stop.\n"); + event_child->stop_expected = 0; + linux_resume_one_process (&event_child->head, + event_child->stepping, 0); + continue; + } - if (check_breakpoints (stop_pc) != 0) + /* FIXME drow/2002-06-09: Get signal numbers from the inferior's + thread library? */ + if (WIFSTOPPED (wstat) + && (WSTOPSIG (wstat) == SIGRTMIN + || WSTOPSIG (wstat) == SIGRTMIN + 1)) { - if (the_low_target.set_pc != NULL) - (*the_low_target.set_pc) (stop_pc); + if (debug_threads) + fprintf (stderr, "Ignored signal %d for %d (LWP %d).\n", + WSTOPSIG (wstat), event_child->tid, + event_child->head.id); + linux_resume_one_process (&event_child->head, + event_child->stepping, + WSTOPSIG (wstat)); + continue; + } + } - if (the_low_target.breakpoint_reinsert_addr == NULL) - { - linux_bp_reinsert = stop_pc; - uninsert_breakpoint (stop_pc); - linux_resume (1, 0); - } - else - { - reinsert_breakpoint_by_bp - (stop_pc, (*the_low_target.breakpoint_reinsert_addr) ()); - linux_resume (0, 0); - } + /* If this event was not handled above, and is not a SIGTRAP, report + it. */ + if (!WIFSTOPPED (wstat) || WSTOPSIG (wstat) != SIGTRAP) + return wstat; - continue; + /* If this target does not support breakpoints, we simply report the + SIGTRAP; it's of no concern to us. */ + if (the_low_target.get_pc == NULL) + return wstat; + + stop_pc = get_stop_pc (); + + /* bp_reinsert will only be set if we were single-stepping. + Notice that we will resume the process after hitting + a gdbserver breakpoint; single-stepping to/over one + is not supported (yet). */ + if (event_child->bp_reinsert != 0) + { + if (debug_threads) + fprintf (stderr, "Reinserted breakpoint.\n"); + reinsert_breakpoint (event_child->bp_reinsert); + event_child->bp_reinsert = 0; + + /* Clear the single-stepping flag and SIGTRAP as we resume. */ + linux_resume_one_process (&event_child->head, 0, 0); + continue; + } + + if (debug_threads) + fprintf (stderr, "Hit a (non-reinsert) breakpoint.\n"); + + if (check_breakpoints (stop_pc) != 0) + { + /* We hit one of our own breakpoints. We mark it as a pending + breakpoint, so that check_removed_breakpoints () will do the PC + adjustment for us at the appropriate time. */ + event_child->pending_is_breakpoint = 1; + event_child->pending_stop_pc = stop_pc; + + /* Now we need to put the breakpoint back. We continue in the event + loop instead of simply replacing the breakpoint right away, + in order to not lose signals sent to the thread that hit the + breakpoint. Unfortunately this increases the window where another + thread could sneak past the removed breakpoint. For the current + use of server-side breakpoints (thread creation) this is + acceptable; but it needs to be considered before this breakpoint + mechanism can be used in more general ways. For some breakpoints + it may be necessary to stop all other threads, but that should + be avoided where possible. + + If breakpoint_reinsert_addr is NULL, that means that we can + use PTRACE_SINGLESTEP on this platform. Uninsert the breakpoint, + mark it for reinsertion, and single-step. + + Otherwise, call the target function to figure out where we need + our temporary breakpoint, create it, and continue executing this + process. */ + if (the_low_target.breakpoint_reinsert_addr == NULL) + { + event_child->bp_reinsert = stop_pc; + uninsert_breakpoint (stop_pc); + linux_resume_one_process (&event_child->head, 1, 0); + } + else + { + reinsert_breakpoint_by_bp + (stop_pc, (*the_low_target.breakpoint_reinsert_addr) ()); + linux_resume_one_process (&event_child->head, 0, 0); } + + continue; + } + + /* If we were single-stepping, we definitely want to report the + SIGTRAP. The single-step operation has completed, so also + clear the stepping flag; in general this does not matter, + because the SIGTRAP will be reported to the client, which + will give us a new action for this thread, but clear it for + consistency anyway. It's safe to clear the stepping flag + because the only consumer of get_stop_pc () after this point + is check_removed_breakpoints, and pending_is_breakpoint is not + set. It might be wiser to use a step_completed flag instead. */ + if (event_child->stepping) + { + event_child->stepping = 0; + return wstat; + } + + /* A SIGTRAP that we can't explain. It may have been a breakpoint. + Check if it is a breakpoint, and if so mark the process information + accordingly. This will handle both the necessary fiddling with the + PC on decr_pc_after_break targets and suppressing extra threads + hitting a breakpoint if two hit it at once and then GDB removes it + after the first is reported. Arguably it would be better to report + multiple threads hitting breakpoints simultaneously, but the current + remote protocol does not allow this. */ + if ((*the_low_target.breakpoint_at) (stop_pc)) + { + event_child->pending_is_breakpoint = 1; + event_child->pending_stop_pc = stop_pc; } return wstat; } + /* NOTREACHED */ return 0; } -/* Wait for process, returns status */ +/* Wait for process, returns status. */ static unsigned char linux_wait (char *status) { int w; + struct thread_info *child = NULL; + +retry: + /* If we were only supposed to resume one thread, only wait for + that thread - if it's still alive. If it died, however - which + can happen if we're coming from the thread death case below - + then we need to make sure we restart the other threads. We could + pick a thread at random or restart all; restarting all is less + arbitrary. */ + if (cont_thread > 0) + { + child = (struct thread_info *) find_inferior_id (&all_threads, + cont_thread); + + /* No stepping, no signal - unless one is pending already, of course. */ + if (child == NULL) + linux_resume (0, 0); + } enable_async_io (); - w = linux_wait_for_one_inferior (current_inferior); + w = linux_wait_for_event (child); + stop_all_processes (); disable_async_io (); - if (WIFEXITED (w)) + /* If we are waiting for a particular child, and it exited, + linux_wait_for_event will return its exit status. Similarly if + the last child exited. If this is not the last child, however, + do not report it as exited until there is a 'thread exited' response + available in the remote protocol. Instead, just wait for another event. + This should be safe, because if the thread crashed we will already + have reported the termination signal to GDB; that should stop any + in-progress stepping operations, etc. + + Report the exit status of the last thread to exit. This matches + LinuxThreads' behavior. */ + + if (all_threads.head == all_threads.tail) { - fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w)); - *status = 'W'; - clear_inferiors (); - return ((unsigned char) WEXITSTATUS (w)); + if (WIFEXITED (w)) + { + fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w)); + *status = 'W'; + clear_inferiors (); + return ((unsigned char) WEXITSTATUS (w)); + } + else if (!WIFSTOPPED (w)) + { + fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w)); + clear_inferiors (); + *status = 'X'; + return ((unsigned char) WTERMSIG (w)); + } } - else if (!WIFSTOPPED (w)) + else { - fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w)); - clear_inferiors (); - *status = 'X'; - return ((unsigned char) WTERMSIG (w)); + if (!WIFSTOPPED (w)) + goto retry; } - fetch_inferior_registers (0); - *status = 'T'; return ((unsigned char) WSTOPSIG (w)); } +static void +send_sigstop (struct inferior_list_entry *entry) +{ + struct process_info *process = (struct process_info *) entry; + + if (process->stopped) + return; + + /* If we already have a pending stop signal for this process, don't + send another. */ + if (process->stop_expected) + { + process->stop_expected = 0; + return; + } + + if (debug_threads) + fprintf (stderr, "Sending sigstop to process %d\n", process->head.id); + + kill (process->head.id, SIGSTOP); + process->sigstop_sent = 1; +} + +static void +wait_for_sigstop (struct inferior_list_entry *entry) +{ + struct process_info *process = (struct process_info *) entry; + struct thread_info *saved_inferior, *thread; + int wstat, saved_tid; + + if (process->stopped) + return; + + saved_inferior = current_inferior; + saved_tid = ((struct inferior_list_entry *) saved_inferior)->id; + thread = (struct thread_info *) find_inferior_id (&all_threads, + process->tid); + wstat = linux_wait_for_event (thread); + + /* If we stopped with a non-SIGSTOP signal, save it for later + and record the pending SIGSTOP. If the process exited, just + return. */ + if (WIFSTOPPED (wstat) + && WSTOPSIG (wstat) != SIGSTOP) + { + if (debug_threads) + fprintf (stderr, "Stopped with non-sigstop signal\n"); + process->status_pending_p = 1; + process->status_pending = wstat; + process->stop_expected = 1; + } + + if (linux_thread_alive (saved_tid)) + current_inferior = saved_inferior; + else + { + if (debug_threads) + fprintf (stderr, "Previously current thread died.\n"); + + /* Set a valid thread as current. */ + set_desired_inferior (0); + } +} + +static void +stop_all_processes (void) +{ + stopping_threads = 1; + for_each_inferior (&all_processes, send_sigstop); + for_each_inferior (&all_processes, wait_for_sigstop); + stopping_threads = 0; +} + /* Resume execution of the inferior process. If STEP is nonzero, single-step it. If SIGNAL is nonzero, give it that signal. */ static void -linux_resume (int step, int signal) +linux_resume_one_process (struct inferior_list_entry *entry, + int step, int signal) { + struct process_info *process = (struct process_info *) entry; + struct thread_info *saved_inferior; + + if (process->stopped == 0) + return; + + /* If we have pending signals or status, and a new signal, enqueue the + signal. Also enqueue the signal if we are waiting to reinsert a + breakpoint; it will be picked up again below. */ + if (signal != 0 + && (process->status_pending_p || process->pending_signals != NULL + || process->bp_reinsert != 0)) + { + struct pending_signals *p_sig; + p_sig = malloc (sizeof (*p_sig)); + p_sig->prev = process->pending_signals; + p_sig->signal = signal; + process->pending_signals = p_sig; + } + + if (process->status_pending_p) + return; + + saved_inferior = current_inferior; + current_inferior = get_process_thread (process); + + if (debug_threads) + fprintf (stderr, "Resuming process %d (%s, signal %d, stop %s)\n", inferior_pid, + step ? "step" : "continue", signal, + process->stop_expected ? "expected" : "not expected"); + + /* This bit needs some thinking about. If we get a signal that + we must report while a single-step reinsert is still pending, + we often end up resuming the thread. It might be better to + (ew) allow a stack of pending events; then we could be sure that + the reinsert happened right away and not lose any signals. + + Making this stack would also shrink the window in which breakpoints are + uninserted (see comment in linux_wait_for_process) but not enough for + complete correctness, so it won't solve that problem. It may be + worthwhile just to solve this one, however. */ + if (process->bp_reinsert != 0) + { + if (debug_threads) + fprintf (stderr, " pending reinsert at %08lx", (long)process->bp_reinsert); + if (step == 0) + fprintf (stderr, "BAD - reinserting but not stepping.\n"); + step = 1; + + /* Postpone any pending signal. It was enqueued above. */ + signal = 0; + } + + check_removed_breakpoint (process); + + if (debug_threads && the_low_target.get_pc != NULL) + { + fprintf (stderr, " "); + (long) (*the_low_target.get_pc) (); + } + + /* If we have pending signals, consume one unless we are trying to reinsert + a breakpoint. */ + if (process->pending_signals != NULL && process->bp_reinsert == 0) + { + struct pending_signals **p_sig; + + p_sig = &process->pending_signals; + while ((*p_sig)->prev != NULL) + p_sig = &(*p_sig)->prev; + + signal = (*p_sig)->signal; + free (*p_sig); + *p_sig = NULL; + } + + regcache_invalidate_one ((struct inferior_list_entry *) + get_process_thread (process)); errno = 0; - ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, inferior_pid, 1, signal); + process->stopped = 0; + process->stepping = step; + ptrace (step ? PTRACE_SINGLESTEP : PTRACE_CONT, process->lwpid, 0, signal); + + current_inferior = saved_inferior; if (errno) perror_with_name ("ptrace"); } +/* This function is called once per process other than the first + one. The first process we are told the signal to continue + with, and whether to step or continue; for all others, any + existing signals will be marked in status_pending_p to be + reported momentarily, and we preserve the stepping flag. */ +static void +linux_continue_one_process (struct inferior_list_entry *entry) +{ + struct process_info *process; -#ifdef HAVE_LINUX_USRREGS + process = (struct process_info *) entry; + linux_resume_one_process (entry, process->stepping, 0); +} + +static void +linux_resume (int step, int signal) +{ + struct process_info *process; + + process = get_thread_process (current_inferior); + + /* If the current process has a status pending, this signal will + be enqueued and sent later. */ + linux_resume_one_process (&process->head, step, signal); -#define REGISTER_RAW_SIZE(regno) register_size((regno)) + if (cont_thread == 0 || cont_thread == -1) + for_each_inferior (&all_processes, linux_continue_one_process); +} + +#ifdef HAVE_LINUX_USRREGS int register_addr (int regnum) @@ -262,6 +904,7 @@ fetch_register (int regno) { CORE_ADDR regaddr; register int i; + char *buf; if (regno >= the_low_target.num_regs) return; @@ -271,10 +914,11 @@ fetch_register (int regno) regaddr = register_addr (regno); if (regaddr == -1) return; - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) + buf = alloca (register_size (regno)); + for (i = 0; i < register_size (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; - *(PTRACE_XFER_TYPE *) (register_data (regno) + i) = + *(PTRACE_XFER_TYPE *) (buf + i) = ptrace (PTRACE_PEEKUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, 0); regaddr += sizeof (PTRACE_XFER_TYPE); if (errno != 0) @@ -288,6 +932,8 @@ fetch_register (int regno) goto error_exit; } } + supply_register (regno, buf); + error_exit:; } @@ -310,6 +956,7 @@ usr_store_inferior_registers (int regno) { CORE_ADDR regaddr; int i; + char *buf; if (regno >= 0) { @@ -323,11 +970,13 @@ usr_store_inferior_registers (int regno) if (regaddr == -1) return; errno = 0; - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) + buf = alloca (register_size (regno)); + collect_register (regno, buf); + for (i = 0; i < register_size (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; ptrace (PTRACE_POKEUSER, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) (register_data (regno) + i)); + *(int *) (buf + i)); if (errno != 0) { if ((*the_low_target.cannot_store_register) (regno) == 0) @@ -345,7 +994,7 @@ usr_store_inferior_registers (int regno) } else for (regno = 0; regno < the_low_target.num_regs; regno++) - store_inferior_registers (regno); + usr_store_inferior_registers (regno); } #endif /* HAVE_LINUX_USRREGS */ @@ -354,7 +1003,7 @@ usr_store_inferior_registers (int regno) #ifdef HAVE_LINUX_REGSETS static int -regsets_fetch_inferior_registers (void) +regsets_fetch_inferior_registers () { struct regset_info *regset; @@ -392,7 +1041,10 @@ regsets_fetch_inferior_registers (void) } else { - perror ("Warning: ptrace(regsets_fetch_inferior_registers)"); + char s[256]; + sprintf (s, "ptrace(regsets_fetch_inferior_registers) PID=%d", + inferior_pid); + perror (s); } } regset->store_function (buf); @@ -402,7 +1054,7 @@ regsets_fetch_inferior_registers (void) } static int -regsets_store_inferior_registers (void) +regsets_store_inferior_registers () { struct regset_info *regset; @@ -528,6 +1180,11 @@ linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len) register PTRACE_XFER_TYPE *buffer = (PTRACE_XFER_TYPE *) alloca (count * sizeof (PTRACE_XFER_TYPE)); extern int errno; + if (debug_threads) + { + fprintf (stderr, "Writing %02x to %08lx\n", (unsigned)myaddr[0], (long)memaddr); + } + /* Fill start and end extra bytes of buffer with existing memory data. */ buffer[0] = ptrace (PTRACE_PEEKTEXT, inferior_pid, @@ -562,7 +1219,40 @@ linux_write_memory (CORE_ADDR memaddr, const char *myaddr, int len) static void linux_look_up_symbols (void) { - /* Don't need to look up any symbols yet. */ +#ifdef USE_THREAD_DB + if (using_threads) + return; + + using_threads = thread_db_init (); +#endif +} + +/* Return 1 if this process is not stopped. */ +static int +unstopped_p (struct inferior_list_entry *entry, void *dummy) +{ + struct process_info *process = (struct process_info *) entry; + + if (process->stopped) + return 0; + + return 1; +} + +static int +linux_signal_pid () +{ + struct inferior_list_entry *process; + + process = find_inferior (&all_processes, unstopped_p, NULL); + + if (process == NULL) + { + warning ("no unstopped process"); + return inferior_pid; + } + + return pid_of ((struct process_info *) process); } @@ -578,13 +1268,24 @@ static struct target_ops linux_target_ops = { linux_read_memory, linux_write_memory, linux_look_up_symbols, + linux_signal_pid, }; +static void +linux_init_signals () +{ + /* FIXME drow/2002-06-09: As above, we should check with LinuxThreads + to find what the cancel signal actually is. */ + signal (SIGRTMIN+1, SIG_IGN); +} + void initialize_low (void) { + using_threads = 0; set_target_ops (&linux_target_ops); set_breakpoint_data (the_low_target.breakpoint, the_low_target.breakpoint_len); init_registers (); + linux_init_signals (); } diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index b484982e15e..bae76b77bdc 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -19,12 +19,21 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_LINUX_REGSETS -typedef void (*regset_func) (void *); +typedef void (*regset_fill_func) (void *); +typedef void (*regset_store_func) (const void *); +enum regset_type { + GENERAL_REGS, + FP_REGS, + EXTENDED_REGS, +}; + struct regset_info { int get_request, set_request; int size; - regset_func fill_function, store_function; + enum regset_type type; + regset_fill_func fill_function; + regset_store_func store_function; }; extern struct regset_info target_regsets[]; #endif @@ -39,11 +48,67 @@ struct linux_target_ops store the register, and 2 if failure to store the register is acceptable. */ int (*cannot_store_register) (int); - CORE_ADDR (*stop_pc) (void); + CORE_ADDR (*get_pc) (void); void (*set_pc) (CORE_ADDR newpc); const char *breakpoint; int breakpoint_len; CORE_ADDR (*breakpoint_reinsert_addr) (void); + + + int decr_pc_after_break; + int (*breakpoint_at) (CORE_ADDR pc); }; extern struct linux_target_ops the_low_target; + +#define get_process(inf) ((struct process_info *)(inf)) +#define get_thread_process(thr) (get_process (inferior_target_data (thr))) +#define get_process_thread(proc) ((struct thread_info *) \ + find_inferior_id (&all_threads, \ + get_process (proc)->tid)) + +struct process_info +{ + struct inferior_list_entry head; + int thread_known; + int lwpid; + int tid; + + /* If this flag is set, the next SIGSTOP will be ignored (the process will + be immediately resumed). */ + int stop_expected; + + /* If this flag is set, the process is known to be stopped right now (stop + event already received in a wait()). */ + int stopped; + + /* If this flag is set, we have sent a SIGSTOP to this process and are + waiting for it to stop. */ + int sigstop_sent; + + /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet + been reported. */ + int status_pending_p; + int status_pending; + + /* If this flag is set, the pending status is a (GDB-placed) breakpoint. */ + int pending_is_breakpoint; + CORE_ADDR pending_stop_pc; + + /* If this is non-zero, it is a breakpoint to be reinserted at our next + stop (SIGTRAP stops only). */ + CORE_ADDR bp_reinsert; + + /* If this flag is set, the last continue operation on this process + was a single-step. */ + int stepping; + + /* If this is non-zero, it points to a chain of signals which need to + be delivered to this process. */ + struct pending_signals *pending_signals; +}; +extern struct inferior_list all_processes; + +void linux_attach_lwp (int pid, int tid); + +int thread_db_init (void); diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c index f721ec94eeb..51e74cef140 100644 --- a/gdb/gdbserver/linux-mips-low.c +++ b/gdb/gdbserver/linux-mips-low.c @@ -96,9 +96,60 @@ mips_cannot_store_register (int regno) return 0; } +static CORE_ADDR +mips_get_pc () +{ + unsigned long pc; + collect_register_by_name ("pc", &pc); + return pc; +} + +static void +mips_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. */ +static const unsigned long mips_breakpoint = 0x0005000d; +#define mips_breakpoint_len 4 + +/* We only place breakpoints in empty marker functions, and thread locking + is outside of the function. So rather than importing software single-step, + we can just run until exit. */ +static CORE_ADDR +mips_reinsert_addr () +{ + unsigned long pc; + collect_register_by_name ("ra", &pc); + return pc; +} + +static int +mips_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == mips_breakpoint) + return 1; + + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + struct linux_target_ops the_low_target = { mips_num_regs, mips_regmap, mips_cannot_fetch_register, mips_cannot_store_register, + mips_get_pc, + mips_set_pc, + (const char *) &mips_breakpoint, + mips_breakpoint_len, + mips_reinsert_addr, + 0, + mips_breakpoint_at, }; diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 7cb315a304a..2bb0f50034e 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -64,9 +64,53 @@ ppc_cannot_fetch_register (int regno) return 0; } +static CORE_ADDR +ppc_get_pc (void) +{ + unsigned long pc; + + collect_register_by_name ("pc", &pc); + return (CORE_ADDR) pc; +} + +static void +ppc_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. Note that this file is + for PowerPC only, not PowerPC64. + This instruction is "twge r2, r2", which GDB uses as a software + breakpoint. */ +static const unsigned long ppc_breakpoint = 0x7d821008; +#define ppc_breakpoint_len 4 + +static int +ppc_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == ppc_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + struct linux_target_ops the_low_target = { ppc_num_regs, ppc_regmap, ppc_cannot_fetch_register, ppc_cannot_store_register, + ppc_get_pc, + ppc_set_pc, + (const char *) &ppc_breakpoint, + ppc_breakpoint_len, + NULL, + 0, + ppc_breakpoint_at, }; diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c index cdc390d2332..ee84561f17c 100644 --- a/gdb/gdbserver/linux-sh-low.c +++ b/gdb/gdbserver/linux-sh-low.c @@ -57,9 +57,49 @@ sh_cannot_fetch_register (int regno) return 0; } +static CORE_ADDR +sh_get_pc () +{ + unsigned long pc; + collect_register_by_name ("pc", &pc); + return pc; +} + +static void +sh_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness, obviously. */ +static const unsigned short sh_breakpoint = 0xc3c3; +#define sh_breakpoint_len 2 + +static int +sh_breakpoint_at (CORE_ADDR where) +{ + unsigned short insn; + + (*the_target->read_memory) (where, (char *) &insn, 2); + if (insn == sh_breakpoint) + return 1; + + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + struct linux_target_ops the_low_target = { sh_num_regs, sh_regmap, sh_cannot_fetch_register, sh_cannot_store_register, + sh_get_pc, + sh_set_pc, + (const char *) &sh_breakpoint, + sh_breakpoint_len, + NULL, + 0, + sh_breakpoint_at, }; diff --git a/gdb/gdbserver/linux-x86-64-low.c b/gdb/gdbserver/linux-x86-64-low.c index e1248904aba..1f80d990cc9 100644 --- a/gdb/gdbserver/linux-x86-64-low.c +++ b/gdb/gdbserver/linux-x86-64-low.c @@ -71,10 +71,12 @@ x86_64_store_fpregset (void *buf) struct regset_info target_regsets[] = { { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), + GENERAL_REGS, x86_64_fill_gregset, x86_64_store_gregset }, { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), + FP_REGS, x86_64_fill_fpregset, x86_64_store_fpregset }, - { 0, 0, -1, NULL, NULL } + { 0, 0, -1, -1, NULL, NULL } }; struct linux_target_ops the_low_target = { diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index 701d09232f8..be3b3a7f33e 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -25,8 +25,13 @@ #include #include +/* The private data for the register cache. Note that we have one + per inferior; this is primarily for simplicity, as the performance + benefit is minimal. */ + struct inferior_regcache_data { + int registers_valid; char *registers; }; @@ -38,7 +43,7 @@ static int num_registers; const char **gdbserver_expedite_regs; static struct inferior_regcache_data * -get_regcache (struct inferior_info *inf) +get_regcache (struct thread_info *inf, int fetch) { struct inferior_regcache_data *regcache; @@ -47,17 +52,50 @@ get_regcache (struct inferior_info *inf) if (regcache == NULL) fatal ("no register cache"); + /* FIXME - fetch registers for INF */ + if (fetch && regcache->registers_valid == 0) + { + fetch_inferior_registers (0); + regcache->registers_valid = 1; + } + return regcache; } +void +regcache_invalidate_one (struct inferior_list_entry *entry) +{ + struct thread_info *thread = (struct thread_info *) entry; + struct inferior_regcache_data *regcache; + + regcache = (struct inferior_regcache_data *) inferior_regcache_data (thread); + + if (regcache->registers_valid) + { + struct thread_info *saved_inferior = current_inferior; + + current_inferior = thread; + store_inferior_registers (-1); + current_inferior = saved_inferior; + } + + regcache->registers_valid = 0; +} + +void +regcache_invalidate () +{ + for_each_inferior (&all_threads, regcache_invalidate_one); +} + int registers_length (void) { return 2 * register_bytes; } -void -create_register_cache (struct inferior_info *inferior) +void * +new_register_cache (void) { struct inferior_regcache_data *regcache; @@ -67,15 +105,19 @@ create_register_cache (struct inferior_info *inferior) if (regcache->registers == NULL) fatal ("Could not allocate register cache."); - set_inferior_regcache_data (inferior, regcache); + regcache->registers_valid = 0; + + return regcache; } void -free_register_cache (struct inferior_info *inferior) +free_register_cache (void *regcache_p) { - free (get_regcache (current_inferior)->registers); - free (get_regcache (current_inferior)); - set_inferior_regcache_data (inferior, NULL); + struct inferior_regcache_data *regcache + = (struct inferior_regcache_data *) regcache_p; + + free (regcache->registers); + free (regcache); } void @@ -99,7 +141,7 @@ set_register_cache (struct reg *regs, int n) void registers_to_string (char *buf) { - char *registers = get_regcache (current_inferior)->registers; + char *registers = get_regcache (current_inferior, 1)->registers; convert_int_to_ascii (registers, buf, register_bytes); } @@ -108,7 +150,7 @@ void registers_from_string (char *buf) { int len = strlen (buf); - char *registers = get_regcache (current_inferior)->registers; + char *registers = get_regcache (current_inferior, 1)->registers; if (len != register_bytes * 2) { @@ -155,10 +197,10 @@ register_size (int n) return reg_defs[n].size / 8; } -char * -register_data (int n) +static char * +register_data (int n, int fetch) { - char *registers = get_regcache (current_inferior)->registers; + char *registers = get_regcache (current_inferior, fetch)->registers; return registers + (reg_defs[n].offset / 8); } @@ -166,7 +208,7 @@ register_data (int n) void supply_register (int n, const void *buf) { - memcpy (register_data (n), buf, register_size (n)); + memcpy (register_data (n, 0), buf, register_size (n)); } void @@ -178,7 +220,13 @@ supply_register_by_name (const char *name, const void *buf) void collect_register (int n, void *buf) { - memcpy (buf, register_data (n), register_size (n)); + memcpy (buf, register_data (n, 1), register_size (n)); +} + +void +collect_register_as_string (int n, char *buf) +{ + convert_int_to_ascii (register_data (n, 1), buf, register_size (n)); } void diff --git a/gdb/gdbserver/regcache.h b/gdb/gdbserver/regcache.h index 362288ee049..930bd9cbfe6 100644 --- a/gdb/gdbserver/regcache.h +++ b/gdb/gdbserver/regcache.h @@ -21,15 +21,20 @@ #ifndef REGCACHE_H #define REGCACHE_H -struct inferior_info; +struct inferior_list_entry; /* Create a new register cache for INFERIOR. */ -void create_register_cache (struct inferior_info *inferior); +void *new_register_cache (void); /* Release all memory associated with the register cache for INFERIOR. */ -void free_register_cache (struct inferior_info *inferior); +void free_register_cache (void *regcache); + +/* Invalidate cached registers for one or all threads. */ + +void regcache_invalidate_one (struct inferior_list_entry *); +void regcache_invalidate (void); /* Convert all registers to a string in the currently specified remote format. */ @@ -48,8 +53,6 @@ int registers_length (void); struct reg *find_register_by_number (int n); -char *register_data (int n); - int register_size (int n); int find_regno (const char *name); @@ -62,6 +65,8 @@ void supply_register_by_name (const char *name, const void *buf); void collect_register (int n, void *buf); +void collect_register_as_string (int n, char *buf); + void collect_register_by_name (const char *name, void *buf); #endif /* REGCACHE_H */ diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 14734f161bd..c610c4c0e7c 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -42,6 +42,10 @@ struct ui_file *gdb_stdlog; static int remote_desc; +/* FIXME headerize? */ +extern int using_threads; +extern int debug_threads; + /* Open a connection to a remote debugger. NAME is the filename used for communication. */ @@ -296,10 +300,17 @@ putpkt (char *buf) } if (remote_debug) - printf ("putpkt (\"%s\"); [looking for ack]\n", buf2); + { + fprintf (stderr, "putpkt (\"%s\"); [looking for ack]\n", buf2); + fflush (stderr); + } cc = read (remote_desc, buf3, 1); if (remote_debug) - printf ("[received '%c' (0x%x)]\n", buf3[0], buf3[0]); + { + fprintf (stderr, "[received '%c' (0x%x)]\n", buf3[0], buf3[0]); + fflush (stderr); + } + if (cc <= 0) { if (cc == 0) @@ -310,6 +321,10 @@ putpkt (char *buf) free (buf2); return -1; } + + /* Check for an input interrupt while we're here. */ + if (buf3[0] == '\003') + kill ((*the_target->signal_pid) (), SIGINT); } while (buf3[0] != '+'); @@ -346,7 +361,7 @@ input_interrupt (int unused) return; } - kill (signal_pid, SIGINT); + kill ((*the_target->signal_pid) (), SIGINT); } } @@ -411,7 +426,11 @@ getpkt (char *buf) if (c == '$') break; if (remote_debug) - printf ("[getpkt: discarding char '%c']\n", c); + { + fprintf (stderr, "[getpkt: discarding char '%c']\n", c); + fflush (stderr); + } + if (c < 0) return -1; } @@ -441,12 +460,19 @@ getpkt (char *buf) } if (remote_debug) - printf ("getpkt (\"%s\"); [sending ack] \n", buf); + { + fprintf (stderr, "getpkt (\"%s\"); [sending ack] \n", buf); + fflush (stderr); + } write (remote_desc, "+", 1); if (remote_debug) - printf ("[sent ack]\n"); + { + fprintf (stderr, "[sent ack]\n"); + fflush (stderr); + } + return bp - buf; } @@ -499,8 +525,6 @@ convert_ascii_to_int (char *from, char *to, int n) static char * outreg (int regno, char *buf) { - int regsize = register_size (regno); - if ((regno >> 12) != 0) *buf++ = tohex ((regno >> 12) & 0xf); if ((regno >> 8) != 0) @@ -508,13 +532,46 @@ outreg (int regno, char *buf) *buf++ = tohex ((regno >> 4) & 0xf); *buf++ = tohex (regno & 0xf); *buf++ = ':'; - convert_int_to_ascii (register_data (regno), buf, regsize); - buf += 2 * regsize; + collect_register_as_string (regno, buf); + buf += 2 * register_size (regno); *buf++ = ';'; return buf; } +void +new_thread_notify (int id) +{ + char own_buf[256]; + + /* The `n' response is not yet part of the remote protocol. Do nothing. */ + if (1) + return; + + if (server_waiting == 0) + return; + + sprintf (own_buf, "n%x", id); + disable_async_io (); + putpkt (own_buf); + enable_async_io (); +} + +void +dead_thread_notify (int id) +{ + char own_buf[256]; + + /* The `x' response is not yet part of the remote protocol. Do nothing. */ + if (1) + return; + + sprintf (own_buf, "x%x", id); + disable_async_io (); + putpkt (own_buf); + enable_async_io (); +} + void prepare_resume_reply (char *buf, char status, unsigned char signo) { @@ -538,12 +595,23 @@ prepare_resume_reply (char *buf, char status, unsigned char signo) regp ++; } - /* If the debugger hasn't used any thread features, don't burden it with - threads. If we didn't check this, GDB 4.13 and older would choke. */ - if (cont_thread != 0) + /* Formerly, if the debugger had not used any thread features we would not + burden it with a thread status response. This was for the benefit of + GDB 4.13 and older. However, in recent GDB versions the check + (``if (cont_thread != 0)'') does not have the desired effect because of + sillyness in the way that the remote protocol handles specifying a thread. + Since thread support relies on qSymbol support anyway, assume GDB can handle + threads. */ + + if (using_threads) { + /* FIXME right place to set this? */ + thread_from_wait = ((struct inferior_list_entry *)current_inferior)->id; + if (debug_threads) + fprintf (stderr, "Writing resume reply for %d\n\n", thread_from_wait); if (old_thread_from_wait != thread_from_wait) { + general_thread = thread_from_wait; sprintf (buf, "thread:%x;", thread_from_wait); buf += strlen (buf); old_thread_from_wait = thread_from_wait; @@ -620,7 +688,11 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp) { /* Malformed response. */ if (remote_debug) - fprintf (stderr, "Malformed response to qSymbol, ignoring.\n"); + { + fprintf (stderr, "Malformed response to qSymbol, ignoring.\n"); + fflush (stderr); + } + return -1; } diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index ba85b59d2c8..b674ed0070f 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -23,9 +23,12 @@ int cont_thread; int general_thread; +int step_thread; int thread_from_wait; int old_thread_from_wait; int extended_protocol; +int server_waiting; + jmp_buf toplevel; static unsigned char @@ -33,11 +36,12 @@ start_inferior (char *argv[], char *statusptr) { /* FIXME Check error? Or turn to void. */ create_inferior (argv[0], argv); - /* FIXME Print pid properly. */ - fprintf (stderr, "Process %s created; pid = %d\n", argv[0], signal_pid); + + fprintf (stderr, "Process %s created; pid = %d\n", argv[0], + all_threads.head->id); /* Wait till we are at 1st instruction in program, return signal number. */ - return mywait (statusptr); + return mywait (statusptr, 0); } static int @@ -48,7 +52,7 @@ attach_inferior (int pid, char *statusptr, unsigned char *sigptr) if (myattach (pid) != 0) return -1; - *sigptr = mywait (statusptr); + *sigptr = mywait (statusptr, 0); return 0; } @@ -59,6 +63,8 @@ extern int remote_debug; void handle_query (char *own_buf) { + static struct inferior_list_entry *thread_ptr; + if (strcmp ("qSymbol::", own_buf) == 0) { if (the_target->look_up_symbols != NULL) @@ -68,6 +74,29 @@ handle_query (char *own_buf) return; } + if (strcmp ("qfThreadInfo", own_buf) == 0) + { + thread_ptr = all_threads.head; + sprintf (own_buf, "m%x", thread_ptr->id); + thread_ptr = thread_ptr->next; + return; + } + + if (strcmp ("qsThreadInfo", own_buf) == 0) + { + if (thread_ptr != NULL) + { + sprintf (own_buf, "m%x", thread_ptr->id); + thread_ptr = thread_ptr->next; + return; + } + else + { + sprintf (own_buf, "l"); + return; + } + } + /* Otherwise we didn't know what packet it was. Say we didn't understand it. */ own_buf[0] = 0; @@ -75,6 +104,16 @@ handle_query (char *own_buf) static int attached; +static void +gdbserver_usage (void) +{ + error ("Usage:\tgdbserver COMM PROG [ARGS ...]\n" + "\tgdbserver COMM --attach PID\n" + "\n" + "COMM may either be a tty device (for serial debugging), or \n" + "HOST:PORT to listen for a TCP connection.\n"); +} + int main (int argc, char *argv[]) { @@ -110,8 +149,7 @@ main (int argc, char *argv[]) } if (argc < 3 || bad_attach) - error ("Usage:\tgdbserver tty prog [args ...]\n" - "\tgdbserver tty --attach pid"); + gdbserver_usage(); initialize_low (); @@ -179,12 +217,16 @@ main (int argc, char *argv[]) case 'g': general_thread = strtol (&own_buf[2], NULL, 16); write_ok (own_buf); - fetch_inferior_registers (0); + set_desired_inferior (1); break; case 'c': cont_thread = strtol (&own_buf[2], NULL, 16); write_ok (own_buf); break; + case 's': + step_thread = strtol (&own_buf[2], NULL, 16); + write_ok (own_buf); + break; default: /* Silently ignore it so that gdb can extend the protocol without compatibility headaches. */ @@ -193,11 +235,12 @@ main (int argc, char *argv[]) } break; case 'g': + set_desired_inferior (1); registers_to_string (own_buf); break; case 'G': + set_desired_inferior (1); registers_from_string (&own_buf[1]); - store_inferior_registers (-1); write_ok (own_buf); break; case 'm': @@ -218,8 +261,9 @@ main (int argc, char *argv[]) signal = target_signal_to_host (sig); else signal = 0; + set_desired_inferior (0); myresume (0, signal); - signal = mywait (&status); + signal = mywait (&status, 1); prepare_resume_reply (own_buf, status, signal); break; case 'S': @@ -228,18 +272,21 @@ main (int argc, char *argv[]) signal = target_signal_to_host (sig); else signal = 0; + set_desired_inferior (0); myresume (1, signal); - signal = mywait (&status); + signal = mywait (&status, 1); prepare_resume_reply (own_buf, status, signal); break; case 'c': + set_desired_inferior (0); myresume (0, 0); - signal = mywait (&status); + signal = mywait (&status, 1); prepare_resume_reply (own_buf, status, signal); break; case 's': + set_desired_inferior (0); myresume (1, 0); - signal = mywait (&status); + signal = mywait (&status, 1); prepare_resume_reply (own_buf, status, signal); break; case 'k': diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index 32b90b5bcc7..746502b3d63 100644 --- a/gdb/gdbserver/server.h +++ b/gdb/gdbserver/server.h @@ -54,8 +54,21 @@ least the size of a (void *). */ typedef long long CORE_ADDR; -/* Opaque inferior process information. */ -struct inferior_info; +/* Generic information for tracking a list of ``inferiors'' - threads, + processes, etc. */ +struct inferior_list +{ + struct inferior_list_entry *head; + struct inferior_list_entry *tail; +}; +struct inferior_list_entry +{ + int id; + struct inferior_list_entry *next; +}; + +/* Opaque type for user-visible threads. */ +struct thread_info; #include "regcache.h" #include "gdb/signals.h" @@ -67,27 +80,41 @@ struct inferior_info; void initialize_low (); -/* Target-specific variables */ - -extern char *registers; - /* From inferiors.c. */ -extern struct inferior_info *current_inferior; -extern int signal_pid; -void add_inferior (int pid); +extern struct inferior_list all_threads; +void add_inferior_to_list (struct inferior_list *list, + struct inferior_list_entry *new_inferior); +void for_each_inferior (struct inferior_list *list, + void (*action) (struct inferior_list_entry *)); +extern struct thread_info *current_inferior; +void remove_inferior (struct inferior_list *list, + struct inferior_list_entry *entry); +void remove_thread (struct thread_info *thread); +void add_thread (int thread_id, void *target_data); void clear_inferiors (void); -void *inferior_target_data (struct inferior_info *); -void set_inferior_target_data (struct inferior_info *, void *); -void *inferior_regcache_data (struct inferior_info *); -void set_inferior_regcache_data (struct inferior_info *, void *); +struct inferior_list_entry *find_inferior + (struct inferior_list *, + int (*func) (struct inferior_list_entry *, + void *), + void *arg); +struct inferior_list_entry *find_inferior_id (struct inferior_list *list, + int id); +void *inferior_target_data (struct thread_info *); +void set_inferior_target_data (struct thread_info *, void *); +void *inferior_regcache_data (struct thread_info *); +void set_inferior_regcache_data (struct thread_info *, void *); +void change_inferior_id (struct inferior_list *list, + int new_id); /* Public variables in server.c */ extern int cont_thread; extern int general_thread; +extern int step_thread; extern int thread_from_wait; extern int old_thread_from_wait; +extern int server_waiting; extern jmp_buf toplevel; @@ -103,6 +130,8 @@ void enable_async_io (void); void disable_async_io (void); void convert_ascii_to_int (char *from, char *to, int n); void convert_int_to_ascii (char *from, char *to, int n); +void new_thread_notify (int id); +void dead_thread_notify (int id); void prepare_resume_reply (char *buf, char status, unsigned char sig); void decode_m_packet (char *from, CORE_ADDR * mem_addr_ptr, diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 53a4c1ef55a..1c2860a11e9 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -25,6 +25,38 @@ struct target_ops *the_target; +void +set_desired_inferior (int use_general) +{ + struct thread_info *found; + + if (use_general == 1) + { + found = (struct thread_info *) find_inferior_id (&all_threads, + general_thread); + } + else + { + found = NULL; + + /* If we are continuing any (all) thread(s), use step_thread + to decide which thread to step and/or send the specified + signal to. */ + if (step_thread > 0 && (cont_thread == 0 || cont_thread == -1)) + found = (struct thread_info *) find_inferior_id (&all_threads, + step_thread); + + if (found == NULL) + found = (struct thread_info *) find_inferior_id (&all_threads, + cont_thread); + } + + if (found == NULL) + current_inferior = (struct thread_info *) all_threads.head; + else + current_inferior = found; +} + void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) { @@ -33,10 +65,41 @@ read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) } int -write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) +write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len) +{ + /* Lacking cleanups, there is some potential for a memory leak if the + write fails and we go through error(). Make sure that no more than + one buffer is ever pending by making BUFFER static. */ + static char *buffer = 0; + int res; + + if (buffer != NULL) + free (buffer); + + buffer = malloc (len); + memcpy (buffer, myaddr, len); + check_mem_write (memaddr, buffer, len); + res = (*the_target->write_memory) (memaddr, buffer, len); + free (buffer); + buffer = NULL; + + return res; +} + +unsigned char +mywait (char *statusp, int connected_wait) { - check_mem_write (memaddr, myaddr, len); - return (*the_target->write_memory) (memaddr, myaddr, len); + unsigned char ret; + + if (connected_wait) + server_waiting = 1; + + ret = (*the_target->wait) (statusp); + + if (connected_wait) + server_waiting = 0; + + return ret; } void diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 6d06b9fd4ab..c6aeee6f562 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -104,6 +104,11 @@ struct target_ops symbols. */ void (*look_up_symbols) (void); + + /* Return the PID we should send a signal to. Used for asynchronous + interrupts (user hitting Control-C). */ + + int (*signal_pid) (void); }; extern struct target_ops *the_target; @@ -125,17 +130,18 @@ void set_target_ops (struct target_ops *); #define myresume(step,signo) \ (*the_target->resume) (step, signo) -#define mywait(statusp) \ - (*the_target->wait) (statusp) - #define fetch_inferior_registers(regno) \ (*the_target->fetch_registers) (regno) #define store_inferior_registers(regno) \ (*the_target->store_registers) (regno) +unsigned char mywait (char *statusp, int connected_wait); + void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len); -int write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len); +int write_inferior_memory (CORE_ADDR memaddr, const char *myaddr, int len); + +void set_desired_inferior (int id); #endif /* TARGET_H */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index e8ba96d1038..562481cb066 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -73,7 +73,9 @@ struct type *builtin_type_uint128; struct type *builtin_type_bool; /* 128 bit long vector types */ +struct type *builtin_type_v2_double; struct type *builtin_type_v4_float; +struct type *builtin_type_v2_int64; struct type *builtin_type_v4_int32; struct type *builtin_type_v8_int16; struct type *builtin_type_v16_int8; @@ -91,6 +93,7 @@ struct type *builtin_type_v8hi; struct type *builtin_type_v4hi; struct type *builtin_type_v2si; struct type *builtin_type_vec128; +struct type *builtin_type_vec128i; struct type *builtin_type_ieee_single_big; struct type *builtin_type_ieee_single_little; struct type *builtin_type_ieee_double_big; @@ -127,7 +130,7 @@ static void add_mangled_type (struct extra *, struct type *); static void cfront_mangle_name (struct type *, int, int); #endif static void print_bit_vector (B_TYPE *, int); -static void print_arg_types (struct type **, int); +static void print_arg_types (struct field *, int, int); static void dump_fn_fieldlists (struct type *, int); static void print_cplus_stuff (struct type *, int); static void virtual_base_list_aux (struct type *dclass); @@ -576,7 +579,6 @@ allocate_stub_method (struct type *type) TYPE_OBJFILE (type)); TYPE_TARGET_TYPE (mtype) = type; /* _DOMAIN_TYPE (mtype) = unknown yet */ - /* _ARG_TYPES (mtype) = unknown yet */ return (mtype); } @@ -844,6 +846,24 @@ build_builtin_type_vec128 (void) return t; } +static struct type * +build_builtin_type_vec128i (void) +{ + /* 128-bit Intel SIMD registers */ + struct type *t; + + t = init_composite_type ("__gdb_builtin_type_vec128i", TYPE_CODE_UNION); + append_composite_type_field (t, "v4_float", builtin_type_v4_float); + append_composite_type_field (t, "v2_double", builtin_type_v2_double); + append_composite_type_field (t, "v16_int8", builtin_type_v16_int8); + append_composite_type_field (t, "v8_int16", builtin_type_v8_int16); + append_composite_type_field (t, "v4_int32", builtin_type_v4_int32); + append_composite_type_field (t, "v2_int64", builtin_type_v2_int64); + append_composite_type_field (t, "uint128", builtin_type_int128); + + return t; +} + /* Smash TYPE to be a type of members of DOMAIN with type TO_TYPE. A MEMBER is a wierd thing -- it amounts to a typed offset into a struct, e.g. "an int at offset 8". A MEMBER TYPE doesn't @@ -879,7 +899,8 @@ smash_to_member_type (struct type *type, struct type *domain, void smash_to_method_type (struct type *type, struct type *domain, - struct type *to_type, struct type **args) + struct type *to_type, struct field *args, + int nargs, int varargs) { struct objfile *objfile; @@ -889,7 +910,10 @@ smash_to_method_type (struct type *type, struct type *domain, TYPE_OBJFILE (type) = objfile; TYPE_TARGET_TYPE (type) = to_type; TYPE_DOMAIN_TYPE (type) = domain; - TYPE_ARG_TYPES (type) = args; + TYPE_FIELDS (type) = args; + TYPE_NFIELDS (type) = nargs; + if (varargs) + TYPE_FLAGS (type) |= TYPE_FLAG_VARARGS; TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */ TYPE_CODE (type) = TYPE_CODE_METHOD; } @@ -1593,7 +1617,7 @@ check_stub_method (struct type *type, int method_id, int signature_id) DMGL_PARAMS | DMGL_ANSI); char *argtypetext, *p; int depth = 0, argcount = 1; - struct type **argtypes; + struct field *argtypes; struct type *mtype; /* Make sure we got back a function string that we can use. */ @@ -1626,11 +1650,14 @@ check_stub_method (struct type *type, int method_id, int signature_id) p += 1; } - /* We need two more slots: one for the THIS pointer, and one for the - NULL [...] or void [end of arglist]. */ + /* If we read one argument and it was ``void'', don't count it. */ + if (strncmp (argtypetext, "(void)", 6) == 0) + argcount -= 1; + + /* We need one extra slot, for the THIS pointer. */ - argtypes = (struct type **) - TYPE_ALLOC (type, (argcount + 2) * sizeof (struct type *)); + argtypes = (struct field *) + TYPE_ALLOC (type, (argcount + 1) * sizeof (struct field)); p = argtypetext; /* Add THIS pointer for non-static methods. */ @@ -1639,7 +1666,7 @@ check_stub_method (struct type *type, int method_id, int signature_id) argcount = 0; else { - argtypes[0] = lookup_pointer_type (type); + argtypes[0].type = lookup_pointer_type (type); argcount = 1; } @@ -1650,10 +1677,12 @@ check_stub_method (struct type *type, int method_id, int signature_id) { if (depth <= 0 && (*p == ',' || *p == ')')) { - /* Avoid parsing of ellipsis, they will be handled below. */ - if (strncmp (argtypetext, "...", p - argtypetext) != 0) + /* Avoid parsing of ellipsis, they will be handled below. + Also avoid ``void'' as above. */ + if (strncmp (argtypetext, "...", p - argtypetext) != 0 + && strncmp (argtypetext, "void", p - argtypetext) != 0) { - argtypes[argcount] = + argtypes[argcount].type = safe_parse_type (argtypetext, p - argtypetext); argcount += 1; } @@ -1673,25 +1702,19 @@ check_stub_method (struct type *type, int method_id, int signature_id) } } - if (p[-2] != '.') /* Not '...' */ - { - argtypes[argcount] = builtin_type_void; /* List terminator */ - } - else - { - argtypes[argcount] = NULL; /* Ellist terminator */ - } - - xfree (demangled_name); - TYPE_FN_FIELD_PHYSNAME (f, signature_id) = mangled_name; /* Now update the old "stub" type into a real type. */ mtype = TYPE_FN_FIELD_TYPE (f, signature_id); TYPE_DOMAIN_TYPE (mtype) = type; - TYPE_ARG_TYPES (mtype) = argtypes; + TYPE_FIELDS (mtype) = argtypes; + TYPE_NFIELDS (mtype) = argcount; TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB; TYPE_FN_FIELD_STUB (f, signature_id) = 0; + if (p[-2] == '.') + TYPE_FLAGS (mtype) |= TYPE_FLAG_VARARGS; + + xfree (demangled_name); } const struct cplus_struct_type cplus_struct_default; @@ -2682,25 +2705,18 @@ print_bit_vector (B_TYPE *bits, int nbits) } } -/* The args list is a strange beast. It is either terminated by a NULL - pointer for varargs functions, or by a pointer to a TYPE_CODE_VOID - type for normal fixed argcount functions. (FIXME someday) - Also note the first arg should be the "this" pointer, we may not want to - include it since we may get into a infinitely recursive situation. */ +/* Note the first arg should be the "this" pointer, we may not want to + include it since we may get into a infinitely recursive situation. */ static void -print_arg_types (struct type **args, int spaces) +print_arg_types (struct field *args, int nargs, int spaces) { if (args != NULL) { - while (*args != NULL) - { - recursive_dump_type (*args, spaces + 2); - if (TYPE_CODE (*args++) == TYPE_CODE_VOID) - { - break; - } - } + int i; + + for (i = 0; i < nargs; i++) + recursive_dump_type (args[i].type, spaces + 2); } } @@ -2745,7 +2761,9 @@ dump_fn_fieldlists (struct type *type, int spaces) gdb_print_host_address (TYPE_FN_FIELD_ARGS (f, overload_idx), gdb_stdout); printf_filtered ("\n"); - print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), spaces); + print_arg_types (TYPE_FN_FIELD_ARGS (f, overload_idx), + TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, overload_idx)), + spaces); printfi_filtered (spaces + 8, "fcontext "); gdb_print_host_address (TYPE_FN_FIELD_FCONTEXT (f, overload_idx), gdb_stdout); @@ -3087,14 +3105,6 @@ recursive_dump_type (struct type *type, int spaces) printfi_filtered (spaces, "vptr_fieldno %d\n", TYPE_VPTR_FIELDNO (type)); switch (TYPE_CODE (type)) { - case TYPE_CODE_METHOD: - case TYPE_CODE_FUNC: - printfi_filtered (spaces, "arg_types "); - gdb_print_host_address (TYPE_ARG_TYPES (type), gdb_stdout); - puts_filtered ("\n"); - print_arg_types (TYPE_ARG_TYPES (type), spaces); - break; - case TYPE_CODE_STRUCT: printfi_filtered (spaces, "cplus_stuff "); gdb_print_host_address (TYPE_CPLUS_SPECIFIC (type), gdb_stdout); @@ -3300,7 +3310,9 @@ build_gdbtypes (void) = init_simd_type ("__builtin_v2si", builtin_type_int32, "f", 2); /* 128 bit vectors. */ + builtin_type_v2_double = init_vector_type (builtin_type_double, 2); builtin_type_v4_float = init_vector_type (builtin_type_float, 4); + builtin_type_v2_int64 = init_vector_type (builtin_type_int64, 2); builtin_type_v4_int32 = init_vector_type (builtin_type_int32, 4); builtin_type_v8_int16 = init_vector_type (builtin_type_int16, 8); builtin_type_v16_int8 = init_vector_type (builtin_type_int8, 16); @@ -3312,6 +3324,7 @@ build_gdbtypes (void) /* Vector types. */ builtin_type_vec128 = build_builtin_type_vec128 (); + builtin_type_vec128i = build_builtin_type_vec128i (); /* Pointer/Address types. */ @@ -3400,7 +3413,9 @@ _initialize_gdbtypes (void) register_gdbarch_swap (&builtin_type_v8hi, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL); + register_gdbarch_swap (&builtin_type_v2_double, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4_float, sizeof (struct type *), NULL); + register_gdbarch_swap (&builtin_type_v2_int64, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4_int32, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v8_int16, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v16_int8, sizeof (struct type *), NULL); @@ -3409,6 +3424,7 @@ _initialize_gdbtypes (void) register_gdbarch_swap (&builtin_type_v8_int8, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_v4_int16, sizeof (struct type *), NULL); register_gdbarch_swap (&builtin_type_vec128, sizeof (struct type *), NULL); + register_gdbarch_swap (&builtin_type_vec128i, sizeof (struct type *), NULL); REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr); REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr); REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 87b529e67ea..8221bcec37a 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -240,10 +240,8 @@ enum type_code #define TYPE_FLAG_DATA_SPACE (1 << 10) #define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE) -/* FIXME: Kludge to mark a varargs function type for C++ member - function argument processing. Currently only used in dwarf2read.c, - but put it here so we won't accidentally overload the bit with - another flag. */ +/* FIXME drow/2002-06-03: Only used for methods, but applies as well + to functions. */ #define TYPE_FLAG_VARARGS (1 << 11) #define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS) @@ -354,7 +352,7 @@ struct main_type For range types, there are two "fields", the minimum and maximum values (both inclusive). For enum types, each possible value is described by one "field". - For a function type, a "field" for each parameter type. + For a function or method type, a "field" for each parameter. For C++ classes, there is one field for each base class (if it is a derived class) plus one field for each class data member. Member functions are recorded elsewhere. @@ -383,7 +381,7 @@ struct main_type CORE_ADDR physaddr; char *physname; - /* For a function type, this is 1 if the argument is marked + /* For a function or member type, this is 1 if the argument is marked artificial. Artificial arguments should not be shown to the user. */ int artificial; @@ -400,13 +398,14 @@ struct main_type int bitsize; /* In a struct or union type, type of this field. - In a function type, type of this argument. + In a function or member type, type of this argument. In an array type, the domain-type of the array. */ struct type *type; /* Name of field, value or argument. - NULL for range bounds and array domains. */ + NULL for range bounds, array domains, and member function + arguments. */ char *name; @@ -438,14 +437,6 @@ struct main_type union type_specific { - /* ARG_TYPES is for TYPE_CODE_METHOD. - Contains the type of each argument, ending with a void type - after the last argument for normal member functions or a NULL - pointer after the last argument for functions with variable - arguments. */ - - struct type **arg_types; - /* CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to point to cplus_struct_default, a default static instance of a struct cplus_struct_type. */ @@ -604,13 +595,6 @@ struct cplus_struct_type struct type *type; - /* The argument list. Only valid if is_stub is clear. Contains - the type of each argument, including `this', and ending with - a NULL pointer after the last argument. Should not contain - a `this' pointer for static member functions. */ - - struct type **args; - /* For virtual functions. First baseclass that defines this virtual function. */ @@ -792,7 +776,6 @@ extern void allocate_cplus_struct_type (struct type *); #define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations #define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type #define TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific -#define TYPE_ARG_TYPES(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.arg_types #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat #define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type @@ -870,7 +853,7 @@ extern void allocate_cplus_struct_type (struct type *); #define TYPE_FN_FIELD(thisfn, n) (thisfn)[n] #define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname #define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type -#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type) +#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_FIELDS ((thisfn)[n].type) #define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const) #define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile) #define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private) @@ -970,6 +953,7 @@ extern struct type *builtin_type_v2si; /* Type for 128 bit vectors. */ extern struct type *builtin_type_vec128; +extern struct type *builtin_type_vec128i; /* Explicit floating-point formats. See "floatformat.h". */ extern struct type *builtin_type_ieee_single_big; @@ -1094,8 +1078,9 @@ extern struct type *make_type_with_address_space (struct type *type, extern struct type *lookup_member_type (struct type *, struct type *); extern void -smash_to_method_type (struct type *, struct type *, struct type *, - struct type **); +smash_to_method_type (struct type *type, struct type *domain, + struct type *to_type, struct field *args, + int nargs, int varargs); extern void smash_to_member_type (struct type *, struct type *, struct type *); diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 93b9bbb78c1..b12897fda9d 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -39,8 +39,8 @@ extern int h8300hmode, h8300smode; -#undef NUM_REGS -#define NUM_REGS 11 +#undef NUM_REGS +#define NUM_REGS (h8300smode?12:11) #define UNSIGNED_SHORT(X) ((X) & 0xffff) @@ -54,19 +54,18 @@ extern int h8300hmode, h8300smode; #define IS_MOVK_R5(x) (x==0x7905) #define IS_SUB_R5SP(x) (x==0x1957) - /* The register names change depending on whether the h8300h processor type is selected. */ static char *original_register_names[] = REGISTER_NAMES; -static char *h8300h_register_names[] = -{"er0", "er1", "er2", "er3", "er4", "er5", "er6", - "sp", "ccr", "pc", "cycles", "tick", "inst"}; +static char *h8300h_register_names[] = { + "er0", "er1", "er2", "er3", "er4", "er5", "er6", + "sp", "ccr", "pc", "cycles", "exr", "tick", "inst" +}; char **h8300_register_names = original_register_names; - /* Local function declarations. */ static CORE_ADDR examine_prologue (); @@ -766,7 +765,6 @@ h8300s_command (char *args, int from_tty) set_register_names (); } - static void set_machine (char *args, int from_tty) { @@ -824,22 +822,22 @@ _initialize_h8300m (void) specify_exec_file_hook (set_machine_hook); } - - void h8300_print_register_hook (int regno) { - if (regno == 8) + if (regno == CCR_REGNUM) { /* CCR register */ int C, Z, N, V; - unsigned char b[4]; + unsigned char b[REGISTER_SIZE]; unsigned char l; frame_register_read (selected_frame, regno, b); - l = b[REGISTER_VIRTUAL_SIZE (8) - 1]; + l = b[REGISTER_VIRTUAL_SIZE (CCR_REGNUM) - 1]; printf_unfiltered ("\t"); - printf_unfiltered ("I-%d - ", (l & 0x80) != 0); - printf_unfiltered ("H-%d - ", (l & 0x20) != 0); + printf_unfiltered ("I-%d ", (l & 0x80) != 0); + printf_unfiltered ("UI-%d ", (l & 0x40) != 0); + printf_unfiltered ("H-%d ", (l & 0x20) != 0); + printf_unfiltered ("U-%d ", (l & 0x10) != 0); N = (l & 0x8) != 0; Z = (l & 0x4) != 0; V = (l & 0x2) != 0; @@ -869,6 +867,20 @@ h8300_print_register_hook (int regno) if ((Z | (N ^ V)) == 1) printf_unfiltered ("<= "); } + + if (regno == EXR_REGNUM && h8300smode) + { + /* EXR register */ + unsigned char b[REGISTER_SIZE]; + unsigned char l; + frame_register_read (selected_frame, regno, b); + l = b[REGISTER_VIRTUAL_SIZE (EXR_REGNUM) - 1]; + printf_unfiltered ("\t"); + printf_unfiltered ("T-%d - - - ", (l & 0x80) != 0); + printf_unfiltered ("I2-%d ", (l & 4) != 0); + printf_unfiltered ("I1-%d ", (l & 2) != 0); + printf_unfiltered ("I0-%d", (l & 1) != 0); + } } void diff --git a/gdb/hpread.c b/gdb/hpread.c index 45a00a6c417..6443eacac9f 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -3959,38 +3959,10 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* But mark it as NULL if the method was incompletely processed We'll fix this up later when the method is fully processed */ if (TYPE_INCOMPLETE (memtype)) - { - fn_p->field.fn_fields[ix].type = NULL; - fn_p->field.fn_fields[ix].args = NULL; - } + fn_p->field.fn_fields[ix].type = NULL; else - { - fn_p->field.fn_fields[ix].type = memtype; - - /* The argument list */ - TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types - = (struct type **) obstack_alloc (&objfile->type_obstack, - (sizeof (struct type *) - * (TYPE_NFIELDS (memtype) - + 1))); - for (i = 0; i < TYPE_NFIELDS (memtype); i++) - TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type) - .arg_types[i] = TYPE_FIELDS (memtype)[i].type; - /* void termination */ - TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type) - .arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void; - - /* pai: It's not clear why this args field has to be set. Perhaps - * it should be eliminated entirely. */ - fn_p->field.fn_fields[ix].args = - (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (TYPE_NFIELDS (memtype) + 1)); - for (i = 0; i < TYPE_NFIELDS (memtype); i++) - fn_p->field.fn_fields[ix].args[i] - = TYPE_FIELDS (memtype)[i].type; - /* null-terminated, unlike arg_types above e */ - fn_p->field.fn_fields[ix].args[TYPE_NFIELDS (memtype)] = NULL; - } + fn_p->field.fn_fields[ix].type = memtype; + /* For virtual functions, fill in the voffset field with the * virtual table offset. (This is just copied over from the * SOM record; not sure if it is what GDB expects here...). @@ -4466,24 +4438,6 @@ fixup_class_method_type (struct type *class, struct type *method, { /* Set the method type */ TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method; - /* The argument list */ - TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types - = (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (TYPE_NFIELDS (method) + 1)); - for (k = 0; k < TYPE_NFIELDS (method); k++) - TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type; - /* void termination */ - TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void; - - /* pai: It's not clear why this args field has to be set. Perhaps - * it should be eliminated entirely. */ - (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args - = (struct type **) obstack_alloc (&objfile->type_obstack, - sizeof (struct type *) * (TYPE_NFIELDS (method) + 1)); - for (k = 0; k < TYPE_NFIELDS (method); k++) - (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[k] = TYPE_FIELDS (method)[k].type; - /* null-terminated, unlike arg_types above */ - (TYPE_FN_FIELD (TYPE_FN_FIELDLIST1 (class, i), j)).args[TYPE_NFIELDS (method)] = NULL; /* Break out of both loops -- only one method to fix up in a class */ goto finish; @@ -4937,21 +4891,18 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) struct type *retvaltype; int nargs; int i; - struct type **args_type; class_type = hpread_type_lookup (dn_bufp->dptrmem.pointsto, objfile); functype = hpread_type_lookup (dn_bufp->dptrmem.memtype, objfile); retvaltype = TYPE_TARGET_TYPE (functype); nargs = TYPE_NFIELDS (functype); - args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *)); - for (i = 0; i < nargs; i++) - { - args_type[i] = TYPE_FIELD_TYPE (functype, i); - } - args_type[nargs] = NULL; ptrmemtype = alloc_type (objfile); - smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type); + + smash_to_method_type (ptrmemtype, class_type, retvaltype, + TYPE_FIELDS (functype), + TYPE_NFIELDS (functype), + 0); return make_pointer_type (ptrmemtype, NULL); } break; diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index e20e894113e..26f5aaf85ab 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -62,6 +62,9 @@ /* Defines for XMM0_REGNUM etc. */ #include "i386-tdep.h" +/* Defines I386_LINUX_ORIG_EAX_REGNUM. */ +#include "i386-linux-tdep.h" + /* Prototypes for local functions. */ static void dummy_sse_values (void); @@ -311,7 +314,8 @@ supply_gregset (elf_gregset_t *gregsetp) for (i = 0; i < NUM_GREGS; i++) supply_register (i, (char *) (regp + regmap[i])); - supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX)); + if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS) + supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX)); } /* Fill register REGNO (if it is a general-purpose register) in @@ -328,7 +332,8 @@ fill_gregset (elf_gregset_t *gregsetp, int regno) if ((regno == -1 || regno == i)) regcache_collect (i, regp + regmap[i]); - if (regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM) + if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM) + && I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS) regcache_collect (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX); } diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 9592decee19..12a2ab9004d 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -33,9 +33,12 @@ #include "solib-svr4.h" /* For struct link_map_offsets. */ +#include "i386-tdep.h" +#include "i386-linux-tdep.h" + /* Return the name of register REG. */ -char * +static char * i386_linux_register_name (int reg) { /* Deal with the extra "orig_eax" pseudo register. */ @@ -45,7 +48,7 @@ i386_linux_register_name (int reg) return i386_register_name (reg); } -int +static int i386_linux_register_byte (int reg) { /* Deal with the extra "orig_eax" pseudo register. */ @@ -56,7 +59,7 @@ i386_linux_register_byte (int reg) return i386_register_byte (reg); } -int +static int i386_linux_register_raw_size (int reg) { /* Deal with the extra "orig_eax" pseudo register. */ @@ -224,8 +227,8 @@ i386_linux_rt_sigtramp_start (CORE_ADDR pc) /* Return whether PC is in a GNU/Linux sigtramp routine. */ -int -i386_linux_in_sigtramp (CORE_ADDR pc, char *name) +static int +i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name) { if (name) return STREQ ("__restore", name) || STREQ ("__restore_rt", name); @@ -379,7 +382,7 @@ i386_linux_saved_pc_after_call (struct frame_info *frame) /* Set the program counter for process PTID to PC. */ -void +static void i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid) { write_register_pid (PC_REGNUM, pc, ptid); @@ -496,7 +499,7 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc) from a GDB that was not built on an GNU/Linux x86 host (for cross debugging). */ -struct link_map_offsets * +static struct link_map_offsets * i386_linux_svr4_fetch_link_map_offsets (void) { static struct link_map_offsets lmo; @@ -528,3 +531,53 @@ i386_linux_svr4_fetch_link_map_offsets (void) return lmp; } + + +static void +i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* GNU/Linux uses ELF. */ + i386_elf_init_abi (info, gdbarch); + + /* We support the SSE registers on GNU/Linux. */ + tdep->num_xmm_regs = I386_NUM_XREGS - 1; + /* set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); */ + + /* Since we have the extra "orig_eax" register on GNU/Linux, we have + to adjust a few things. */ + + set_gdbarch_write_pc (gdbarch, i386_linux_write_pc); + set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1); + set_gdbarch_register_name (gdbarch, i386_linux_register_name); + set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4); + set_gdbarch_register_byte (gdbarch, i386_linux_register_byte); + set_gdbarch_register_raw_size (gdbarch, i386_linux_register_raw_size); + + tdep->jb_pc_offset = 20; /* From . */ + + /* When the i386 Linux kernel calls a signal handler, the return + address points to a bit of code on the stack. These definitions + are used to identify this bit of code as a signal trampoline in + order to support backtracing through calls to signal handlers. */ + + set_gdbarch_pc_in_sigtramp (gdbarch, i386_linux_pc_in_sigtramp); + set_gdbarch_frame_chain (gdbarch, i386_linux_frame_chain); + set_gdbarch_frame_saved_pc (gdbarch, i386_linux_frame_saved_pc); + set_gdbarch_saved_pc_after_call (gdbarch, i386_linux_saved_pc_after_call); + tdep->sigtramp_saved_pc = i386_linux_sigtramp_saved_pc; + + set_solib_svr4_fetch_link_map_offsets (gdbarch, + i386_linux_svr4_fetch_link_map_offsets); +} + +/* Provide a prototype to silence -Wmissing-prototypes. */ +extern void _initialize_i386_linux_tdep (void); + +void +_initialize_i386_linux_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_LINUX, + i386_linux_init_abi); +} diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index ddc461ec151..f0723fa660b 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -36,8 +36,6 @@ #include "value.h" #include "gdb_assert.h" -#include "elf-bfd.h" - #include "i386-tdep.h" /* Names of the registers. The first 10 registers match the register @@ -119,7 +117,7 @@ i386_register_virtual_size (int reg) /* Convert stabs register number REG to the appropriate register number used by GDB. */ -int +static int i386_stab_reg_to_regnum (int reg) { /* This implements what GCC calls the "default" register map. */ @@ -150,10 +148,10 @@ i386_stab_reg_to_regnum (int reg) return NUM_REGS + NUM_PSEUDO_REGS; } -/* Convert Dwarf register number REG to the appropriate register +/* Convert DWARF register number REG to the appropriate register number used by GDB. */ -int +static int i386_dwarf_reg_to_regnum (int reg) { /* The DWARF register numbering includes %eip and %eflags, and @@ -466,7 +464,7 @@ i386_get_frame_setup (CORE_ADDR pc) frame's nominal address is the address of a 4-byte word containing the calling frame's address. */ -CORE_ADDR +static CORE_ADDR i386_frame_chain (struct frame_info *frame) { if (frame->signal_handler_caller) @@ -493,30 +491,24 @@ i386_frameless_function_invocation (struct frame_info *frame) /* Return the saved program counter for FRAME. */ -CORE_ADDR +static CORE_ADDR i386_frame_saved_pc (struct frame_info *frame) { - /* FIXME: kettenis/2001-05-09: Conditionalizing the next bit of code - on SIGCONTEXT_PC_OFFSET and I386V4_SIGTRAMP_SAVED_PC should be - considered a temporary hack. I plan to come up with something - better when we go multi-arch. */ -#if defined (SIGCONTEXT_PC_OFFSET) || defined (I386V4_SIGTRAMP_SAVED_PC) if (frame->signal_handler_caller) - return sigtramp_saved_pc (frame); -#endif + { + CORE_ADDR (*sigtramp_saved_pc) (struct frame_info *); + sigtramp_saved_pc = gdbarch_tdep (current_gdbarch)->sigtramp_saved_pc; - return read_memory_unsigned_integer (frame->frame + 4, 4); -} + gdb_assert (sigtramp_saved_pc != NULL); + return sigtramp_saved_pc (frame); + } -CORE_ADDR -i386go32_frame_saved_pc (struct frame_info *frame) -{ - return read_memory_integer (frame->frame + 4, 4); + return read_memory_unsigned_integer (frame->frame + 4, 4); } /* Immediately after a function call, return the saved pc. */ -CORE_ADDR +static CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame) { return read_memory_unsigned_integer (read_register (SP_REGNUM), 4); @@ -834,49 +826,35 @@ i386_pop_frame (void) } -#ifdef GET_LONGJMP_TARGET - -/* FIXME: Multi-arching does not set JB_PC and JB_ELEMENT_SIZE yet. - Fill in with dummy value to enable compilation. */ -#ifndef JB_PC -#define JB_PC 0 -#endif /* JB_PC */ - -#ifndef JB_ELEMENT_SIZE -#define JB_ELEMENT_SIZE 4 -#endif /* JB_ELEMENT_SIZE */ - /* Figure out where the longjmp will land. Slurp the args out of the stack. We expect the first arg to be a pointer to the jmp_buf - structure from which we extract the pc (JB_PC) that we will land - at. The pc is copied into PC. This routine returns true on + structure from which we extract the address that we will land at. + This address is copied into PC. This routine returns true on success. */ -int -get_longjmp_target (CORE_ADDR *pc) +static int +i386_get_longjmp_target (CORE_ADDR *pc) { - char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT]; + char buf[4]; CORE_ADDR sp, jb_addr; + int jb_pc_offset = gdbarch_tdep (current_gdbarch)->jb_pc_offset; - sp = read_register (SP_REGNUM); - - if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */ - buf, - TARGET_PTR_BIT / TARGET_CHAR_BIT)) + /* If JB_PC_OFFSET is -1, we have no way to find out where the + longjmp will land. */ + if (jb_pc_offset == -1) return 0; - jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT); - - if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, - TARGET_PTR_BIT / TARGET_CHAR_BIT)) + sp = read_register (SP_REGNUM); + if (target_read_memory (sp + 4, buf, 4)) return 0; - *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT); + jb_addr = extract_address (buf, 4); + if (target_read_memory (jb_addr + jb_pc_offset, buf, 4)) + return 0; + *pc = extract_address (buf, 4); return 1; } - -#endif /* GET_LONGJMP_TARGET */ CORE_ADDR @@ -1044,6 +1022,37 @@ i386_extract_struct_value_address (char *regbuf) } +/* This is the variable that is set with "set struct-convention", and + its legitimate values. */ +static const char default_struct_convention[] = "default"; +static const char pcc_struct_convention[] = "pcc"; +static const char reg_struct_convention[] = "reg"; +static const char *valid_conventions[] = +{ + default_struct_convention, + pcc_struct_convention, + reg_struct_convention, + NULL +}; +static const char *struct_convention = default_struct_convention; + +static int +i386_use_struct_convention (int gcc_p, struct type *type) +{ + enum struct_return struct_return; + + if (struct_convention == default_struct_convention) + struct_return = gdbarch_tdep (current_gdbarch)->struct_return; + else if (struct_convention == pcc_struct_convention) + struct_return = pcc_struct_return; + else + struct_return = reg_struct_return; + + return generic_use_struct_convention (struct_return == reg_struct_return, + type); +} + + /* Return the GDB type object for the "standard" data type of data in register REGNUM. Perhaps %esi and %edi should go here, but potentially they could be used for things other than address. */ @@ -1058,7 +1067,7 @@ i386_register_virtual_type (int regnum) return builtin_type_i387_ext; if (IS_SSE_REGNUM (regnum)) - return builtin_type_v4sf; + return builtin_type_vec128i; return builtin_type_int; } @@ -1122,34 +1131,6 @@ i386_register_convert_to_raw (struct type *type, int regnum, } -#ifdef I386V4_SIGTRAMP_SAVED_PC -/* Get saved user PC for sigtramp from the pushed ucontext on the - stack for all three variants of SVR4 sigtramps. */ - -CORE_ADDR -i386v4_sigtramp_saved_pc (struct frame_info *frame) -{ - CORE_ADDR saved_pc_offset = 4; - char *name = NULL; - - find_pc_partial_function (frame->pc, &name, NULL, NULL); - if (name) - { - if (STREQ (name, "_sigreturn")) - saved_pc_offset = 132 + 14 * 4; - else if (STREQ (name, "_sigacthandler")) - saved_pc_offset = 80 + 14 * 4; - else if (STREQ (name, "sigvechandler")) - saved_pc_offset = 120 + 14 * 4; - } - - if (frame->next) - return read_memory_integer (frame->next->frame + saved_pc_offset, 4); - return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4); -} -#endif /* I386V4_SIGTRAMP_SAVED_PC */ - - #ifdef STATIC_TRANSFORM_NAME /* SunPRO encodes the static variables. This is not related to C++ mangling, it is done for C too. */ @@ -1199,6 +1180,16 @@ skip_trampoline_code (CORE_ADDR pc, char *name) } +/* Return non-zero if PC and NAME show that we are in a signal + trampoline. */ + +static int +i386_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + return (name && strcmp ("_sigtramp", name) == 0); +} + + /* We have two flavours of disassembly. The machinery on this page deals with switching between those. */ @@ -1213,229 +1204,132 @@ gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info) or intel_flavor. */ internal_error (__FILE__, __LINE__, "failed internal consistency check"); } - -/* This table matches the indices assigned to enum i386_abi. Keep - them in sync. */ -static const char * const i386_abi_names[] = -{ - "", - "SVR4", - "NetBSD", - "GNU/Linux", - "GNU/Hurd", - "Solaris", - "FreeBSD", - NULL -}; +/* There are a few i386 architecture variants that differ only + slightly from the generic i386 target. For now, we don't give them + their own source file, but include them here. As a consequence, + they'll always be included. */ -#define ABI_TAG_OS_GNU_LINUX I386_ABI_LINUX -#define ABI_TAG_OS_GNU_HURD I386_ABI_HURD -#define ABI_TAG_OS_GNU_SOLARIS I386_ABI_INVALID -#define ABI_TAG_OS_FREEBSD I386_ABI_FREEBSD -#define ABI_TAG_OS_NETBSD I386_ABI_NETBSD +/* System V Release 4 (SVR4). */ -static void -process_note_sections (bfd *abfd, asection *sect, void *obj) +static int +i386_svr4_pc_in_sigtramp (CORE_ADDR pc, char *name) { - int *abi = obj; - const char *name; - unsigned int sectsize; + return (name && (strcmp ("_sigreturn", name) == 0 + || strcmp ("_sigacthandler", name) == 0 + || strcmp ("sigvechandler", name) == 0)); +} - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); +/* Get saved user PC for sigtramp from the pushed ucontext on the + stack for all three variants of SVR4 sigtramps. */ - if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) +CORE_ADDR +i386_svr4_sigtramp_saved_pc (struct frame_info *frame) +{ + CORE_ADDR saved_pc_offset = 4; + char *name = NULL; + + find_pc_partial_function (frame->pc, &name, NULL, NULL); + if (name) { - unsigned int name_length, data_length, note_type; - char *note; + if (strcmp (name, "_sigreturn") == 0) + saved_pc_offset = 132 + 14 * 4; + else if (strcmp (name, "_sigacthandler") == 0) + saved_pc_offset = 80 + 14 * 4; + else if (strcmp (name, "sigvechandler") == 0) + saved_pc_offset = 120 + 14 * 4; + } - /* If the section is larger than this, it's probably not what we - are looking for. */ - if (sectsize > 128) - sectsize = 128; + if (frame->next) + return read_memory_integer (frame->next->frame + saved_pc_offset, 4); + return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4); +} + - note = alloca (sectsize); +/* DJGPP. */ - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); +static int +i386_go32_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + /* DJGPP doesn't have any special frames for signal handlers. */ + return 0; +} + - name_length = bfd_h_get_32 (abfd, note); - data_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); +/* Generic ELF. */ - if (name_length == 4 && data_length == 16 - && note_type == NT_GNU_ABI_TAG - && strcmp (note + 12, "GNU") == 0) - { - int abi_tag_os = bfd_h_get_32 (abfd, note + 16); +void +i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + /* We typically use stabs-in-ELF with the DWARF register numbering. */ + set_gdbarch_stab_reg_to_regnum (gdbarch, i386_dwarf_reg_to_regnum); +} - /* The case numbers are from abi-tags in glibc. */ - switch (abi_tag_os) - { - case GNU_ABI_TAG_LINUX: - *abi = ABI_TAG_OS_GNU_LINUX; - break; - - case GNU_ABI_TAG_HURD: - *abi = ABI_TAG_OS_GNU_HURD; - break; - - case GNU_ABI_TAG_SOLARIS: - *abi = ABI_TAG_OS_GNU_SOLARIS; - break; - - default: - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: unknown ABI OS tag %d", - abi_tag_os); - break; - } - } - else if (name_length == 8 && data_length == 4 - && note_type == NT_FREEBSD_ABI_TAG - && strcmp (note + 12, "FreeBSD") == 0) - *abi = ABI_TAG_OS_FREEBSD; - } - /* NetBSD uses a similar trick. */ - else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0) - { - unsigned int name_length, desc_length, note_type; - char *note; +/* System V Release 4 (SVR4). */ - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; +void +i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - note = alloca (sectsize); + /* System V Release 4 uses ELF. */ + i386_elf_init_abi (info, gdbarch); - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); + /* FIXME: kettenis/20020511: Why do we override this function here? */ + set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); - name_length = bfd_h_get_32 (abfd, note); - desc_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); + set_gdbarch_pc_in_sigtramp (gdbarch, i386_svr4_pc_in_sigtramp); + tdep->sigtramp_saved_pc = i386_svr4_sigtramp_saved_pc; - if (name_length == 7 && desc_length == 4 - && note_type == NT_NETBSD_IDENT - && strcmp (note + 12, "NetBSD") == 0) - *abi = ABI_TAG_OS_NETBSD; - } + tdep->jb_pc_offset = 20; } -static int -i386_elf_abi_from_note (bfd *abfd) -{ - enum i386_abi abi = I386_ABI_UNKNOWN; - - bfd_map_over_sections (abfd, process_note_sections, &abi); - - return abi; -} +/* DJGPP. */ -static enum i386_abi -i386_elf_abi (bfd *abfd) +void +i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - int elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; - - /* The fact that the EI_OSABI byte is set to ELFOSABI_NONE doesn't - necessarily mean that this is a System V ELF binary. To further - distinguish between binaries for differens operating systems, - check for vendor-specific note elements. */ - if (elfosabi == ELFOSABI_NONE) - { - enum i386_abi abi = i386_elf_abi_from_note (abfd); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (abi != I386_ABI_UNKNOWN) - return abi; - - /* FreeBSD folks are naughty; they stored the string "FreeBSD" - in the padding of the e_ident field of the ELF header. */ - if (strcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD") == 0) - return I386_ABI_FREEBSD; - } + set_gdbarch_pc_in_sigtramp (gdbarch, i386_go32_pc_in_sigtramp); - switch (elfosabi) - { - case ELFOSABI_NONE: - return I386_ABI_SVR4; - case ELFOSABI_FREEBSD: - return I386_ABI_FREEBSD; - } - - return I386_ABI_UNKNOWN; + tdep->jb_pc_offset = 36; } -struct i386_abi_handler -{ - struct i386_abi_handler *next; - enum i386_abi abi; - void (*init_abi)(struct gdbarch_info, struct gdbarch *); -}; - -struct i386_abi_handler *i386_abi_handler_list = NULL; +/* NetWare. */ void -i386_gdbarch_register_os_abi (enum i386_abi abi, - void (*init_abi)(struct gdbarch_info, - struct gdbarch *)) +i386_nw_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - struct i386_abi_handler **handler_p; + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - for (handler_p = &i386_abi_handler_list; *handler_p != NULL; - handler_p = &(*handler_p)->next) - { - if ((*handler_p)->abi == abi) - { - internal_error - (__FILE__, __LINE__, - "i386_gdbarch_register_abi: A handler for this ABI variant " - "(%d) has already been registered", (int) abi); - /* If user wants to continue, override previous definition. */ - (*handler_p)->init_abi = init_abi; - return; - } - } - (*handler_p) - = (struct i386_abi_handler *) xmalloc (sizeof (struct i386_abi_handler)); - (*handler_p)->next = NULL; - (*handler_p)->abi = abi; - (*handler_p)->init_abi = init_abi; + /* FIXME: kettenis/20020511: Why do we override this function here? */ + set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); + + tdep->jb_pc_offset = 24; } + struct gdbarch * i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch_tdep *tdep; struct gdbarch *gdbarch; - enum i386_abi abi = I386_ABI_UNKNOWN; - struct i386_abi_handler *abi_handler; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; + /* Try to determine the OS ABI of the object we're loading. */ if (info.abfd != NULL) - { - switch (bfd_get_flavour (info.abfd)) - { - case bfd_target_elf_flavour: - abi= i386_elf_abi (info.abfd); - break; - - default: - /* Not sure what to do here, leave the ABI as unknown. */ - break; - } - } + osabi = gdbarch_lookup_osabi (info.abfd); /* Find a candidate among extant architectures. */ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL; arches = gdbarch_list_lookup_by_info (arches->next, &info)) { - /* Make sure the ABI selection matches. */ + /* Make sure the OS ABI selection matches. */ tdep = gdbarch_tdep (arches->gdbarch); - if (tdep && tdep->abi == abi) + if (tdep && tdep->osabi == osabi) return arches->gdbarch; } @@ -1443,11 +1337,32 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); - tdep->abi = abi; + tdep->osabi = osabi; + + /* The i386 default settings don't include the SSE registers. + FIXME: kettenis/20020509: They do include the FPU registers for + now, which is not quite right. */ + tdep->num_xmm_regs = 0; + + tdep->jb_pc_offset = -1; + tdep->struct_return = pcc_struct_return; + tdep->sigtramp_saved_pc = NULL; + tdep->sigtramp_start = 0; + tdep->sigtramp_end = 0; + tdep->sc_pc_offset = -1; + + /* The format used for `long double' on almost all i386 targets is + the i387 extended floating-point format. In fact, of all targets + in the GCC 2.95 tree, only OSF/1 does it different, and insists + on having a `long double' that's not `long' at all. */ + set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); + + /* Although the i386 extended floating-point has only 80 significant + bits, a `long double' actually takes up 96, probably to enforce + alignment. */ + set_gdbarch_long_double_bit (gdbarch, 96); - /* FIXME: kettenis/2001-11-24: Although not all IA-32 processors - have the SSE registers, it's easier to set the default to 8. */ - tdep->num_xmm_regs = 8; + set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target); set_gdbarch_use_generic_dummy_frames (gdbarch, 0); @@ -1463,50 +1378,61 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack); - /* NOTE: tm-i386nw.h and tm-i386v4.h override this. */ + set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention); + + /* The following redefines make backtracing through sigtramp work. + They manufacture a fake sigtramp frame and obtain the saved pc in + sigtramp from the sigcontext structure which is pushed by the + kernel on the user stack, along with a pointer to it. */ + + set_gdbarch_frame_chain (gdbarch, i386_frame_chain); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); + set_gdbarch_frame_saved_pc (gdbarch, i386_frame_saved_pc); + set_gdbarch_saved_pc_after_call (gdbarch, i386_saved_pc_after_call); + set_gdbarch_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp); + + /* NOTE: tm-i386aix.h, tm-i386bsd.h, tm-i386os9k.h, tm-ptx.h, + tm-symmetry.h currently override this. Sigh. */ + set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS); + + /* Use the "default" register numbering scheme for stabs and COFF. */ + set_gdbarch_stab_reg_to_regnum (gdbarch, i386_stab_reg_to_regnum); + set_gdbarch_sdb_reg_to_regnum (gdbarch, i386_stab_reg_to_regnum); + + /* Use the DWARF register numbering scheme for DWARF and DWARF 2. */ + set_gdbarch_dwarf_reg_to_regnum (gdbarch, i386_dwarf_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, i386_dwarf_reg_to_regnum); - /* NOTE: tm-i386aix.h, tm-i386bsd.h, tm-i386os9k.h, tm-linux.h, - tm-ptx.h, tm-symmetry.h currently override this. Sigh. */ - set_gdbarch_num_regs (gdbarch, NUM_GREGS + NUM_FREGS + NUM_SSE_REGS); + /* We don't define ECOFF_REG_TO_REGNUM, since ECOFF doesn't seem to + be in use on any of the supported i386 targets. */ + + set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS); + set_gdbarch_register_name (gdbarch, i386_register_name); + set_gdbarch_register_byte (gdbarch, i386_register_byte); + set_gdbarch_register_raw_size (gdbarch, i386_register_raw_size); /* Hook in ABI-specific overrides, if they have been registered. */ - if (abi == I386_ABI_UNKNOWN) - { - /* Don't complain about not knowing the ABI variant if we don't - have an inferior. */ - if (info.abfd) - fprintf_filtered - (gdb_stderr, "GDB doesn't recognize the ABI of the inferior. " - "Attempting to continue with the default i386 settings"); - } - else - { - for (abi_handler = i386_abi_handler_list; abi_handler != NULL; - abi_handler = abi_handler->next) - if (abi_handler->abi == abi) - break; + gdbarch_init_osabi (info, gdbarch, osabi); - if (abi_handler) - abi_handler->init_abi (info, gdbarch); - else - { - /* We assume that if GDB_MULTI_ARCH is less than - GDB_MULTI_ARCH_TM that an ABI variant can be supported by - overriding definitions in this file. */ - if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - fprintf_filtered - (gdb_stderr, - "A handler for the ABI variant \"%s\" is not built into this " - "configuration of GDB. " - "Attempting to continue with the default i386 settings", - i386_abi_names[abi]); - } - } - return gdbarch; } +static enum gdb_osabi +i386_coff_osabi_sniffer (bfd *abfd) +{ + if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0) + return GDB_OSABI_GO32; + + return GDB_OSABI_UNKNOWN; +} + +static enum gdb_osabi +i386_nlm_osabi_sniffer (bfd *abfd) +{ + return GDB_OSABI_NETWARE; +} + + /* Provide a prototype to silence -Wmissing-prototypes. */ void _initialize_i386_tdep (void); @@ -1544,4 +1470,30 @@ and the default value is \"att\".", &setlist); add_show_from_set (new_cmd, &showlist); } + + /* Add the variable that controls the convention for returning + structs. */ + { + struct cmd_list_element *new_cmd; + + new_cmd = add_set_enum_cmd ("struct-convention", no_class, + valid_conventions, + &struct_convention, "\ +Set the convention for returning small structs, valid values \ +are \"default\", \"pcc\" and \"reg\", and the default value is \"default\".", + &setlist); + add_show_from_set (new_cmd, &showlist); + } + + gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour, + i386_coff_osabi_sniffer); + gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_nlm_flavour, + i386_nlm_osabi_sniffer); + + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_SVR4, + i386_svr4_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_GO32, + i386_go32_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETWARE, + i386_nw_init_abi); } diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 0bdbb057e2f..64af99d1e66 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -1,5 +1,5 @@ /* Target-dependent code for GDB, the GNU debugger. - Copyright 2001 + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -22,6 +22,8 @@ #ifndef I386_TDEP_H #define I386_TDEP_H +#include "osabi.h" + /* GDB's i386 target supports both the 32-bit Intel Architecture (IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses a similar register layout for both. @@ -40,30 +42,38 @@ differs and is determined by the num_xmm_regs member of `struct gdbarch_tdep'. */ -/* ABI variants that we know about. */ -enum i386_abi -{ - I386_ABI_UNKNOWN = 0, - - /* ELF */ - I386_ABI_SVR4, /* This is the default. */ - I386_ABI_NETBSD, - I386_ABI_LINUX, - I386_ABI_HURD, - I386_ABI_SOLARIS, - I386_ABI_FREEBSD, +/* Convention for returning structures. */ - I386_ABI_INVALID = -1 +enum struct_return +{ + pcc_struct_return, /* Return "short" structures in memory. */ + reg_struct_return /* Return "short" structures in registers. */ }; /* i386 architecture specific information. */ struct gdbarch_tdep { /* ABI. */ - enum i386_abi abi; + enum gdb_osabi osabi; /* Number of SSE registers. */ int num_xmm_regs; + + /* Offset of saved PC in jmp_buf. */ + int jb_pc_offset; + + /* Convention for returning structures. */ + enum struct_return struct_return; + + /* Get saved PC for sigtramp. */ + CORE_ADDR (*sigtramp_saved_pc) (struct frame_info *); + + /* Address range where sigtramp lives. */ + CORE_ADDR sigtramp_start; + CORE_ADDR sigtramp_end; + + /* Offset of saved PC in `struct sigcontext'. */ + int sc_pc_offset; }; /* Floating-point registers. */ @@ -129,8 +139,42 @@ struct gdbarch_tdep #define IS_FPU_CTRL_REGNUM(n) FPC_REGNUM_P (n) #define IS_SSE_REGNUM(n) SSE_REGNUM_P (n) -void i386_gdbarch_register_os_abi (enum i386_abi, - void (*init_abi)(struct gdbarch_info, - struct gdbarch *)); +#define I386_NUM_GREGS 16 +#define I386_NUM_FREGS 16 +#define I386_NUM_XREGS 9 + +#define I386_SSE_NUM_REGS (I386_NUM_GREGS + I386_NUM_FREGS \ + + I386_NUM_XREGS) + +/* Sizes of individual register sets. These cover the entire register + file, so summing up the sizes of those portions actually present + yields REGISTER_BYTES. */ +#define I386_SIZEOF_GREGS (I386_NUM_GREGS * 4) +#define I386_SIZEOF_FREGS (8 * 10 + 8 * 4) +#define I386_SIZEOF_XREGS (8 * 16 + 4) + +#define I386_SSE_SIZEOF_REGS (I386_SIZEOF_GREGS + I386_SIZEOF_FREGS \ + + I386_SIZEOF_XREGS) + +/* Return the name of register REG. */ +extern char *i386_register_name (int reg); + +/* Return the offset into the register array of the start of register + number REG. */ +extern int i386_register_byte (int reg); + +/* Return the number of bytes of storage in GDB's register array + occupied by register REG. */ +extern int i386_register_raw_size (int reg); + +/* Initialize a basic ELF architecture variant. */ +extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *); + +/* Initialize a SVR4 architecture variant. */ +extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *); + +/* Functions exported from i386bsd-tdep.c. */ + +extern CORE_ADDR i386bsd_sigtramp_saved_pc (struct frame_info *frame); #endif /* i386-tdep.h */ diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c index ad5a3013f34..a941d5b468c 100644 --- a/gdb/i386bsd-nat.c +++ b/gdb/i386bsd-nat.c @@ -382,19 +382,39 @@ kernel_u_size (void) return (sizeof (struct user)); } -/* See i386bsd-tdep.c. */ -extern int i386bsd_sigcontext_pc_offset; - void _initialize_i386bsd_nat (void) { + int sc_pc_offset; + /* To support the recognition of signal handlers, i386bsd-tdep.c hardcodes some constants. Inclusion of this file means that we are compiling a native debugger, which means that we can use the system header files and sysctl(3) to get at the relevant information. */ +#if defined (__FreeBSD_version) && __FreeBSD_version >= 400011 + extern int i386fbsd4_sc_pc_offset; +#define SC_PC_OFFSET i386fbsd4_sc_pc_offset +#elif defined (NetBSD) || defined (__NetBSD_Version__) + extern int i386nbsd_sc_pc_offset; +#define SC_PC_OFFSET i386nbsd_sc_pc_offset +#else + extern int i386bsd_sc_pc_offset; +#define SC_PC_OFFSET i386bsd_sc_pc_offset +#endif + /* Override the default value for the offset of the program counter in the sigcontext structure. */ - i386bsd_sigcontext_pc_offset = offsetof (struct sigcontext, sc_pc); + sc_pc_offset = offsetof (struct sigcontext, sc_pc); + + if (SC_PC_OFFSET != sc_pc_offset) + { + warning ("\ +offsetof (struct sigcontext, sc_pc) yields %d instead of %d.\n\ +Please report this to .", + sc_pc_offset, SC_PC_OFFSET); + } + + SC_PC_OFFSET = sc_pc_offset; } diff --git a/gdb/i386bsd-tdep.c b/gdb/i386bsd-tdep.c index a01ed6b89e6..e6427b3ac9f 100644 --- a/gdb/i386bsd-tdep.c +++ b/gdb/i386bsd-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for i386 BSD's. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -23,26 +23,19 @@ #include "gdbcore.h" #include "regcache.h" -/* Support for signal handlers. */ - -/* Range in which to find the signaltramp routine, traditionally found - on the use stack, just below the user area. Initialized to values - that work for NetBSD and FreeBSD. */ +#include "i386-tdep.h" -CORE_ADDR i386bsd_sigtramp_start = 0xbfbfdf20; -CORE_ADDR i386bsd_sigtramp_end = 0xbfbfdff0; +/* Support for signal handlers. */ /* Return whether PC is in a BSD sigtramp routine. */ -int -i386bsd_in_sigtramp (CORE_ADDR pc, char *name) +static int +i386bsd_pc_in_sigtramp (CORE_ADDR pc, char *name) { - return (pc >= i386bsd_sigtramp_start && pc < i386bsd_sigtramp_end); -} + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -/* Offset in the sigcontext structure of the program counter. - Initialized to the value from 4.4 BSD Lite. */ -int i386bsd_sigcontext_pc_offset = 20; + return (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end); +} /* Assuming FRAME is for a BSD sigtramp routine, return the address of the associated sigcontext structure. */ @@ -62,19 +55,24 @@ i386bsd_sigcontext_addr (struct frame_info *frame) } /* Assuming FRAME is for a BSD sigtramp routine, return the saved - program counter. */ + program counter. -static CORE_ADDR + Note: This function is used for Solaris 2 too, so don't make it + static. */ + +CORE_ADDR i386bsd_sigtramp_saved_pc (struct frame_info *frame) { + int sc_pc_offset = gdbarch_tdep (current_gdbarch)->sc_pc_offset; CORE_ADDR addr; + addr = i386bsd_sigcontext_addr (frame); - return read_memory_unsigned_integer (addr + i386bsd_sigcontext_pc_offset, 4); + return read_memory_unsigned_integer (addr + sc_pc_offset, 4); } /* Return the saved program counter for FRAME. */ -CORE_ADDR +static CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame) { if (frame->signal_handler_caller) @@ -82,3 +80,168 @@ i386bsd_frame_saved_pc (struct frame_info *frame) return read_memory_unsigned_integer (frame->frame + 4, 4); } + +/* Return the start address of the sigtramp routine. */ + +CORE_ADDR +i386bsd_sigtramp_start (CORE_ADDR pc) +{ + return gdbarch_tdep (current_gdbarch)->sigtramp_start; +} + +/* Return the end address of the sigtramp routine. */ + +CORE_ADDR +i386bsd_sigtramp_end (CORE_ADDR pc) +{ + return gdbarch_tdep (current_gdbarch)->sigtramp_end; +} + + +/* Traditional BSD (4.3 BSD, still used for BSDI and 386BSD). */ + +/* From . */ +int i386bsd_sc_pc_offset = 20; + +static void +i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + set_gdbarch_pc_in_sigtramp (gdbarch, i386bsd_pc_in_sigtramp); + + tdep->jb_pc_offset = 0; + + tdep->sigtramp_saved_pc = i386bsd_sigtramp_saved_pc; + tdep->sigtramp_start = 0xfdbfdfc0; + tdep->sigtramp_end = 0xfdbfe000; + tdep->sc_pc_offset = i386bsd_sc_pc_offset; +} + +/* NetBSD 1.0 or later. */ + +/* From . */ +int i386nbsd_sc_pc_offset = 44; + +static void +i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Obviously NetBSD is BSD-based. */ + i386bsd_init_abi (info, gdbarch); + + /* NetBSD uses -freg-struct-return by default. */ + tdep->struct_return = reg_struct_return; + + /* NetBSD uses a different memory layout. */ + tdep->sigtramp_start = 0xbfbfdf20; + tdep->sigtramp_end = 0xbfbfdff0; + + /* NetBSD has a `struct sigcontext' that's different from the + origional 4.3 BSD. */ + tdep->sc_pc_offset = i386nbsd_sc_pc_offset; +} + +/* NetBSD ELF. */ +static void +i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* It's still NetBSD. */ + i386nbsd_init_abi (info, gdbarch); + + /* But ELF-based. */ + i386_elf_init_abi (info, gdbarch); + + /* NetBSD ELF uses -fpcc-struct-return by default. */ + tdep->struct_return = pcc_struct_return; + + /* We support the SSE registers on NetBSD ELF. */ + tdep->num_xmm_regs = I386_NUM_XREGS - 1; + set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS + + I386_NUM_XREGS); +} + +/* FreeBSD 3.0-RELEASE or later. */ + +CORE_ADDR i386fbsd_sigtramp_start = 0xbfbfdf20; +CORE_ADDR i386fbsd_sigtramp_end = 0xbfbfdff0; + +static void +i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Obviously FreeBSD is BSD-based. */ + i386bsd_init_abi (info, gdbarch); + + /* FreeBSD uses -freg-struct-return by default. */ + tdep->struct_return = reg_struct_return; + + /* FreeBSD uses a different memory layout. */ + tdep->sigtramp_start = i386fbsd_sigtramp_start; + tdep->sigtramp_end = i386fbsd_sigtramp_end; +} + +static void +i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + /* It's almost identical to FreeBSD a.out. */ + i386fbsdaout_init_abi (info, gdbarch); + + /* Except that it uses ELF. */ + i386_elf_init_abi (info, gdbarch); +} + +/* FreeBSD 4.0-RELEASE or later. */ + +/* From . */ +int i386fbsd4_sc_pc_offset = 76; + +static void +i386fbsd4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Inherit stuff from older releases. We assume that FreeBSD + 4.0-RELEASE always uses ELF. */ + i386fbsd_init_abi (info, gdbarch); + + /* FreeBSD 4.0 introduced a new `struct sigcontext'. */ + tdep->sc_pc_offset = i386fbsd4_sc_pc_offset; +} + + +static enum gdb_osabi +i386bsd_aout_osabi_sniffer (bfd *abfd) +{ + if (strcmp (bfd_get_target (abfd), "a.out-i386-netbsd") == 0) + return GDB_OSABI_NETBSD_AOUT; + + if (strcmp (bfd_get_target (abfd), "a.out-i386-freebsd") == 0) + return GDB_OSABI_FREEBSD_AOUT; + + return GDB_OSABI_UNKNOWN; +} + + +/* Provide a prototype to silence -Wmissing-prototypes. */ +void _initialize_i386bsd_tdep (void); + +void +_initialize_i386bsd_tdep (void) +{ + gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour, + i386bsd_aout_osabi_sniffer); + + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_AOUT, + i386nbsd_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_NETBSD_ELF, + i386nbsdelf_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_AOUT, + i386fbsdaout_init_abi); + gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_FREEBSD_ELF, + i386fbsd4_init_abi); +} diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c index 1c19ac87eb4..a80d0a0af89 100644 --- a/gdb/i386fbsd-nat.c +++ b/gdb/i386fbsd-nat.c @@ -1,5 +1,5 @@ /* Native-dependent code for FreeBSD/i386. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -79,7 +79,7 @@ _initialize_i386fbsd_nat (void) { /* FreeBSD provides a kern.ps_strings sysctl that we can use to locate the sigtramp. That way we can still recognize a sigtramp - if it's location is changed in a new kernel. Of course this is + if its location is changed in a new kernel. Of course this is still based on the assumption that the sigtramp is placed directly under the location where the program arguments and environment can be found. */ @@ -89,13 +89,16 @@ _initialize_i386fbsd_nat (void) int ps_strings; size_t len; + extern CORE_ADDR i386fbsd_sigtramp_start; + extern CORE_ADDR i386fbsd_sigtramp_end; + mib[0] = CTL_KERN; mib[1] = KERN_PS_STRINGS; len = sizeof (ps_strings); if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0) { - i386bsd_sigtramp_start = ps_strings - 128; - i386bsd_sigtramp_end = ps_strings; + i386fbsd_sigtramp_start = ps_strings - 128; + i386fbsd_sigtramp_end = ps_strings; } } #endif diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 02ba77c7be9..c327d426de4 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -137,16 +137,6 @@ static struct core_fns i386nbsd_elfcore_fns = NULL /* next */ }; -/* FIXME: should be multi-arch'd */ -int -i386nbsd_aout_use_struct_convention (int gcc_p, struct type *type) -{ - return !(TYPE_LENGTH (type) == 1 - || TYPE_LENGTH (type) == 2 - || TYPE_LENGTH (type) == 4 - || TYPE_LENGTH (type) == 8); -} - void _initialize_i386nbsd_tdep (void) { diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index ab7e4674f75..44210d7d065 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -96,8 +96,8 @@ static gdbarch_frame_saved_pc_ftype ia64_frame_saved_pc; static gdbarch_skip_prologue_ftype ia64_skip_prologue; static gdbarch_frame_init_saved_regs_ftype ia64_frame_init_saved_regs; static gdbarch_get_saved_register_ftype ia64_get_saved_register; -static gdbarch_extract_return_value_ftype ia64_extract_return_value; -static gdbarch_extract_struct_value_address_ftype ia64_extract_struct_value_address; +static gdbarch_deprecated_extract_return_value_ftype ia64_extract_return_value; +static gdbarch_deprecated_extract_struct_value_address_ftype ia64_extract_struct_value_address; static gdbarch_use_struct_convention_ftype ia64_use_struct_convention; static gdbarch_frameless_function_invocation_ftype ia64_frameless_function_invocation; static gdbarch_init_extra_frame_info_ftype ia64_init_extra_frame_info; @@ -2190,11 +2190,11 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw); set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention); - set_gdbarch_extract_return_value (gdbarch, ia64_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value); set_gdbarch_store_struct_return (gdbarch, ia64_store_struct_return); set_gdbarch_store_return_value (gdbarch, ia64_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); set_gdbarch_memory_insert_breakpoint (gdbarch, ia64_memory_insert_breakpoint); set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index ae5d5253902..89138e80007 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1847,7 +1847,7 @@ interrupt_target_command (char *args, int from_tty) static void float_info (char *addr_exp, int from_tty) { - PRINT_FLOAT_INFO (); + gdbarch_print_float_info (current_gdbarch, gdb_stdout, selected_frame); } /* ARGSUSED */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 409fede4d1d..cb8f1086341 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3914,7 +3914,9 @@ struct inferior_status any registers. */ struct regcache *registers; - int selected_level; + /* A frame unique identifier. */ + struct frame_id selected_frame_id; + int breakpoint_proceeded; int restore_stack_info; int proceed_to_finish; @@ -3965,38 +3967,21 @@ save_inferior_status (int restore_stack_info) inf_status->registers = regcache_dup (current_regcache); - record_selected_frame (&(inf_status->selected_frame_address), - &(inf_status->selected_level)); + get_frame_id (selected_frame, &inf_status->selected_frame_id); return inf_status; } -struct restore_selected_frame_args -{ - CORE_ADDR frame_address; - int level; -}; - static int restore_selected_frame (void *args) { - struct restore_selected_frame_args *fr = - (struct restore_selected_frame_args *) args; + struct frame_id *fid = (struct frame_id *) args; struct frame_info *frame; - int level = fr->level; - frame = find_relative_frame (get_current_frame (), &level); + frame = frame_find_by_id (*fid); /* If inf_status->selected_frame_address is NULL, there was no previously selected frame. */ - if (frame == NULL || - /* FRAME_FP (frame) != fr->frame_address || */ - /* elz: deleted this check as a quick fix to the problem that - for function called by hand gdb creates no internal frame - structure and the real stack and gdb's idea of stack are - different if nested calls by hands are made. - - mvs: this worries me. */ - level != 0) + if (frame == NULL) { warning ("Unable to restore previously selected frame.\n"); return 0; @@ -4046,19 +4031,14 @@ restore_inferior_status (struct inferior_status *inf_status) if (target_has_stack && inf_status->restore_stack_info) { - struct restore_selected_frame_args fr; - fr.level = inf_status->selected_level; - fr.frame_address = inf_status->selected_frame_address; /* The point of catch_errors is that if the stack is clobbered, - walking the stack might encounter a garbage pointer and error() - trying to dereference it. */ - if (catch_errors (restore_selected_frame, &fr, + walking the stack might encounter a garbage pointer and + error() trying to dereference it. */ + if (catch_errors (restore_selected_frame, &inf_status->selected_frame_id, "Unable to restore previously selected frame:\n", RETURN_MASK_ERROR) == 0) /* Error in restoring the selected frame. Select the innermost frame. */ - - select_frame (get_current_frame ()); } diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 6d00ab1faf5..38ec7e348e4 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1117,7 +1117,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_extract_return_value (gdbarch, m68hc11_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, m68hc11_extract_return_value); set_gdbarch_push_arguments (gdbarch, m68hc11_push_arguments); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); set_gdbarch_push_return_address (gdbarch, m68hc11_push_return_address); @@ -1125,8 +1125,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return); set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m68hc11_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not); @@ -1143,7 +1142,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_store_struct_return (gdbarch, m68hc11_store_struct_return); set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value); - set_gdbarch_extract_struct_value_address + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention); set_gdbarch_init_extra_frame_info (gdbarch, m68hc11_init_extra_frame_info); diff --git a/gdb/macrotab.c b/gdb/macrotab.c index d979a91b71f..bb615a55723 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -660,27 +660,64 @@ find_definition (const char *name, } -/* If NAME already has a definition in scope at LINE in FILE, and - return the key. Otherwise, return zero. */ +/* If NAME already has a definition in scope at LINE in SOURCE, return + the key. If the old definition is different from the definition + given by KIND, ARGC, ARGV, and REPLACEMENT, complain, too. + Otherwise, return zero. (ARGC and ARGV are meaningless unless KIND + is `macro_function_like'.) */ static struct macro_key * check_for_redefinition (struct macro_source_file *source, int line, - const char *name) + const char *name, enum macro_kind kind, + int argc, const char **argv, + const char *replacement) { splay_tree_node n = find_definition (name, source, line); - /* This isn't really right. There's nothing wrong with redefining a - macro if the new replacement list is the same as the old one. */ if (n) { struct macro_key *found_key = (struct macro_key *) n->key; - static struct complaint macro_redefined = { - "macro `%s' redefined at %s:%d;" - "original definition at %s:%d", 0, 0 - }; - complain (¯o_redefined, name, - source->filename, line, - found_key->start_file->filename, - found_key->start_line); + struct macro_definition *found_def + = (struct macro_definition *) n->value; + int same = 1; + + /* Is this definition the same as the existing one? + According to the standard, this comparison needs to be done + on lists of tokens, not byte-by-byte, as we do here. But + that's too hard for us at the moment, and comparing + byte-by-byte will only yield false negatives (i.e., extra + warning messages), not false positives (i.e., unnoticed + definition changes). */ + if (kind != found_def->kind) + same = 0; + else if (strcmp (replacement, found_def->replacement)) + same = 0; + else if (kind == macro_function_like) + { + if (argc != found_def->argc) + same = 0; + else + { + int i; + + for (i = 0; i < argc; i++) + if (strcmp (argv[i], found_def->argv[i])) + same = 0; + } + } + + if (! same) + { + static struct complaint macro_redefined = { + "macro `%s' redefined at %s:%d; original definition at %s:%d", + 0, 0 + }; + complain (¯o_redefined, + name, + source->filename, line, + found_key->start_file->filename, + found_key->start_line); + } + return found_key; } else @@ -696,7 +733,10 @@ macro_define_object (struct macro_source_file *source, int line, struct macro_key *k; struct macro_definition *d; - k = check_for_redefinition (source, line, name); + k = check_for_redefinition (source, line, + name, macro_object_like, + 0, 0, + replacement); /* If we're redefining a symbol, and the existing key would be identical to our new key, then the splay_tree_insert function @@ -726,7 +766,10 @@ macro_define_function (struct macro_source_file *source, int line, struct macro_key *k; struct macro_definition *d; - k = check_for_redefinition (source, line, name); + k = check_for_redefinition (source, line, + name, macro_function_like, + argc, argv, + replacement); /* See comments about duplicate keys in macro_define_object. */ if (k && ! key_compare (k, name, source, line)) diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index bb529748feb..fb029512645 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -11,6 +11,17 @@ (register_changed_p): Use regbuf_read and regbuf_write. (setup_architecture_data): Use regbuf_xmalloc. +2002-05-20 Keith Seitz + + * mi-main.c (captured_mi_execute_command): Add uiout parameter. + "data" is now a structure which is used to pass data to/from this + function to mi_execute_command. + Modify function to comply with requirements from catch_exceptions. + Store real return result and command's return result in data. + (mi_execute_command): Use catch_exceptions. + Use enum to handle actions to be performed instead of overloading + catch_errors return result and the mi return result. + 2002-04-14 Andrew Cagney * mi-main.c (mi_cmd_exec_return): diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 33f1cc723e9..d0e63e9a85a 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -48,6 +48,29 @@ enum FROM_TTY = 0 }; +/* Enumerations of the actions that may result from calling + captured_mi_execute_command */ + +enum captured_mi_execute_command_actions + { + EXECUTE_COMMAND_DISPLAY_PROMPT, + EXECUTE_COMMAND_SUPRESS_PROMPT, + EXECUTE_COMMAND_DISPLAY_ERROR + }; + +/* This structure is used to pass information from captured_mi_execute_command + to mi_execute_command. */ +struct captured_mi_execute_command_args +{ + /* This return result of the MI command (output) */ + enum mi_cmd_result rc; + + /* What action to perform when the call is finished (output) */ + enum captured_mi_execute_command_actions action; + + /* The command context to be executed (input) */ + struct mi_parse *command; +}; int mi_debug_p; struct ui_file *raw_stdout; @@ -1023,15 +1046,19 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc) return MI_CMD_DONE; } -/* Execute a command within a safe environment. Return >0 for - ok. Return <0 for supress prompt. Return 0 to have the error - extracted from error_last_message(). */ +/* Execute a command within a safe environment. + Return <0 for error; >=0 for ok. + + args->action will tell mi_execute_command what action + to perfrom after the given command has executed (display/supress + prompt, display error). */ static int -captured_mi_execute_command (void *data) +captured_mi_execute_command (struct ui_out *uiout, void *data) { - struct mi_parse *context = data; - enum mi_cmd_result rc; + struct captured_mi_execute_command_args *args = + (struct captured_mi_execute_command_args *) data; + struct mi_parse *context = args->command; switch (context->op) { @@ -1046,11 +1073,13 @@ captured_mi_execute_command (void *data) condition expression, each function should return an indication of what action is required and then switch on that. */ - rc = mi_cmd_execute (context); + args->action = EXECUTE_COMMAND_DISPLAY_PROMPT; + args->rc = mi_cmd_execute (context); + if (!target_can_async_p () || !target_executing) { /* print the result if there were no errors */ - if (rc == MI_CMD_DONE) + if (args->rc == MI_CMD_DONE) { fputs_unfiltered (context->token, raw_stdout); fputs_unfiltered ("^done", raw_stdout); @@ -1058,7 +1087,7 @@ captured_mi_execute_command (void *data) mi_out_rewind (uiout); fputs_unfiltered ("\n", raw_stdout); } - else if (rc == MI_CMD_ERROR) + else if (args->rc == MI_CMD_ERROR) { if (mi_error_message) { @@ -1070,18 +1099,22 @@ captured_mi_execute_command (void *data) } mi_out_rewind (uiout); } - else if (rc == MI_CMD_CAUGHT_ERROR) + else if (args->rc == MI_CMD_CAUGHT_ERROR) { mi_out_rewind (uiout); - return 0; + args->action = EXECUTE_COMMAND_DISPLAY_ERROR; + return 1; } else mi_out_rewind (uiout); } else if (sync_execution) - /* Don't print the prompt. We are executing the target in - synchronous mode. */ - return -1; + { + /* Don't print the prompt. We are executing the target in + synchronous mode. */ + args->action = EXECUTE_COMMAND_SUPRESS_PROMPT; + return 1; + } break; case CLI_COMMAND: @@ -1100,9 +1133,12 @@ captured_mi_execute_command (void *data) mi_out_put (uiout, raw_stdout); mi_out_rewind (uiout); fputs_unfiltered ("\n", raw_stdout); + args->action = EXECUTE_COMMAND_DISPLAY_PROMPT; + args->rc = MI_CMD_DONE; break; } + return 1; } @@ -1111,6 +1147,9 @@ void mi_execute_command (char *cmd, int from_tty) { struct mi_parse *command; + struct captured_mi_execute_command_args args; + struct ui_out *saved_uiout = uiout; + int result, rc; /* This is to handle EOF (^D). We just quit gdb. */ /* FIXME: we should call some API function here. */ @@ -1121,18 +1160,20 @@ mi_execute_command (char *cmd, int from_tty) if (command != NULL) { - /* FIXME: cagney/1999-11-04: Can this use of catch_errors either + /* FIXME: cagney/1999-11-04: Can this use of catch_exceptions either be pushed even further down or even eliminated? */ - int rc = catch_errors (captured_mi_execute_command, command, "", - RETURN_MASK_ALL); - if (rc < 0) + args.command = command; + result = catch_exceptions (uiout, captured_mi_execute_command, &args, "", + RETURN_MASK_ALL); + + if (args.action == EXECUTE_COMMAND_SUPRESS_PROMPT) { /* The command is executing synchronously. Bail out early suppressing the finished prompt. */ mi_parse_free (command); return; } - if (rc == 0) + if (args.action == EXECUTE_COMMAND_DISPLAY_ERROR || result < 0) { char *msg = error_last_message (); struct cleanup *cleanup = make_cleanup (xfree, msg); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 16ebaca7eb7..d7f6d855ea0 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -38,6 +38,7 @@ #include "target.h" #include "arch-utils.h" #include "regcache.h" +#include "osabi.h" #include "opcode/mips.h" #include "elf/mips.h" @@ -105,12 +106,6 @@ enum mips_fpu_type #endif static int mips_fpu_type_auto = 1; static enum mips_fpu_type mips_fpu_type = MIPS_DEFAULT_FPU_TYPE; -#define MIPS_FPU_TYPE mips_fpu_type - -/* Do not use "TARGET_IS_MIPS64" to test the size of floating point registers */ -#ifndef FP_REGISTER_DOUBLE -#define FP_REGISTER_DOUBLE (REGISTER_VIRTUAL_SIZE(FP0_REGNUM) == 8) -#endif static int mips_debug = 0; @@ -119,6 +114,7 @@ struct gdbarch_tdep { /* from the elf header */ int elf_flags; + /* mips options */ enum mips_abi mips_abi; const char *mips_abi_string; @@ -131,37 +127,22 @@ struct gdbarch_tdep int mips_default_stack_argsize; int gdb_target_is_mips64; int default_mask_address_p; + + enum gdb_osabi osabi; }; -#if GDB_MULTI_ARCH -#undef MIPS_EABI #define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \ || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64) -#endif -#if GDB_MULTI_ARCH -#undef MIPS_LAST_FP_ARG_REGNUM #define MIPS_LAST_FP_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_fp_arg_regnum) -#endif -#if GDB_MULTI_ARCH -#undef MIPS_LAST_ARG_REGNUM #define MIPS_LAST_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_arg_regnum) -#endif -#if GDB_MULTI_ARCH -#undef MIPS_FPU_TYPE #define MIPS_FPU_TYPE (gdbarch_tdep (current_gdbarch)->mips_fpu_type) -#endif /* Return the currently configured (or set) saved register size. */ -#if GDB_MULTI_ARCH -#undef MIPS_DEFAULT_SAVED_REGSIZE #define MIPS_DEFAULT_SAVED_REGSIZE (gdbarch_tdep (current_gdbarch)->mips_default_saved_regsize) -#elif !defined (MIPS_DEFAULT_SAVED_REGSIZE) -#define MIPS_DEFAULT_SAVED_REGSIZE MIPS_REGSIZE -#endif static const char *mips_saved_regsize_string = size_auto; @@ -208,31 +189,18 @@ mips2_fp_compat (void) form double-precision values). Do not use "TARGET_IS_MIPS64" to determine if the ABI is using double-precision registers. See also MIPS_FPU_TYPE. */ -#if GDB_MULTI_ARCH -#undef FP_REGISTER_DOUBLE #define FP_REGISTER_DOUBLE (gdbarch_tdep (current_gdbarch)->mips_fp_register_double) -#endif /* Does the caller allocate a ``home'' for each register used in the function call? The N32 ABI and MIPS_EABI do not, the others do. */ -#if GDB_MULTI_ARCH -#undef MIPS_REGS_HAVE_HOME_P #define MIPS_REGS_HAVE_HOME_P (gdbarch_tdep (current_gdbarch)->mips_regs_have_home_p) -#elif !defined (MIPS_REGS_HAVE_HOME_P) -#define MIPS_REGS_HAVE_HOME_P (!MIPS_EABI) -#endif /* The amount of space reserved on the stack for registers. This is different to MIPS_SAVED_REGSIZE as it determines the alignment of data allocated after the registers have run out. */ -#if GDB_MULTI_ARCH -#undef MIPS_DEFAULT_STACK_ARGSIZE #define MIPS_DEFAULT_STACK_ARGSIZE (gdbarch_tdep (current_gdbarch)->mips_default_stack_argsize) -#elif !defined (MIPS_DEFAULT_STACK_ARGSIZE) -#define MIPS_DEFAULT_STACK_ARGSIZE (MIPS_DEFAULT_SAVED_REGSIZE) -#endif #define MIPS_STACK_ARGSIZE (mips_stack_argsize ()) @@ -249,17 +217,9 @@ mips_stack_argsize (void) return 4; } -#if GDB_MULTI_ARCH -#undef GDB_TARGET_IS_MIPS64 #define GDB_TARGET_IS_MIPS64 (gdbarch_tdep (current_gdbarch)->gdb_target_is_mips64 + 0) -#endif -#if GDB_MULTI_ARCH -#undef MIPS_DEFAULT_MASK_ADDRESS_P #define MIPS_DEFAULT_MASK_ADDRESS_P (gdbarch_tdep (current_gdbarch)->default_mask_address_p) -#elif !defined (MIPS_DEFAULT_MASK_ADDRESS_P) -#define MIPS_DEFAULT_MASK_ADDRESS_P (0) -#endif #define VM_MIN_ADDRESS (CORE_ADDR)0x400000 @@ -421,6 +381,8 @@ static unsigned int heuristic_fence_post = 0; #define PROC_REG_OFFSET(proc) ((proc)->pdr.regoffset) #define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset) #define PROC_PC_REG(proc) ((proc)->pdr.pcreg) +/* FIXME drow/2002-06-10: If a pointer on the host is bigger than a long, + this will corrupt pdr.iline. Fortunately we don't use it. */ #define PROC_SYMBOL(proc) (*(struct symbol**)&(proc)->pdr.isym) #define _PROC_MAGIC_ 0x0F0F0F0F #define PROC_DESC_IS_DUMMY(proc) ((proc)->pdr.isym == _PROC_MAGIC_) @@ -1928,6 +1890,30 @@ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc, return &temp_proc_desc; } +struct mips_objfile_private +{ + bfd_size_type size; + char *contents; +}; + +/* Global used to communicate between non_heuristic_proc_desc and + compare_pdr_entries within qsort (). */ +static bfd *the_bfd; + +static int +compare_pdr_entries (const void *a, const void *b) +{ + CORE_ADDR lhs = bfd_get_32 (the_bfd, (bfd_byte *) a); + CORE_ADDR rhs = bfd_get_32 (the_bfd, (bfd_byte *) b); + + if (lhs < rhs) + return -1; + else if (lhs == rhs) + return 0; + else + return 1; +} + static mips_extra_func_info_t non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr) { @@ -1935,23 +1921,145 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr) mips_extra_func_info_t proc_desc; struct block *b = block_for_pc (pc); struct symbol *sym; + struct obj_section *sec; + struct mips_objfile_private *priv; + + if (PC_IN_CALL_DUMMY (pc, 0, 0)) + return NULL; find_pc_partial_function (pc, NULL, &startaddr, NULL); if (addrptr) *addrptr = startaddr; - if (b == NULL || PC_IN_CALL_DUMMY (pc, 0, 0)) - sym = NULL; - else + + priv = NULL; + + sec = find_pc_section (pc); + if (sec != NULL) { - if (startaddr > BLOCK_START (b)) - /* This is the "pathological" case referred to in a comment in - print_frame_info. It might be better to move this check into - symbol reading. */ - sym = NULL; - else - sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, 0, NULL); + priv = (struct mips_objfile_private *) sec->objfile->obj_private; + + /* Search the ".pdr" section generated by GAS. This includes most of + the information normally found in ECOFF PDRs. */ + + the_bfd = sec->objfile->obfd; + if (priv == NULL + && (the_bfd->format == bfd_object + && bfd_get_flavour (the_bfd) == bfd_target_elf_flavour + && elf_elfheader (the_bfd)->e_ident[EI_CLASS] == ELFCLASS64)) + { + /* Right now GAS only outputs the address as a four-byte sequence. + This means that we should not bother with this method on 64-bit + targets (until that is fixed). */ + + priv = obstack_alloc (& sec->objfile->psymbol_obstack, + sizeof (struct mips_objfile_private)); + priv->size = 0; + sec->objfile->obj_private = priv; + } + else if (priv == NULL) + { + asection *bfdsec; + + priv = obstack_alloc (& sec->objfile->psymbol_obstack, + sizeof (struct mips_objfile_private)); + + bfdsec = bfd_get_section_by_name (sec->objfile->obfd, ".pdr"); + if (bfdsec != NULL) + { + priv->size = bfd_section_size (sec->objfile->obfd, bfdsec); + priv->contents = obstack_alloc (& sec->objfile->psymbol_obstack, + priv->size); + bfd_get_section_contents (sec->objfile->obfd, bfdsec, + priv->contents, 0, priv->size); + + /* In general, the .pdr section is sorted. However, in the + presence of multiple code sections (and other corner cases) + it can become unsorted. Sort it so that we can use a faster + binary search. */ + qsort (priv->contents, priv->size / 32, 32, compare_pdr_entries); + } + else + priv->size = 0; + + sec->objfile->obj_private = priv; + } + the_bfd = NULL; + + if (priv->size != 0) + { + int low, mid, high; + char *ptr; + + low = 0; + high = priv->size / 32; + + do + { + CORE_ADDR pdr_pc; + + mid = (low + high) / 2; + + ptr = priv->contents + mid * 32; + pdr_pc = bfd_get_signed_32 (sec->objfile->obfd, ptr); + pdr_pc += ANOFFSET (sec->objfile->section_offsets, + SECT_OFF_TEXT (sec->objfile)); + if (pdr_pc == startaddr) + break; + if (pdr_pc > startaddr) + high = mid; + else + low = mid + 1; + } + while (low != high); + + if (low != high) + { + struct symbol *sym = find_pc_function (pc); + + /* Fill in what we need of the proc_desc. */ + proc_desc = (mips_extra_func_info_t) + obstack_alloc (&sec->objfile->psymbol_obstack, + sizeof (struct mips_extra_func_info)); + PROC_LOW_ADDR (proc_desc) = startaddr; + + /* Only used for dummy frames. */ + PROC_HIGH_ADDR (proc_desc) = 0; + + PROC_FRAME_OFFSET (proc_desc) + = bfd_get_32 (sec->objfile->obfd, ptr + 20); + PROC_FRAME_REG (proc_desc) = bfd_get_32 (sec->objfile->obfd, + ptr + 24); + PROC_FRAME_ADJUST (proc_desc) = 0; + PROC_REG_MASK (proc_desc) = bfd_get_32 (sec->objfile->obfd, + ptr + 4); + PROC_FREG_MASK (proc_desc) = bfd_get_32 (sec->objfile->obfd, + ptr + 12); + PROC_REG_OFFSET (proc_desc) = bfd_get_32 (sec->objfile->obfd, + ptr + 8); + PROC_FREG_OFFSET (proc_desc) + = bfd_get_32 (sec->objfile->obfd, ptr + 16); + PROC_PC_REG (proc_desc) = bfd_get_32 (sec->objfile->obfd, + ptr + 28); + proc_desc->pdr.isym = (long) sym; + + return proc_desc; + } + } } + if (b == NULL) + return NULL; + + if (startaddr > BLOCK_START (b)) + { + /* This is the "pathological" case referred to in a comment in + print_frame_info. It might be better to move this check into + symbol reading. */ + return NULL; + } + + sym = lookup_symbol (MIPS_EFI_SYMBOL_NAME, b, LABEL_NAMESPACE, 0, NULL); + /* If we never found a PDR for this function in symbol reading, then examine prologues to find the information. */ if (sym) @@ -3563,10 +3671,7 @@ set_mipsfpu_single_command (char *args, int from_tty) { mips_fpu_type = MIPS_FPU_SINGLE; mips_fpu_type_auto = 0; - if (GDB_MULTI_ARCH) - { - gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_SINGLE; - } + gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_SINGLE; } static void @@ -3574,10 +3679,7 @@ set_mipsfpu_double_command (char *args, int from_tty) { mips_fpu_type = MIPS_FPU_DOUBLE; mips_fpu_type_auto = 0; - if (GDB_MULTI_ARCH) - { - gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_DOUBLE; - } + gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_DOUBLE; } static void @@ -3585,10 +3687,7 @@ set_mipsfpu_none_command (char *args, int from_tty) { mips_fpu_type = MIPS_FPU_NONE; mips_fpu_type_auto = 0; - if (GDB_MULTI_ARCH) - { - gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_NONE; - } + gdbarch_tdep (current_gdbarch)->mips_fpu_type = MIPS_FPU_NONE; } static void @@ -4122,6 +4221,32 @@ mips_integer_to_address (struct type *type, void *buf) TYPE_LENGTH (builtin_type_void_data_ptr)); } +static void +mips_find_abi_section (bfd *abfd, asection *sect, void *obj) +{ + enum mips_abi *abip = (enum mips_abi *) obj; + const char *name = bfd_get_section_name (abfd, sect); + + if (*abip != MIPS_ABI_UNKNOWN) + return; + + if (strncmp (name, ".mdebug.", 8) != 0) + return; + + if (strcmp (name, ".mdebug.abi32") == 0) + *abip = MIPS_ABI_O32; + else if (strcmp (name, ".mdebug.abiN32") == 0) + *abip = MIPS_ABI_N32; + else if (strcmp (name, ".mdebug.abiO64") == 0) + *abip = MIPS_ABI_O64; + else if (strcmp (name, ".mdebug.eabi32") == 0) + *abip = MIPS_ABI_EABI32; + else if (strcmp (name, ".mdebug.eabi64") == 0) + *abip = MIPS_ABI_EABI64; + else + warning ("unsupported ABI %s.", name + 8); +} + static struct gdbarch * mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -4132,6 +4257,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_tdep *tdep; int elf_flags; enum mips_abi mips_abi; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; /* Reset the disassembly info, in case it was set to something non-default. */ @@ -4139,12 +4265,18 @@ mips_gdbarch_init (struct gdbarch_info info, tm_print_insn_info.arch = bfd_arch_unknown; tm_print_insn_info.mach = 0; - /* Extract the elf_flags if available */ - if (info.abfd != NULL - && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour) - elf_flags = elf_elfheader (info.abfd)->e_flags; - else - elf_flags = 0; + elf_flags = 0; + + if (info.abfd) + { + /* First of all, extract the elf_flags, if available. */ + if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour) + elf_flags = elf_elfheader (info.abfd)->e_flags; + + /* Try to determine the OS ABI of the object we are loading. If + we end up with `unknown', just leave it that way. */ + osabi = gdbarch_lookup_osabi (info.abfd); + } /* Check ELF_FLAGS to see if it specifies the ABI being used. */ switch ((elf_flags & EF_MIPS_ABI)) @@ -4169,6 +4301,10 @@ mips_gdbarch_init (struct gdbarch_info info, break; } + /* GCC creates a pseudo-section whose name describes the ABI. */ + if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL) + bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi); + /* Try the architecture for any hint of the corect ABI */ if (mips_abi == MIPS_ABI_UNKNOWN && info.bfd_arch_info != NULL @@ -4215,13 +4351,15 @@ mips_gdbarch_init (struct gdbarch_info info, continue; if (gdbarch_tdep (arches->gdbarch)->mips_abi != mips_abi) continue; - return arches->gdbarch; + if (gdbarch_tdep (arches->gdbarch)->osabi == osabi) + return arches->gdbarch; } /* Need a new architecture. Fill in a target specific vector. */ tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); tdep->elf_flags = elf_flags; + tdep->osabi = osabi; /* Initially set everything according to the default ABI/ISA. */ set_gdbarch_short_bit (gdbarch, 16); @@ -4433,6 +4571,10 @@ mips_gdbarch_init (struct gdbarch_info info, set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address); set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer); set_gdbarch_integer_to_address (gdbarch, mips_integer_to_address); + + /* Hook in OS ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch, osabi); + return gdbarch; } @@ -4841,6 +4983,10 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "mips_dump_tdep: _PROC_MAGIC_ = %d\n", _PROC_MAGIC_); + + fprintf_unfiltered (file, + "mips_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); } void @@ -4919,21 +5065,6 @@ This option can be set to one of:\n\ "Show current use of MIPS floating-point coprocessor target.", &showlist); -#if !GDB_MULTI_ARCH - c = add_set_cmd ("processor", class_support, var_string_noescape, - (char *) &tmp_mips_processor_type, - "Set the type of MIPS processor in use.\n\ -Set this to be able to access processor-type-specific registers.\n\ -", - &setlist); - set_cmd_cfunc (c, mips_set_processor_type_command); - c = add_show_from_set (c, &showlist); - set_cmd_cfunc (c, mips_show_processor_type_command); - - tmp_mips_processor_type = xstrdup (DEFAULT_MIPS_TYPE); - mips_set_processor_type_command (xstrdup (DEFAULT_MIPS_TYPE), 0); -#endif - /* We really would like to have both "0" and "unlimited" work, but command.c doesn't deal with that. So make it a var_zinteger because the user can always use "999999" or some such for unlimited. */ diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 0a5704b1704..5d3da69c0b9 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -1171,8 +1171,8 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs); set_gdbarch_frame_chain (gdbarch, mn10300_frame_chain); set_gdbarch_frame_saved_pc (gdbarch, mn10300_frame_saved_pc); - set_gdbarch_extract_return_value (gdbarch, mn10300_extract_return_value); - set_gdbarch_extract_struct_value_address + set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, mn10300_extract_struct_value_address); set_gdbarch_store_return_value (gdbarch, mn10300_store_return_value); set_gdbarch_store_struct_return (gdbarch, mn10300_store_struct_return); diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index e9bbfc479a9..4e9f9608f91 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -1,6 +1,6 @@ -/* Print NS 32000 instructions for GDB, the GNU debugger. - Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. +/* Target dependent code for the NS32000, for GDB. + Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001, + 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -21,20 +21,128 @@ #include "defs.h" #include "frame.h" +#include "gdbtypes.h" #include "gdbcore.h" +#include "inferior.h" +#include "regcache.h" +#include "target.h" + +#include "arch-utils.h" + +#include "ns32k-tdep.h" static int sign_extend (int value, int bits); +static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); +static int ns32k_localcount (CORE_ADDR enter_pc); +static void flip_bytes (void *, int); -void -_initialize_ns32k_tdep (void) +static char * +ns32k_register_name_32082 (int regno) { - tm_print_insn = print_insn_ns32k; + static char *register_names[] = + { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "sp", "fp", "pc", "ps", + "l0", "l1", "l2", "l3", "xx", + }; + + if (regno < 0) + return NULL; + if (regno >= sizeof (register_names) / sizeof (*register_names)) + return NULL; + + return (register_names[regno]); +} + +static char * +ns32k_register_name_32382 (int regno) +{ + static char *register_names[] = + { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "sp", "fp", "pc", "ps", + "fsr", + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", + }; + + if (regno < 0) + return NULL; + if (regno >= sizeof (register_names) / sizeof (*register_names)) + return NULL; + + return (register_names[regno]); +} + +static int +ns32k_register_byte_32082 (int regno) +{ + if (regno >= NS32K_LP0_REGNUM) + return (NS32K_LP0_REGNUM * 4) + ((regno - NS32K_LP0_REGNUM) * 8); + + return (regno * 4); +} + +static int +ns32k_register_byte_32382 (int regno) +{ + /* This is a bit yuk. The even numbered double precision floating + point long registers occupy the same space as the even:odd numbered + single precision floating point registers, but the extra 32381 FPU + registers are at the end. Doing it this way is compatible for both + 32081 and 32381 equipped machines. */ + + return ((regno < NS32K_LP0_REGNUM ? regno + : (regno - NS32K_LP0_REGNUM) & 1 ? regno - 1 + : (regno - NS32K_LP0_REGNUM + FP0_REGNUM)) * 4); +} + +static int +ns32k_register_raw_size (int regno) +{ + /* All registers are 4 bytes, except for the doubled floating + registers. */ + + return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4); +} + +static int +ns32k_register_virtual_size (int regno) +{ + return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4); +} + +static struct type * +ns32k_register_virtual_type (int regno) +{ + if (regno < FP0_REGNUM) + return (builtin_type_int); + + if (regno < FP0_REGNUM + 8) + return (builtin_type_float); + + if (regno < NS32K_LP0_REGNUM) + return (builtin_type_int); + + return (builtin_type_double); +} + +/* Immediately after a function call, return the saved PC. Can't + always go through the frames for this because on some systems, + the new frame is not set up until the new function executes some + instructions. */ + +static CORE_ADDR +ns32k_saved_pc_after_call (struct frame_info *frame) +{ + return (read_memory_integer (read_register (SP_REGNUM), 4)); } /* Advance PC across any function entry prologue instructions to reach some "real" code. */ -CORE_ADDR +static CORE_ADDR umax_skip_prologue (CORE_ADDR pc) { register unsigned char op = read_memory_integer (pc, 1); @@ -50,6 +158,15 @@ umax_skip_prologue (CORE_ADDR pc) } return pc; } + +static const unsigned char * +ns32k_breakpoint_from_pc (CORE_ADDR *pcp, int *lenp) +{ + static const unsigned char breakpoint_insn[] = { 0xf2 }; + + *lenp = sizeof (breakpoint_insn); + return breakpoint_insn; +} /* Return number of args passed to a frame. Can return -1, meaning no way to tell. @@ -57,7 +174,7 @@ umax_skip_prologue (CORE_ADDR pc) so this will often not work properly. If the arg names are known, it's likely most of them will be printed. */ -int +static int umax_frame_num_args (struct frame_info *fi) { int numargs; @@ -106,7 +223,7 @@ sign_extend (int value, int bits) : value); } -void +static void flip_bytes (void *p, int count) { char tmp; @@ -122,11 +239,11 @@ flip_bytes (void *p, int count) } } -/* Return the number of locals in the current frame given a pc - pointing to the enter instruction. This is used in the macro - FRAME_FIND_SAVED_REGS. */ +/* Return the number of locals in the current frame given a + pc pointing to the enter instruction. This is used by + ns32k_frame_init_saved_regs. */ -int +static int ns32k_localcount (CORE_ADDR enter_pc) { unsigned char localtype; @@ -155,16 +272,10 @@ ns32k_about_to_return (CORE_ADDR pc) return (read_memory_integer (pc, 1) == 0x12); } - -/* - * Get the address of the enter opcode for the function - * containing PC, if there is an enter for the function, - * and if the pc is between the enter and exit. - * Returns positive address if pc is between enter/exit, - * 1 if pc before enter or after exit, 0 otherwise. - */ - -CORE_ADDR +/* Get the address of the enter opcode for this function, if it is active. + Returns positive address > 1 if pc is between enter/exit, + 1 if pc before enter or after exit, 0 otherwise. */ +static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR pc) { CORE_ADDR enter_addr; @@ -188,3 +299,375 @@ ns32k_get_enter_addr (CORE_ADDR pc) return enter_addr; /* pc is between enter and exit */ } + +static CORE_ADDR +ns32k_frame_chain (struct frame_info *frame) +{ + /* In the case of the NS32000 series, the frame's nominal address is the + FP value, and that address is saved at the previous FP value as a + 4-byte word. */ + + if (inside_entry_file (frame->pc)) + return 0; + + return (read_memory_integer (frame->frame, 4)); +} + +static CORE_ADDR +ns32k_frame_saved_pc (struct frame_info *frame) +{ + if (frame->signal_handler_caller) + return (sigtramp_saved_pc (frame)); /* XXXJRT */ + + return (read_memory_integer (frame->frame + 4, 4)); +} + +static CORE_ADDR +ns32k_frame_args_address (struct frame_info *frame) +{ + if (ns32k_get_enter_addr (frame->pc) > 1) + return (frame->frame); + + return (read_register (SP_REGNUM) - 4); +} + +static CORE_ADDR +ns32k_frame_locals_address (struct frame_info *frame) +{ + return (frame->frame); +} + +static void +ns32k_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, + struct frame_info *frame, int regnum, + enum lval_type *lval) +{ + CORE_ADDR addr; + + if (!target_has_registers) + error ("No registers."); + + /* Normal systems don't optimize out things with register numbers. */ + if (optimized != NULL) + *optimized = 0; + addr = find_saved_register (frame, regnum); + if (addr != 0) + { + if (lval != NULL) + *lval = lval_memory; + if (regnum == SP_REGNUM) + { + if (raw_buffer != NULL) + { + /* Put it back in target format. */ + store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), + (LONGEST) addr); + } + if (addrp != NULL) + *addrp = 0; + return; + } + if (raw_buffer != NULL) + target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum)); + } + else + { + if (lval != NULL) + *lval = lval_register; + addr = REGISTER_BYTE (regnum); + if (raw_buffer != NULL) + read_register_gen (regnum, raw_buffer); + } + if (addrp != NULL) + *addrp = addr; +} + +/* Code to initialize the addresses of the saved registers of frame described + by FRAME_INFO. This includes special registers such as pc and fp saved in + special ways in the stack frame. sp is even more special: the address we + return for it IS the sp for the next frame. */ + +static void +ns32k_frame_init_saved_regs (struct frame_info *frame) +{ + int regmask, regnum; + int localcount; + CORE_ADDR enter_addr, next_addr; + + if (frame->saved_regs) + return; + + frame_saved_regs_zalloc (frame); + + enter_addr = ns32k_get_enter_addr (frame->pc); + if (enter_addr > 1) + { + regmask = read_memory_integer (enter_addr + 1, 1) & 0xff; + localcount = ns32k_localcount (enter_addr); + next_addr = frame->frame + localcount; + + for (regnum = 0; regnum < 8; regnum++) + { + if (regmask & (1 << regnum)) + frame->saved_regs[regnum] = next_addr -= 4; + } + + frame->saved_regs[SP_REGNUM] = frame->frame + 4; + frame->saved_regs[PC_REGNUM] = frame->frame + 4; + frame->saved_regs[FP_REGNUM] = read_memory_integer (frame->frame, 4); + } + else if (enter_addr == 1) + { + CORE_ADDR sp = read_register (SP_REGNUM); + frame->saved_regs[PC_REGNUM] = sp; + frame->saved_regs[SP_REGNUM] = sp + 4; + } +} + +static void +ns32k_push_dummy_frame (void) +{ + CORE_ADDR sp = read_register (SP_REGNUM); + int regnum; + + sp = push_word (sp, read_register (PC_REGNUM)); + sp = push_word (sp, read_register (FP_REGNUM)); + write_register (FP_REGNUM, sp); + + for (regnum = 0; regnum < 8; regnum++) + sp = push_word (sp, read_register (regnum)); + + write_register (SP_REGNUM, sp); +} + +static void +ns32k_pop_frame (void) +{ + struct frame_info *frame = get_current_frame (); + CORE_ADDR fp; + int regnum; + + fp = frame->frame; + FRAME_INIT_SAVED_REGS (frame); + + for (regnum = 0; regnum < 8; regnum++) + if (frame->saved_regs[regnum]) + write_register (regnum, + read_memory_integer (frame->saved_regs[regnum], 4)); + + write_register (FP_REGNUM, read_memory_integer (fp, 4)); + write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); + write_register (SP_REGNUM, fp + 8); + flush_cached_frames (); +} + +/* The NS32000 call dummy sequence: + + enter 0xff,0 82 ff 00 + jsr @0x00010203 7f ae c0 01 02 03 + adjspd 0x69696969 7f a5 01 02 03 04 + bpt f2 + + It is 16 bytes long. */ + +static LONGEST ns32k_call_dummy_words[] = +{ + 0x7f00ff82, + 0x0201c0ae, + 0x01a57f03, + 0xf2040302 +}; +static int sizeof_ns32k_call_dummy_words = sizeof (ns32k_call_dummy_words); + +#define NS32K_CALL_DUMMY_ADDR 5 +#define NS32K_CALL_DUMMY_NARGS 11 + +static void +ns32k_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, + struct value **args, struct type *type, int gcc_p) +{ + int flipped; + + flipped = fun | 0xc0000000; + flip_bytes (&flipped, 4); + store_unsigned_integer (dummy + NS32K_CALL_DUMMY_ADDR, 4, flipped); + + flipped = - nargs * 4; + flip_bytes (&flipped, 4); + store_unsigned_integer (dummy + NS32K_CALL_DUMMY_NARGS, 4, flipped); +} + +static void +ns32k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + /* On this machine, this is a no-op (Encore Umax didn't use GCC). */ +} + +static void +ns32k_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) +{ + memcpy (valbuf, + regbuf + REGISTER_BYTE (TYPE_CODE (valtype) == TYPE_CODE_FLT ? + FP0_REGNUM : 0), TYPE_LENGTH (valtype)); +} + +static void +ns32k_store_return_value (struct type *valtype, char *valbuf) +{ + write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT ? + FP0_REGNUM : 0, valbuf, TYPE_LENGTH (valtype)); +} + +static CORE_ADDR +ns32k_extract_struct_value_address (char *regbuf) +{ + return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0))); +} + +void +ns32k_gdbarch_init_32082 (struct gdbarch *gdbarch) +{ + set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32082); + + set_gdbarch_register_name (gdbarch, ns32k_register_name_32082); + set_gdbarch_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32082); + set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32082); +} + +void +ns32k_gdbarch_init_32382 (struct gdbarch *gdbarch) +{ + set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32382); + + set_gdbarch_register_name (gdbarch, ns32k_register_name_32382); + set_gdbarch_register_bytes (gdbarch, NS32K_REGISTER_BYTES_32382); + set_gdbarch_register_byte (gdbarch, ns32k_register_byte_32382); +} + +/* Initialize the current architecture based on INFO. If possible, re-use an + architecture from ARCHES, which is a list of architectures already created + during this debugging session. + + Called e.g. at program startup, when reading a core file, and when reading + a binary file. */ + +static struct gdbarch * +ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +{ + struct gdbarch_tdep *tdep; + struct gdbarch *gdbarch; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; + + /* Try to determine the OS ABI of the object we are loading. */ + if (info.abfd != NULL) + { + osabi = gdbarch_lookup_osabi (info.abfd); + } + + /* Find a candidate among extant architectures. */ + for (arches = gdbarch_list_lookup_by_info (arches, &info); + arches != NULL; + arches = gdbarch_list_lookup_by_info (arches->next, &info)) + { + /* Make sure the OS ABI selection matches. */ + tdep = gdbarch_tdep (arches->gdbarch); + if (tdep && tdep->osabi == osabi) + return arches->gdbarch; + } + + tdep = xmalloc (sizeof (struct gdbarch_tdep)); + gdbarch = gdbarch_alloc (&info, tdep); + + tdep->osabi = osabi; + + /* Register info */ + ns32k_gdbarch_init_32082 (gdbarch); + set_gdbarch_num_regs (gdbarch, NS32K_SP_REGNUM); + set_gdbarch_num_regs (gdbarch, NS32K_FP_REGNUM); + set_gdbarch_num_regs (gdbarch, NS32K_PC_REGNUM); + set_gdbarch_num_regs (gdbarch, NS32K_PS_REGNUM); + + set_gdbarch_register_size (gdbarch, NS32K_REGISTER_SIZE); + set_gdbarch_register_raw_size (gdbarch, ns32k_register_raw_size); + set_gdbarch_max_register_raw_size (gdbarch, NS32K_MAX_REGISTER_RAW_SIZE); + set_gdbarch_register_virtual_size (gdbarch, ns32k_register_virtual_size); + set_gdbarch_max_register_virtual_size (gdbarch, + NS32K_MAX_REGISTER_VIRTUAL_SIZE); + set_gdbarch_register_virtual_type (gdbarch, ns32k_register_virtual_type); + + /* Frame and stack info */ + set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue); + set_gdbarch_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call); + + set_gdbarch_frame_num_args (gdbarch, umax_frame_num_args); + set_gdbarch_frameless_function_invocation (gdbarch, + generic_frameless_function_invocation_not); + + set_gdbarch_frame_chain (gdbarch, ns32k_frame_chain); + set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); + set_gdbarch_frame_saved_pc (gdbarch, ns32k_frame_saved_pc); + + set_gdbarch_frame_args_address (gdbarch, ns32k_frame_args_address); + set_gdbarch_frame_locals_address (gdbarch, ns32k_frame_locals_address); + + set_gdbarch_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs); + + set_gdbarch_frame_args_skip (gdbarch, 8); + + set_gdbarch_get_saved_register (gdbarch, ns32k_get_saved_register); + + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); + + /* Return value info */ + set_gdbarch_store_struct_return (gdbarch, ns32k_store_struct_return); + set_gdbarch_deprecated_extract_return_value (gdbarch, ns32k_extract_return_value); + set_gdbarch_store_return_value (gdbarch, ns32k_store_return_value); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, + ns32k_extract_struct_value_address); + + /* Call dummy info */ + set_gdbarch_push_dummy_frame (gdbarch, ns32k_push_dummy_frame); + set_gdbarch_pop_frame (gdbarch, ns32k_pop_frame); + set_gdbarch_call_dummy_location (gdbarch, ON_STACK); + set_gdbarch_call_dummy_p (gdbarch, 1); + set_gdbarch_call_dummy_words (gdbarch, ns32k_call_dummy_words); + set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof_ns32k_call_dummy_words); + set_gdbarch_fix_call_dummy (gdbarch, ns32k_fix_call_dummy); + set_gdbarch_call_dummy_start_offset (gdbarch, 3); + set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 0); + set_gdbarch_use_generic_dummy_frames (gdbarch, 0); + set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack); + set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); + + /* Breakpoint info */ + set_gdbarch_decr_pc_after_break (gdbarch, 0); + set_gdbarch_breakpoint_from_pc (gdbarch, ns32k_breakpoint_from_pc); + + /* Misc info */ + set_gdbarch_function_start_offset (gdbarch, 0); + + /* Hook in OS ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch, osabi); + + return (gdbarch); +} + +static void +ns32k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (tdep == NULL) + return; + + fprintf_unfiltered (file, "ns32k_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); +} + +void +_initialize_ns32k_tdep (void) +{ + gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, ns32k_dump_tdep); + + tm_print_insn = print_insn_ns32k; +} diff --git a/gdb/objfiles.h b/gdb/objfiles.h index ed4e6b7b32f..f8adb498b24 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -360,7 +360,7 @@ struct objfile so that it gets freed automatically when reading a new object file. */ - PTR obj_private; + void *obj_private; /* Set of relocation offsets to apply to each section. Currently on the psymbol_obstack (which makes no sense, but I'm diff --git a/gdb/osabi.c b/gdb/osabi.c index 1e122b8fb9f..0abc4a25b35 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -42,7 +42,6 @@ static const char * const gdb_osabi_names[] = "Windows CE", "DJGPP", "NetWare", - "LynxOS", "ARM EABI v1", "ARM EABI v2", diff --git a/gdb/osabi.h b/gdb/osabi.h index 1654f9d6fa1..f3882e78541 100644 --- a/gdb/osabi.h +++ b/gdb/osabi.h @@ -39,7 +39,6 @@ enum gdb_osabi GDB_OSABI_WINCE, GDB_OSABI_GO32, GDB_OSABI_NETWARE, - GDB_OSABI_LYNXOS, GDB_OSABI_ARM_EABI_V1, GDB_OSABI_ARM_EABI_V2, diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 8efb45019f4..7333f6d04a0 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -150,9 +150,15 @@ static char * uptok (char *, int); /* YYSTYPE gets defined by %union */ static int parse_number (char *, int, int, YYSTYPE *); + +static struct type *current_type; + +static void push_current_type (); +static void pop_current_type (); +static int search_field; %} -%type exp exp1 type_exp start variable qualified_name +%type exp exp1 type_exp start normal_start variable qualified_name %type type typebase /* %type block */ @@ -170,7 +176,8 @@ parse_number (char *, int, int, YYSTYPE *); Contexts where this distinction is not important can use the nonterminal "name", which matches either NAME or TYPENAME. */ -%token STRING +%token STRING +%token FIELDNAME %token NAME /* BLOCKNAME defined below to give it higher precedence. */ %token TYPENAME %type name @@ -219,15 +226,21 @@ parse_number (char *, int, int, YYSTYPE *); %% -start : exp1 +start : { current_type = NULL; + search_field = 0; + } + normal_start; + +normal_start : + exp1 | type_exp ; type_exp: type { write_exp_elt_opcode(OP_TYPE); write_exp_elt_type($1); - write_exp_elt_opcode(OP_TYPE);} - ; + write_exp_elt_opcode(OP_TYPE); + current_type = $1; } ; /* Expressions, including the comma operator. */ exp1 : exp @@ -237,10 +250,14 @@ exp1 : exp /* Expressions, not including the comma operator. */ exp : exp '^' %prec UNARY - { write_exp_elt_opcode (UNOP_IND); } + { write_exp_elt_opcode (UNOP_IND); + if (current_type) + current_type = TYPE_TARGET_TYPE (current_type); } exp : '@' exp %prec UNARY - { write_exp_elt_opcode (UNOP_ADDR); } + { write_exp_elt_opcode (UNOP_ADDR); + if (current_type) + current_type = TYPE_POINTER_TYPE (current_type); } exp : '-' exp %prec UNARY { write_exp_elt_opcode (UNOP_NEG); } @@ -258,24 +275,55 @@ exp : DECREMENT '(' exp ')' %prec UNARY { write_exp_elt_opcode (UNOP_PREDECREMENT); } ; -exp : exp '.' name +exp : exp '.' { search_field = 1; } + FIELDNAME + /* name */ { write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string ($3); - write_exp_elt_opcode (STRUCTOP_STRUCT); } - ; - -exp : exp '[' exp1 ']' - { write_exp_elt_opcode (BINOP_SUBSCRIPT); } - ; + write_exp_string ($4); + write_exp_elt_opcode (STRUCTOP_STRUCT); + search_field = 0; + if (current_type) + { while (TYPE_CODE (current_type) == TYPE_CODE_PTR) + current_type = TYPE_TARGET_TYPE (current_type); + current_type = lookup_struct_elt_type ( + current_type, $4.ptr, false); }; + } ; +exp : exp '[' + /* We need to save the current_type value */ + { char *arrayname; + int arrayfieldindex; + arrayfieldindex = is_pascal_string_type ( + current_type, NULL, NULL, + NULL, NULL, &arrayname); + if (arrayfieldindex) + { + struct stoken stringsval; + stringsval.ptr = alloca (strlen (arrayname) + 1); + stringsval.length = strlen (arrayname); + strcpy (stringsval.ptr, arrayname); + current_type = TYPE_FIELD_TYPE (current_type, + arrayfieldindex - 1); + write_exp_elt_opcode (STRUCTOP_STRUCT); + write_exp_string (stringsval); + write_exp_elt_opcode (STRUCTOP_STRUCT); + } + push_current_type (); } + exp1 ']' + { pop_current_type (); + write_exp_elt_opcode (BINOP_SUBSCRIPT); + if (current_type) + current_type = TYPE_TARGET_TYPE (current_type); } exp : exp '(' /* This is to save the value of arglist_len being accumulated by an outer function call. */ - { start_arglist (); } + { push_current_type (); + start_arglist (); } arglist ')' %prec ARROW { write_exp_elt_opcode (OP_FUNCALL); write_exp_elt_longcst ((LONGEST) end_arglist ()); - write_exp_elt_opcode (OP_FUNCALL); } + write_exp_elt_opcode (OP_FUNCALL); + pop_current_type (); } ; arglist : @@ -288,7 +336,8 @@ arglist : exp : type '(' exp ')' %prec UNARY { write_exp_elt_opcode (UNOP_CAST); write_exp_elt_type ($1); - write_exp_elt_opcode (UNOP_CAST); } + write_exp_elt_opcode (UNOP_CAST); + current_type = $1; } ; exp : '(' exp1 ')' @@ -567,9 +616,11 @@ variable: name_not_typename write_exp_elt_block (NULL); write_exp_elt_sym (sym); write_exp_elt_opcode (OP_VAR_VALUE); - } + current_type = sym->type; } else if ($1.is_a_field_of_this) { + struct value * this_val; + struct type * this_type; /* Object pascal: it hangs off of `this'. Must not inadvertently convert from a method call to data ref. */ @@ -581,6 +632,18 @@ variable: name_not_typename write_exp_elt_opcode (STRUCTOP_PTR); write_exp_string ($1.stoken); write_exp_elt_opcode (STRUCTOP_PTR); + /* we need type of this */ + this_val = value_of_this (0); + if (this_val) + this_type = this_val->type; + else + this_type = NULL; + if (this_type) + current_type = lookup_struct_elt_type ( + this_type, + $1.stoken.ptr, false); + else + current_type = NULL; } else { @@ -881,6 +944,36 @@ parse_number (p, len, parsed_float, putithere) return INT; } + +struct type_push +{ + struct type *stored; + struct type_push *next; +}; + +static struct type_push *tp_top = NULL; + +static void push_current_type () +{ + struct type_push *tpnew; + tpnew = (struct type_push *) malloc (sizeof (struct type_push)); + tpnew->next = tp_top; + tpnew->stored = current_type; + current_type = NULL; + tp_top = tpnew; +} + +static void pop_current_type () +{ + struct type_push *tp = tp_top; + if (tp) + { + current_type = tp->stored; + tp_top = tp->next; + xfree (tp); + } +} + struct token { char *operator; @@ -907,8 +1000,8 @@ static const struct token tokentab2[] = {"<>", NOTEQUAL, BINOP_END}, {"<=", LEQ, BINOP_END}, {">=", GEQ, BINOP_END}, - {":=", ASSIGN, BINOP_END} - }; + {":=", ASSIGN, BINOP_END}, + {"::", COLONCOLON, BINOP_END} }; /* Allocate uppercased var */ /* make an uppercased copy of tokstart */ @@ -1149,6 +1242,7 @@ yylex () { tempbuf = (char *) realloc (tempbuf, tempbufsize += 64); } + switch (*tokptr) { case '\0': @@ -1295,25 +1389,37 @@ yylex () char *tmp = copy_name (yylval.sval); struct symbol *sym; int is_a_field_of_this = 0; + int is_a_field = 0; int hextype; - sym = lookup_symbol (tmp, expression_context_block, - VAR_NAMESPACE, - &is_a_field_of_this, - (struct symtab **) NULL); + + if (search_field && current_type) + is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); + if (is_a_field) + sym = NULL; + else + sym = lookup_symbol (tmp, expression_context_block, + VAR_NAMESPACE, + &is_a_field_of_this, + (struct symtab **) NULL); /* second chance uppercased (as Free Pascal does). */ - if (!sym && !is_a_field_of_this) + if (!sym && !is_a_field_of_this && !is_a_field) { for (i = 0; i <= namelen; i++) { if ((tmp[i] >= 'a' && tmp[i] <= 'z')) tmp[i] -= ('a'-'A'); } - sym = lookup_symbol (tmp, expression_context_block, + if (search_field && current_type) + is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); + if (is_a_field) + sym = NULL; + else + sym = lookup_symbol (tmp, expression_context_block, VAR_NAMESPACE, &is_a_field_of_this, (struct symtab **) NULL); - if (sym || is_a_field_of_this) + if (sym || is_a_field_of_this || is_a_field) for (i = 0; i <= namelen; i++) { if ((tokstart[i] >= 'a' && tokstart[i] <= 'z')) @@ -1321,7 +1427,7 @@ yylex () } } /* Third chance Capitalized (as GPC does). */ - if (!sym && !is_a_field_of_this) + if (!sym && !is_a_field_of_this && !is_a_field) { for (i = 0; i <= namelen; i++) { @@ -1334,11 +1440,16 @@ yylex () if ((tmp[i] >= 'A' && tmp[i] <= 'Z')) tmp[i] -= ('A'-'a'); } - sym = lookup_symbol (tmp, expression_context_block, + if (search_field && current_type) + is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); + if (is_a_field) + sym = NULL; + else + sym = lookup_symbol (tmp, expression_context_block, VAR_NAMESPACE, &is_a_field_of_this, (struct symtab **) NULL); - if (sym || is_a_field_of_this) + if (sym || is_a_field_of_this || is_a_field) for (i = 0; i <= namelen; i++) { if (i == 0) @@ -1351,6 +1462,15 @@ yylex () tokstart[i] -= ('A'-'a'); } } + + if (is_a_field) + { + tempbuf = (char *) realloc (tempbuf, namelen + 1); + strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0; + yylval.sval.ptr = tempbuf; + yylval.sval.length = namelen; + return FIELDNAME; + } /* Call lookup_symtab, not lookup_partial_symtab, in case there are no psymtabs (coff, xcoff, or some future change to blow away the psymtabs once once symbols are read). */ diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index 0058cbf6ead..fce8fea0365 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -1,5 +1,6 @@ /* Handle HP ELF shared libraries for GDB, the GNU Debugger. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -47,7 +48,6 @@ #include "gdb-stabs.h" #include "gdb_stat.h" #include "gdbcmd.h" -#include "assert.h" #include "language.h" #include "regcache.h" @@ -109,7 +109,7 @@ static int pa64_solib_st_size_threshold_exceeded; typedef struct { CORE_ADDR dld_flags_addr; - long long dld_flags; + LONGEST dld_flags; sec_ptr dyninfo_sect; boolean have_read_dld_descriptor; boolean is_valid; @@ -251,7 +251,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, /* Now find the true lowest section in the shared library. */ sec = NULL; - bfd_map_over_sections (tmp_bfd, find_lowest_section, (PTR) &sec); + bfd_map_over_sections (tmp_bfd, find_lowest_section, &sec); if (sec) { @@ -283,7 +283,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, sizeof (obj_private_data_t)); obj_private->unwind_info = NULL; obj_private->so_info = NULL; - so->objfile->obj_private = (PTR) obj_private; + so->objfile->obj_private = obj_private; } obj_private = (obj_private_data_t *) so->objfile->obj_private; @@ -1224,13 +1224,13 @@ bfd_lookup_symbol (bfd *abfd, char *symname) if (storage_needed > 0) { symbol_table = (asymbol **) xmalloc (storage_needed); - back_to = make_cleanup (xfree, (PTR) symbol_table); + back_to = make_cleanup (xfree, symbol_table); number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); for (i = 0; i < number_of_symbols; i++) { sym = *symbol_table++; - if (STREQ (sym->name, symname)) + if (strcmp (sym->name, symname) == 0) { /* Bfd symbols are section relative. */ symaddr = sym->value + sym->section->vma; diff --git a/gdb/parse.c b/gdb/parse.c index 9c1f3e16d0b..bc81f221b52 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -71,6 +71,7 @@ struct expression *expout; int expout_size; int expout_ptr; struct block *expression_context_block; +CORE_ADDR expression_context_pc; struct block *innermost_block; int arglist_len; union type_stack_elt *type_stack; @@ -1140,7 +1141,13 @@ parse_exp_1 (char **stringptr, struct block *block, int comma) old_chain = make_cleanup (free_funcalls, 0 /*ignore*/); funcall_chain = 0; - expression_context_block = block ? block : get_selected_block (0); + if (block) + { + expression_context_block = block; + expression_context_pc = block->startaddr; + } + else + expression_context_block = get_selected_block (&expression_context_pc); namecopy = (char *) alloca (strlen (lexptr) + 1); expout_size = 10; diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index ece28493752..7db1c77e123 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -37,6 +37,12 @@ extern int expout_ptr; extern struct block *expression_context_block; +/* If expression_context_block is non-zero, then this is the PC within + the block that we want to evaluate expressions at. When debugging + C or C++ code, we use this to find the exact line we're at, and + then look up the macro definitions active at that point. */ +CORE_ADDR expression_context_pc; + /* The innermost context required by the stack and register variables we've encountered so far. */ extern struct block *innermost_block; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index f358274140b..1a88d4052d3 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -411,293 +411,6 @@ ppc_linux_frame_chain (struct frame_info *thisframe) return rs6000_frame_chain (thisframe); } -/* FIXME: Move the following to rs6000-tdep.c (or some other file where - it may be used generically by ports which use either the SysV ABI or - the EABI */ - -/* Until November 2001, gcc was not complying to the SYSV ABI for - returning structures less than or equal to 8 bytes in size. It was - returning everything in memory. When this was corrected, it wasn't - fixed for native platforms. */ -int -ppc_sysv_abi_broken_use_struct_convention (int gcc_p, struct type *value_type) -{ - if (TYPE_LENGTH (value_type) == 16 - && TYPE_VECTOR (value_type)) - return 0; - - return generic_use_struct_convention (gcc_p, value_type); -} - -/* Structures 8 bytes or less long are returned in the r3 & r4 - registers, according to the SYSV ABI. */ -int -ppc_sysv_abi_use_struct_convention (int gcc_p, struct type *value_type) -{ - if (TYPE_LENGTH (value_type) == 16 - && TYPE_VECTOR (value_type)) - return 0; - - return (TYPE_LENGTH (value_type) > 8); -} - -/* round2 rounds x up to the nearest multiple of s assuming that s is a - power of 2 */ - -#undef round2 -#define round2(x,s) ((((long) (x) - 1) & ~(long)((s)-1)) + (s)) - -/* Pass the arguments in either registers, or in the stack. Using the - ppc sysv ABI, the first eight words of the argument list (that might - be less than eight parameters if some parameters occupy more than one - word) are passed in r3..r10 registers. float and double parameters are - passed in fpr's, in addition to that. Rest of the parameters if any - are passed in user stack. - - If the function is returning a structure, then the return address is passed - in r3, then the first 7 words of the parametes can be passed in registers, - starting from r4. */ - -CORE_ADDR -ppc_sysv_abi_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) -{ - int argno; - /* Next available general register for non-float, non-vector arguments. */ - int greg; - /* Next available floating point register for float arguments. */ - int freg; - /* Next available vector register for vector arguments. */ - int vreg; - int argstkspace; - int structstkspace; - int argoffset; - int structoffset; - struct value *arg; - struct type *type; - int len; - char old_sp_buf[4]; - CORE_ADDR saved_sp; - - greg = struct_return ? 4 : 3; - freg = 1; - vreg = 2; - argstkspace = 0; - structstkspace = 0; - - /* Figure out how much new stack space is required for arguments - which don't fit in registers. Unlike the PowerOpen ABI, the - SysV ABI doesn't reserve any extra space for parameters which - are put in registers. */ - for (argno = 0; argno < nargs; argno++) - { - arg = args[argno]; - type = check_typedef (VALUE_TYPE (arg)); - len = TYPE_LENGTH (type); - - if (TYPE_CODE (type) == TYPE_CODE_FLT) - { - if (freg <= 8) - freg++; - else - { - /* SysV ABI converts floats to doubles when placed in - memory and requires 8 byte alignment */ - if (argstkspace & 0x4) - argstkspace += 4; - argstkspace += 8; - } - } - else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */ - { - if (greg > 9) - { - greg = 11; - if (argstkspace & 0x4) - argstkspace += 4; - argstkspace += 8; - } - else - { - if ((greg & 1) == 0) - greg++; - greg += 2; - } - } - else if (!TYPE_VECTOR (type)) - { - if (len > 4 - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) - { - /* Rounding to the nearest multiple of 8 may not be necessary, - but it is safe. Particularly since we don't know the - field types of the structure */ - structstkspace += round2 (len, 8); - } - if (greg <= 10) - greg++; - else - argstkspace += 4; - } - else - { - if (len == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type)) - { - if (vreg <= 13) - vreg++; - else - { - /* Vector arguments must be aligned to 16 bytes on - the stack. */ - argstkspace += round2 (argstkspace, 16); - argstkspace += 16; - } - } - } - } - - /* Get current SP location */ - saved_sp = read_sp (); - - sp -= argstkspace + structstkspace; - - /* Allocate space for backchain and callee's saved lr */ - sp -= 8; - - /* Make sure that we maintain 16 byte alignment */ - sp &= ~0x0f; - - /* Update %sp before proceeding any further */ - write_register (SP_REGNUM, sp); - - /* write the backchain */ - store_address (old_sp_buf, 4, saved_sp); - write_memory (sp, old_sp_buf, 4); - - argoffset = 8; - structoffset = argoffset + argstkspace; - freg = 1; - greg = 3; - vreg = 2; - /* Fill in r3 with the return structure, if any */ - if (struct_return) - { - char val_buf[4]; - store_address (val_buf, 4, struct_addr); - memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); - greg++; - } - /* Now fill in the registers and stack... */ - for (argno = 0; argno < nargs; argno++) - { - arg = args[argno]; - type = check_typedef (VALUE_TYPE (arg)); - len = TYPE_LENGTH (type); - - if (TYPE_CODE (type) == TYPE_CODE_FLT) - { - if (freg <= 8) - { - if (len > 8) - printf_unfiltered ( - "Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM + freg)], - VALUE_CONTENTS (arg), len); - freg++; - } - else - { - /* SysV ABI converts floats to doubles when placed in - memory and requires 8 byte alignment */ - /* FIXME: Convert floats to doubles */ - if (argoffset & 0x4) - argoffset += 4; - write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len); - argoffset += 8; - } - } - else if (TYPE_CODE (type) == TYPE_CODE_INT && len == 8) /* long long */ - { - if (greg > 9) - { - greg = 11; - if (argoffset & 0x4) - argoffset += 4; - write_memory (sp + argoffset, (char *) VALUE_CONTENTS (arg), len); - argoffset += 8; - } - else - { - if ((greg & 1) == 0) - greg++; - - memcpy (®isters[REGISTER_BYTE (greg)], - VALUE_CONTENTS (arg), 4); - memcpy (®isters[REGISTER_BYTE (greg + 1)], - VALUE_CONTENTS (arg) + 4, 4); - greg += 2; - } - } - else if (!TYPE_VECTOR (type)) - { - char val_buf[4]; - if (len > 4 - || TYPE_CODE (type) == TYPE_CODE_STRUCT - || TYPE_CODE (type) == TYPE_CODE_UNION) - { - write_memory (sp + structoffset, VALUE_CONTENTS (arg), len); - store_address (val_buf, 4, sp + structoffset); - structoffset += round2 (len, 8); - } - else - { - memset (val_buf, 0, 4); - memcpy (val_buf, VALUE_CONTENTS (arg), len); - } - if (greg <= 10) - { - memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); - greg++; - } - else - { - write_memory (sp + argoffset, val_buf, 4); - argoffset += 4; - } - } - else - { - if (len == 16 - && TYPE_CODE (type) == TYPE_CODE_ARRAY - && TYPE_VECTOR (type)) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - char *v_val_buf = alloca (16); - memset (v_val_buf, 0, 16); - memcpy (v_val_buf, VALUE_CONTENTS (arg), len); - if (vreg <= 13) - { - memcpy (®isters[REGISTER_BYTE (tdep->ppc_vr0_regnum - + vreg)], - v_val_buf, 16); - vreg++; - } - else - { - write_memory (sp + argoffset, v_val_buf, 16); - argoffset += 16; - } - } - } - } - - target_store_registers (-1); - return sp; -} - /* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint in much the same fashion as memory_remove_breakpoint in mem-break.c, but is careful not to write back the previous contents if the code @@ -886,3 +599,44 @@ ppc_linux_svr4_fetch_link_map_offsets (void) return lmp; } + +static void +ppc_linux_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Until November 2001, gcc was not complying to the SYSV ABI for + returning structures less than or equal to 8 bytes in size. It was + returning everything in memory. When this was corrected, it wasn't + fixed for native platforms. */ + set_gdbarch_use_struct_convention (gdbarch, + ppc_sysv_abi_broken_use_struct_convention); + + if (tdep->wordsize == 4) + { + /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding + *_push_arguments(). The same remarks hold for the methods below. */ + set_gdbarch_frameless_function_invocation (gdbarch, + ppc_linux_frameless_function_invocation); + set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain); + set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc); + + set_gdbarch_frame_init_saved_regs (gdbarch, + ppc_linux_frame_init_saved_regs); + set_gdbarch_init_extra_frame_info (gdbarch, + ppc_linux_init_extra_frame_info); + + set_gdbarch_memory_remove_breakpoint (gdbarch, + ppc_linux_memory_remove_breakpoint); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, ppc_linux_svr4_fetch_link_map_offsets); + } +} + +void +_initialize_ppc_linux_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_powerpc, GDB_OSABI_LINUX, + ppc_linux_init_abi); +} diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index 3da66ad1405..2f40742abcd 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -22,6 +22,8 @@ #ifndef PPC_TDEP_H #define PPC_TDEP_H +#include "osabi.h" + struct frame_info; struct value; @@ -52,7 +54,7 @@ int altivec_register_p (int regno); struct gdbarch_tdep { int wordsize; /* size in bytes of fixed-point word */ - int osabi; /* OS / ABI from ELF header */ + enum gdb_osabi osabi; /* OS / ABI from ELF header */ int *regoff; /* byte offsets in register arrays */ const struct reg *regs; /* from current variant */ int ppc_gp0_regnum; /* GPR register 0 */ diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c index 55acf95fb21..ce097d7a59d 100644 --- a/gdb/ppcnbsd-nat.c +++ b/gdb/ppcnbsd-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for PowerPC's running NetBSD, for GDB. - Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001 - Free Software Foundation, Inc. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, Inc. This file is part of GDB. @@ -22,124 +22,100 @@ #include #include #include -#include #include "defs.h" #include "inferior.h" -#include "gdbcore.h" -#include "ppc-tdep.h" -#include "regcache.h" -#define RF(dst, src) \ - memcpy(®isters[REGISTER_BYTE(dst)], &src, sizeof(src)) - -#define RS(src, dst) \ - memcpy(&dst, ®isters[REGISTER_BYTE(src)], sizeof(dst)) +#include "ppc-tdep.h" +#include "ppcnbsd-tdep.h" -void -fetch_inferior_registers (int regno) +/* Returns true if PT_GETREGS fetches this register. */ +static int +getregs_supplies (int regno) { - struct reg inferior_registers; -#ifdef PT_GETFPREGS - struct fpreg inferior_fp_registers; -#endif - int i; - - ptrace (PT_GETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) & inferior_registers, 0); - for (i = 0; i < 32; i++) - RF (i, inferior_registers.fixreg[i]); - RF (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, inferior_registers.lr); - RF (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, inferior_registers.cr); - RF (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, inferior_registers.xer); - RF (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, inferior_registers.ctr); - RF (PC_REGNUM, inferior_registers.pc); - -#ifdef PT_GETFPREGS - ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); - for (i = 0; i < 32; i++) - RF (FP0_REGNUM + i, inferior_fp_registers.fpreg[i]); -#endif - - registers_fetched (); + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + return ((regno >= 0 && regno <= 31) + || regno == tdep->ppc_lr_regnum + || regno == tdep->ppc_cr_regnum + || regno == tdep->ppc_xer_regnum + || regno == tdep->ppc_ctr_regnum + || regno == PC_REGNUM); } -void -store_inferior_registers (int regno) +/* Like above, but for PT_GETFPREGS. */ +static int +getfpregs_supplies (int regno) { - struct reg inferior_registers; -#ifdef PT_SETFPREGS - struct fpreg inferior_fp_registers; -#endif - int i; - - for (i = 0; i < 32; i++) - RS (i, inferior_registers.fixreg[i]); - RS (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, inferior_registers.lr); - RS (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, inferior_registers.cr); - RS (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, inferior_registers.xer); - RS (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, inferior_registers.ctr); - RS (PC_REGNUM, inferior_registers.pc); - - ptrace (PT_SETREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) & inferior_registers, 0); - -#ifdef PT_SETFPREGS - for (i = 0; i < 32; i++) - RS (FP0_REGNUM + i, inferior_fp_registers.fpreg[i]); - ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); -#endif -} + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); -struct md_core -{ - struct reg intreg; -#ifdef PT_GETFPREGS - struct fpreg freg; -#endif -}; + return ((regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31) + || regno == tdep->ppc_fpscr_regnum); +} void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR ignore) +fetch_inferior_registers (int regno) { - struct md_core *core_reg = (struct md_core *) core_reg_sect; - int i; - - /* Integer registers */ - for (i = 0; i < 32; i++) - RF (i, core_reg->intreg.fixreg[i]); - RF (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum, core_reg->intreg.lr); - RF (gdbarch_tdep (current_gdbarch)->ppc_cr_regnum, core_reg->intreg.cr); - RF (gdbarch_tdep (current_gdbarch)->ppc_xer_regnum, core_reg->intreg.xer); - RF (gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum, core_reg->intreg.ctr); - RF (PC_REGNUM, core_reg->intreg.pc); - -#ifdef PT_FPGETREGS - /* Floating point registers */ - for (i = 0; i < 32; i++) - RF (FP0_REGNUM + i, core_reg->freg.fpreg[i]); -#endif - - registers_fetched (); + if (regno == -1 || getregs_supplies (regno)) + { + struct reg regs; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't get registers"); + + ppcnbsd_supply_reg ((char *) ®s, regno); + if (regno != -1) + return; + } + + if (regno == -1 || getfpregs_supplies (regno)) + { + struct fpreg fpregs; + + if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + + ppcnbsd_supply_fpreg ((char *) &fpregs, regno); + if (regno != -1) + return; + } } -/* Register that we are able to handle ppcnbsd core file formats. - FIXME: is this really bfd_target_unknown_flavour? */ - -static struct core_fns ppcnbsd_core_fns = -{ - bfd_target_unknown_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ -}; - void -_initialize_ppcnbsd_nat (void) +store_inferior_registers (int regno) { - add_core_fns (&ppcnbsd_core_fns); + if (regno == -1 || getregs_supplies (regno)) + { + struct reg regs; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't get registers"); + + ppcnbsd_fill_reg ((char *) ®s, regno); + + if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't write registers"); + + if (regno != -1) + return; + } + + if (regno == -1 || getfpregs_supplies (regno)) + { + struct fpreg fpregs; + + if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't get FP registers"); + + ppcnbsd_fill_fpreg ((char *) &fpregs, regno); + + if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't set FP registers"); + } } diff --git a/gdb/rdi-share/devsw.c b/gdb/rdi-share/devsw.c index 6ad0e4de91d..214b8179936 100644 --- a/gdb/rdi-share/devsw.c +++ b/gdb/rdi-share/devsw.c @@ -53,7 +53,7 @@ static void openLogFile () /* The following line is equivalent to: */ /* setlinebuf (angelDebugLogFile); */ setvbuf(angelDebugLogFile, (char *)NULL, _IOLBF, 0); -#if defined(__CYGWIN32__) || defined(__CYGWIN__) +#if defined(__CYGWIN__) setmode(fileno(angelDebugLogFile), O_TEXT); #endif } diff --git a/gdb/rdi-share/host.h b/gdb/rdi-share/host.h index 2fdbf5f4541..9944c15b714 100644 --- a/gdb/rdi-share/host.h +++ b/gdb/rdi-share/host.h @@ -29,14 +29,6 @@ # define offsetof(T, member) ((char *)&(((T *)0)->member) - (char *)0) #endif -/* If under Cygwin, provide backwards compatibility with older - Cygwin compilers that don't define the current cpp define. */ -#ifdef __CYGWIN32__ -#ifndef __CYGWIN__ -#define __CYGWIN__ -#endif -#endif - /* A temporary sop to older compilers */ #if defined (__NetBSD__) || defined (unix) # ifndef __unix /* (good for long-term portability?) */ @@ -52,7 +44,7 @@ #endif #if defined(_WIN32) # define COMPILING_ON_WIN32 1 -# if !defined(__CYGWIN32__) +# if !defined(__CYGWIN__) # define COMPILING_ON_WINDOWS 1 # endif #endif diff --git a/gdb/rdi-share/hostchan.c b/gdb/rdi-share/hostchan.c index 3114c52d2f7..483bc5be4d2 100644 --- a/gdb/rdi-share/hostchan.c +++ b/gdb/rdi-share/hostchan.c @@ -556,7 +556,7 @@ static unsigned long tv_diff(const struct timeval *time_now, - ((time_was->tv_sec * 1000000) + time_was->tv_usec) ); } -#if !defined(__unix) && !defined(__CYGWIN32__) +#if !defined(__unix) && !defined(__CYGWIN__) static void gettimeofday( struct timeval *time_now, void *dummy ) { time_t t = clock(); diff --git a/gdb/rdi-share/hostchan.h b/gdb/rdi-share/hostchan.h index 3e6d26fd792..b60804d4379 100644 --- a/gdb/rdi-share/hostchan.h +++ b/gdb/rdi-share/hostchan.h @@ -15,14 +15,6 @@ #ifndef angsd_hostchan_h #define angsd_hostchan_h -/* If under Cygwin, provide backwards compatibility with older - Cygwin compilers that don't define the current cpp define. */ -#ifdef __CYGWIN32__ -#ifndef __CYGWIN__ -#define __CYGWIN__ -#endif -#endif - /* A temporary sop to older compilers */ #if defined (__NetBSD__) || defined (unix) # ifndef __unix /* (good for long-term portability?) */ @@ -31,7 +23,7 @@ #endif /* struct timeval */ -#if defined(__unix) || defined(__CYGWIN32__) +#if defined(__unix) || defined(__CYGWIN__) # include #else # include "winsock.h" diff --git a/gdb/rdi-share/serdrv.c b/gdb/rdi-share/serdrv.c index 91f8f196b2f..bff6a1892e4 100644 --- a/gdb/rdi-share/serdrv.c +++ b/gdb/rdi-share/serdrv.c @@ -254,7 +254,7 @@ static int SerialOpen(const char *name, const char *arg) serial_reset(); -#if defined(__unix) || defined(__CYGWIN32__) +#if defined(__unix) || defined(__CYGWIN__) Unix_ioctlNonBlocking(); #endif diff --git a/gdb/rdi-share/serpardr.c b/gdb/rdi-share/serpardr.c index 604d0480613..fad05481402 100644 --- a/gdb/rdi-share/serpardr.c +++ b/gdb/rdi-share/serpardr.c @@ -278,7 +278,7 @@ static int SerparOpen(const char *name, const char *arg) serpar_reset(); -#if defined(__unix) || defined(__CYGWIN32__) +#if defined(__unix) || defined(__CYGWIN__) Unix_ioctlNonBlocking(); #endif diff --git a/gdb/rdi-share/unixcomm.c b/gdb/rdi-share/unixcomm.c index 0abd4115a29..2204d6d59fd 100644 --- a/gdb/rdi-share/unixcomm.c +++ b/gdb/rdi-share/unixcomm.c @@ -96,7 +96,7 @@ #define PARPORT2 "/dev/par1" #endif -#if defined(_WIN32) || defined (__CYGWIN32__) +#if defined(_WIN32) || defined (__CYGWIN__) #define SERIAL_PREFIX "com" #define SERPORT1 "com1" #define SERPORT2 "com2" @@ -248,7 +248,7 @@ extern int Unix_IsSerialInUse(void) extern int Unix_OpenSerial(const char *name) { -#if defined(BSD) || defined(__CYGWIN32__) +#if defined(BSD) || defined(__CYGWIN__) serpfd = open(name, O_RDWR); #else serpfd = open(name, O_RDWR | O_NONBLOCK); diff --git a/gdb/regbuf.c b/gdb/regbuf.c deleted file mode 100644 index 79953540576..00000000000 --- a/gdb/regbuf.c +++ /dev/null @@ -1,220 +0,0 @@ -/* Register buffer sufficient to hold all raw registers - - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - Contributed by Red Hat, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "regbuf.h" -#include "gdb_assert.h" - -extern void _initialize_regbuf (void); - -/* Per-architecture object describing the layout of a register buffer. - Computed once when the architecture is created */ - -struct gdbarch_data *regcache_data_handle; - -struct regbuf_descr -{ - struct gdbarch *gdbarch; - /* Size of the register buffer, over-allocate making room for both - real and pseudo-registers. */ - /* FIXME: cagney/2002-05-11: This over-allocation shouldn't be - necessary, only some targets store values in the pseudo-register - section and we want to be sure that GDB won't trash memory. */ - long sizeof_registers; - /* Total number of registers in the buffer. */ - int nr_registers; - /* Offset into the register buffer for each register. */ - long *register_offset; - /* Size, in ``bytes'', of a register. */ - long *sizeof_register; -}; - -static struct regbuf_descr * -regbuf_descr (struct gdbarch *gdbarch) -{ - int i; - /* FIXME: cagney/2002-05-11: gdbarch_data() should take that - ``gdbarch'' as a parameter. */ - struct regbuf_descr *descr = gdbarch_data (gdbarch, regbuf_data_handle); - if (descr != NULL) - return descr; - - descr = XMALLOC (struct regbuf_descr); - descr->gdbarch = gdbarch; - /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers - in the register buffer. Unfortunatly some architectures are - storing pseudo register values in the raw register buffer. */ - descr->nr_registers = NUM_REGS + NUM_PSEUDO_REGS; - /* FIXME: cagney/2002-05-11: Instead of using REGISTER_BYTE() this - should compute, at runtime, an offset table describing where each - register is in the register table. This currently isn't possible - because some targets overlap registers, ulgh! */ - descr->register_offset = XCALLOC (descr->nr_registers, long); - descr->sizeof_register = XCALLOC (descr->nr_registers, long); - for (i = 0; i < descr->nr_registers; i++) - { - descr->register_offset[i] = REGISTER_BYTE (i); - descr->sizeof_register[i] = REGISTER_RAW_SIZE (i); - } - /* Come up with the real size of the registers buffer. */ - descr->sizeof_registers = REGISTER_BYTES; /* OK use. */ - for (i = 0; i < descr->nr_registers; i++) - { - long regend; - /* Keep extending the buffer so that there is always enough - space for all registers. The comparison is necessary since - legacy code is free to put registers in random places in the - buffer separated by holes. Once REGISTER_BYTE() is killed - this can be greatly simplified. */ - /* FIXME: cagney/2001-12-04: This code shouldn't need to use - REGISTER_BYTE(). Unfortunatly, legacy code likes to lay the - buffer out so that certain registers just happen to overlap. - Ulgh! New targets use gdbarch's register read/write and - entirely avoid this uglyness. */ - regend = descr->register_offset[i] + descr->sizeof_register[i]; - if (descr->sizeof_registers < regend) - descr->sizeof_registers = regend; - } - set_gdbarch_data (gdbarch, regbuf_data_handle, descr); - return descr; -} - -static void -xfree_regbuf (struct gdbarch *gdbarch, void *ptr) -{ - struct regbuf_descr *descr = ptr; - if (descr == NULL) - return; - xfree (descr->register_offset); - xfree (descr->sizeof_register); - xfree (descr); -} - -/* For moment, ``struct regbuf'' is just a character buffer. */ - -struct regbuf -{ - struct regbuf_descr *descr; - char *registers; - char *valid_p; -}; - -struct regbuf * -regbuf_xmalloc (struct gdbarch *gdbarch) -{ - struct regbuf_descr *descr = regbuf_descr (gdbarch); - struct regbuf *regbuf = XMALLOC (struct regbuf); - regbuf->descr = descr; - regbuf->registers = xmalloc (descr->sizeof_registers); - regbuf->valid_p = xmalloc (descr->nr_registers); - return regbuf; -} - -void -regbuf_xfree (struct regbuf *regbuf) -{ - gdb_assert (regbuf != NULL); - xfree (regbuf->registers); - xfree (regbuf->valid_p); - xfree (regbuf); -} - -void -do_regbuf_xfree (void *buf) -{ - regbuf_xfree (buf); -} - -struct regbuf * -regbuf_xmalloc_with_cleanup (struct gdbarch *gdbarch) -{ - struct regbuf *regbuf = regbuf_xmalloc (gdbarch); - make_cleanup (do_regbuf_xfree, regbuf); - return regbuf; -} - -struct regbuf * -regbuf_dup (struct regbuf *regbuf) -{ - struct regbuf *newbuf = regbuf_xmalloc (regbuf->descr->gdbarch); - memcpy (newbuf->registers, regbuf->registers, - regbuf->descr->sizeof_registers); - memcpy (newbuf->valid_p, regbuf->valid_p, regbuf->descr->nr_registers); - return newbuf; -} - -int -regbuf_valid_p (struct regbuf *regbuf, int regnum) -{ - gdb_assert (regnum != NULL); - gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS); - return regbuf->valid_p[regnum]; -} - -void -regbuf_read (struct regbuf *regbuf, int regnum, void *buf) -{ - gdb_assert (regbuf != NULL); - gdb_assert (regnum >= 0 && regnum < regbuf->descr->nr_registers); - memcpy (buf, regbuf->registers + regbuf->descr->register_offset[regnum], - regbuf->descr->sizeof_register[regnum]); -} - -void -regbuf_write (struct regbuf *regbuf, int regnum, const void *buf) -{ - gdb_assert (regbuf != NULL); - gdb_assert (regnum >= 0 && regnum < regbuf->descr->nr_registers); - memcpy (regbuf->registers + regbuf->descr->register_offset[regnum], buf, - regbuf->descr->sizeof_register[regnum]); - regbuf->valid_p[regnum] = 1; -} - -CORE_ADDR -regbuf_read_as_address (struct regbuf *regbuf, int regnum) -{ - char *buf; - gdb_assert (regbuf != NULL); - gdb_assert (regnum >= 0 && regnum < regbuf->descr->nr_registers); - buf = alloca (regbuf->descr->sizeof_register[regnum]); - regbuf_read (regbuf, regnum, buf); - return extract_address (buf, regbuf->descr->sizeof_register[regnum]); -} - -char * -grub_around_regbuf_for_registers (struct regbuf *regbuf) -{ - return regbuf->registers; -} - -char * -grub_around_regbuf_for_register_valid (struct regbuf *regbuf) -{ - return regbuf->valid_p; -} - -void -_initialize_regbuf (void) -{ - regbuf_data_handle = register_gdbarch_data (NULL, xfree_regbuf); -} diff --git a/gdb/regbuf.h b/gdb/regbuf.h deleted file mode 100644 index 45955f9c7bc..00000000000 --- a/gdb/regbuf.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Register buffer sufficient to hold all raw registers - - Copyright 2002 Free Software Foundation, Inc. - - This file is part of GDB. - - Contributed by Red Hat, 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. */ - -#ifndef REGBUF_H -#define REGBUF_H - -struct regbuf; - -/* Create/destroy the register buffer. */ - -extern struct regbuf *regbuf_xmalloc (struct gdbarch *gdbarch); -extern void regbuf_xfree (struct regbuf *regbuf); -extern struct regbuf *regbuf_xmalloc_with_cleanup (struct gdbarch *gdbarch); - -/* Duplicate a regbuf and all contents. */ - -extern struct regbuf *regbuf_dup (struct regbuf *regbuf); - -/* Is the regbuf entry valid. */ - -int regbuf_valid_p (struct regbuf *regbuf, int regnum); - -/* Access the register buffer. */ - -extern void regbuf_read (struct regbuf *regbuf, int rawnum, void *buf); -extern void regbuf_write (struct regbuf *regbuf, int rawnum, const void *buf); - -/* Convenience routines for reading/writing registers using an - internal format. */ - -extern CORE_ADDR regbuf_read_as_address (struct regbuf *regbuf, int regnum); - -/* FIXME: cagney/2002-05-11: This is here simply to prop up the - `registers' and `register_valid' global arrays. */ - -extern char *grub_around_regbuf_for_registers (struct regbuf *regbuf); -extern char *grub_around_regbuf_for_register_valid (struct regbuf *regbuf); - -#endif /* REGBUF_H */ diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 280e79cdad4..34a42abb1fa 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -41,7 +41,7 @@ #include "defs.h" #include "inferior.h" #include "value.h" -#include "callback.h" +#include "gdb/callback.h" #include "command.h" #include #include diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 1d037c8fa79..221efe45674 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -35,11 +35,13 @@ #include "terminal.h" #include "target.h" #include "gdbcore.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "remote-utils.h" #include "command.h" #include "regcache.h" +#include "gdb_assert.h" +#include "sim-regno.h" /* Prototypes */ @@ -276,46 +278,72 @@ gdb_os_error (host_callback * p, const char *format,...) } } +int +one2one_register_sim_regno (int regnum) +{ + /* Only makes sense to supply raw registers. */ + gdb_assert (regnum >= 0 && regnum < NUM_REGS); + return regnum; +} + static void gdbsim_fetch_register (int regno) { - static int warn_user = 1; if (regno == -1) { for (regno = 0; regno < NUM_REGS; regno++) gdbsim_fetch_register (regno); + return; } - else if (REGISTER_NAME (regno) != NULL - && *REGISTER_NAME (regno) != '\0') + + switch (REGISTER_SIM_REGNO (regno)) { - char buf[MAX_REGISTER_RAW_SIZE]; - int nr_bytes; - if (REGISTER_SIM_REGNO (regno) >= 0) + case LEGACY_SIM_REGNO_IGNORE: + break; + case SIM_REGNO_DOES_NOT_EXIST: + { + /* For moment treat a `does not exist' register the same way + as an ``unavailable'' register. */ + char *buf = alloca (MAX_REGISTER_RAW_SIZE); + int nr_bytes; + memset (buf, 0, MAX_REGISTER_RAW_SIZE); + supply_register (regno, buf); + set_register_cached (regno, -1); + break; + } + default: + { + static int warn_user = 1; + char *buf = alloca (MAX_REGISTER_RAW_SIZE); + int nr_bytes; + gdb_assert (regno >= 0 && regno < NUM_REGS); + memset (buf, 0, MAX_REGISTER_RAW_SIZE); nr_bytes = sim_fetch_register (gdbsim_desc, REGISTER_SIM_REGNO (regno), buf, REGISTER_RAW_SIZE (regno)); - else - nr_bytes = 0; - if (nr_bytes == 0) - /* register not applicable, supply zero's */ - memset (buf, 0, MAX_REGISTER_RAW_SIZE); - else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno) - && warn_user) - { - fprintf_unfiltered (gdb_stderr, - "Size of register %s (%d/%d) incorrect (%d instead of %d))", - REGISTER_NAME (regno), - regno, REGISTER_SIM_REGNO (regno), - nr_bytes, REGISTER_RAW_SIZE (regno)); - warn_user = 0; - } - supply_register (regno, buf); - if (sr_get_debug ()) - { - printf_filtered ("gdbsim_fetch_register: %d", regno); - /* FIXME: We could print something more intelligible. */ - dump_mem (buf, REGISTER_RAW_SIZE (regno)); - } + if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno) && warn_user) + { + fprintf_unfiltered (gdb_stderr, + "Size of register %s (%d/%d) incorrect (%d instead of %d))", + REGISTER_NAME (regno), + regno, REGISTER_SIM_REGNO (regno), + nr_bytes, REGISTER_RAW_SIZE (regno)); + warn_user = 0; + } + /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' + indicatingthat GDB and the SIM have different ideas about + which registers are fetchable. */ + /* Else if (nr_bytes < 0): an old simulator, that doesn't + think to return the register size. Just assume all is ok. */ + supply_register (regno, buf); + if (sr_get_debug ()) + { + printf_filtered ("gdbsim_fetch_register: %d", regno); + /* FIXME: We could print something more intelligible. */ + dump_mem (buf, REGISTER_RAW_SIZE (regno)); + } + break; + } } } @@ -327,10 +355,9 @@ gdbsim_store_register (int regno) { for (regno = 0; regno < NUM_REGS; regno++) gdbsim_store_register (regno); + return; } - else if (REGISTER_NAME (regno) != NULL - && *REGISTER_NAME (regno) != '\0' - && REGISTER_SIM_REGNO (regno) >= 0) + else if (REGISTER_SIM_REGNO (regno) >= 0) { char tmp[MAX_REGISTER_RAW_SIZE]; int nr_bytes; @@ -341,6 +368,9 @@ gdbsim_store_register (int regno) if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)) internal_error (__FILE__, __LINE__, "Register size different to expected"); + /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' + indicatingthat GDB and the SIM have different ideas about + which registers are fetchable. */ if (sr_get_debug ()) { printf_filtered ("gdbsim_store_register: %d", regno); diff --git a/gdb/remote-vx29k.c b/gdb/remote-vx29k.c deleted file mode 100644 index 798cd088396..00000000000 --- a/gdb/remote-vx29k.c +++ /dev/null @@ -1,182 +0,0 @@ -/* Am29k-dependent portions of the RPC protocol - - Contributed by Wind River Systems. - - 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 -#include "defs.h" - -#include "vx-share/regPacket.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" -#include "gdbcore.h" -#include "command.h" -#include "symtab.h" -#include "symfile.h" /* for struct complaint */ -#include "regcache.h" - -#include "gdb_string.h" -#include -#include -#include -#include -#include - -#ifdef _AIX /* IBM claims "void *malloc()" not char * */ -#define malloc bogon_malloc -#endif - -#include -#include /* UTek's doesn't #incl this */ -#include -#include "vx-share/ptrace.h" -#include "vx-share/xdr_ptrace.h" -#include "vx-share/xdr_ld.h" -#include "vx-share/xdr_rdb.h" -#include "vx-share/dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -/* Flag set if target has fpu */ - -extern int target_has_fp; - -/* Generic register read/write routines in remote-vx.c. */ - -extern void net_read_registers (); -extern void net_write_registers (); - -/* Read a register or registers from the VxWorks target. - REGNO is the register to read, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_read_register (int regno) -{ - char am29k_greg_packet[AM29K_GREG_PLEN]; - char am29k_fpreg_packet[AM29K_FPREG_PLEN]; - - /* Get general-purpose registers. When copying values into - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - net_read_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_GETREGS); - - /* Now copy the register values into registers[]. - Note that this code depends on the ordering of the REGNUMs - as defined in "tm-29k.h". */ - - bcopy (&am29k_greg_packet[AM29K_R_GR96], - ®isters[REGISTER_BYTE (GR96_REGNUM)], 160 * AM29K_GREG_SIZE); - bcopy (&am29k_greg_packet[AM29K_R_VAB], - ®isters[REGISTER_BYTE (VAB_REGNUM)], 15 * AM29K_GREG_SIZE); - registers[REGISTER_BYTE (INTE_REGNUM)] = am29k_greg_packet[AM29K_R_INTE]; - bcopy (&am29k_greg_packet[AM29K_R_RSP], - ®isters[REGISTER_BYTE (GR1_REGNUM)], 5 * AM29K_GREG_SIZE); - - /* PAD For now, don't care about exop register */ - - memset (®isters[REGISTER_BYTE (EXO_REGNUM)], '\0', AM29K_GREG_SIZE); - - /* If the target has floating point registers, fetch them. - Otherwise, zero the floating point register values in - registers[] for good measure, even though we might not - need to. */ - - if (target_has_fp) - { - net_read_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN, - PTRACE_GETFPREGS); - registers[REGISTER_BYTE (FPE_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPE]; - registers[REGISTER_BYTE (FPS_REGNUM)] = am29k_fpreg_packet[AM29K_R_FPS]; - - /* PAD For now, don't care about registers (?) AI0 to q */ - - memset (®isters[REGISTER_BYTE (161)], '\0', 21 * AM29K_FPREG_SIZE); - } - else - { - memset (®isters[REGISTER_BYTE (FPE_REGNUM)], '\0', AM29K_FPREG_SIZE); - memset (®isters[REGISTER_BYTE (FPS_REGNUM)], '\0', AM29K_FPREG_SIZE); - - /* PAD For now, don't care about registers (?) AI0 to q */ - - memset (®isters[REGISTER_BYTE (161)], '\0', 21 * AM29K_FPREG_SIZE); - } - - /* Mark the register cache valid. */ - - registers_fetched (); -} - -/* Store a register or registers into the VxWorks target. - REGNO is the register to store, or -1 for all; currently, - it is ignored. FIXME look at regno to improve efficiency. */ - -void -vx_write_register (int regno) -{ - char am29k_greg_packet[AM29K_GREG_PLEN]; - char am29k_fpreg_packet[AM29K_FPREG_PLEN]; - - /* Store general purpose registers. When copying values from - registers [], don't assume that a location in registers [] - is properly aligned for the target data type. */ - - bcopy (®isters[REGISTER_BYTE (GR96_REGNUM)], - &am29k_greg_packet[AM29K_R_GR96], 160 * AM29K_GREG_SIZE); - bcopy (®isters[REGISTER_BYTE (VAB_REGNUM)], - &am29k_greg_packet[AM29K_R_VAB], 15 * AM29K_GREG_SIZE); - am29k_greg_packet[AM29K_R_INTE] = registers[REGISTER_BYTE (INTE_REGNUM)]; - bcopy (®isters[REGISTER_BYTE (GR1_REGNUM)], - &am29k_greg_packet[AM29K_R_RSP], 5 * AM29K_GREG_SIZE); - - net_write_registers (am29k_greg_packet, AM29K_GREG_PLEN, PTRACE_SETREGS); - - /* Store floating point registers if the target has them. */ - - if (target_has_fp) - { - am29k_fpreg_packet[AM29K_R_FPE] = registers[REGISTER_BYTE (FPE_REGNUM)]; - am29k_fpreg_packet[AM29K_R_FPS] = registers[REGISTER_BYTE (FPS_REGNUM)]; - - net_write_registers (am29k_fpreg_packet, AM29K_FPREG_PLEN, - PTRACE_SETFPREGS); - } -} - -/* VxWorks zeroes fp when the task is initialized; we use this - to terminate the frame chain. Chain means here the nominal address of - a frame, that is, the return address (lr0) address in the stack. To - obtain the frame pointer (lr1) contents, we must add 4 bytes. - Note : may be we should modify init_frame_info() to get the frame pointer - and store it into the frame_info struct rather than reading its - contents when FRAME_CHAIN_VALID is invoked. THISFRAME is unused. */ - -int -vx29k_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe) -{ - int fp_contents; - - read_memory ((CORE_ADDR) (chain + 4), (char *) &fp_contents, 4); - return (fp_contents != 0); -} diff --git a/gdb/remote.c b/gdb/remote.c index c3f40fed1f9..a1b90b7a5a4 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -86,7 +86,7 @@ static void remote_resume (ptid_t ptid, int step, enum target_signal siggnal); static void remote_async_resume (ptid_t ptid, int step, enum target_signal siggnal); -static int remote_start_remote (PTR); +static int remote_start_remote (struct ui_out *uiout, void *dummy); static void remote_open (char *name, int from_tty); static void remote_async_open (char *name, int from_tty); @@ -970,8 +970,8 @@ show_remote_protocol_binary_download_cmd (char *args, /* Tokens for use by the asynchronous signal handlers for SIGINT */ -PTR sigint_remote_twice_token; -PTR sigint_remote_token; +static void *sigint_remote_twice_token; +static void *sigint_remote_token; /* These are pointers to hook functions that may be set in order to modify resume/wait behavior for a particular architecture. */ @@ -2107,14 +2107,16 @@ remote_cisco_objfile_relocate (bfd_signed_vma text_off, bfd_signed_vma data_off, /* Stub for catch_errors. */ static int -remote_start_remote_dummy (void *dummy) +remote_start_remote_dummy (struct ui_out *uiout, void *dummy) { start_remote (); /* Initialize gdb process mechanisms */ + /* NOTE: Return something >=0. A -ve value is reserved for + catch_exceptions. */ return 1; } static int -remote_start_remote (PTR dummy) +remote_start_remote (struct ui_out *uiout, void *dummy) { immediate_quit++; /* Allow user to interrupt it */ @@ -2131,7 +2133,9 @@ remote_start_remote (PTR dummy) putpkt ("?"); /* initiate a query from remote machine */ immediate_quit--; - return remote_start_remote_dummy (dummy); + /* NOTE: See comment above in remote_start_remote_dummy(). This + function returns something >=0. */ + return remote_start_remote_dummy (uiout, dummy); } /* Open a connection to a remote debugger. @@ -2246,6 +2250,7 @@ static void remote_open_1 (char *name, int from_tty, struct target_ops *target, int extended_p) { + int ex; struct remote_state *rs = get_remote_state (); if (name == 0) error ("To open a remote debug connection, you need to specify what\n" @@ -2308,15 +2313,30 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, no_shared_libraries (NULL, 0); #endif - /* Start the remote connection; if error (0), discard this target. - In particular, if the user quits, be sure to discard it - (we'd be in an inconsistent state otherwise). */ - if (!catch_errors (remote_start_remote, NULL, - "Couldn't establish connection to remote target\n", - RETURN_MASK_ALL)) + /* Start the remote connection. If error() or QUIT, discard this + target (we'd otherwise be in an inconsistent state) and then + propogate the error on up the exception chain. This ensures that + the caller doesn't stumble along blindly assuming that the + function succeeded. The CLI doesn't have this problem but other + UI's, such as MI do. + + FIXME: cagney/2002-05-19: Instead of re-throwing the exception, + this function should return an error indication letting the + caller restore the previous state. Unfortunatly the command + ``target remote'' is directly wired to this function making that + impossible. On a positive note, the CLI side of this problem has + been fixed - the function set_cmd_context() makes it possible for + all the ``target ....'' commands to share a common callback + function. See cli-dump.c. */ + ex = catch_exceptions (uiout, + remote_start_remote, NULL, + "Couldn't establish connection to remote" + " target\n", + RETURN_MASK_ALL); + if (ex < 0) { pop_target (); - return; + throw_exception (ex); } if (extended_p) @@ -2347,6 +2367,7 @@ static void remote_async_open_1 (char *name, int from_tty, struct target_ops *target, int extended_p) { + int ex; struct remote_state *rs = get_remote_state (); if (name == 0) error ("To open a remote debug connection, you need to specify what\n" @@ -2419,16 +2440,19 @@ remote_async_open_1 (char *name, int from_tty, struct target_ops *target, no_shared_libraries (NULL, 0); #endif - /* Start the remote connection; if error (0), discard this target. - In particular, if the user quits, be sure to discard it - (we'd be in an inconsistent state otherwise). */ - if (!catch_errors (remote_start_remote, NULL, - "Couldn't establish connection to remote target\n", - RETURN_MASK_ALL)) + /* Start the remote connection; if error, discard this target. See + the comments in remote_open_1() for further details such as the + need to re-throw the exception. */ + ex = catch_exceptions (uiout, + remote_start_remote, NULL, + "Couldn't establish connection to remote" + " target\n", + RETURN_MASK_ALL); + if (ex < 0) { pop_target (); wait_forever_enabled_p = 1; - return; + throw_exception (ex); } wait_forever_enabled_p = 1; @@ -5472,6 +5496,7 @@ remote_info_process (char *args, int from_tty) static void remote_cisco_open (char *name, int from_tty) { + int ex; if (name == 0) error ("To open a remote debug connection, you need to specify what \n" "device is attached to the remote system (e.g. host:port)."); @@ -5534,14 +5559,18 @@ remote_cisco_open (char *name, int from_tty) someday have a notion of debugging several processes. */ inferior_ptid = pid_to_ptid (MAGIC_NULL_PID); - /* Start the remote connection; if error (0), discard this target. */ - - if (!catch_errors (remote_start_remote_dummy, (char *) 0, - "Couldn't establish connection to remote target\n", - RETURN_MASK_ALL)) + /* Start the remote connection; if error, discard this target. See + the comments in remote_open_1() for further details such as the + need to re-throw the exception. */ + ex = catch_exceptions (uiout, + remote_start_remote_dummy, NULL, + "Couldn't establish connection to remote" + " target\n", + RETURN_MASK_ALL); + if (ex < 0) { pop_target (); - return; + throw_exception (ex); } } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 37794725bf0..ffc7bb98b58 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1857,19 +1857,16 @@ rs6000_do_registers_info (int regnum, int fpregs) } else { - /* Print as integer in hex and in decimal. */ + /* Print the register in hex. */ + val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + gdb_stdout, 'x', 1, 0, Val_pretty_default); + /* If not a vector register, print it also in decimal. */ if (!altivec_register_p (i)) { - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, - gdb_stdout, 'x', 1, 0, Val_pretty_default); printf_filtered ("\t"); val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, gdb_stdout, 0, 1, 0, Val_pretty_default); } - else - /* Print as integer in hex only. */ - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, - gdb_stdout, 'x', 1, 0, Val_pretty_default); } printf_filtered ("\n"); } @@ -2410,88 +2407,7 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach) return NULL; } - - - - -static void -process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) -{ - int *os_ident_ptr = obj; - const char *name; - unsigned int sectsize; - - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); - if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) - { - unsigned int name_length, data_length, note_type; - char *note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - data_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 4 && data_length == 16 && note_type == 1 - && strcmp (note + 12, "GNU") == 0) - { - int os_number = bfd_h_get_32 (abfd, note + 16); - - /* The case numbers are from abi-tags in glibc */ - switch (os_number) - { - case 0 : - *os_ident_ptr = ELFOSABI_LINUX; - break; - case 1 : - *os_ident_ptr = ELFOSABI_HURD; - break; - case 2 : - *os_ident_ptr = ELFOSABI_SOLARIS; - break; - default : - internal_error (__FILE__, __LINE__, - "process_note_abi_sections: unknown OS number %d", - os_number); - break; - } - } - } -} - -/* Return one of the ELFOSABI_ constants for BFDs representing ELF - executables. If it's not an ELF executable or if the OS/ABI couldn't - be determined, simply return -1. */ - -static int -get_elfosabi (bfd *abfd) -{ - int elfosabi = -1; - - if (abfd != NULL && bfd_get_flavour (abfd) == bfd_target_elf_flavour) - { - elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; - - /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate - that we're on a SYSV system. However, GNU/Linux uses a note section - to record OS/ABI info, but leaves e_ident[EI_OSABI] zero. So we - have to check the note sections too. */ - if (elfosabi == 0) - { - bfd_map_over_sections (abfd, - process_note_abi_tag_sections, - &elfosabi); - } - } - - return elfosabi; -} - - /* Initialize the current architecture based on INFO. If possible, re-use an architecture from ARCHES, which is a list of architectures already created during this debugging session. @@ -2510,7 +2426,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) enum bfd_architecture arch; unsigned long mach; bfd abfd; - int osabi, sysv_abi; + int sysv_abi; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; gdbarch_print_insn_ftype *print_insn; from_xcoff_exec = info.abfd && info.abfd->format == bfd_object && @@ -2521,7 +2438,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sysv_abi = info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour; - osabi = get_elfosabi (info.abfd); + if (info.abfd) + osabi = gdbarch_lookup_osabi (info.abfd); /* Check word size. If INFO is from a binary file, infer it from that, else choose a likely default. */ @@ -2706,7 +2624,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_convert_to_raw (gdbarch, rs6000_register_convert_to_raw); set_gdbarch_stab_reg_to_regnum (gdbarch, rs6000_stab_reg_to_regnum); - set_gdbarch_extract_return_value (gdbarch, rs6000_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value); /* Note: kevinb/2002-04-12: I'm not convinced that rs6000_push_arguments() is correct for the SysV ABI when the wordsize is 8, but I'm also @@ -2722,7 +2640,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return); set_gdbarch_store_return_value (gdbarch, rs6000_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); + set_gdbarch_deprecated_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); @@ -2734,57 +2652,23 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Not sure on this. FIXMEmgo */ set_gdbarch_frame_args_skip (gdbarch, 8); - /* Until November 2001, gcc was not complying to the SYSV ABI for - returning structures less than or equal to 8 bytes in size. It was - returning everything in memory. When this was corrected, it wasn't - fixed for native platforms. */ if (sysv_abi) - { - if (osabi == ELFOSABI_LINUX - || osabi == ELFOSABI_NETBSD - || osabi == ELFOSABI_FREEBSD) - set_gdbarch_use_struct_convention (gdbarch, - ppc_sysv_abi_broken_use_struct_convention); - else - set_gdbarch_use_struct_convention (gdbarch, - ppc_sysv_abi_use_struct_convention); - } + set_gdbarch_use_struct_convention (gdbarch, + ppc_sysv_abi_use_struct_convention); else - { - set_gdbarch_use_struct_convention (gdbarch, - generic_use_struct_convention); - } + set_gdbarch_use_struct_convention (gdbarch, + generic_use_struct_convention); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); - /* Note: kevinb/2002-04-12: See note above regarding *_push_arguments(). - The same remarks hold for the methods below. */ - if (osabi == ELFOSABI_LINUX && wordsize == 4) - { - set_gdbarch_frameless_function_invocation (gdbarch, - ppc_linux_frameless_function_invocation); - set_gdbarch_frame_chain (gdbarch, ppc_linux_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc); - - set_gdbarch_frame_init_saved_regs (gdbarch, - ppc_linux_frame_init_saved_regs); - set_gdbarch_init_extra_frame_info (gdbarch, - ppc_linux_init_extra_frame_info); - - set_gdbarch_memory_remove_breakpoint (gdbarch, - ppc_linux_memory_remove_breakpoint); - set_solib_svr4_fetch_link_map_offsets - (gdbarch, ppc_linux_svr4_fetch_link_map_offsets); - } - else - { - set_gdbarch_frameless_function_invocation (gdbarch, - rs6000_frameless_function_invocation); - set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain); - set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc); - set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs); - set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info); - } + set_gdbarch_frameless_function_invocation (gdbarch, + rs6000_frameless_function_invocation); + set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain); + set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc); + + set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs); + set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info); + if (!sysv_abi) { /* Handle RS/6000 function pointers (which are really function @@ -2800,9 +2684,24 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) now that the C compiler delays popping them. */ set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + /* Hook in ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch, osabi); + return gdbarch; } +static void +rs6000_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (tdep == NULL) + return; + + fprintf_unfiltered (file, "rs6000_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); +} + static struct cmd_list_element *info_powerpc_cmdlist = NULL; static void @@ -2816,8 +2715,8 @@ rs6000_info_powerpc_command (char *args, int from_tty) void _initialize_rs6000_tdep (void) { - register_gdbarch_init (bfd_arch_rs6000, rs6000_gdbarch_init); - register_gdbarch_init (bfd_arch_powerpc, rs6000_gdbarch_init); + gdbarch_register (bfd_arch_rs6000, rs6000_gdbarch_init, rs6000_dump_tdep); + gdbarch_register (bfd_arch_powerpc, rs6000_gdbarch_init, rs6000_dump_tdep); /* Add root prefix command for "info powerpc" commands */ add_prefix_cmd ("powerpc", class_info, rs6000_info_powerpc_command, @@ -2827,5 +2726,4 @@ _initialize_rs6000_tdep (void) add_cmd ("altivec", class_info, rs6000_altivec_registers_info, "Display the contents of the AltiVec registers.", &info_powerpc_cmdlist); - } diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index c69aca69fa3..8add4952f19 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1773,7 +1773,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* We can't do this */ set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_store_struct_return (gdbarch, s390_store_struct_return); - set_gdbarch_extract_return_value (gdbarch, s390_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, s390_extract_return_value); set_gdbarch_store_return_value (gdbarch, s390_store_return_value); /* Amount PC must be decremented by after a breakpoint. This is often the number of bytes in BREAKPOINT @@ -1818,7 +1818,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); - set_gdbarch_extract_struct_value_address + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, generic_cannot_extract_struct_value_address); /* Parameters for inferior function calls. */ diff --git a/gdb/ser-e7kpc.c b/gdb/ser-e7kpc.c index 49b2c89c324..063cca13d63 100644 --- a/gdb/ser-e7kpc.c +++ b/gdb/ser-e7kpc.c @@ -423,16 +423,12 @@ static struct serial_ops e7000pc_ops = e7000pc_noop, /* wait for output to drain */ }; -void -_initialize_ser_e7000pc (void) -{ - serial_add_interface (&e7000pc_ops); -} -#else +#endif /*_WIN32 or __GO32__*/ void _initialize_ser_e7000pc (void) { - +#if defined __GO32__ || defined _WIN32 + serial_add_interface (&e7000pc_ops); +#endif } -#endif diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index cef62699ae0..c6ae19dab02 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include "gdb_string.h" diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index b7686929977..375b55a6b66 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -41,6 +41,8 @@ #include "regcache.h" #include "doublest.h" +#include "sh-tdep.h" + #include "elf-bfd.h" #include "solib-svr4.h" @@ -906,29 +908,8 @@ sh_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) static int gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - return print_insn_sh (memaddr, info); - else - return print_insn_shl (memaddr, info); -} - -/* Disassemble an instruction. */ -static int -gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info) -{ - if (pc_is_isa32 (memaddr)) - { - /* Round down the instruction address to the appropriate boundary - before disassembling it. */ - return print_insn_sh64x_media (UNMAKE_ISA32_ADDR (memaddr), info); - } - else - { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - return print_insn_sh (memaddr, info); - else - return print_insn_shl (memaddr, info); - } + info->endian = TARGET_BYTE_ORDER; + return print_insn_sh (memaddr, info); } /* Given a GDB frame, determine the address of the calling function's frame. @@ -4198,175 +4179,6 @@ sh_linux_svr4_fetch_link_map_offsets (void) #endif /* SVR4_SHARED_LIBS */ -/* This table matches the indices assigned to enum sh_osabi. Keep - them in sync. */ -static const char * const sh_osabi_names[] = -{ - "", - "GNU/Linux", - "NetBSD ELF", - NULL -}; - -static void -process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj) -{ - enum sh_osabi *os_ident_ptr = obj; - const char *name; - unsigned int sectsize; - - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); - - if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0) - { - unsigned int name_length, data_length, note_type; - char *note; - - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; - - note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - data_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 4 && data_length == 16 && note_type == NT_GNU_ABI_TAG - && strcmp (note + 12, "GNU") == 0) - { - int os_number = bfd_h_get_32 (abfd, note + 16); - - /* The case numbers are from abi-tags in glibc. */ - switch (os_number) - { - case GNU_ABI_TAG_LINUX: - *os_ident_ptr = SH_OSABI_LINUX; - break; - - case GNU_ABI_TAG_HURD: - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: Hurd objects not supported"); - break; - - case GNU_ABI_TAG_SOLARIS: - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: Solaris objects not supported"); - break; - - default: - internal_error - (__FILE__, __LINE__, - "process_note_abi_sections: unknown OS number %d", - os_number); - } - } - } - /* NetBSD uses a similar trick. */ - else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0) - { - unsigned int name_length, desc_length, note_type; - char *note; - - /* If the section is larger than this, it's probably not what we are - looking for. */ - if (sectsize > 128) - sectsize = 128; - - note = alloca (sectsize); - - bfd_get_section_contents (abfd, sect, note, - (file_ptr) 0, (bfd_size_type) sectsize); - - name_length = bfd_h_get_32 (abfd, note); - desc_length = bfd_h_get_32 (abfd, note + 4); - note_type = bfd_h_get_32 (abfd, note + 8); - - if (name_length == 7 && desc_length == 4 && note_type == NT_NETBSD_IDENT - && strcmp (note + 12, "NetBSD") == 0) - /* XXX Should we check the version here? - Probably not necessary yet. */ - *os_ident_ptr = SH_OSABI_NETBSD_ELF; - } -} - -static int -get_elfosabi (bfd *abfd) -{ - int elfosabi; - enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN; - - elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI]; - - switch (elfosabi) - { - case ELFOSABI_NONE: - /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate - that we're on a SYSV system. However, some systems use note sections - to record OS/ABI info, but leave e_ident[EI_OSABI] zero. So we - have to check the note sections too. */ - bfd_map_over_sections (abfd, - process_note_abi_tag_sections, - &sh_osabi); - break; - - case ELFOSABI_NETBSD: - sh_osabi = SH_OSABI_NETBSD_ELF; - break; - - case ELFOSABI_LINUX: - sh_osabi = SH_OSABI_LINUX; - break; - } - - return (sh_osabi); -} - -struct sh_osabi_handler -{ - struct sh_osabi_handler *next; - enum sh_osabi abi; - void (*init_osabi)(struct gdbarch_info, struct gdbarch *); -}; - -struct sh_osabi_handler *sh_osabi_handler_list = NULL; - -void -sh_gdbarch_register_os_abi (enum sh_osabi abi, - void (*init_osabi)(struct gdbarch_info, - struct gdbarch *)) -{ - struct sh_osabi_handler **handler_p; - - for (handler_p = &sh_osabi_handler_list; *handler_p != NULL; - handler_p = &(*handler_p)->next) - { - if ((*handler_p)->abi == abi) - { - internal_error - (__FILE__, __LINE__, - "sh_gdbarch_register_os_abi: A handler for this ABI variant " - "(%d) has already been registered", (int) abi); - /* If user wants to continue, override previous definition. */ - (*handler_p)->init_osabi = init_osabi; - return; - } - } - - (*handler_p) - = (struct sh_osabi_handler *) xmalloc (sizeof (struct sh_osabi_handler)); - (*handler_p)->next = NULL; - (*handler_p)->abi = abi; - (*handler_p)->init_osabi = init_osabi; -} - static gdbarch_init_ftype sh_gdbarch_init; static struct gdbarch * @@ -4378,23 +4190,14 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) gdbarch_register_name_ftype *sh_register_name; gdbarch_store_return_value_ftype *sh_store_return_value; gdbarch_register_virtual_type_ftype *sh_register_virtual_type; - enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN; - struct sh_osabi_handler *osabi_handler; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; /* Try to determine the ABI of the object we are loading. */ if (info.abfd != NULL) { - switch (bfd_get_flavour (info.abfd)) - { - case bfd_target_elf_flavour: - sh_osabi = get_elfosabi (info.abfd); - break; - - default: - /* Just leave it as "unkown". */ - break; - } + osabi = gdbarch_lookup_osabi (info.abfd); + /* If we get "unknown" back, just leave it that way. */ } /* Find a candidate among the list of pre-declared architectures. */ @@ -4404,7 +4207,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { /* Make sure the ABI selection matches. */ tdep = gdbarch_tdep (arches->gdbarch); - if (tdep && tdep->sh_osabi == sh_osabi) + if (tdep && tdep->osabi == osabi) return arches->gdbarch; } @@ -4413,15 +4216,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XMALLOC (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); - tdep->sh_osabi = sh_osabi; - if (sh_osabi < SH_OSABI_INVALID) - tdep->osabi_name = sh_osabi_names[sh_osabi]; - else - { - internal_error (__FILE__, __LINE__, "Invalid setting of sh_osabi %d", - (int) sh_osabi); - tdep->osabi_name = ""; - } + tdep->osabi = osabi; /* Initialize the register numbers that are not common to all the variants to -1, if necessary thse will be overwritten in the case @@ -4475,11 +4270,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_chain (gdbarch, sh_frame_chain); set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info); - set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value); set_gdbarch_push_arguments (gdbarch, sh_push_arguments); set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return); set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention); - set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); set_gdbarch_pop_frame (gdbarch, sh_pop_frame); set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh); skip_prologue_hard_way = sh_skip_prologue_hard_way; @@ -4552,7 +4347,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size); set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size); set_gdbarch_register_byte (gdbarch, sh_default_register_byte); - set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); set_gdbarch_fp0_regnum (gdbarch, 25); tdep->FPUL_REGNUM = 23; tdep->FPSCR_REGNUM = 24; @@ -4592,7 +4387,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh3e_sh4_store_return_value; sh_register_virtual_type = sh_sh4_register_virtual_type; set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs); - set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value); set_gdbarch_fp0_regnum (gdbarch, 25); set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size); set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size); @@ -4682,7 +4477,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) sh_store_return_value = sh64_store_return_value; skip_prologue_hard_way = sh64_skip_prologue_hard_way; do_pseudo_register = sh64_do_pseudo_register; - set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64); set_gdbarch_register_raw_size (gdbarch, sh_sh64_register_raw_size); set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size); set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte); @@ -4702,10 +4496,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info); set_gdbarch_frame_chain (gdbarch, sh64_frame_chain); set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register); - set_gdbarch_extract_return_value (gdbarch, sh64_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value); set_gdbarch_push_arguments (gdbarch, sh64_push_arguments); /*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/ - set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention); set_gdbarch_pop_frame (gdbarch, sh64_pop_frame); set_gdbarch_elf_make_msymbol_special (gdbarch, @@ -4774,32 +4568,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); set_gdbarch_believe_pcc_promotion (gdbarch, 1); - /* Hook in ABI-specific overrides, if they have been registered. If - the ABI is unknown, this is probably an embedded target, so we - should not warn about this situation. */ - if (sh_osabi != SH_OSABI_UNKNOWN) - { - for (osabi_handler = sh_osabi_handler_list; osabi_handler != NULL; - osabi_handler = osabi_handler->next) - if (osabi_handler->abi == sh_osabi) - break; + /* Hook in ABI-specific overrides, if they have been registered. - if (osabi_handler) - osabi_handler->init_osabi (info, gdbarch); - else - { - /* We assume that if GDB_MULTI_ARCH is less than - GDB_MULTI_ARCH_TM that an ABI variant can be supported by - overriding definitions in this file. */ - if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) - fprintf_filtered - (gdb_stderr, - "A handler for the ABI variant \"%s\" is not built into this " - "configuration of GDB. " - "Attempting to continue with the default SuperH settings", - sh_osabi_names[sh_osabi]); - } - } + FIXME: if the ABI is unknown, this is probably an embedded target, + so we should not warn about this situation. */ + gdbarch_init_osabi (info, gdbarch, osabi); return gdbarch; } @@ -4812,12 +4585,8 @@ sh_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) if (tdep == NULL) return; - if (tdep->osabi_name != NULL) - fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n", tdep->osabi_name); - else - internal_error (__FILE__, __LINE__, - "sh_dump_tdep: illegal setting of tdep->sh_osabi (%d)", - (int) tdep->sh_osabi); + fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); } void diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index 2b07bd83c81..f450ac9d5fc 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -28,6 +28,8 @@ #include "arch-utils.h" #include "regcache.h" +#include "sh-tdep.h" + static struct serial *parallel; static int parallel_in_use; diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c index 5f9903d8d7a..02982267ba2 100644 --- a/gdb/shnbsd-tdep.c +++ b/gdb/shnbsd-tdep.c @@ -24,7 +24,10 @@ #include "regcache.h" #include "value.h" +#include "solib-svr4.h" + #include "nbsd-tdep.h" +#include "sh-tdep.h" #include "shnbsd-tdep.h" /* Convert an r0-r15 register number into an offset into a ptrace @@ -176,5 +179,5 @@ _initialize_shnbsd_tdep (void) add_core_fns (&shnbsd_core_fns); add_core_fns (&shnbsd_elfcore_fns); - sh_gdbarch_register_os_abi (SH_OSABI_NETBSD_ELF, shnbsd_init_abi); + gdbarch_register_osabi (bfd_arch_sh, GDB_OSABI_NETBSD_ELF, shnbsd_init_abi); } diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index 643e450fbbe..0057e60e377 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -498,8 +498,11 @@ target_signal_from_host (int hostsig) if (33 <= hostsig && hostsig <= 63) return (enum target_signal) (hostsig - 33 + (int) TARGET_SIGNAL_REALTIME_33); - else if (hostsig == 64) - return TARGET_SIGNAL_REALTIME_64; + else if (hostsig == 32) + return TARGET_SIGNAL_REALTIME_32; + else if (64 <= hostsig && hostsig <= 127) + return (enum target_signal) + (hostsig - 64 + (int) TARGET_SIGNAL_REALTIME_64); else error ("GDB bug: target.c (target_signal_from_host): unrecognized real-time signal"); } @@ -784,8 +787,21 @@ do_target_signal_to_host (enum target_signal oursig, if (retsig >= SIGRTMIN && retsig <= SIGRTMAX) return retsig; } - else if (oursig == TARGET_SIGNAL_REALTIME_64) - return 64; + else if (oursig == TARGET_SIGNAL_REALTIME_32) + { + /* TARGET_SIGNAL_REALTIME_32 isn't contiguous with + TARGET_SIGNAL_REALTIME_33. It is 32 by definition. */ + return 32; + } + else if (oursig >= TARGET_SIGNAL_REALTIME_64 + && oursig <= TARGET_SIGNAL_REALTIME_127) + { + /* This block of signals is continuous, and + TARGET_SIGNAL_REALTIME_64 is 64 by definition. */ + int retsig = + (int) oursig - (int) TARGET_SIGNAL_REALTIME_64 + 64; + return retsig; + } #endif *oursig_ok = 0; return 0; diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 2d71097c091..3f98a1eb433 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1318,24 +1318,20 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch, set_gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data, flmo); } -/* Initialize the architecture specific link_map_offsets fetcher. - This is called after _gdbarch_init() has set up its struct - gdbarch for the new architecture, so care must be taken to use the - value set by set_solib_svr4_fetch_link_map_offsets(), above. We - do, however, attempt to provide a reasonable alternative (for - native targets anyway) if the _gdbarch_init() fails to call +/* Initialize the architecture-specific link_map_offsets fetcher. + This is called after _gdbarch_init() has set up its `struct + gdbarch' for the new architecture, and is only called if the + link_map_offsets fetcher isn't already initialized (which is + usually done by calling set_solib_svr4_fetch_link_map_offsets() + above in _gdbarch_init()). Therefore we attempt to provide a + reasonable alternative (for native targets anyway) if the + _gdbarch_init() fails to call set_solib_svr4_fetch_link_map_offsets(). */ static void * init_fetch_link_map_offsets (struct gdbarch *gdbarch) { - struct link_map_offsets *(*flmo) = - gdbarch_data (gdbarch, fetch_link_map_offsets_gdbarch_data); - - if (flmo == NULL) - return legacy_fetch_link_map_offsets; - else - return flmo; + return legacy_fetch_link_map_offsets; } static struct target_so_ops svr4_so_ops; diff --git a/gdb/somsolib.c b/gdb/somsolib.c index d623e4b76db..2eb1ff5685c 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -1,6 +1,7 @@ /* Handle HP SOM shared libraries for GDB, the GNU Debugger. - Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free + Software Foundation, Inc. This file is part of GDB. @@ -38,7 +39,6 @@ #include "gdb-stabs.h" #include "gdb_stat.h" #include "gdbcmd.h" -#include "assert.h" #include "language.h" #include "regcache.h" @@ -319,7 +319,7 @@ som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty, sizeof (obj_private_data_t)); obj_private->unwind_info = NULL; obj_private->so_info = NULL; - so->objfile->obj_private = (PTR) obj_private; + so->objfile->obj_private = obj_private; } obj_private = (obj_private_data_t *) so->objfile->obj_private; diff --git a/gdb/source.c b/gdb/source.c index ac743724058..c7c1ce2f5d2 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -500,6 +500,8 @@ source_info (char *ignore, int from_tty) printf_filtered ("Source language is %s.\n", language_str (s->language)); printf_filtered ("Compiled with %s debugging format.\n", s->debugformat); + printf_filtered ("%s preprocessor macro info.\n", + s->macro_table ? "Includes" : "Does not include"); } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 6461ca088f6..6ad95c48dc8 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -33,6 +33,7 @@ #include "bfd.h" #include "gdb_string.h" #include "regcache.h" +#include "osabi.h" #ifdef USE_PROC_FS #include @@ -111,6 +112,8 @@ struct gdbarch_tdep int reg_save_offset; int call_dummy_call_offset; int print_insn_mach; + + enum gdb_osabi osabi; }; /* Now make GDB_TARGET_IS_SPARC64 a runtime test. */ @@ -2272,12 +2275,13 @@ sparc_target_architecture_hook (const bfd_arch_info_type *ap) static struct gdbarch * sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches); +static void sparc_dump_tdep (struct gdbarch *, struct ui_file *); void _initialize_sparc_tdep (void) { /* Hook us into the gdbarch mechanism. */ - register_gdbarch_init (bfd_arch_sparc, sparc_gdbarch_init); + gdbarch_register (bfd_arch_sparc, sparc_gdbarch_init, sparc_dump_tdep); tm_print_insn = gdb_print_insn_sparc; tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */ @@ -2930,6 +2934,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; struct gdbarch_tdep *tdep; + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; static LONGEST call_dummy_32[] = { 0xbc100001, 0x9de38000, 0xbc100002, 0xbe100003, @@ -2953,10 +2958,29 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) }; static LONGEST call_dummy_nil[] = {0}; + /* Try to determine the OS ABI of the object we are loading. */ + + if (info.abfd != NULL) + { + osabi = gdbarch_lookup_osabi (info.abfd); + if (osabi == GDB_OSABI_UNKNOWN) + { + /* If it's an ELF file, assume it's Solaris. */ + if (bfd_get_flavour (info.abfd) == bfd_target_elf_flavour) + osabi = GDB_OSABI_SOLARIS; + } + } + /* First see if there is already a gdbarch that can satisfy the request. */ - arches = gdbarch_list_lookup_by_info (arches, &info); - if (arches != NULL) - return arches->gdbarch; + for (arches = gdbarch_list_lookup_by_info (arches, &info); + arches != NULL; + arches = gdbarch_list_lookup_by_info (arches->next, &info)) + { + /* Make sure the ABI selection matches. */ + tdep = gdbarch_tdep (arches->gdbarch); + if (tdep && tdep->osabi == osabi) + return arches->gdbarch; + } /* None found: is the request for a sparc architecture? */ if (info.bfd_arch_info->arch != bfd_arch_sparc) @@ -2966,6 +2990,8 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); gdbarch = gdbarch_alloc (&info, tdep); + tdep->osabi = osabi; + /* First set settings that are common for all sparc architectures. */ set_gdbarch_believe_pcc_promotion (gdbarch, 1); set_gdbarch_breakpoint_from_pc (gdbarch, memory_breakpoint_from_pc); @@ -2976,8 +3002,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 1); set_gdbarch_decr_pc_after_break (gdbarch, 0); set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_extract_struct_value_address (gdbarch, - sparc_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sparc_extract_struct_value_address); set_gdbarch_fix_call_dummy (gdbarch, sparc_gdbarch_fix_call_dummy); set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_fp_regnum (gdbarch, SPARC_FP_REGNUM); @@ -3191,7 +3216,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) switch (info.bfd_arch_info->mach) { case bfd_mach_sparc: - set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 72); set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); @@ -3202,8 +3227,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->print_insn_mach = bfd_mach_sparc; break; case bfd_mach_sparc_sparclet: - set_gdbarch_extract_return_value (gdbarch, - sparclet_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparclet_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 32 + 32 + 8 + 8 + 8); set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4 + 8*4); @@ -3214,7 +3238,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->print_insn_mach = bfd_mach_sparc_sparclet; break; case bfd_mach_sparc_sparclite: - set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 80); set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4); @@ -3225,7 +3249,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->print_insn_mach = bfd_mach_sparc_sparclite; break; case bfd_mach_sparc_v8plus: - set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 72); set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); @@ -3236,7 +3260,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->has_fpu = 1; /* (all but sparclet and sparclite) */ break; case bfd_mach_sparc_v8plusa: - set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 72); set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4); @@ -3247,7 +3271,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->print_insn_mach = bfd_mach_sparc; break; case bfd_mach_sparc_sparclite_le: - set_gdbarch_extract_return_value (gdbarch, sparc32_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc32_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 80); set_gdbarch_register_bytes (gdbarch, 32*4 + 32*4 + 8*4 + 8*4); @@ -3258,7 +3282,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->print_insn_mach = bfd_mach_sparc_sparclite; break; case bfd_mach_sparc_v9: - set_gdbarch_extract_return_value (gdbarch, sparc64_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc64_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 125); set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8); @@ -3269,7 +3293,7 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->print_insn_mach = bfd_mach_sparc_v9a; break; case bfd_mach_sparc_v9a: - set_gdbarch_extract_return_value (gdbarch, sparc64_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, sparc64_extract_return_value); set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid); set_gdbarch_num_regs (gdbarch, 125); set_gdbarch_register_bytes (gdbarch, 32*8 + 32*8 + 45*8); @@ -3281,6 +3305,20 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) break; } + /* Hook in OS ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch, osabi); + return gdbarch; } +static void +sparc_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (tdep == NULL) + return; + + fprintf_unfiltered (file, "sparc_dump_tdep: OS ABI = %s\n", + gdbarch_osabi_name (tdep->osabi)); +} diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c index 87351f11c13..aa06747e97b 100644 --- a/gdb/sparcl-tdep.c +++ b/gdb/sparcl-tdep.c @@ -27,7 +27,7 @@ #include "regcache.h" #include -#if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN32__) +#if (!defined(__GO32__) && !defined(_WIN32)) || defined(__CYGWIN__) #define HAVE_SOCKETS #include #include diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 56b78495938..47502141547 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -142,7 +142,7 @@ static struct type *read_struct_type (char **, struct type *, static struct type *read_array_type (char **, struct type *, struct objfile *); -static struct type **read_args (char **, int, struct objfile *); +static struct field *read_args (char **, int, struct objfile *, int *, int *); static int read_cpp_abbrev (struct field_info *, char **, struct type *, @@ -2780,7 +2780,8 @@ again: { struct type *domain = read_type (pp, objfile); struct type *return_type; - struct type **args; + struct field *args; + int nargs, varargs; if (**pp != ',') /* Invalid member type data format. */ @@ -2789,9 +2790,10 @@ again: ++(*pp); return_type = read_type (pp, objfile); - args = read_args (pp, ';', objfile); + args = read_args (pp, ';', objfile, &nargs, &varargs); type = dbx_alloc_type (typenums, objfile); - smash_to_method_type (type, domain, return_type, args); + smash_to_method_type (type, domain, return_type, args, + nargs, varargs); } break; @@ -4929,38 +4931,39 @@ handle_true_range: and terminated with END. Return the list of types read in, or (struct type **)-1 if there is an error. */ -static struct type ** -read_args (char **pp, int end, struct objfile *objfile) +static struct field * +read_args (char **pp, int end, struct objfile *objfile, int *nargsp, + int *varargsp) { /* FIXME! Remove this arbitrary limit! */ - struct type *types[1024], **rval; /* allow for fns of 1023 parameters */ - int n = 0; + struct type *types[1024]; /* allow for fns of 1023 parameters */ + int n = 0, i; + struct field *rval; while (**pp != end) { if (**pp != ',') /* Invalid argument list: no ','. */ - return (struct type **) -1; + return (struct field *) -1; (*pp)++; STABS_CONTINUE (pp, objfile); types[n++] = read_type (pp, objfile); } (*pp)++; /* get past `end' (the ':' character) */ - if (n == 1) - { - rval = (struct type **) xmalloc (2 * sizeof (struct type *)); - } - else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID) - { - rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *)); - memset (rval + n, 0, sizeof (struct type *)); - } + if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID) + *varargsp = 1; else { - rval = (struct type **) xmalloc (n * sizeof (struct type *)); + n--; + *varargsp = 0; } - memcpy (rval, types, n * sizeof (struct type *)); + + rval = (struct field *) xmalloc (n * sizeof (struct field)); + memset (rval, 0, n * sizeof (struct field)); + for (i = 0; i < n; i++) + rval[i].type = types[i]; + *nargsp = n; return rval; } diff --git a/gdb/stack.c b/gdb/stack.c index 2dab0deb016..014c274c740 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -929,39 +929,84 @@ frame_info (char *addr_exp, int from_tty) } } - FRAME_INIT_SAVED_REGS (fi); - if (fi->saved_regs != NULL) - { - /* The sp is special; what's returned isn't the save address, but - actually the value of the previous frame's sp. */ - printf_filtered (" Previous frame's sp is "); - print_address_numeric (fi->saved_regs[SP_REGNUM], 1, gdb_stdout); - printf_filtered ("\n"); - count = 0; - numregs = NUM_REGS + NUM_PSEUDO_REGS; - for (i = 0; i < numregs; i++) - if (fi->saved_regs[i] && i != SP_REGNUM) + if (fi->saved_regs == NULL) + FRAME_INIT_SAVED_REGS (fi); + /* Print as much information as possible on the location of all the + registers. */ + { + enum lval_type lval; + int optimized; + CORE_ADDR addr; + int realnum; + int count; + int i; + int need_nl = 1; + + /* The sp is special; what's displayed isn't the save address, but + the value of the previous frame's sp. This is a legacy thing, + at one stage the frame cached the previous frame's SP instead + of its address, hence it was easiest to just display the cached + value. */ + if (SP_REGNUM >= 0) + { + /* Find out the location of the saved stack pointer with out + actually evaluating it. */ + frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr, + &realnum, NULL); + if (!optimized && lval == not_lval) { - if (count == 0) - puts_filtered (" Saved registers:\n "); - else - puts_filtered (","); - wrap_here (" "); - printf_filtered (" %s at ", REGISTER_NAME (i)); - print_address_numeric (fi->saved_regs[i], 1, gdb_stdout); - count++; + void *value = alloca (MAX_REGISTER_RAW_SIZE); + CORE_ADDR sp; + frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr, + &realnum, value); + sp = extract_address (value, REGISTER_RAW_SIZE (SP_REGNUM)); + printf_filtered (" Previous frame's sp is "); + print_address_numeric (sp, 1, gdb_stdout); + printf_filtered ("\n"); + need_nl = 0; } - if (count) - puts_filtered ("\n"); - } - else - { - /* We could get some information about saved registers by - calling get_saved_register on each register. Which info goes - with which frame is necessarily lost, however, and I suspect - that the users don't care whether they get the info. */ + else if (!optimized && lval == lval_memory) + { + printf_filtered (" Previous frame's sp at "); + print_address_numeric (addr, 1, gdb_stdout); + printf_filtered ("\n"); + need_nl = 0; + } + else if (!optimized && lval == lval_register) + { + printf_filtered (" Previous frame's sp in %s\n", + REGISTER_NAME (realnum)); + need_nl = 0; + } + /* else keep quiet. */ + } + + count = 0; + numregs = NUM_REGS + NUM_PSEUDO_REGS; + for (i = 0; i < numregs; i++) + if (i != SP_REGNUM) + { + /* Find out the location of the saved register without + fetching the corresponding value. */ + frame_register_unwind (fi, i, &optimized, &lval, &addr, &realnum, + NULL); + /* For moment, only display registers that were saved on the + stack. */ + if (!optimized && lval == lval_memory) + { + if (count == 0) + puts_filtered (" Saved registers:\n "); + else + puts_filtered (","); + wrap_here (" "); + printf_filtered (" %s at ", REGISTER_NAME (i)); + print_address_numeric (addr, 1, gdb_stdout); + count++; + } + } + if (count || need_nl) puts_filtered ("\n"); - } + } } #if 0 @@ -1500,17 +1545,6 @@ select_and_print_frame (struct frame_info *fi) } } - -/* Store the selected frame and its level into *FRAMEP and *LEVELP. - If there is no selected frame, *FRAMEP is set to NULL. */ - -void -record_selected_frame (CORE_ADDR *frameaddrp, int *levelp) -{ - *frameaddrp = selected_frame ? selected_frame->frame : 0; - *levelp = frame_relative_level (selected_frame); -} - /* Return the symbol-block in which the selected frame is executing. Can return zero under various legitimate circumstances. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2705785946e..da681a6b34e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,89 @@ +2002-06-11 Jim Blandy + + * lib/gdb.exp (get_debug_format): Tolerate message saying whether + preprocessor macro information is present. + + * macscp.exp, macscp1.c, macscp2.h, macscp3.h, macscp4.h: New + tests. + +2002-06-06 Michael Snyder + + * gdb.base/overlays.exp: Record addresses of overlay + functions in TCL variables rather than in GDB variables, + to avoid having GDB convert them to pointers (with loss + of information). + + * gdb.base/d10v.ld: Merge in several years worth of + default linker script changes. + * gdb.base/long_long.exp: Add check for sizeof (long double). + +2002-06-06 Michal Ludvig + + * gdb.asm/asm-source.exp: Add x86-64 target. + * gdb.asm/x86_64.inc: New. + +2002-05-30 Michael Chastain + + From Benjamin Kosnik : + * gdb.c++/m-static.cc: New file. + * gdb.c++/m-static.exp: New file. + +2002-05-28 Michael Snyder + + * gdb.base/call-ar-st.exp: Allow for reduced floating point + precision. + +2002-05-27 Michael Chastain + + From Benjamin Kosnik : + * gdb.c++/m-data.cc: New file. + * gdb.c++/m-data.exp: New file. + +2002-05-27 Michael Chastain + + From Benjamin Kosnik : + * gdb.c++/try_catch.cc: New file. + * gdb.c++/try_catch.exp: New file. + +2002-05-27 Michael Chastain + + * gdb.c++/local.exp: Accept more nested types in output. + +2002-05-26 Michael Chastain + + * gdb.base/call-rt-st.exp: Fix typo in brace quoting. + +2002-05-15 Nick Clifton + + * lib/gdb.exp (gdb_wrapper_init): Just because + gdb_wrapper_file exists, this does not mean that the file + should not be rebuilt. That is what gdb_wrapper_initialized + is for. + (default_gdb_init): Reset gdb_wrapper_initialized. + +2002-05-23 Michael Snyder + + * gdb.base/all-bin.exp: Revise previous patch by just reducing + the precision of the floating point test results. + * gdb.base/call-rt-st.exp: Ditto. + + * gdb.base/all-bin.exp: Allow for reduced floating point precision. + * gdb.base/call-rt-st.exp: Ditto. + +2002-05-19 Michael Chastain + + * gdb.c++/inherit.exp: Accept "VTT for ..." in output strings. + +2002-05-19 Elena Zannoni + + * configure.in (configdirs): Add gdb.arch. + * configure: Regenerate. + +2002-05-17 Jim Blandy + + * gdb.base/completion.exp: Recognize the more detailed error + messages produced by the macro expander's lexical analyzer. + 2002-05-14 Elena Zannoni * gdb.arch/altivec-abi.c: New file. diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure index ba66f400d89..bdfc4cd443e 100755 --- a/gdb/testsuite/configure +++ b/gdb/testsuite/configure @@ -649,7 +649,8 @@ test "$host_alias" != "$target_alias" && # Directories to use in all configurations. -configdirs="gdb.asm \ +configdirs="gdb.arch \ + gdb.asm \ gdb.base \ gdb.c++ \ gdb.java \ @@ -749,12 +750,12 @@ fi # End stuff to support --enable-shared echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:753: checking for Cygwin environment" >&5 +echo "configure:754: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -782,19 +783,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:786: checking for mingw32 environment" >&5 +echo "configure:787: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -813,7 +814,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:817: checking for executable suffix" >&5 +echo "configure:818: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -823,7 +824,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in index 446c8d1429f..48e50d873f4 100644 --- a/gdb/testsuite/configure.in +++ b/gdb/testsuite/configure.in @@ -13,7 +13,8 @@ AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..) AC_CANONICAL_SYSTEM # Directories to use in all configurations. -configdirs="gdb.asm \ +configdirs="gdb.arch \ + gdb.asm \ gdb.base \ gdb.c++ \ gdb.java \ diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index f6ce1c73b2b..f10f4ae2a62 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -47,6 +47,10 @@ if [istarget "d10v-*-*"] then { if [istarget "s390-*-*"] then { set asm-arch s390 } +if [istarget "x86_64-*-*"] then { + set asm-arch x86_64 + set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}" +} if [istarget "i\[3456\]86-*-*"] then { set asm-arch i386 } diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp index d809db7d158..fe6b7558e4c 100644 --- a/gdb/testsuite/gdb.base/all-bin.exp +++ b/gdb/testsuite/gdb.base/all-bin.exp @@ -187,12 +187,12 @@ gdb_expect { send_gdb "print v_int+v_double\n" gdb_expect { - -re ".*206.56565.*$gdb_prompt $" { + -re ".*206.565.*$gdb_prompt $" { pass "print value of v_int+v_double" - } + } -re ".*$gdb_prompt $" { fail "print value of v_int+v_double" } - timeout { fail "(timeout) print value of v_int+" } - } + timeout { fail "(timeout) print value of v_int+v_double" } +} # diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index d9bb350f8d1..a7ea5cf56aa 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -125,7 +125,7 @@ if {![gdb_skip_float_test "print print_double_array(double_array)"] && \ "\[ \t\r\n\]+array_d :" "\[ \t\r\n\]+=========" "\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]" "\[ \t\r\n\]+" } } @@ -194,7 +194,7 @@ if {![gdb_skip_float_test "continuing to breakpoint 1220"] && \ "\[ \t\r\n\]+array_d :" "\[ \t\r\n\]+=========" "\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*" "\[ \t\r\n\]+" ".*array_f :" ".*student id :\[\t \]+.*YELLOW" @@ -240,7 +240,7 @@ if {![gdb_skip_float_test "print print_double_array(array_d)"] && \ "array_d :" "\[ \t\r\n\]+=========" "\[ \t\r\n\]+\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*" "\[ \t\r\n\]+" } } @@ -259,7 +259,7 @@ if {![gdb_skip_float_test "continuing to 1236"] && \ "\[ \t\r\n\]+array_d :" "\[ \t\r\n\]+=========" "\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*" "\[ \t\r\n\]+.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)." } } else { @@ -433,11 +433,11 @@ if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \ ![gdb_skip_stdio_test "print print_ten_doubles(...)"]} { send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n" gdb_expect_list "print print_ten_doubles" ".*$gdb_prompt $" { - "\[\t\r\n \]+Two Doubles : 123.456000.*123.456000" - "\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000" - "\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000" - "\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450" - "\[\t\r\n \]+Two Doubles : -0.111111.*216.970650" + "\[\t\r\n \]+Two Doubles : 123.45\[0-9\]*.*123.45\[0-9\]*" + "\[\t\r\n \]+Two Doubles : -0.1200\[0-9\]*.*-1.2300\[0-9\]*" + "\[\t\r\n \]+Two Doubles : 343434.\[0-9\]*.*89.09\[0-9\]*" + "\[\t\r\n \]+Two Doubles : 3.1400\[0-9\]*.*-5678.123\[0-9\]*" + "\[\t\r\n \]+Two Doubles : -0.1111\[0-9\]*.*216.97\[0-9\]*" } } diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 033b5ef73dc..115dcb3fa7e 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2000, 2001, 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 @@ -176,7 +176,7 @@ if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] { if {![gdb_skip_float_test "print print_one_double(*d1)"] && \ ![gdb_skip_stdio_test "print print_one_double(*d1)"] } { print_struct_call "print_one_double(*d1)" \ - ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \\{double1 = 1\\.11111\\}" + ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \\{double1 = 1\\.111\[0-9\]*\\}" } if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \ diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index f8f4568e5f8..332e1697a7f 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -414,7 +414,7 @@ gdb_expect { -re "^p 'a\\\x07$"\ { send_gdb "\n" gdb_expect { - -re "Invalid character constant\\..*$gdb_prompt $"\ + -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $"\ { pass "complete 'p \'a'"} -re ".*$gdb_prompt $" { fail "complete 'p \'a'"} timeout {fail "(timeout) complete 'p \'a'"} @@ -433,7 +433,7 @@ gdb_expect { -re ".*argv.*$gdb_prompt p .a$" { send_gdb "\n" gdb_expect { - -re "Invalid character constant\\..*$gdb_prompt $" { + -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" { pass "complete (2) 'p \'a'" } -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } @@ -446,7 +446,7 @@ gdb_expect { -re "\\(gdb\\) p 'a$" { send_gdb "\n" gdb_expect { - -re "Invalid character constant\\..*$gdb_prompt $" { + -re "(Invalid character constant\\.|Unmatched single quote\\.).*$gdb_prompt $" { pass "complete (2) 'p \'a'" } -re ".*$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.base/d10v.ld b/gdb/testsuite/gdb.base/d10v.ld index 3c4c38a3c9c..41f085b1ed7 100644 --- a/gdb/testsuite/gdb.base/d10v.ld +++ b/gdb/testsuite/gdb.base/d10v.ld @@ -2,54 +2,57 @@ OUTPUT_FORMAT("elf32-d10v", "elf32-d10v", "elf32-d10v") OUTPUT_ARCH(d10v) ENTRY(_start) - SEARCH_DIR(/usr/cygnus/d10v-961230/H-sparc-sun-sunos4.1//lib); /* Do we need any of these for elf? __DYNAMIC = 0; */ + +MEMORY +{ + UNIFIED : org = 0, len = 0x1000000 + INSN : org = 0x1014000, len = 0x40000 + DATA : org = 0x2000004, len = 0x7FFC + STACK : org = 0x200BFFE, len = 4 +} + SECTIONS { /* Overlay sections: */ - .ovly0 0x01010000 : AT (0x12010000) { foo.o(.text) } - .ovly1 0x01010000 : AT (0x12011000) { bar.o(.text) } - .ovly2 0x01011000 : AT (0x12012000) { baz.o(.text) } - .ovly3 0x01011000 : AT (0x12013000) { grbx.o(.text) } - .data00 0x00001000 : AT (0x12014000) { foo.o(.data) } - .data01 0x00001000 : AT (0x12015000) { bar.o(.data) } - .data02 0x00002000 : AT (0x12016000) { baz.o(.data) } - .data03 0x00002000 : AT (0x12017000) { grbx.o(.data) } - /* Read-only sections, merged into data segment: */ - . = 0x00000004; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .plt : { *(.plt) } - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - /* Adjust the address for the data segment. */ - . = ALIGN(4); + .ovly0 0x1001000 : AT (0x8000) { foo.o(.text) } + .ovly1 0x1001000 : AT (0x9000) { bar.o(.text) } + .ovly2 0x1002000 : AT (0xa000) { baz.o(.text) } + .ovly3 0x1002000 : AT (0xb000) { grbx.o(.text) } + .data00 0x2001000 : AT (0xc000) { foo.o(.data) } + .data01 0x2001000 : AT (0xd000) { bar.o(.data) } + .data02 0x2002000 : AT (0xe000) { baz.o(.data) } + .data03 0x2002000 : AT (0xf000) { grbx.o(.data) } + + .text : + { + KEEP (*(.init)) + KEEP (*(.init.*)) + KEEP (*(.fini)) + KEEP (*(.fini.*)) + *(.text) + *(.text.*) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + _etext = .; + PROVIDE (etext = .); + } >INSN =0 + .rodata : { + *(.rodata) + *(.gnu.linkonce.r*) + *(.rodata.*) + } >DATA + .rodata1 : { + *(.rodata1) + *(.rodata1.*) + } >DATA + .data : { *(.data) + *(.data.*) *(.gnu.linkonce.d*) _ovly_table = .; LONG(ABSOLUTE(ADDR(.ovly0))); @@ -87,34 +90,66 @@ SECTIONS _novlys = .; LONG((_novlys - _ovly_table) / 16); CONSTRUCTORS - } - .data1 : { *(.data1) } + } >DATA + .data1 : { + *(.data1) + *(.data1.*) + } >DATA .ctors : { - *(.ctors) - } + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } >DATA .dtors : { - *(.dtors) - } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } >DATA /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } + .sdata : { + *(.sdata) + *(.sdata.*) + } >DATA _edata = .; PROVIDE (edata = .); __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } + .sbss : { *(.sbss) *(.scommon) } >DATA .bss : { *(.dynbss) + *(.dynbss.*) *(.bss) + *(.bss.*) *(COMMON) - } + } >DATA + _end = . ; PROVIDE (end = .); + + .stack : { _stack = .; *(.stack) } >STACK + /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } @@ -122,34 +157,37 @@ SECTIONS .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + + /* DWARF 1 */ .debug 0 : { *(.debug) } - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } - /* These must appear regardless of . */ - /* Hmmm, there's got to be a better way. This sets the stack to the - top of the simulator memory (i.e. top of 64K data space). */ - .stack 0x00007FFE : { _stack = .; *(.stack) } - .text 0x1000000 : - { - *(.init) - *(.fini) - *(.text) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0 - _etext = .; - PROVIDE (etext = .); + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } } diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index 7084a8deee1..55086d76755 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -114,6 +114,14 @@ gdb_expect { default { } } +set sizeof_long_double 8 +send_gdb "print sizeof(long double)\n" +gdb_expect { + -re ".* = 4.*$gdb_prompt $" { set sizeof_long_double 4 } + -re ".*$gdb_prompt $" { } + default { } +} + gdb_test "n 4" ".*38.*" "get to known place" # Check the hack for long long prints. @@ -146,11 +154,10 @@ if { $sizeof_ptr == 2 } { } gdb_test "p/c oct" ".*'w'.*" -if { $sizeof_double == 8 } { - -# ARM floating point numbers are not strictly little endian or big endian, -# but a hybrid. They are in little endian format with the two words -# swapped in big endian format. +if { $sizeof_double == 8 || $sizeof_long_double == 8 } { + # ARM floating point numbers are not strictly little endian or big endian, + # but a hybrid. They are in little endian format with the two words + # swapped in big endian format. if { [istarget "arm*-*-*"] || \ [istarget "xscale*-*-*"] || \ @@ -239,7 +246,7 @@ if { $target_bigendian_p } { gdb_test "x/c &oct" ".*-89 .*" # FIXME GDB's output is correct, but this longer match fails. # gdb_test "x/c &oct" ".*-89 '\\\\247'.*" - if { $sizeof_double == 8 } { + if { $sizeof_double == 8 || $sizeof_long_double == 8 } { gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*" } else { gdb_test "x/f &oct" ".*-2.42716126e-15.*" diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp index 9188b278014..c31da4e5ad4 100644 --- a/gdb/testsuite/gdb.base/overlays.exp +++ b/gdb/testsuite/gdb.base/overlays.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998 Free Software Foundation, Inc. +# Copyright 1997, 1998, 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 @@ -86,22 +86,42 @@ if ![runto_main] then { } # couple of convenience variables -set fptrcast [string_to_regexp "(int (*)(int))"] +set fptrcast [string_to_regexp "{int (int)}"] set iptrcast [string_to_regexp "(int *)"] +set hexx "0x\[0-9abcdefABCDEF\]+" gdb_test "overlay manual" "" gdb_test "overlay list" "No sections are mapped." "List with none mapped" # capture the LMA addresses of [foo bar baz grbx foox barx bazx grbxx] -gdb_test "print \$foo_lma = &foo" \ - ".* $fptrcast 0x.* <\\*foo\\*>" "foo load addr" -gdb_test "print \$bar_lma = &bar" \ - ".* $fptrcast 0x.* <\\*bar\\*>" "bar load addr" -gdb_test "print \$baz_lma = &baz" \ - ".* $fptrcast 0x.* <\\*baz\\*>" "baz load addr" -gdb_test "print \$grbx_lma = &grbx" \ - ".* $fptrcast 0x.* <\\*grbx\\*>" "grbx load addr" +proc get_func_address { func func_sym msg } { + global gdb_prompt + global fptrcast + global hexx + + set func_addr 0 + send_gdb "print $func\n" + gdb_expect { + -re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" { + set func_addr $expect_out(1,string) + pass "get $msg" + } + -re ".*$gdb_prompt $" { + fail "get $msg" + } + default { + fail "get $msg (timeout)" + } + } + return $func_addr +} + +set foo_lma [get_func_address "foo" "\\*foo\\*" "foo load address"] +set bar_lma [get_func_address "bar" "\\*bar\\*" "bar load address"] +set baz_lma [get_func_address "baz" "\\*baz\\*" "baz load address"] +set grbx_lma [get_func_address "grbx" "\\*grbx\\*" "grbx load address"] + gdb_test "print \$foox_lma = &foox" \ ".* $iptrcast 0x.*" "foox load addr" gdb_test "print \$barx_lma = &barx" \ @@ -116,23 +136,19 @@ gdb_test "print \$grbxx_lma = &grbxx" \ gdb_test "overlay map .ovly0" "" gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "List ovly0" -gdb_test "print \$foo_vma = &foo" \ - ".* $fptrcast 0x.* " "foo runtime addr" +set foo_vma [get_func_address "foo" "foo" "foo runtime address"] gdb_test "overlay map .ovly1" "" gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "List ovly1" -gdb_test "print \$bar_vma = &bar" \ - ".* $fptrcast 0x.* " "bar runtime addr" +set bar_vma [get_func_address "bar" "bar" "bar runtime address"] gdb_test "overlay map .ovly2" "" gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "List ovly2" -gdb_test "print \$baz_vma = &baz" \ - ".* $fptrcast 0x.* " "baz runtime addr" +set baz_vma [get_func_address "baz" "baz" "baz runtime address"] gdb_test "overlay map .ovly3" "" gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "List ovly3" -gdb_test "print \$grbx_vma = &grbx" \ - ".* $fptrcast 0x.* " "grbx runtime addr" +set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"] gdb_test "overlay map .data00" "" gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "List data00" @@ -156,10 +172,10 @@ gdb_test "print \$grbxx_vma = &grbxx" \ # Verify that LMA != VMA -gdb_test "print \$foo_lma != \$foo_vma" ".* = 1" "foo's LMA != VMA" -gdb_test "print \$bar_lma != \$bar_vma" ".* = 1" "bar's LMA != VMA" -gdb_test "print \$baz_lma != \$baz_vma" ".* = 1" "baz's LMA != VMA" -gdb_test "print \$grbx_lma != \$grbx_vma" ".* = 1" "grbx's LMA != VMA" +gdb_test "print $foo_lma != $foo_vma" ".* = 1" "foo's LMA != VMA" +gdb_test "print $bar_lma != $bar_vma" ".* = 1" "bar's LMA != VMA" +gdb_test "print $baz_lma != $baz_vma" ".* = 1" "baz's LMA != VMA" +gdb_test "print $grbx_lma != $grbx_vma" ".* = 1" "grbx's LMA != VMA" gdb_test "print \$foox_lma != \$foox_vma" ".* = 1" "foox's LMA != VMA" gdb_test "print \$barx_lma != \$barx_vma" ".* = 1" "barx's LMA != VMA" gdb_test "print \$bazx_lma != \$bazx_vma" ".* = 1" "bazx's LMA != VMA" diff --git a/gdb/testsuite/gdb.c++/inherit.exp b/gdb/testsuite/gdb.c++/inherit.exp index e24b7f5885a..286c27b09f3 100644 --- a/gdb/testsuite/gdb.c++/inherit.exp +++ b/gdb/testsuite/gdb.c++/inherit.exp @@ -993,7 +993,7 @@ proc test_print_mvi_classes {} { -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \ = \{${vbptr}vA = $hex, vc = 0, vx = 0\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 0, vx = 0\}, ${vbptr}vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { pass "print g_vE" } - -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, _vptr.vB = $hex, vb = 0, vx = 0\}, \ = \{_vptr.vC = $hex, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + -re ".* = \{\ = \{\ = \{\ = \{va = 0, vx = 0\}, _vptr.vB = $hex *(\)?, vb = 0, vx = 0\}, \ = \{_vptr.vC = $hex *(\)?, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { pass "print g_vE (FIXME v3 vtbl ptr)" } -re ".*$gdb_prompt $" { fail "print g_vE" } diff --git a/gdb/testsuite/gdb.c++/local.exp b/gdb/testsuite/gdb.c++/local.exp index 091d643f0d4..3ec2d5ef8b5 100644 --- a/gdb/testsuite/gdb.c++/local.exp +++ b/gdb/testsuite/gdb.c++/local.exp @@ -124,12 +124,12 @@ gdb_expect { # Pattern 1: # PASS # dwarf-2 -# 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# 2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD # # Pattern 2: # PASS # stabs+ -# 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# 2.95.3, 2.96-rh, 3.0.4, 3.1, gcc-3_1-branch, HEAD # # Pattern 3: # Old hppa pattern. @@ -137,12 +137,12 @@ gdb_expect { # Pattern 4: # Old hppa pattern. # -# chastain 2002-04-08 +# chastain 2002-05-27 send_gdb "ptype InnerLocal\n" gdb_expect { - -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal" } - -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal" } + -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 1)" } + -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 2)" } -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" } -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" } -re ".*$gdb_prompt $" { fail "ptype InnerLocal" } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index c41ed725473..8d666f936ef 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1119,8 +1119,7 @@ proc gdb_wrapper_init { args } { if { $gdb_wrapper_initialized == 1 } { return; } if {[target_info exists needs_status_wrapper] && \ - [target_info needs_status_wrapper] != "0" && \ - ![info exists gdb_wrapper_file]} { + [target_info needs_status_wrapper] != "0"} { set result [build_wrapper "testglue.o"]; if { $result != "" } { set gdb_wrapper_file [lindex $result 0]; @@ -1390,8 +1389,14 @@ proc gdb_continue { function } { } proc default_gdb_init { args } { + global gdb_wrapper_initialized + gdb_clear_suppressed; + # Make sure that the wrapper is rebuilt + # with the appropriate multilib option. + set gdb_wrapper_initialized 0 + # Uh, this is lame. Really, really, really lame. But there's this *one* # testcase that will fail in random places if we don't increase this. match_max -d 20000 @@ -1435,7 +1440,7 @@ proc get_debug_format { } { set debug_format "unknown" send_gdb "info source\n" gdb_expect 10 { - -re "Compiled with (.*) debugging format.\r\n$gdb_prompt $" { + -re "Compiled with (.*) debugging format.\r\n.*$gdb_prompt $" { set debug_format $expect_out(1,string) verbose "debug format is $debug_format" return 1; diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 534e9565066..dc3bc6ba9e0 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for the NEC V850 for GDB, the GNU debugger. - Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -30,9 +30,118 @@ #include "symfile.h" #include "arch-utils.h" #include "regcache.h" +#include "symtab.h" +struct gdbarch_tdep +{ + /* gdbarch target dependent data here. Currently unused for v850. */ +}; + +/* Extra info which is saved in each frame_info. */ +struct frame_extra_info +{ +}; + +enum { + E_R0_REGNUM, + E_R1_REGNUM, + E_R2_REGNUM, E_SAVE1_START_REGNUM = E_R2_REGNUM, E_SAVE1_END_REGNUM = E_R2_REGNUM, + E_R3_REGNUM, E_SP_REGNUM = E_R3_REGNUM, + E_R4_REGNUM, + E_R5_REGNUM, + E_R6_REGNUM, E_ARG0_REGNUM = E_R6_REGNUM, + E_R7_REGNUM, + E_R8_REGNUM, + E_R9_REGNUM, E_ARGLAST_REGNUM = E_R9_REGNUM, + E_R10_REGNUM, E_V0_REGNUM = E_R10_REGNUM, + E_R11_REGNUM, E_V1_REGNUM = E_R11_REGNUM, + E_R12_REGNUM, + E_R13_REGNUM, + E_R14_REGNUM, + E_R15_REGNUM, + E_R16_REGNUM, + E_R17_REGNUM, + E_R18_REGNUM, + E_R19_REGNUM, + E_R20_REGNUM, E_SAVE2_START_REGNUM = E_R20_REGNUM, + E_R21_REGNUM, + E_R22_REGNUM, + E_R23_REGNUM, + E_R24_REGNUM, + E_R25_REGNUM, + E_R26_REGNUM, + E_R27_REGNUM, + E_R28_REGNUM, + E_R29_REGNUM, E_SAVE2_END_REGNUM = E_R29_REGNUM, E_FP_RAW_REGNUM = E_R29_REGNUM, + E_R30_REGNUM, E_EP_REGNUM = E_R30_REGNUM, + E_R31_REGNUM, E_SAVE3_START_REGNUM = E_R31_REGNUM, E_SAVE3_END_REGNUM = E_R31_REGNUM, E_RP_REGNUM = E_R31_REGNUM, + E_R32_REGNUM, E_SR0_REGNUM = E_R32_REGNUM, + E_R33_REGNUM, + E_R34_REGNUM, + E_R35_REGNUM, + E_R36_REGNUM, + E_R37_REGNUM, E_PS_REGNUM = E_R37_REGNUM, + E_R38_REGNUM, + E_R39_REGNUM, + E_R40_REGNUM, + E_R41_REGNUM, + E_R42_REGNUM, + E_R43_REGNUM, + E_R44_REGNUM, + E_R45_REGNUM, + E_R46_REGNUM, + E_R47_REGNUM, + E_R48_REGNUM, + E_R49_REGNUM, + E_R50_REGNUM, + E_R51_REGNUM, + E_R52_REGNUM, E_CTBP_REGNUM = E_R52_REGNUM, + E_R53_REGNUM, + E_R54_REGNUM, + E_R55_REGNUM, + E_R56_REGNUM, + E_R57_REGNUM, + E_R58_REGNUM, + E_R59_REGNUM, + E_R60_REGNUM, + E_R61_REGNUM, + E_R62_REGNUM, + E_R63_REGNUM, + E_R64_REGNUM, E_PC_REGNUM = E_R64_REGNUM, + E_R65_REGNUM, E_FP_REGNUM = E_R65_REGNUM, + E_NUM_REGS +}; + +enum +{ + v850_reg_size = 4 +}; + +/* Size of all registers as a whole. */ +enum +{ + E_ALL_REGS_SIZE = (E_NUM_REGS) * v850_reg_size +}; + +/* Size of return datatype which fits into all return registers. */ +enum +{ + E_MAX_RETTYPE_SIZE_IN_REGS = 2 * v850_reg_size +}; -static char *v850_generic_reg_names[] = REGISTER_NAMES; +static LONGEST call_dummy_nil[] = {0}; + +static char *v850_generic_reg_names[] = +{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", + "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7", + "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15", + "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23", + "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31", + "pc", "fp" +}; static char *v850e_reg_names[] = { @@ -93,12 +202,160 @@ struct prologue_info static CORE_ADDR v850_scan_prologue (CORE_ADDR pc, struct prologue_info *fs); +/* Function: v850_register_name + Returns the name of the v850/v850e register N. */ + +static char * +v850_register_name (int regnum) +{ + if (regnum < 0 || regnum >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "v850_register_name: illegal register number %d", + regnum); + else + return v850_register_names[regnum]; + +} + +/* Function: v850_register_byte + Returns the byte position in the register cache for register N. */ + +static int +v850_register_byte (int regnum) +{ + if (regnum < 0 || regnum >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "v850_register_byte: illegal register number %d", + regnum); + else + return regnum * v850_reg_size; +} + +/* Function: v850_register_raw_size + Returns the number of bytes occupied by the register on the target. */ + +static int +v850_register_raw_size (int regnum) +{ + if (regnum < 0 || regnum >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "v850_register_raw_size: illegal register number %d", + regnum); + /* Only the PC has 4 Byte, all other registers 2 Byte. */ + else + return v850_reg_size; +} + +/* Function: v850_register_virtual_size + Returns the number of bytes occupied by the register as represented + internally by gdb. */ + +static int +v850_register_virtual_size (int regnum) +{ + return v850_register_raw_size (regnum); +} + +/* Function: v850_reg_virtual_type + Returns the default type for register N. */ + +static struct type * +v850_reg_virtual_type (int regnum) +{ + if (regnum < 0 || regnum >= E_NUM_REGS) + internal_error (__FILE__, __LINE__, + "v850_register_virtual_type: illegal register number %d", + regnum); + else if (regnum == E_PC_REGNUM) + return builtin_type_uint32; + else + return builtin_type_int32; +} + +static int +v850_type_is_scalar (struct type *t) +{ + return (TYPE_CODE (t) != TYPE_CODE_STRUCT + && TYPE_CODE (t) != TYPE_CODE_UNION + && TYPE_CODE (t) != TYPE_CODE_ARRAY); +} /* Should call_function allocate stack space for a struct return? */ -int +static int v850_use_struct_convention (int gcc_p, struct type *type) { - return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 4); + /* According to ABI: + * return TYPE_LENGTH (type) > 8); + */ + + /* Current implementation in gcc: */ + + int i; + struct type *fld_type, *tgt_type; + + /* 1. The value is greater than 8 bytes -> returned by copying */ + if (TYPE_LENGTH (type) > 8) + return 1; + + /* 2. The value is a single basic type -> returned in register */ + if (v850_type_is_scalar (type)) + return 0; + + /* The value is a structure or union with a single element + * and that element is either a single basic type or an array of + * a single basic type whoes size is greater than or equal to 4 + * -> returned in register */ + if ((TYPE_CODE (type) == TYPE_CODE_STRUCT + || TYPE_CODE (type) == TYPE_CODE_UNION) + && TYPE_NFIELDS (type) == 1) + { + fld_type = TYPE_FIELD_TYPE (type, 0); + if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4) + return 0; + + if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY) + { + tgt_type = TYPE_TARGET_TYPE (fld_type); + if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4) + return 0; + } + } + + /* The value is a structure whose first element is an integer or + * a float, and which contains no arrays of more than two elements + * -> returned in register */ + if (TYPE_CODE (type) == TYPE_CODE_STRUCT + && v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0)) + && TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4) + { + for (i = 1; i < TYPE_NFIELDS (type); ++i) + { + fld_type = TYPE_FIELD_TYPE (type, 0); + if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY) + { + tgt_type = TYPE_TARGET_TYPE (fld_type); + if (TYPE_LENGTH (fld_type) >= 0 && TYPE_LENGTH (tgt_type) >= 0 + && TYPE_LENGTH (fld_type) / TYPE_LENGTH (tgt_type) > 2) + return 1; + } + } + return 0; + } + + /* The value is a union which contains at least one field which + * would be returned in registers according to these rules + * -> returned in register */ + if (TYPE_CODE (type) == TYPE_CODE_UNION) + { + for (i = 0; i < TYPE_NFIELDS (type); ++i) + { + fld_type = TYPE_FIELD_TYPE (type, 0); + if (!v850_use_struct_convention (0, fld_type)) + return 0; + } + } + + return 1; } @@ -150,7 +407,7 @@ handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr, it to the immediate value used to adjust SP. */ for (i = 0; reg_table[i].mask != 0; i++) if (list12 & reg_table[i].mask) - offset += REGISTER_RAW_SIZE (regtable[i].regno); + offset += v850_register_raw_size (reg_table[i].regno); pi->frameoffset -= offset; /* Calculate the offsets of the registers relative to the value @@ -163,7 +420,7 @@ handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr, if (list12 & reg_table[i].mask) { int reg = reg_table[i].regno; - offset -= REGISTER_RAW_SIZE (reg); + offset -= v850_register_raw_size (reg); pifsr->reg = reg; pifsr->offset = offset; pifsr->cur_frameoffset = pi->frameoffset; @@ -197,7 +454,7 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi, long offset = 0; static struct reg_list pushml_reg_table[] = { - {0x80000, PS_REGNUM}, /* PSW */ + {0x80000, E_PS_REGNUM}, /* PSW */ {0x40000, 1}, /* r1 */ {0x20000, 2}, /* r2 */ {0x10000, 3}, /* r3 */ @@ -248,7 +505,7 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi, it to the immediate value used to adjust SP. */ for (i = 0; reg_table[i].mask != 0; i++) if (list12 & reg_table[i].mask) - offset += REGISTER_RAW_SIZE (regtable[i].regno); + offset += v850_register_raw_size (reg_table[i].regno); pi->frameoffset -= offset; /* Calculate the offsets of the registers relative to the value @@ -261,7 +518,7 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi, if (list12 & reg_table[i].mask) { int reg = reg_table[i].regno; - offset -= REGISTER_RAW_SIZE (reg); + offset -= v850_register_raw_size (reg); pifsr->reg = reg; pifsr->offset = offset; pifsr->cur_frameoffset = pi->frameoffset; @@ -285,12 +542,12 @@ handle_pushm (int insn, int insn2, struct prologue_info *pi, /* Function: scan_prologue Scan the prologue of the function that contains PC, and record what - we find in PI. PI->fsr must be zeroed by the called. Returns the - pc after the prologue. Note that the addresses saved in pi->fsr - are actually just frame relative (negative offsets from the frame - pointer). This is because we don't know the actual value of the - frame pointer yet. In some circumstances, the frame pointer can't - be determined till after we have scanned the prologue. */ + we find in PI. Returns the pc after the prologue. Note that the + addresses saved in frame->saved_regs are just frame relative (negative + offsets from the frame pointer). This is because we don't know the + actual value of the frame pointer yet. In some circumstances, the + frame pointer can't be determined till after we have scanned the + prologue. */ static CORE_ADDR v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) @@ -340,7 +597,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) registers. */ pi->frameoffset = 0; - pi->framereg = SP_REGNUM; + pi->framereg = E_SP_REGNUM; fp_used = 0; ep_used = 0; pifsr = pi->pifsrs; @@ -397,7 +654,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) } else if ((insn & 0xffc0) == 0x0200 && !regsave_func_p) { /* callt */ - long ctbp = read_register (CTBP_REGNUM); + long ctbp = read_register (E_CTBP_REGNUM); long adr = ctbp + ((insn & 0x3f) << 1); save_pc = current_pc; @@ -455,33 +712,33 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) break; /* Ran into end of prologue */ } - else if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add ,sp */ + else if ((insn & 0xffe0) == ((E_SP_REGNUM << 11) | 0x0240)) /* add ,sp */ pi->frameoffset += ((insn & 0x1f) ^ 0x10) - 0x10; - else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi ,sp,sp */ + else if (insn == ((E_SP_REGNUM << 11) | 0x0600 | E_SP_REGNUM)) /* addi ,sp,sp */ pi->frameoffset += insn2; - else if (insn == ((FP_RAW_REGNUM << 11) | 0x0000 | SP_REGNUM)) /* mov sp,fp */ + else if (insn == ((E_FP_RAW_REGNUM << 11) | 0x0000 | E_SP_REGNUM)) /* mov sp,fp */ { fp_used = 1; - pi->framereg = FP_RAW_REGNUM; + pi->framereg = E_FP_RAW_REGNUM; } - else if (insn == ((R12_REGNUM << 11) | 0x0640 | R0_REGNUM)) /* movhi hi(const),r0,r12 */ + else if (insn == ((E_R12_REGNUM << 11) | 0x0640 | E_R0_REGNUM)) /* movhi hi(const),r0,r12 */ r12_tmp = insn2 << 16; - else if (insn == ((R12_REGNUM << 11) | 0x0620 | R12_REGNUM)) /* movea lo(const),r12,r12 */ + else if (insn == ((E_R12_REGNUM << 11) | 0x0620 | E_R12_REGNUM)) /* movea lo(const),r12,r12 */ r12_tmp += insn2; - else if (insn == ((SP_REGNUM << 11) | 0x01c0 | R12_REGNUM) && r12_tmp) /* add r12,sp */ + else if (insn == ((E_SP_REGNUM << 11) | 0x01c0 | E_R12_REGNUM) && r12_tmp) /* add r12,sp */ pi->frameoffset = r12_tmp; - else if (insn == ((EP_REGNUM << 11) | 0x0000 | SP_REGNUM)) /* mov sp,ep */ + else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_SP_REGNUM)) /* mov sp,ep */ ep_used = 1; - else if (insn == ((EP_REGNUM << 11) | 0x0000 | R1_REGNUM)) /* mov r1,ep */ + else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_R1_REGNUM)) /* mov r1,ep */ ep_used = 0; - else if (((insn & 0x07ff) == (0x0760 | SP_REGNUM) /* st.w ,[sp] */ + else if (((insn & 0x07ff) == (0x0760 | E_SP_REGNUM) /* st.w ,[sp] */ || (fp_used - && (insn & 0x07ff) == (0x0760 | FP_RAW_REGNUM))) /* st.w ,[fp] */ + && (insn & 0x07ff) == (0x0760 | E_FP_RAW_REGNUM))) /* st.w ,[fp] */ && pifsr - && (((reg = (insn >> 11) & 0x1f) >= SAVE1_START_REGNUM && reg <= SAVE1_END_REGNUM) - || (reg >= SAVE2_START_REGNUM && reg <= SAVE2_END_REGNUM) - || (reg >= SAVE3_START_REGNUM && reg <= SAVE3_END_REGNUM))) + && (((reg = (insn >> 11) & 0x1f) >= E_SAVE1_START_REGNUM && reg <= E_SAVE1_END_REGNUM) + || (reg >= E_SAVE2_START_REGNUM && reg <= E_SAVE2_END_REGNUM) + || (reg >= E_SAVE3_START_REGNUM && reg <= E_SAVE3_END_REGNUM))) { pifsr->reg = reg; pifsr->offset = insn2 & ~1; @@ -495,9 +752,9 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) else if (ep_used /* sst.w ,[ep] */ && ((insn & 0x0781) == 0x0501) && pifsr - && (((reg = (insn >> 11) & 0x1f) >= SAVE1_START_REGNUM && reg <= SAVE1_END_REGNUM) - || (reg >= SAVE2_START_REGNUM && reg <= SAVE2_END_REGNUM) - || (reg >= SAVE3_START_REGNUM && reg <= SAVE3_END_REGNUM))) + && (((reg = (insn >> 11) & 0x1f) >= E_SAVE1_START_REGNUM && reg <= E_SAVE1_END_REGNUM) + || (reg >= E_SAVE2_START_REGNUM && reg <= E_SAVE2_END_REGNUM) + || (reg >= E_SAVE3_START_REGNUM && reg <= E_SAVE3_END_REGNUM))) { pifsr->reg = reg; pifsr->offset = (insn & 0x007e) << 1; @@ -536,49 +793,25 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi) return current_pc; } -/* Function: init_extra_frame_info - Setup the frame's frame pointer, pc, and frame addresses for saved - registers. Most of the work is done in scan_prologue(). - - Note that when we are called for the last frame (currently active frame), - that fi->pc and fi->frame will already be setup. However, fi->frame will - be valid only if this routine uses FP. For previous frames, fi-frame will - always be correct (since that is derived from v850_frame_chain ()). - - We can be called with the PC in the call dummy under two circumstances. - First, during normal backtracing, second, while figuring out the frame - pointer just prior to calling the target function (see run_stack_dummy). */ +/* Function: find_callers_reg + Find REGNUM on the stack. Otherwise, it's in an active register. + One thing we might want to do here is to check REGNUM against the + clobber mask, and somehow flag it as invalid if it isn't saved on + the stack somewhere. This would provide a graceful failure mode + when trying to get the value of caller-saves registers for an inner + frame. */ -void -v850_init_extra_frame_info (struct frame_info *fi) +CORE_ADDR +v850_find_callers_reg (struct frame_info *fi, int regnum) { - struct prologue_info pi; - struct pifsr pifsrs[NUM_REGS + 1], *pifsr; - - if (fi->next) - fi->pc = FRAME_SAVED_PC (fi->next); - - memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs); - - /* The call dummy doesn't save any registers on the stack, so we can return - now. */ - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return; - - pi.pifsrs = pifsrs; - - v850_scan_prologue (fi->pc, &pi); - - if (!fi->next && pi.framereg == SP_REGNUM) - fi->frame = read_register (pi.framereg) - pi.frameoffset; - - for (pifsr = pifsrs; pifsr->framereg; pifsr++) - { - fi->fsr.regs[pifsr->reg] = pifsr->offset + fi->frame; + for (; fi; fi = fi->next) + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) + return generic_read_register_dummy (fi->pc, fi->frame, regnum); + else if (fi->saved_regs[regnum] != 0) + return read_memory_unsigned_integer (fi->saved_regs[regnum], + v850_register_raw_size (regnum)); - if (pifsr->framereg == SP_REGNUM) - fi->fsr.regs[pifsr->reg] += pi.frameoffset; - } + return read_register (regnum); } /* Function: frame_chain @@ -597,7 +830,7 @@ v850_frame_chain (struct frame_info *fi) /* First, find out who called us */ callers_pc = FRAME_SAVED_PC (fi); /* If caller is a call-dummy, then our FP bears no relation to his FP! */ - fp = v850_find_callers_reg (fi, FP_RAW_REGNUM); + fp = v850_find_callers_reg (fi, E_FP_RAW_REGNUM); if (PC_IN_CALL_DUMMY (callers_pc, fp, fp)) return fp; /* caller is call-dummy: return oldest value of FP */ @@ -610,33 +843,12 @@ v850_frame_chain (struct frame_info *fi) if (pi.start_function) return 0; /* Don't chain beyond the start function */ - if (pi.framereg == FP_RAW_REGNUM) + if (pi.framereg == E_FP_RAW_REGNUM) return v850_find_callers_reg (fi, pi.framereg); return fi->frame - pi.frameoffset; } -/* Function: find_callers_reg - Find REGNUM on the stack. Otherwise, it's in an active register. - One thing we might want to do here is to check REGNUM against the - clobber mask, and somehow flag it as invalid if it isn't saved on - the stack somewhere. This would provide a graceful failure mode - when trying to get the value of caller-saves registers for an inner - frame. */ - -CORE_ADDR -v850_find_callers_reg (struct frame_info *fi, int regnum) -{ - for (; fi; fi = fi->next) - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, regnum); - else if (fi->fsr.regs[regnum] != 0) - return read_memory_unsigned_integer (fi->fsr.regs[regnum], - REGISTER_RAW_SIZE (regnum)); - - return read_register (regnum); -} - /* Function: skip_prologue Return the address of the first code past the prologue of the function. */ @@ -671,23 +883,24 @@ v850_skip_prologue (CORE_ADDR pc) command, or the call dummy breakpoint gets hit. */ void -v850_pop_frame (struct frame_info *frame) +v850_pop_frame (void) { + struct frame_info *frame = get_current_frame (); int regnum; if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) generic_pop_dummy_frame (); else { - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (E_PC_REGNUM, FRAME_SAVED_PC (frame)); - for (regnum = 0; regnum < NUM_REGS; regnum++) - if (frame->fsr.regs[regnum] != 0) + for (regnum = 0; regnum < E_NUM_REGS; regnum++) + if (frame->saved_regs[regnum] != 0) write_register (regnum, - read_memory_unsigned_integer (frame->fsr.regs[regnum], - REGISTER_RAW_SIZE (regnum))); + read_memory_unsigned_integer (frame->saved_regs[regnum], + v850_register_raw_size (regnum))); - write_register (SP_REGNUM, FRAME_FP (frame)); + write_register (E_SP_REGNUM, FRAME_FP (frame)); } flush_cached_frames (); @@ -706,7 +919,7 @@ v850_pop_frame (struct frame_info *frame) CORE_ADDR v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - unsigned char struct_return, CORE_ADDR struct_addr) + int struct_return, CORE_ADDR struct_addr) { int argreg; int argnum; @@ -716,22 +929,22 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, /* First, just for safety, make sure stack is aligned */ sp &= ~3; + /* The offset onto the stack at which we will start copying parameters + (after the registers are used up) begins at 16 rather than at zero. + I don't really know why, that's just the way it seems to work. */ + stack_offset = 16; + /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) len += ((TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3); - sp -= len; /* possibly over-allocating, but it works... */ + sp -= len + stack_offset; /* possibly over-allocating, but it works... */ /* (you might think we could allocate 16 bytes */ /* less, but the ABI seems to use it all! ) */ - argreg = ARG0_REGNUM; + argreg = E_ARG0_REGNUM; /* the struct_return pointer occupies the first parameter-passing reg */ if (struct_return) - write_register (argreg++, struct_addr); - - stack_offset = 16; - /* The offset onto the stack at which we will start copying parameters - (after the registers are used up) begins at 16 rather than at zero. - I don't really know why, that's just the way it seems to work. */ + argreg++; /* Now load as many as possible of the first arguments into registers, and push the rest onto the stack. There are 16 bytes @@ -740,10 +953,10 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, { int len; char *val; - char valbuf[REGISTER_RAW_SIZE (ARG0_REGNUM)]; + char valbuf[v850_register_raw_size (E_ARG0_REGNUM)]; - if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT - && TYPE_LENGTH (VALUE_TYPE (*args)) > 8) + if (!v850_type_is_scalar (VALUE_TYPE (*args)) + && TYPE_LENGTH (VALUE_TYPE (*args)) > E_MAX_RETTYPE_SIZE_IN_REGS) { store_address (valbuf, 4, VALUE_ADDRESS (*args)); len = 4; @@ -756,15 +969,15 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, } while (len > 0) - if (argreg <= ARGLAST_REGNUM) + if (argreg <= E_ARGLAST_REGNUM) { CORE_ADDR regval; - regval = extract_address (val, REGISTER_RAW_SIZE (argreg)); + regval = extract_address (val, v850_register_raw_size (argreg)); write_register (argreg, regval); - len -= REGISTER_RAW_SIZE (argreg); - val += REGISTER_RAW_SIZE (argreg); + len -= v850_register_raw_size (argreg); + val += v850_register_raw_size (argreg); argreg++; } else @@ -787,12 +1000,12 @@ v850_push_arguments (int nargs, struct value **args, CORE_ADDR sp, CORE_ADDR v850_push_return_address (CORE_ADDR pc, CORE_ADDR sp) { - write_register (RP_REGNUM, CALL_DUMMY_ADDRESS ()); + write_register (E_RP_REGNUM, CALL_DUMMY_ADDRESS ()); return sp; } /* Function: frame_saved_pc - Find the caller of this frame. We do this by seeing if RP_REGNUM + Find the caller of this frame. We do this by seeing if E_RP_REGNUM is saved in the stack anywhere, otherwise we get it from the registers. If the inner frame is a dummy frame, return its PC instead of RP, because that's where "caller" of the dummy-frame @@ -802,9 +1015,9 @@ CORE_ADDR v850_frame_saved_pc (struct frame_info *fi) { if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + return generic_read_register_dummy (fi->pc, fi->frame, E_PC_REGNUM); else - return v850_find_callers_reg (fi, RP_REGNUM); + return v850_find_callers_reg (fi, E_RP_REGNUM); } @@ -815,7 +1028,7 @@ v850_frame_saved_pc (struct frame_info *fi) trap */ -int +void v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p) { @@ -827,36 +1040,271 @@ v850_fix_call_dummy (char *dummy, CORE_ADDR sp, CORE_ADDR fun, int nargs, store_unsigned_integer ((unsigned int *) &dummy[2], 2, offset24 & 0xffff); store_unsigned_integer ((unsigned int *) &dummy[0], 2, offset24 >> 16); - return 0; } -/* Change the register names based on the current machine type. */ +static CORE_ADDR +v850_saved_pc_after_call (struct frame_info *ignore) +{ + return read_register (E_RP_REGNUM); +} -static int -v850_target_architecture_hook (const bfd_arch_info_type *ap) +static void +v850_extract_return_value (struct type *type, char *regbuf, char *valbuf) +{ + CORE_ADDR return_buffer; + + if (!v850_use_struct_convention (0, type)) + { + /* Scalar return values of <= 8 bytes are returned in + E_V0_REGNUM to E_V1_REGNUM. */ + memcpy (valbuf, + ®buf[REGISTER_BYTE (E_V0_REGNUM)], + TYPE_LENGTH (type)); + } + else + { + /* Aggregates and return values > 8 bytes are returned in memory, + pointed to by R6. */ + return_buffer = + extract_address (regbuf + REGISTER_BYTE (E_V0_REGNUM), + REGISTER_RAW_SIZE (E_V0_REGNUM)); + + read_memory (return_buffer, valbuf, TYPE_LENGTH (type)); + } +} + +const static unsigned char * +v850_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { - int i, j; + static unsigned char breakpoint[] = { 0x85, 0x05 }; + *lenptr = sizeof (breakpoint); + return breakpoint; +} + +static CORE_ADDR +v850_extract_struct_value_address (char *regbuf) +{ + return extract_address (regbuf + v850_register_byte (E_V0_REGNUM), + v850_register_raw_size (E_V0_REGNUM)); +} + +static void +v850_store_return_value (struct type *type, char *valbuf) +{ + CORE_ADDR return_buffer; - if (ap->arch != bfd_arch_v850) + if (!v850_use_struct_convention (0, type)) + write_register_bytes (REGISTER_BYTE (E_V0_REGNUM), valbuf, + TYPE_LENGTH (type)); + else + { + return_buffer = read_register (E_V0_REGNUM); + write_memory (return_buffer, valbuf, TYPE_LENGTH (type)); + } +} + +static void +v850_frame_init_saved_regs (struct frame_info *fi) +{ + struct prologue_info pi; + struct pifsr pifsrs[E_NUM_REGS + 1], *pifsr; + CORE_ADDR func_addr, func_end; + + if (!fi->saved_regs) + { + frame_saved_regs_zalloc (fi); + + /* The call dummy doesn't save any registers on the stack, so we + can return now. */ + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) + return; + + /* Find the beginning of this function, so we can analyze its + prologue. */ + if (find_pc_partial_function (fi->pc, NULL, &func_addr, &func_end)) + { + pi.pifsrs = pifsrs; + + v850_scan_prologue (fi->pc, &pi); + + if (!fi->next && pi.framereg == E_SP_REGNUM) + fi->frame = read_register (pi.framereg) - pi.frameoffset; + + for (pifsr = pifsrs; pifsr->framereg; pifsr++) + { + fi->saved_regs[pifsr->reg] = pifsr->offset + fi->frame; + + if (pifsr->framereg == E_SP_REGNUM) + fi->saved_regs[pifsr->reg] += pi.frameoffset; + } + } + /* Else we're out of luck (can't debug completely stripped code). + FIXME. */ + } +} + +/* Function: init_extra_frame_info + Setup the frame's frame pointer, pc, and frame addresses for saved + registers. Most of the work is done in scan_prologue(). + + Note that when we are called for the last frame (currently active frame), + that fi->pc and fi->frame will already be setup. However, fi->frame will + be valid only if this routine uses FP. For previous frames, fi-frame will + always be correct (since that is derived from v850_frame_chain ()). + + We can be called with the PC in the call dummy under two circumstances. + First, during normal backtracing, second, while figuring out the frame + pointer just prior to calling the target function (see run_stack_dummy). */ + +static void +v850_init_extra_frame_info (int fromleaf, struct frame_info *fi) +{ + struct prologue_info pi; + + if (fi->next) + fi->pc = FRAME_SAVED_PC (fi->next); + + v850_frame_init_saved_regs (fi); +} + +static void +v850_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + write_register (E_ARG0_REGNUM, addr); +} + +static CORE_ADDR +v850_target_read_fp (void) +{ + return read_register (E_FP_RAW_REGNUM); +} + +static struct gdbarch * +v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +{ + static LONGEST call_dummy_words[1] = { 0 }; + struct gdbarch_tdep *tdep = NULL; + struct gdbarch *gdbarch; + int i; + + /* find a candidate among the list of pre-declared architectures. */ + arches = gdbarch_list_lookup_by_info (arches, &info); + if (arches != NULL) + return (arches->gdbarch); + +#if 0 + tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); +#endif + + /* Change the register names based on the current machine type. */ + if (info.bfd_arch_info->arch != bfd_arch_v850) return 0; + gdbarch = gdbarch_alloc (&info, 0); + for (i = 0; v850_processor_type_table[i].regnames != NULL; i++) { - if (v850_processor_type_table[i].mach == ap->mach) + if (v850_processor_type_table[i].mach == info.bfd_arch_info->mach) { v850_register_names = v850_processor_type_table[i].regnames; - tm_print_insn_info.mach = ap->mach; - return 1; + tm_print_insn_info.mach = info.bfd_arch_info->mach; + break; } } - internal_error (__FILE__, __LINE__, - "Architecture `%s' unrecognized", ap->printable_name); + /* + * Basic register fields and methods. + */ + set_gdbarch_num_regs (gdbarch, E_NUM_REGS); + set_gdbarch_num_pseudo_regs (gdbarch, 0); + set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); + set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); + set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); + set_gdbarch_register_name (gdbarch, v850_register_name); + set_gdbarch_register_size (gdbarch, v850_reg_size); + set_gdbarch_register_bytes (gdbarch, E_ALL_REGS_SIZE); + set_gdbarch_register_byte (gdbarch, v850_register_byte); + set_gdbarch_register_raw_size (gdbarch, v850_register_raw_size); + set_gdbarch_max_register_raw_size (gdbarch, v850_reg_size); + set_gdbarch_register_virtual_size (gdbarch, v850_register_raw_size); + set_gdbarch_max_register_virtual_size (gdbarch, v850_reg_size); + set_gdbarch_register_virtual_type (gdbarch, v850_reg_virtual_type); + + set_gdbarch_read_fp (gdbarch, v850_target_read_fp); + + /* + * Frame Info + */ + set_gdbarch_init_extra_frame_info (gdbarch, v850_init_extra_frame_info); + set_gdbarch_frame_init_saved_regs (gdbarch, v850_frame_init_saved_regs); + set_gdbarch_frame_chain (gdbarch, v850_frame_chain); + set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); + set_gdbarch_saved_pc_after_call (gdbarch, v850_saved_pc_after_call); + set_gdbarch_frame_saved_pc (gdbarch, v850_frame_saved_pc); + set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue); + set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid); + set_gdbarch_frame_args_address (gdbarch, default_frame_address); + set_gdbarch_frame_locals_address (gdbarch, default_frame_address); + + /* + * Miscelany + */ + /* Stack grows up. */ + set_gdbarch_inner_than (gdbarch, core_addr_lessthan); + /* PC stops zero byte after a trap instruction + (which means: exactly on trap instruction). */ + set_gdbarch_decr_pc_after_break (gdbarch, 0); + /* This value is almost never non-zero... */ + set_gdbarch_function_start_offset (gdbarch, 0); + /* This value is almost never non-zero... */ + set_gdbarch_frame_args_skip (gdbarch, 0); + /* OK to default this value to 'unknown'. */ + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); + /* W/o prototype, coerce float args to double. */ + set_gdbarch_coerce_float_to_double (gdbarch, standard_coerce_float_to_double); + + /* + * Call Dummies + * + * These values and methods are used when gdb calls a target function. */ + set_gdbarch_use_generic_dummy_frames (gdbarch, 1); + set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); + set_gdbarch_push_return_address (gdbarch, v850_push_return_address); + set_gdbarch_deprecated_extract_return_value (gdbarch, v850_extract_return_value); + set_gdbarch_push_arguments (gdbarch, v850_push_arguments); + set_gdbarch_pop_frame (gdbarch, v850_pop_frame); + set_gdbarch_store_struct_return (gdbarch, v850_store_struct_return); + set_gdbarch_store_return_value (gdbarch, v850_store_return_value); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, v850_extract_struct_value_address); + set_gdbarch_use_struct_convention (gdbarch, v850_use_struct_convention); + set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); + set_gdbarch_call_dummy_address (gdbarch, entry_point_address); + set_gdbarch_call_dummy_start_offset (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0); + set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + set_gdbarch_call_dummy_length (gdbarch, 0); + set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy); + set_gdbarch_call_dummy_p (gdbarch, 1); + set_gdbarch_call_dummy_words (gdbarch, call_dummy_nil); + set_gdbarch_sizeof_call_dummy_words (gdbarch, 0); + set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); + /* set_gdbarch_call_dummy_stack_adjust */ + set_gdbarch_fix_call_dummy (gdbarch, v850_fix_call_dummy); + set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc); + + set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); + + set_gdbarch_extra_stack_alignment_needed (gdbarch, 0); + + return gdbarch; } void _initialize_v850_tdep (void) { tm_print_insn = print_insn_v850; - target_architecture_hook = v850_target_architecture_hook; + register_gdbarch_init (bfd_arch_v850, v850_gdbarch_init); } diff --git a/gdb/valops.c b/gdb/valops.c index 5e51d1dd066..691c1c4461f 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -45,7 +45,8 @@ extern int hp_som_som_object_present; extern int overload_debug; /* Local functions. */ -static int typecmp (int staticp, struct type *t1[], struct value *t2[]); +static int typecmp (int staticp, int varargs, int nargs, + struct field t1[], struct value *t2[]); static CORE_ADDR find_function_addr (struct value *, struct type **); static struct value *value_arg_coerce (struct value *, struct type *, int); @@ -1438,42 +1439,25 @@ hand_function_call (struct value *function, int nargs, struct value **args) sp = old_sp; /* It really is used, for some ifdef's... */ #endif - if (TYPE_CODE (ftype) == TYPE_CODE_METHOD) - { - i = 0; - while (TYPE_CODE (TYPE_ARG_TYPES (ftype)[i]) != TYPE_CODE_VOID) - i++; - n_method_args = i; - if (nargs < i) - error ("too few arguments in method call"); - } - else if (nargs < TYPE_NFIELDS (ftype)) + if (nargs < TYPE_NFIELDS (ftype)) error ("too few arguments in function call"); for (i = nargs - 1; i >= 0; i--) { - /* Assume that methods are always prototyped, unless they are off the - end (which we should only be allowing if there is a ``...''). - FIXME. */ - if (TYPE_CODE (ftype) == TYPE_CODE_METHOD) - { - if (i < n_method_args) - args[i] = value_arg_coerce (args[i], TYPE_ARG_TYPES (ftype)[i], 1); - else - args[i] = value_arg_coerce (args[i], NULL, 0); - } + int prototyped; - /* If we're off the end of the known arguments, do the standard - promotions. FIXME: if we had a prototype, this should only - be allowed if ... were present. */ - if (i >= TYPE_NFIELDS (ftype)) - args[i] = value_arg_coerce (args[i], NULL, 0); + /* FIXME drow/2002-05-31: Should just always mark methods as + prototyped. Can we respect TYPE_VARARGS? Probably not. */ + if (TYPE_CODE (ftype) == TYPE_CODE_METHOD) + prototyped = 1; + else + prototyped = TYPE_PROTOTYPED (ftype); + if (i < TYPE_NFIELDS (ftype)) + args[i] = value_arg_coerce (args[i], TYPE_FIELD_TYPE (ftype, i), + prototyped); else - { - param_type = TYPE_FIELD_TYPE (ftype, i); - args[i] = value_arg_coerce (args[i], param_type, TYPE_PROTOTYPED (ftype)); - } + args[i] = value_arg_coerce (args[i], NULL, 0); /*elz: this code is to handle the case in which the function to be called has a pointer to function as parameter and the corresponding actual argument @@ -1485,7 +1469,7 @@ hand_function_call (struct value *function, int nargs, struct value **args) In cc this is not a problem. */ if (using_gcc == 0) - if (param_type) + if (param_type && TYPE_CODE (ftype) != TYPE_CODE_METHOD) /* if this parameter is a pointer to function */ if (TYPE_CODE (param_type) == TYPE_CODE_PTR) if (TYPE_CODE (TYPE_TARGET_TYPE (param_type)) == TYPE_CODE_FUNC) @@ -1938,13 +1922,14 @@ value_bitstring (char *ptr, int len) } /* See if we can pass arguments in T2 to a function which takes arguments - of types T1. Both t1 and t2 are NULL-terminated vectors. If some - arguments need coercion of some sort, then the coerced values are written - into T2. Return value is 0 if the arguments could be matched, or the - position at which they differ if not. + of types T1. T1 is a list of NARGS arguments, and T2 is a NULL-terminated + vector. If some arguments need coercion of some sort, then the coerced + values are written into T2. Return value is 0 if the arguments could be + matched, or the position at which they differ if not. STATICP is nonzero if the T1 argument list came from a - static member function. + static member function. T2 will still include the ``this'' pointer, + but it will be skipped. For non-static member functions, we ignore the first argument, which is the type of the instance variable. This is because we want @@ -1953,30 +1938,30 @@ value_bitstring (char *ptr, int len) requested operation is type secure, shouldn't we? FIXME. */ static int -typecmp (int staticp, struct type *t1[], struct value *t2[]) +typecmp (int staticp, int varargs, int nargs, + struct field t1[], struct value *t2[]) { int i; if (t2 == 0) - return 1; - if (staticp && t1 == 0) - return t2[1] != 0; - if (t1 == 0) - return 1; - if (t1[!staticp] == 0) - return 0; - if (TYPE_CODE (t1[0]) == TYPE_CODE_VOID) - return 0; + internal_error (__FILE__, __LINE__, "typecmp: no argument list"); + /* Skip ``this'' argument if applicable. T2 will always include THIS. */ if (staticp) - t2++; - for (i = !staticp; t1[i] && TYPE_CODE (t1[i]) != TYPE_CODE_VOID; i++) + t2 ++; + + for (i = 0; + (i < nargs) && TYPE_CODE (t1[i].type) != TYPE_CODE_VOID; + i++) { struct type *tt1, *tt2; + if (!t2[i]) return i + 1; - tt1 = check_typedef (t1[i]); + + tt1 = check_typedef (t1[i].type); tt2 = check_typedef (VALUE_TYPE (t2[i])); + if (TYPE_CODE (tt1) == TYPE_CODE_REF /* We should be doing hairy argument matching, as below. */ && (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (tt1))) == TYPE_CODE (tt2))) @@ -2012,12 +1997,12 @@ typecmp (int staticp, struct type *t1[], struct value *t2[]) /* We should be doing much hairier argument matching (see section 13.2 of the ARM), but as a quick kludge, just check for the same type code. */ - if (TYPE_CODE (t1[i]) != TYPE_CODE (VALUE_TYPE (t2[i]))) + if (TYPE_CODE (t1[i].type) != TYPE_CODE (VALUE_TYPE (t2[i]))) return i + 1; } - if (!t1[i]) + if (varargs || t2[i] == NULL) return 0; - return t2[i] ? i + 1 : 0; + return i + 1; } /* Helper function used by value_struct_elt to recurse through baseclasses. @@ -2303,6 +2288,8 @@ search_struct_method (char *name, struct value **arg1p, if (TYPE_FN_FIELD_STUB (f, j)) check_stub_method (type, i, j); if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j), + TYPE_VARARGS (TYPE_FN_FIELD_TYPE (f, j)), + TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, j)), TYPE_FN_FIELD_ARGS (f, j), args)) { if (TYPE_FN_FIELD_VIRTUAL_P (f, j)) @@ -2754,13 +2741,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, { if (TYPE_FN_FIELD_STATIC_P (fns_ptr, ix)) static_offset = 1; - nparms=0; - - if (TYPE_FN_FIELD_ARGS(fns_ptr,ix)) - { - while (TYPE_CODE(TYPE_FN_FIELD_ARGS(fns_ptr,ix)[nparms]) != TYPE_CODE_VOID) - nparms++; - } + nparms = TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (fns_ptr, ix)); } else { @@ -2772,7 +2753,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, parm_types = (struct type **) xmalloc (nparms * (sizeof (struct type *))); for (jj = 0; jj < nparms; jj++) parm_types[jj] = (method - ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj]) + ? (TYPE_FN_FIELD_ARGS (fns_ptr, ix)[jj].type) : TYPE_FIELD_TYPE (SYMBOL_TYPE (oload_syms[ix]), jj)); /* Compare parameter types to supplied argument types. Skip THIS for diff --git a/gdb/values.c b/gdb/values.c index a799b595194..1328ddb34b5 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1230,6 +1230,7 @@ value_being_returned (struct type *valtype, struct regcache *retbuf, struct value *val; CORE_ADDR addr; +#if 0 /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */ if (EXTRACT_STRUCT_VALUE_ADDRESS_P ()) if (struct_return) @@ -1239,9 +1240,21 @@ value_being_returned (struct type *valtype, struct regcache *retbuf, error ("Function return value unknown."); return value_at (valtype, addr, NULL); } +#endif + + /* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */ + if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + if (struct_return) + { + addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (retbuf); + if (!addr) + error ("Function return value unknown."); + return value_at (valtype, addr, NULL); + } val = allocate_value (valtype); CHECK_TYPEDEF (valtype); +#define EXTRACT_RETURN_VALUE DEPRECATED_EXTRACT_RETURN_VALUE EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val)); return val; diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 0478227ee92..2e82d927e10 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -48,9 +48,9 @@ static gdbarch_frame_init_saved_regs_ftype vax_frame_init_saved_regs; static gdbarch_get_saved_register_ftype vax_get_saved_register; static gdbarch_store_struct_return_ftype vax_store_struct_return; -static gdbarch_extract_return_value_ftype vax_extract_return_value; +static gdbarch_deprecated_extract_return_value_ftype vax_extract_return_value; static gdbarch_store_return_value_ftype vax_store_return_value; -static gdbarch_extract_struct_value_address_ftype +static gdbarch_deprecated_extract_struct_value_address_ftype vax_extract_struct_value_address; static gdbarch_push_dummy_frame_ftype vax_push_dummy_frame; @@ -671,10 +671,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Return value info */ set_gdbarch_store_struct_return (gdbarch, vax_store_struct_return); - set_gdbarch_extract_return_value (gdbarch, vax_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, vax_extract_return_value); set_gdbarch_store_return_value (gdbarch, vax_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - vax_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, vax_extract_struct_value_address); /* Call dummy info */ set_gdbarch_push_dummy_frame (gdbarch, vax_push_dummy_frame); diff --git a/gdb/version.in b/gdb/version.in index beaddec3fbb..ff62cb84c8f 100644 --- a/gdb/version.in +++ b/gdb/version.in @@ -1 +1 @@ -2002-05-15-cvs +2002-06-15-cvs diff --git a/gdb/x86-64-linux-nat.c b/gdb/x86-64-linux-nat.c index f57a5f27675..4c4f64382c4 100644 --- a/gdb/x86-64-linux-nat.c +++ b/gdb/x86-64-linux-nat.c @@ -25,7 +25,6 @@ #include "inferior.h" #include "gdbcore.h" #include "regcache.h" -#include "i387-tdep.h" #include "gdb_assert.h" #include "x86-64-tdep.h" @@ -195,23 +194,73 @@ store_regs (int tid, int regno) /* Transfering floating-point registers between GDB, inferiors and cores. */ -/* Fill GDB's register array with the floating-point register values in - *FPREGSETP. */ +static void * +x86_64_fxsave_offset (elf_fpregset_t * fxsave, int regnum) +{ + char *reg_name; + int reg_index; + + gdb_assert (x86_64_num_gregs - 1 < regnum && regnum < x86_64_num_regs); + + reg_name = x86_64_register_nr2name (regnum); + + if (reg_name[0] == 's' && reg_name[1] == 't') + { + reg_index = reg_name[2] - '0'; + return &fxsave->st_space[reg_index * 2]; + } + + if (reg_name[0] == 'x' && reg_name[1] == 'm' && reg_name[2] == 'm') + { + reg_index = reg_name[3] - '0'; + return &fxsave->xmm_space[reg_index * 4]; + } + + if (strcmp (reg_name, "mxcsr") == 0) + return &fxsave->mxcsr; + + return NULL; +} + +/* Fill GDB's register array with the floating-point and SSE register + values in *FXSAVE. This function masks off any of the reserved + bits in *FXSAVE. */ void -supply_fpregset (elf_fpregset_t * fpregsetp) +supply_fpregset (elf_fpregset_t * fxsave) { - i387_supply_fxsave ((char *) fpregsetp); + int i, reg_st0, reg_mxcsr; + + reg_st0 = x86_64_register_name2nr ("st0"); + reg_mxcsr = x86_64_register_name2nr ("mxcsr"); + + gdb_assert (reg_st0 > 0 && reg_mxcsr > reg_st0); + + for (i = reg_st0; i <= reg_mxcsr; i++) + supply_register (i, x86_64_fxsave_offset (fxsave, i)); } -/* Fill register REGNO (if it is a floating-point register) in - *FPREGSETP with the value in GDB's register array. If REGNO is -1, - do this for all registers. */ +/* Fill register REGNUM (if it is a floating-point or SSE register) in + *FXSAVE with the value in GDB's register array. If REGNUM is -1, do + this for all registers. This function doesn't touch any of the + reserved bits in *FXSAVE. */ void -fill_fpregset (elf_fpregset_t * fpregsetp, int regno) +fill_fpregset (elf_fpregset_t * fxsave, int regnum) { - i387_fill_fxsave ((char *) fpregsetp, regno); + int i, last_regnum = MXCSR_REGNUM; + void *ptr; + + if (gdbarch_tdep (current_gdbarch)->num_xmm_regs == 0) + last_regnum = FOP_REGNUM; + + for (i = FP0_REGNUM; i <= last_regnum; i++) + if (regnum == -1 || regnum == i) + { + ptr = x86_64_fxsave_offset (fxsave, i); + if (ptr) + regcache_collect (i, ptr); + } } /* Fetch all floating-point registers from process/thread TID and store diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 94f57a5a539..111861aaafe 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -376,14 +376,15 @@ classify_argument (struct type *type, { int num = classify_argument (TYPE_FIELDS (type)[j].type, subclasses, - (TYPE_FIELDS (type)[j].loc.bitpos - + bit_offset) % 256); + (TYPE_FIELDS (type)[j].loc. + bitpos + bit_offset) % 256); if (!num) return 0; for (i = 0; i < num; i++) { int pos = - (TYPE_FIELDS (type)[j].loc.bitpos + bit_offset) / 8 / 8; + (TYPE_FIELDS (type)[j].loc.bitpos + + bit_offset) / 8 / 8; classes[i + pos] = merge_classes (subclasses[i], classes[i + pos]); } @@ -490,7 +491,7 @@ classify_argument (struct type *type, } case TYPE_CODE_VOID: return 0; - default: /* Avoid warning. */ + default: /* Avoid warning. */ break; } internal_error (__FILE__, __LINE__, @@ -797,13 +798,24 @@ x86_64_store_return_value (struct type *type, char *valbuf) } -static char * -x86_64_register_name (int reg_nr) +char * +x86_64_register_nr2name (int reg_nr) { if (reg_nr < 0 || reg_nr >= X86_64_NUM_REGS) return NULL; return x86_64_register_info_table[reg_nr].name; } + +int +x86_64_register_name2nr (const char *name) +{ + int reg_nr; + + for (reg_nr = 0; reg_nr < X86_64_NUM_REGS; reg_nr++) + if (strcmp (name, x86_64_register_info_table[reg_nr].name) == 0) + return reg_nr; + return -1; +} @@ -845,10 +857,10 @@ x86_64_frameless_function_invocation (struct frame_info *frame) CORE_ADDR x86_64_skip_prologue (CORE_ADDR pc) { - int i, firstline, currline; + int i; struct symtab_and_line v_sal; struct symbol *v_function; - CORE_ADDR salendaddr = 0, endaddr = 0; + CORE_ADDR endaddr; /* We will handle only functions beginning with: 55 pushq %rbp @@ -859,23 +871,14 @@ x86_64_skip_prologue (CORE_ADDR pc) read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE); - /* First check, whether pc points to pushq %rbp. If not, - * print a recommendation to enable frame pointer. */ - if (prolog_expect[0] != prolog_buf[0]) - { - if (!omit_fp_note_printed) - { - printf_filtered - ("NOTE: This function doesn't seem to have a valid prologue.\n" - " Consider adding -fno-omit-frame-pointer to your gcc's CFLAGS.\n"); - omit_fp_note_printed++; - } - return pc; - } - /* Valid prolog continues with movq %rsp,%rbp. */ - for (i = 1; i < PROLOG_BUFSIZE; i++) + /* First check, whether pc points to pushq %rbp, movq %rsp,%rbp. */ + for (i = 0; i < PROLOG_BUFSIZE; i++) if (prolog_expect[i] != prolog_buf[i]) - return pc + 1; /* First instruction after pushq %rbp. */ + return pc; /* ... no, it doesn't. Nothing to skip. */ + + /* OK, we have found the prologue and want PC of the first + non-prologue instruction. */ + pc += PROLOG_BUFSIZE; v_function = find_pc_function (pc); v_sal = find_pc_line (pc, 0); @@ -885,18 +888,13 @@ x86_64_skip_prologue (CORE_ADDR pc) if (!v_function || !v_function->ginfo.value.block || !v_sal.symtab) return pc; - firstline = v_sal.line; - currline = firstline; - salendaddr = v_sal.end; endaddr = v_function->ginfo.value.block->endaddr; for (i = 0; i < v_sal.symtab->linetable->nitems; i++) - if (v_sal.symtab->linetable->item[i].line > firstline - && v_sal.symtab->linetable->item[i].pc >= salendaddr + if (v_sal.symtab->linetable->item[i].pc >= pc && v_sal.symtab->linetable->item[i].pc < endaddr) { pc = v_sal.symtab->linetable->item[i].pc; - currline = v_sal.symtab->linetable->item[i].line; break; } @@ -991,7 +989,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS); - set_gdbarch_register_name (gdbarch, x86_64_register_name); + set_gdbarch_register_name (gdbarch, x86_64_register_nr2name); set_gdbarch_register_size (gdbarch, 8); set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size); set_gdbarch_max_register_raw_size (gdbarch, 16); @@ -1078,7 +1076,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Return number of args passed to a frame, no way to tell. */ set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* Don't use default structure extract routine */ - set_gdbarch_extract_struct_value_address (gdbarch, 0); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, 0); /* If USE_STRUCT_CONVENTION retruns 0, then gdb uses STORE_RETURN_VALUE and EXTRACT_RETURN_VALUE to store/fetch the functions return value. It is @@ -1092,7 +1090,7 @@ x86_64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ - set_gdbarch_extract_return_value (gdbarch, x86_64_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, x86_64_extract_return_value); /* Write into the appropriate registers a function return value stored diff --git a/gdb/x86-64-tdep.h b/gdb/x86-64-tdep.h index d15b8e71e7f..dda94bc5eb8 100644 --- a/gdb/x86-64-tdep.h +++ b/gdb/x86-64-tdep.h @@ -28,6 +28,9 @@ extern int x86_64_num_regs; extern int x86_64_num_gregs; +int x86_64_register_name2nr (const char *name); +char *x86_64_register_nr2name (int reg_nr); + gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call; diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index f8c20b70f28..9be59718918 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1086,13 +1086,12 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_use_generic_dummy_frames (gdbarch, 1); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); set_gdbarch_push_return_address (gdbarch, xstormy16_push_return_address); - set_gdbarch_extract_return_value (gdbarch, xstormy16_extract_return_value); + set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value); set_gdbarch_push_arguments (gdbarch, xstormy16_push_arguments); set_gdbarch_pop_frame (gdbarch, xstormy16_pop_frame); set_gdbarch_store_struct_return (gdbarch, xstormy16_store_struct_return); set_gdbarch_store_return_value (gdbarch, xstormy16_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - xstormy16_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, xstormy16_use_struct_convention); set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT); diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index 572a878dc20..789fe2e0235 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -325,25 +325,26 @@ z8k_print_register_hook (int regno) { if ((regno & 1) == 0 && regno < 16) { - unsigned short l[2]; + unsigned char l[4]; - frame_register_read (selected_frame, regno, (char *) (l + 0)); - frame_register_read (selected_frame, regno + 1, (char *) (l + 1)); + frame_register_read (selected_frame, regno, l + 0); + frame_register_read (selected_frame, regno + 1, l + 2); printf_unfiltered ("\t"); - printf_unfiltered ("%04x%04x", l[0], l[1]); + printf_unfiltered ("0x%02x%02x%02x%02x", l[0], l[1], l[2], l[3]); } if ((regno & 3) == 0 && regno < 16) { - unsigned short l[4]; + unsigned char l[8]; - frame_register_read (selected_frame, regno, (char *) (l + 0)); - frame_register_read (selected_frame, regno + 1, (char *) (l + 1)); - frame_register_read (selected_frame, regno + 2, (char *) (l + 2)); - frame_register_read (selected_frame, regno + 3, (char *) (l + 3)); + frame_register_read (selected_frame, regno, l + 0); + frame_register_read (selected_frame, regno + 1, l + 2); + frame_register_read (selected_frame, regno + 2, l + 4); + frame_register_read (selected_frame, regno + 3, l + 6); printf_unfiltered ("\t"); - printf_unfiltered ("%04x%04x%04x%04x", l[0], l[1], l[2], l[3]); + printf_unfiltered ("0x%02x%02x%02x%02x%02x%02x%02x%02x", + l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]); } if (regno == 15) { diff --git a/include/ChangeLog b/include/ChangeLog index dd0a2302ae9..1f04e1b1e6e 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,68 @@ +2002-06-09 Andrew Cagney + + * remote-sim.h: Move to directory gdb/. + * callback.h: Move to directory gdb/. + +2002-06-07 Charles Wilson + + * bfdlink.h (struct bfd_link_info): Change type of + pei386_auto_import field to int so that -1 can mean enabled by + default and 1 can mean enabled by command line switch. + +2002-06-06 DJ Delorie + + * hashtab.h (htab): Rearrange new members for backward + compatibility. + (htab_create): Don't use a macro that requires other headers. + +2002-06-05 Geoffrey Keating + + * hashtab.h (htab_create): Restore prototype for backward + compatibility. + (htab_try_create): Likewise. + +2002-05-22 Geoffrey Keating + + * hashtab.h (struct htab): Update for change to length specifier. + +2002-05-10 Geoffrey Keating + + * hashtab.h (GTY): Define if undefined. + (htab_alloc): New typedef. + (htab_free): New typedef. + (struct htab): Support gengtype; allow user-specified memory + allocation. + (htab_create_alloc): New. + (htab_create): Replace with #define. + (htab_try_create): Delete. + +2002-05-31 Michal Ludvig + + * elf/dwarf2.h (DW_CFA_low_user, DW_CFA_high_user): Renamed + to DW_CFA_lo_user, DW_CFA_hi_user respectively. + +2002-05-28 Kuang Hwa Lin + + * dis-asm.h: Prototype print_insn_dlx. + +2002-05-23 Andrew Cagney + + * sim-d10v.h: Delete file. Moved to include/gdb/. + +2002-05-23 Jakub Jelinek + + * elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define. + * elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22. + * elf/i386.h: Add TLS relocs. + +2002-05-21 H.J. Lu (hjl@gnu.org) + + * bfdlink.h (bfd_link_info): Add allow_multiple_definition. + +2002-05-17 J"orn Rennecke + + * dis-asm.h (print_insn_shl, print_insn_sh64l): Remove prototype. + 2002-04-16 David S. Miller * xregex2.h (__restrict_arr): Define to __restrict on GCC diff --git a/include/bfdlink.h b/include/bfdlink.h index a034547212d..719e7060eab 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -3,21 +3,21 @@ Free Software Foundation, Inc. Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef BFDLINK_H #define BFDLINK_H @@ -231,6 +231,8 @@ struct bfd_link_info select an appropriate memset function. Apparently it is also normal for HPPA shared libraries to have undefined symbols. */ boolean allow_shlib_undefined; + /* True if ok to have multiple definition. */ + boolean allow_multiple_definition; /* Which symbols to strip. */ enum bfd_link_strip strip; /* Which local symbols to discard. */ @@ -286,9 +288,10 @@ struct bfd_link_info /* May be used to set DT_FLAGS_1 for ELF. */ bfd_vma flags_1; - /* True if auto-import thunks for DATA items in pei386 DLLs - should be generated/linked against. */ - boolean pei386_auto_import; + /* Non-zero if auto-import thunks for DATA items in pei386 DLLs + should be generated/linked against. Set to 1 if this feature + is explicitly requested by the user, -1 if enabled by default. */ + int pei386_auto_import; /* True if non-PLT relocs should be merged into one reloc section and sorted so that relocs against the same symbol come together. */ diff --git a/include/dis-asm.h b/include/dis-asm.h index decc863c6d3..8d38f7e8d2b 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -205,6 +205,7 @@ extern int print_insn_little_a29k PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_d10v PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_d30v PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_dlx PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_fr30 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_hppa PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_i860 PARAMS ((bfd_vma, disassemble_info*)); @@ -226,7 +227,6 @@ extern int print_insn_little_powerpc PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_rs6000 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_s390 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*)); -extern int print_insn_shl PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_tic30 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_tic54x PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*)); @@ -235,7 +235,6 @@ extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_xstormy16 PARAMS ((bfd_vma, disassemble_info*)); extern int print_insn_sh64 PARAMS ((bfd_vma, disassemble_info *)); -extern int print_insn_sh64l PARAMS ((bfd_vma, disassemble_info *)); extern int print_insn_sh64x_media PARAMS ((bfd_vma, disassemble_info *)); extern disassembler_ftype arc_get_disassembler PARAMS ((void *)); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index fe3823b1b67..2a1f6b41d81 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,3 +1,35 @@ +2002-06-06 Lars Brinkhoff + + * common.h: Change registry@sco.com to registry@caldera.com. + (EM_PDP10, EM_PDP11): Define. + +2002-06-04 Jason Thorpe + + * sh.h (_bfd_sh64_crange_qsort_cmpb, _bfd_sh64_crange_qsort_cmpl) + (_bfd_sh64_crange_bsearch_cmpb, _bfd_sh64_crange_bsearch_cmpl): New + prototypes. + +2002-06-01 Richard Henderson + + * alpha.h (LITUSE_ALPHA_ADDR, LITUSE_ALPHA_BASE, LITUSE_ALPHA_BYTOFF, + LITUSE_ALPHA_JSR, LITUSE_ALPHA_TLSGD, LITUSE_ALPHA_TLSLDM): New. + +2002-05-30 Richard Henderson + + * alpha.h (R_ALPHA_TLSGD, R_ALPHA_TLSLDM, R_ALPHA_DTPMOD64, + R_ALPHA_GOTDTPREL, R_ALPHA_DTPREL64, R_ALPHA_DTPRELHI, + R_ALPHA_DTPRELLO, R_ALPHA_DTPREL16, R_ALPHA_GOTTPREL, R_ALPHA_TPREL64, + R_ALPHA_TPRELHI, R_ALPHA_TPRELLO, R_ALPHA_TPREL16): New. + +2002-05-29 Matt Thomas + + * vax.h: New file + +2002-05-28 Kuang Hwa Lin + + * common.h (EM_DLX): Define. + * dlx.h: New file. + 2002-05-08 Jason Thorpe * common.h (NT_GNU_ABI_TAG): Define. diff --git a/include/elf/alpha.h b/include/elf/alpha.h index e937b814788..0313b5be6bb 100644 --- a/include/elf/alpha.h +++ b/include/elf/alpha.h @@ -99,6 +99,28 @@ START_RELOC_NUMBERS (elf_alpha_reloc_type) STO_ALPHA_STD_GPLOAD. */ RELOC_NUMBER (R_ALPHA_BRSGP, 28) + /* Thread-Local Storage. */ + RELOC_NUMBER (R_ALPHA_TLSGD, 29) + RELOC_NUMBER (R_ALPHA_TLSLDM, 30) + RELOC_NUMBER (R_ALPHA_DTPMOD64, 31) + RELOC_NUMBER (R_ALPHA_GOTDTPREL, 32) + RELOC_NUMBER (R_ALPHA_DTPREL64, 33) + RELOC_NUMBER (R_ALPHA_DTPRELHI, 34) + RELOC_NUMBER (R_ALPHA_DTPRELLO, 35) + RELOC_NUMBER (R_ALPHA_DTPREL16, 36) + RELOC_NUMBER (R_ALPHA_GOTTPREL, 37) + RELOC_NUMBER (R_ALPHA_TPREL64, 38) + RELOC_NUMBER (R_ALPHA_TPRELHI, 39) + RELOC_NUMBER (R_ALPHA_TPRELLO, 40) + RELOC_NUMBER (R_ALPHA_TPREL16, 41) + END_RELOC_NUMBERS (R_ALPHA_max) +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLSGD 4 +#define LITUSE_ALPHA_TLSLDM 5 + #endif /* _ELF_ALPHA_H */ diff --git a/include/elf/common.h b/include/elf/common.h index f8b0832e867..ce3974eec7a 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -92,7 +92,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ET_HIPROC 0xFFFF /* Processor-specific */ /* Values for e_machine, which identifies the architecture. These numbers - are officially assigned by registry@sco.com. See below for a list of + are officially assigned by registry@caldera.com. See below for a list of ad-hoc numbers used during initial development. */ #define EM_NONE 0 /* No machine */ @@ -145,6 +145,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded processor */ #define EM_X86_64 62 /* Advanced Micro Devices X86-64 processor */ +#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */ +#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */ #define EM_FX66 66 /* Siemens FX66 microcontroller */ #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */ #define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */ @@ -184,7 +186,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ will have a collision. Instead, pick a random number. Normally, each entity or maintainer responsible for a machine with an - unofficial e_machine number should eventually ask registry@sco.com for + unofficial e_machine number should eventually ask registry@caldera.com for an officially blessed number to be added to the list above. */ #define EM_PJ_OLD 99 /* picoJava */ @@ -236,6 +238,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Written in the absense of an ABI. */ #define EM_OPENRISC_OLD 0x3426 +/* DLX magic number + Written in the absense of an ABI. */ +#define EM_DLX 0x5aa5 + #define EM_XSTORMY16 0xad45 /* See the above comment before you add a new EM_* value here. */ @@ -254,6 +260,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define PT_NOTE 4 /* Auxiliary information */ #define PT_SHLIB 5 /* Reserved, unspecified semantics */ #define PT_PHDR 6 /* Entry for header table itself */ +#define PT_TLS 7 /* Thread local storage segment */ #define PT_LOOS 0x60000000 /* OS-specific */ #define PT_HIOS 0x6fffffff /* OS-specific */ #define PT_LOPROC 0x70000000 /* Processor-specific */ @@ -322,6 +329,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SHF_LINK_ORDER (1 << 7) /* Preserve section ordering when linking */ #define SHF_OS_NONCONFORMING (1 << 8) /* OS specific processing required */ #define SHF_GROUP (1 << 9) /* Member of a section group */ +#define SHF_TLS (1 << 10) /* Thread local storage section */ /* #define SHF_MASKOS 0x0F000000 *//* OS-specific semantics */ #define SHF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */ @@ -417,6 +425,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define STT_SECTION 3 /* Symbol associated with a section */ #define STT_FILE 4 /* Symbol gives a file name */ #define STT_COMMON 5 /* An uninitialised common block */ +#define STT_TLS 6 /* Thread local data object */ #define STT_LOOS 10 /* OS-specific semantics */ #define STT_HIOS 12 /* OS-specific semantics */ #define STT_LOPROC 13 /* Application-specific semantics */ @@ -585,6 +594,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define DF_SYMBOLIC (1 << 1) #define DF_TEXTREL (1 << 2) #define DF_BIND_NOW (1 << 3) +#define DF_STATIC_TLS (1 << 4) /* These constants are used for the version number of a Elf32_Verdef structure. */ diff --git a/include/elf/dwarf2.h b/include/elf/dwarf2.h index 750a7204ebf..0e78310c69f 100644 --- a/include/elf/dwarf2.h +++ b/include/elf/dwarf2.h @@ -649,8 +649,8 @@ enum dwarf_call_frame_info #define DW_CIE_VERSION 1 #define DW_CFA_extended 0 -#define DW_CFA_low_user 0x1c -#define DW_CFA_high_user 0x3f +#define DW_CFA_lo_user 0x1c +#define DW_CFA_hi_user 0x3f #define DW_CHILDREN_no 0x00 #define DW_CHILDREN_yes 0x01 diff --git a/include/elf/i386.h b/include/elf/i386.h index 4a15efc4912..c6e9709a1fe 100644 --- a/include/elf/i386.h +++ b/include/elf/i386.h @@ -34,12 +34,31 @@ START_RELOC_NUMBERS (elf_i386_reloc_type) RELOC_NUMBER (R_386_RELATIVE, 8) /* Adjust by program base */ RELOC_NUMBER (R_386_GOTOFF, 9) /* 32 bit offset to GOT */ RELOC_NUMBER (R_386_GOTPC, 10) /* 32 bit PC relative offset to GOT */ - FAKE_RELOC (FIRST_INVALID_RELOC, 11) - FAKE_RELOC (LAST_INVALID_RELOC, 19) + RELOC_NUMBER (R_386_32PLT, 11) /* Used by Sun */ + FAKE_RELOC (FIRST_INVALID_RELOC, 12) + FAKE_RELOC (LAST_INVALID_RELOC, 16) + RELOC_NUMBER (R_386_TLS_LE, 17) + RELOC_NUMBER (R_386_TLS_GD, 18) + RELOC_NUMBER (R_386_TLS_LDM, 19) RELOC_NUMBER (R_386_16, 20) RELOC_NUMBER (R_386_PC16, 21) RELOC_NUMBER (R_386_8, 22) RELOC_NUMBER (R_386_PC8, 23) + RELOC_NUMBER (R_386_TLS_GD_32, 24) + RELOC_NUMBER (R_386_TLS_GD_PUSH, 25) + RELOC_NUMBER (R_386_TLS_GD_CALL, 26) + RELOC_NUMBER (R_386_TLS_GD_POP, 27) + RELOC_NUMBER (R_386_TLS_LDM_32, 28) + RELOC_NUMBER (R_386_TLS_LDM_PUSH, 29) + RELOC_NUMBER (R_386_TLS_LDM_CALL, 30) + RELOC_NUMBER (R_386_TLS_LDM_POP, 31) + RELOC_NUMBER (R_386_TLS_LDO_32, 32) + RELOC_NUMBER (R_386_TLS_IE_32, 33) + RELOC_NUMBER (R_386_TLS_LE_32, 34) + RELOC_NUMBER (R_386_TLS_DTPMOD32, 35) + RELOC_NUMBER (R_386_TLS_DTPOFF32, 36) + RELOC_NUMBER (R_386_TLS_TPOFF32, 37) + /* These are GNU extensions to enable C++ vtable garbage collection. */ RELOC_NUMBER (R_386_GNU_VTINHERIT, 250) RELOC_NUMBER (R_386_GNU_VTENTRY, 251) diff --git a/include/elf/ia64.h b/include/elf/ia64.h index 5e632ed010e..310a7f74af0 100644 --- a/include/elf/ia64.h +++ b/include/elf/ia64.h @@ -192,7 +192,7 @@ START_RELOC_NUMBERS (elf_ia64_reloc_type) RELOC_NUMBER (R_IA64_TPREL64MSB, 0x96) /* @tprel(sym+add), data8 MSB */ RELOC_NUMBER (R_IA64_TPREL64LSB, 0x97) /* @tprel(sym+add), data8 LSB */ - RELOC_NUMBER (R_IA64_LTOFF_TP22, 0x9a) /* @ltoff(@tprel(s+a)), add imm22 */ + RELOC_NUMBER (R_IA64_LTOFF_TPREL22, 0x9a) /* @ltoff(@tprel(s+a)), add imm22 */ RELOC_NUMBER (R_IA64_DTPMOD64MSB, 0xa6) /* @dtpmod(sym+add), data8 MSB */ RELOC_NUMBER (R_IA64_DTPMOD64LSB, 0xa7) /* @dtpmod(sym+add), data8 LSB */ diff --git a/include/elf/sh.h b/include/elf/sh.h index 1480f490bd5..af78c9bb04e 100644 --- a/include/elf/sh.h +++ b/include/elf/sh.h @@ -108,6 +108,11 @@ extern enum sh64_elf_cr_type sh64_get_contents_type FIXME: This seems redundant now that we export the interface above. */ extern boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma)); +extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *)); +extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *)); +extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *)); +extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *)); + /* We put this in elf_section_data (section)->tdata. */ struct sh64_section_data { diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index 96a4a058a30..0ea02b3f8c4 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,21 @@ +2002-06-12 Andrew Cagney + + * sim-arm.h: New file. + +2002-06-08 Andrew Cagney + + * callback.h: Copy to here from directory above. + * remote-sim.h: Copy to here from directory above. + +2002-06-01 Andrew Cagney + + * sim-d10v.h (sim_d10v_regs): Expand to include all registers. + Update copyright. + +2002-05-23 Andrew Cagney + + * sim-d10v.h: New file. Moved from include/sim-d10v.h. + 2002-05-10 Elena Zannoni * sim-sh.h: New file, for sh gdb<->sim interface. diff --git a/include/hashtab.h b/include/hashtab.h index 8871710e5d8..7fb31e48c4e 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -38,6 +38,10 @@ extern "C" { #include +#ifndef GTY +#define GTY(X) +#endif + /* The type for a hash code. */ typedef unsigned int hashval_t; @@ -63,12 +67,21 @@ typedef void (*htab_del) PARAMS ((void *)); htab_traverse. Return 1 to continue scan, 0 to stop. */ typedef int (*htab_trav) PARAMS ((void **, void *)); +/* Memory-allocation function, with the same functionality as calloc(). + Iff it returns NULL, the hash table implementation will pass an error + code back to the user, so if your code doesn't handle errors, + best if you use xcalloc instead. */ +typedef PTR (*htab_alloc) PARAMS ((size_t, size_t)); + +/* We also need a free() routine. */ +typedef void (*htab_free) PARAMS ((PTR)); + /* Hash tables are of the following type. The structure (implementation) of this type is not needed for using the hash tables. All work with hash table should be executed only through functions mentioned below. */ -struct htab +struct htab GTY(()) { /* Pointer to hash function. */ htab_hash hash_f; @@ -80,7 +93,7 @@ struct htab htab_del del_f; /* Table itself. */ - PTR *entries; + PTR * GTY ((use_param (""), length ("%h.size"))) entries; /* Current size (in entries) of the hash table */ size_t size; @@ -99,9 +112,9 @@ struct htab of collisions fixed for time of work with the hash table. */ unsigned int collisions; - /* This is non-zero if we are allowed to return NULL for function calls - that allocate memory. */ - int return_allocation_failure; + /* Pointers to allocate/free functions. */ + htab_alloc alloc_f; + htab_free free_f; }; typedef struct htab *htab_t; @@ -111,14 +124,14 @@ enum insert_option {NO_INSERT, INSERT}; /* The prototypes of the package functions. */ -extern htab_t htab_create PARAMS ((size_t, htab_hash, - htab_eq, htab_del)); +extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash, + htab_eq, htab_del, + htab_alloc, htab_free)); + +/* Backward-compatibility functions. */ +extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); +extern htab_t htab_try_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); -/* This function is like htab_create, but may return NULL if memory - allocation fails, and also signals that htab_find_slot_with_hash and - htab_find_slot are allowed to return NULL when inserting. */ -extern htab_t htab_try_create PARAMS ((size_t, htab_hash, - htab_eq, htab_del)); extern void htab_delete PARAMS ((htab_t)); extern void htab_empty PARAMS ((htab_t)); diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 2882ce56897..1d4c54af1e9 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,38 @@ +2002-06-08 Alan Modra + + * a29k.h: Replace CONST with const. + (CONST): Don't define. + * convex.h: Replace CONST with const. + (CONST): Don't define. + * dlx.h: Replace CONST with const. + * or32.h (CONST): Don't define. + +2002-05-30 Chris G. Demetriou + + * mips.h (OP_SH_ALN, OP_MASK_ALN, OP_SH_VSEL, OP_MASK_VSEL) + (MDMX_FMTSEL_IMM_QH, MDMX_FMTSEL_IMM_OB, MDMX_FMTSEL_VEC_QH) + (MDMX_FMTSEL_VEC_OB, INSN_READ_MDMX_ACC, INSN_WRITE_MDMX_ACC) + (INSN_MDMX): New constants, for MDMX support. + (opcode character list): Add "O", "Q", "X", "Y", and "Z" for MDMX. + +2002-05-28 Kuang Hwa Lin + + * dlx.h: New file. + +2002-05-25 Alan Modra + + * ia64.h: Use #include "" instead of <> for local header files. + * sparc.h: Likewise. + +2002-05-22 Thiemo Seufer + + * mips.h: Add M_DROL, M_DROL_I, M_DROR, M_DROR_I macro cases. + +2002-05-17 Andrey Volkov + + * h8300.h: Corrected defs of all control regs + and eepmov instr. + 2002-04-11 Alan Modra * i386.h: Add intel mode cmpsd and movsd. diff --git a/include/opcode/a29k.h b/include/opcode/a29k.h index 399be67ca5a..c6c8c370003 100644 --- a/include/opcode/a29k.h +++ b/include/opcode/a29k.h @@ -1,5 +1,5 @@ /* Table of opcodes for the AMD 29000 family. - Copyright 1990, 1991, 1993, 1994 Free Software Foundation, Inc. + Copyright 1990, 1991, 1993, 1994, 2002 Free Software Foundation, Inc. This file is part of GDB and GAS. @@ -62,11 +62,7 @@ struct a29k_opcode { char *args; }; -#ifndef CONST -#define CONST -#endif /* CONST */ - -static CONST struct a29k_opcode a29k_opcodes[] = +static const struct a29k_opcode a29k_opcodes[] = { { "add", 0x14000000, "c,a,b" }, @@ -282,4 +278,4 @@ static CONST struct a29k_opcode a29k_opcodes[] = if we've run off the end of the table. */ }; -CONST unsigned int num_opcodes = (((sizeof a29k_opcodes) / (sizeof a29k_opcodes[0])) - 1); +const unsigned int num_opcodes = (((sizeof a29k_opcodes) / (sizeof a29k_opcodes[0])) - 1); diff --git a/include/opcode/convex.h b/include/opcode/convex.h index 780b12d481a..ccf55682915 100644 --- a/include/opcode/convex.h +++ b/include/opcode/convex.h @@ -1,5 +1,5 @@ /* Information for instruction disassembly on the Convex. - Copyright 1989, 1993 Free Software Foundation, Inc. + Copyright 1989, 1993, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -17,10 +17,6 @@ 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 CONST -#define CONST -#endif /* CONST */ - #define xxx 0 #define rrr 1 #define rr 2 @@ -67,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define CPUID 20 #define TID 21 -CONST char *op[] = { +const char *op[] = { "", "v0\0v1\0v2\0v3\0v4\0v5\0v6\0v7", "s0\0s1\0s2\0s3\0s4\0s5\0s6\0s7", @@ -92,7 +88,7 @@ CONST char *op[] = { "tid", }; -CONST struct formstr format0[] = { +const struct formstr format0[] = { {0,0,rrr,V,S,S}, /* mov */ {0,0,rrr,S,S,V}, /* mov */ {1,1,rrr,V,V,V}, /* merg.t */ @@ -159,7 +155,7 @@ CONST struct formstr format0[] = { {4,8,rrr,V,S,V}, /* div.l */ }; -CONST struct formstr format1[] = { +const struct formstr format1[] = { {11,0,xxx,0,0,0}, /* exit */ {12,0,a3,0,0,0}, /* jmp */ {13,2,a3,0,0,0}, /* jmpi.f */ @@ -226,7 +222,7 @@ CONST struct formstr format1[] = { {21,8,a2r,V,0,0}, /* st.l */ }; -CONST struct formstr format2[] = { +const struct formstr format2[] = { {28,5,rr,A,A,0}, /* cvtw.b */ {28,6,rr,A,A,0}, /* cvtw.h */ {29,7,rr,A,A,0}, /* cvtb.w */ @@ -357,7 +353,7 @@ CONST struct formstr format2[] = { {4,8,rr,S,S,0}, /* div.l */ }; -CONST struct formstr format3[] = { +const struct formstr format3[] = { {32,3,rr,V,V,0}, /* cvtd.s */ {31,4,rr,V,V,0}, /* cvts.d */ {33,4,rr,V,V,0}, /* cvtl.d */ @@ -424,7 +420,7 @@ CONST struct formstr format3[] = { {43,8,rr,S,S,0}, /* neg.l */ }; -CONST struct formstr format4[] = { +const struct formstr format4[] = { {46,0,nops,0,0,0}, /* nop */ {47,0,pcrel,0,0,0}, /* br */ {48,2,pcrel,0,0,0}, /* bri.f */ @@ -435,7 +431,7 @@ CONST struct formstr format4[] = { {50,1,pcrel,0,0,0}, /* brs.t */ }; -CONST struct formstr format5[] = { +const struct formstr format5[] = { {51,5,rr,V,V,0}, /* ldvi.b */ {51,6,rr,V,V,0}, /* ldvi.h */ {51,7,rr,V,V,0}, /* ldvi.w */ @@ -454,7 +450,7 @@ CONST struct formstr format5[] = { {52,8,rxr,S,V,0}, /* stvi.l */ }; -CONST struct formstr format6[] = { +const struct formstr format6[] = { {53,0,r,A,0,0}, /* ldsdr */ {54,0,r,A,0,0}, /* ldkdr */ {55,3,r,S,0,0}, /* ln.s */ @@ -521,7 +517,7 @@ CONST struct formstr format6[] = { {83,4,r,S,0,0}, /* atan.d */ }; -CONST struct formstr format7[] = { +const struct formstr format7[] = { {84,5,r,V,0,0}, /* sum.b */ {84,6,r,V,0,0}, /* sum.h */ {84,7,r,V,0,0}, /* sum.w */ @@ -556,11 +552,11 @@ CONST struct formstr format7[] = { {0,0,0,0,0,0}, }; -CONST struct formstr formatx[] = { +const struct formstr formatx[] = { {0,0,0,0,0,0}, }; -CONST struct formstr format1a[] = { +const struct formstr format1a[] = { {91,0,imr,A,0,0}, /* halt */ {92,0,a4,0,0,0}, /* sysc */ {18,6,imr,A,0,0}, /* ld.h */ @@ -595,7 +591,7 @@ CONST struct formstr format1a[] = { {41,7,imr,A,0,0}, /* lt.w */ }; -CONST struct formstr format1b[] = { +const struct formstr format1b[] = { {18,4,imr,S,0,0}, /* ld.d */ {18,10,imr,S,0,0}, /* ld.u */ {18,8,imr,S,0,0}, /* ld.l */ @@ -630,7 +626,7 @@ CONST struct formstr format1b[] = { {41,7,imr,S,0,0}, /* lt.w */ }; -CONST struct formstr e0_format0[] = { +const struct formstr e0_format0[] = { {10,3,rrr,S,V,V}, /* sub.s */ {10,4,rrr,S,V,V}, /* sub.d */ {4,3,rrr,S,V,V}, /* div.s */ @@ -697,7 +693,7 @@ CONST struct formstr e0_format0[] = { {4,16,rrr,V,S,V}, /* div.l.f */ }; -CONST struct formstr e0_format1[] = { +const struct formstr e0_format1[] = { {0,0,0,0,0,0}, {94,0,a3,0,0,0}, /* tst */ {95,0,a3,0,0,0}, /* lck */ @@ -764,7 +760,7 @@ CONST struct formstr e0_format1[] = { {21,16,a2r,V,0,0}, /* st.l.f */ }; -CONST struct formstr e0_format2[] = { +const struct formstr e0_format2[] = { {28,5,rr,V,V,0}, /* cvtw.b */ {28,6,rr,V,V,0}, /* cvtw.h */ {29,7,rr,V,V,0}, /* cvtb.w */ @@ -895,7 +891,7 @@ CONST struct formstr e0_format2[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e0_format3[] = { +const struct formstr e0_format3[] = { {32,11,rr,V,V,0}, /* cvtd.s.f */ {31,12,rr,V,V,0}, /* cvts.d.f */ {33,12,rr,V,V,0}, /* cvtl.d.f */ @@ -962,7 +958,7 @@ CONST struct formstr e0_format3[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e0_format4[] = { +const struct formstr e0_format4[] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, @@ -973,7 +969,7 @@ CONST struct formstr e0_format4[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e0_format5[] = { +const struct formstr e0_format5[] = { {51,13,rr,V,V,0}, /* ldvi.b.f */ {51,14,rr,V,V,0}, /* ldvi.h.f */ {51,15,rr,V,V,0}, /* ldvi.w.f */ @@ -992,7 +988,7 @@ CONST struct formstr e0_format5[] = { {52,16,rxr,S,V,0}, /* stvi.l.f */ }; -CONST struct formstr e0_format6[] = { +const struct formstr e0_format6[] = { {0,0,rxl,S,CIR,0}, /* mov */ {0,0,lr,CIR,S,0}, /* mov */ {0,0,lr,TOC,S,0}, /* mov */ @@ -1059,7 +1055,7 @@ CONST struct formstr e0_format6[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e0_format7[] = { +const struct formstr e0_format7[] = { {84,13,r,V,0,0}, /* sum.b.f */ {84,14,r,V,0,0}, /* sum.h.f */ {84,15,r,V,0,0}, /* sum.w.f */ @@ -1094,7 +1090,7 @@ CONST struct formstr e0_format7[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e1_format0[] = { +const struct formstr e1_format0[] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, @@ -1161,7 +1157,7 @@ CONST struct formstr e1_format0[] = { {4,23,rrr,V,S,V}, /* div.l.t */ }; -CONST struct formstr e1_format1[] = { +const struct formstr e1_format1[] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, @@ -1228,7 +1224,7 @@ CONST struct formstr e1_format1[] = { {21,23,a2r,V,0,0}, /* st.l.t */ }; -CONST struct formstr e1_format2[] = { +const struct formstr e1_format2[] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, @@ -1359,7 +1355,7 @@ CONST struct formstr e1_format2[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e1_format3[] = { +const struct formstr e1_format3[] = { {32,18,rr,V,V,0}, /* cvtd.s.t */ {31,19,rr,V,V,0}, /* cvts.d.t */ {33,19,rr,V,V,0}, /* cvtl.d.t */ @@ -1426,7 +1422,7 @@ CONST struct formstr e1_format3[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e1_format4[] = { +const struct formstr e1_format4[] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, @@ -1437,7 +1433,7 @@ CONST struct formstr e1_format4[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e1_format5[] = { +const struct formstr e1_format5[] = { {51,20,rr,V,V,0}, /* ldvi.b.t */ {51,21,rr,V,V,0}, /* ldvi.h.t */ {51,22,rr,V,V,0}, /* ldvi.w.t */ @@ -1456,7 +1452,7 @@ CONST struct formstr e1_format5[] = { {52,23,rxr,S,V,0}, /* stvi.l.t */ }; -CONST struct formstr e1_format6[] = { +const struct formstr e1_format6[] = { {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, @@ -1523,7 +1519,7 @@ CONST struct formstr e1_format6[] = { {0,0,0,0,0,0}, }; -CONST struct formstr e1_format7[] = { +const struct formstr e1_format7[] = { {84,20,r,V,0,0}, /* sum.b.t */ {84,21,r,V,0,0}, /* sum.h.t */ {84,22,r,V,0,0}, /* sum.w.t */ diff --git a/include/opcode/h8300.h b/include/opcode/h8300.h index 9cd40a6cb89..18d17c537dc 100644 --- a/include/opcode/h8300.h +++ b/include/opcode/h8300.h @@ -333,8 +333,8 @@ struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_AND,SL),0,6,"and.l"),{{IMM32,RD32,E }},{{0x7,0xA,0x6,B30|RD32,IMM32LIST,E}} EOP, NEW_SOP(O(O_AND,SL),0,2,"and.l") ,{{RS32,RD32,E }},{{0x0,0x1,0xF,0x0,0x6,0x6,B30|RS32,B30|RD32,E}} EOP, - NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,CCR,E}},{{ 0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP, - NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP, + NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,CCR|DST,E}},{{ 0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP, + NEW_SOP(O(O_ANDC,SB),1,2,"andc"), {{IMM8,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x6,IMM8,IGNORE,E,0,0,0,0}} EOP, BITOP(O(O_BAND,SB), IMM3|B30,"band",0x7,0x6,0x7,0xC,0x7,0xE,0x0), BRANCH(O(O_BRA,SB),"bra",0x0), @@ -391,14 +391,14 @@ struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_DEC, SW),0,2,"dec.w") ,{{DBIT,RD16,E }},{{0x1,0xB,0x5|DBIT,RD16,E}} EOP, NEW_SOP(O(O_DEC, SL),0,2,"dec.l") ,{{DBIT,RD32,E }},{{0x1,0xB,0x7|DBIT,RD32|B30,E}} EOP, - NEW_SOP(O(O_DIVU,SB),1,6,"divxu.b"), {{RS8,RD16,E}}, {{0x5,0x1,RS8,RD16,E,0,0,0,0}}EOP, - NEW_SOP(O(O_DIVU,SW),0,20,"divxu.w"),{{RS16,RD32,E}},{{0x5,0x3,RS16,B30|RD32,E}}EOP, + NEW_SOP(O(O_DIVU,SB),1,13,"divxu.b"), {{RS8,RD16,E}}, {{0x5,0x1,RS8,RD16,E,0,0,0,0}}EOP, + NEW_SOP(O(O_DIVU,SW),0,21,"divxu.w"),{{RS16,RD32,E}},{{0x5,0x3,RS16,B30|RD32,E}}EOP, - NEW_SOP(O(O_DIVS,SB),0,20,"divxs.b") ,{{RS8,RD16,E }},{{0x0,0x1,0xD,0x0,0x5,0x1,RS8,RD16,E}} EOP, - NEW_SOP(O(O_DIVS,SW),0,02,"divxs.w") ,{{RS16,RD32,E }},{{0x0,0x1,0xD,0x0,0x5,0x3,RS16,B30|RD32,E}} EOP, + NEW_SOP(O(O_DIVS,SB),0,13,"divxs.b") ,{{RS8,RD16,E }},{{0x0,0x1,0xD,0x0,0x5,0x1,RS8,RD16,E}} EOP, + NEW_SOP(O(O_DIVS,SW),0,21,"divxs.w") ,{{RS16,RD32,E }},{{0x0,0x1,0xD,0x0,0x5,0x3,RS16,B30|RD32,E}} EOP, - NEW_SOP(O(O_EEPMOV,SB),1,50,"eepmov.b"),{{E,0,0}},{{0x7,0xB,0x5,0xC,0x5,0x9,0x8,0xF,E}}EOP, - NEW_SOP(O(O_EEPMOV,SW),0,50,"eepmov.w"),{{E,0,0}},{{0x7,0xB,0xD,0x4,0x5,0x9,0x8,0xF,E}} EOP, + NEW_SOP(O(O_EEPMOV,SB),1,4,"eepmov.b"),{{E,0,0}},{{0x7,0xB,0x5,0xC,0x5,0x9,0x8,0xF,E}}EOP, + NEW_SOP(O(O_EEPMOV,SW),0,4,"eepmov.w"),{{E,0,0}},{{0x7,0xB,0xD,0x4,0x5,0x9,0x8,0xF,E}} EOP, NEW_SOP(O(O_EXTS,SW),0,2,"exts.w"),{{OR16,E,0}},{{0x1,0x7,0xD,OR16,E }}EOP, NEW_SOP(O(O_EXTS,SL),0,2,"exts.l"),{{OR32,E,0}},{{0x1,0x7,0xF,OR32|B30,E }}EOP, @@ -419,23 +419,23 @@ struct h8_opcode h8_opcodes[] = SOP(O(O_JSR,SB),8,"jsr"),{{SRC|ABSJMP,E,0}},{{0x5,0xE,SRC|ABSJMP,IGNORE,IGNORE,IGNORE,IGNORE,IGNORE,E}}EOP, SOP(O(O_JSR,SB),8,"jsr"),{{SRC|MEMIND,E,0}},{{0x5,0xF,SRC|MEMIND,IGNORE,E,0,0,0,0}}EOP, - NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,CCR,E}}, {{ 0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP, - NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,CCR,E}}, {{ 0x0,0x3,0x0,OR8,E,0,0,0,0}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,CCR,E}}, {{PREFIXLDC,0x6,0xB,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,CCR,E}}, {{PREFIXLDC,0x6,0xB,0x2,0x0,SRC|ABS32LIST,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,CCR,E}},{{PREFIXLDC,0x6,0xF,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,CCR,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,CCR,E}}, {{PREFIXLDC,0x6,0xD,B30|RSINC,0x0,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,CCR,E}}, {{PREFIXLDC,0x6,0x9,B30|RDIND,0x0,E}} EOP, - - NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP, - NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,EXR,E}}, {{ 0x0,0x3,0x1,OR8,E,0,0,0,0}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x2,0x0,SRC|ABS32LIST,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x6,0xf,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xd,B30|RSINC,0x0,E}}EOP, - NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,EXR,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0x9,B30|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,CCR|DST,E}}, {{ 0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP, + NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,CCR|DST,E}}, {{ 0x0,0x3,0x0,OR8,E,0,0,0,0}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xB,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xB,0x2,0x0,SRC|ABS32LIST,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,CCR|DST,E}},{{PREFIXLDC,0x6,0xF,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,CCR|DST,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,CCR|DST,E}}, {{PREFIXLDC,0x6,0xD,B30|RSINC,0x0,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,CCR|DST,E}}, {{PREFIXLDC,0x6,0x9,B30|RDIND,0x0,E}} EOP, + + NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{IMM8,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x0,0x7,IMM8,IGNORE,E,0,0,0,0}}EOP, + NEW_SOP(O(O_LDC,SB),1,2,"ldc"),{{OR8,EXR|DST,E}}, {{ 0x0,0x3,0x1,OR8,E,0,0,0,0}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS16SRC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x0,0x0,ABS16SRC,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{ABS32SRC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xb,0x2,0x0,SRC|ABS32LIST,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_16,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x6,0xf,B30|DISPREG,0,DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{DISP|SRC|L_32,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0x2,0x0,SRC|DISP32LIST,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSINC,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0xd,B30|RSINC,0x0,E}}EOP, + NEW_SOP(O(O_LDC,SB),0,2,"ldc"),{{RSIND,EXR|DST,E}}, {{ 0x0,0x1,0x4,0x1,0x6,0x9,B30|RDIND,0x0,E}} EOP, SOP(O(O_MOV_TO_REG,SB),4,"mov.b"),{{ABS|SRC|L_16|MEMRELAX,RD8,E}}, {{ 0x6,0xA,0x0,RD8,SRC|ABS|MEMRELAX|A16LIST,E}}EOP, SOP(O(O_MOV_TO_REG,SB),6,"mov.b"),{{ABS|SRC|L_32|MEMRELAX,RD8,E }}, {{ 0x6,0xA,0x2,RD8,SRC|ABS|MEMRELAX|A32LIST,E }}EOP, @@ -520,8 +520,8 @@ struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_OR,SL),0,6,"or.l"),{{IMM32,RD32,E }},{{0x7,0xA,0x4,B30|RD32,IMM32LIST,E}} EOP, NEW_SOP(O(O_OR,SL),0,2,"or.l"),{{RS32,RD32,E }},{{0x0,0x1,0xF,0x0,0x6,0x4,B30|RS32,B30|RD32,E}} EOP, - NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,CCR,E}},{{ 0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP, - NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP, + NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,CCR|DST,E}},{{ 0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP, + NEW_SOP(O(O_ORC,SB),1,2,"orc"),{{IMM8,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x4,IMM8,IGNORE,E,0,0,0,0}}EOP, NEW_SOP(O(O_MOV_TO_REG,SW),1,6,"pop.w"),{{OR16,E,0}},{{ 0x6,0xD,0x7,OR16,E,0,0,0,0}}EOP, NEW_SOP(O(O_MOV_TO_REG,SL),0,6,"pop.l"),{{OR32,E,0}},{{ PREFIX32,0x6,0xD,0x7,OR32|B30,E,0,0,0,0}}EOP, @@ -544,25 +544,25 @@ struct h8_opcode h8_opcodes[] = SOP(O(O_SLEEP,SN),2,"sleep"),{{E,0,0}},{{ 0x0,0x1,0x8,0x0,E,0,0,0,0}} EOP, - NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{CCR,RD8,E}},{{ 0x0,0x2,0x0,RD8,E,0,0,0,0}} EOP, + NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{CCR|SRC,RD8,E}},{{ 0x0,0x2,0x0,RD8,E,0,0,0,0}} EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,RSIND,E}}, {{PREFIXLDC,0x6,0x9,B31|RDIND,0x0,E}} EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,DISP|DST|L_16,E}},{{PREFIXLDC,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,DISP|DST|L_32,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,RDDEC,E}}, {{PREFIXLDC,0x6,0xD,B31|RDDEC,0x0,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RSIND,E}}, {{PREFIXLDC,0x6,0x9,B31|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,DISP|DST|L_16,E}},{{PREFIXLDC,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,DISP|DST|L_32,E}},{{PREFIXLDC,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,RDDEC,E}}, {{PREFIXLDC,0x6,0xD,B31|RDDEC,0x0,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,ABS16SRC,E}}, {{PREFIXLDC,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR,ABS32SRC,E}}, {{PREFIXLDC,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,ABS16DST,E}}, {{PREFIXLDC,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{CCR|SRC,ABS32DST,E}}, {{PREFIXLDC,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP, - NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{EXR,RD8,E}},{{ 0x0,0x2,0x1,RD8,E,0,0,0,0}} EOP, + NEW_SOP(O(O_STC,SB), 1,2,"stc"),{{EXR|SRC,RD8,E}},{{ 0x0,0x2,0x1,RD8,E,0,0,0,0}} EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,RSIND,E}}, {{0x0,0x1,0x4,0x1,0x6,0x9,B31|RDIND,0x0,E}} EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,DISP|DST|L_16,E}},{{0x0,0x1,0x4,0x1,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,DISP|DST|L_32,E}},{{0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,RDDEC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xD,B31|RDDEC,0x0,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RSIND,E}}, {{0x0,0x1,0x4,0x1,0x6,0x9,B31|RDIND,0x0,E}} EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,DISP|DST|L_16,E}},{{0x0,0x1,0x4,0x1,0x6,0xF,B31|DISPREG,0,DST|DISP|L_16,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,DISP|DST|L_32,E}},{{0x0,0x1,0x4,0x1,0x7,0x8,B30|DISPREG,0,0x6,0xB,0xA,0x0,DST|DISP32LIST,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,RDDEC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xD,B31|RDDEC,0x0,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,ABS16SRC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP, - NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR,ABS32SRC,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,ABS16DST,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0x8,0x0,ABS16DST,IGNORE,IGNORE,IGNORE,E}}EOP, + NEW_SOP(O(O_STC,SB),0,2,"stc"),{{EXR|SRC,ABS32DST,E}}, {{0x0,0x1,0x4,0x1,0x6,0xB,0xA,0x0,DST|ABS32LIST,E}}EOP, SOP(O(O_SUB,SB),2,"sub.b"),{{RS8,RD8,E}},{{ 0x1,0x8,RS8,RD8,E,0,0,0,0}}EOP, @@ -585,8 +585,8 @@ struct h8_opcode h8_opcodes[] = NEW_SOP(O(O_XOR,SL),0,6,"xor.l"),{{IMM32,RD32,E }},{{0x7,0xA,0x5,B30|RD32,IMM32LIST,E}} EOP, NEW_SOP(O(O_XOR,SL),0,2,"xor.l") ,{{RS32,RD32,E }},{{0x0,0x1,0xF,0x0,0x6,0x5,B30|RS32,B30|RD32,E}} EOP, - SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,CCR,E}},{{ 0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP, - SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,EXR,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP, + SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,CCR|DST,E}},{{ 0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP, + SOP(O(O_XORC,SB),2,"xorc"),{{IMM8,EXR|DST,E}},{{ 0x0,0x1,0x4,0x1,0x0,0x5,IMM8,IGNORE,E,0,0,0,0}}EOP, NEW_SOP(O(O_CLRMAC,SN),1,2,"clrmac"),{{E, 0, 0}},{{0x0,0x1,0xa,0x0,E}} EOP, NEW_SOP(O(O_MAC,SL),1,2,"mac"),{{RSINC,RDINC,E}},{{0x0,0x1,0x6,0x0,0x6,0xd,B30|RSINC,B30|RDINC,E}} EOP, diff --git a/include/opcode/ia64.h b/include/opcode/ia64.h index 642330cc118..d4e6d108137 100644 --- a/include/opcode/ia64.h +++ b/include/opcode/ia64.h @@ -1,5 +1,5 @@ /* ia64.h -- Header file for ia64 opcode table - Copyright (C) 1998, 1999 David Mosberger-Tang + Copyright (C) 1998, 1999, 2002 David Mosberger-Tang See the file HP-COPYRIGHT for additional information. */ @@ -8,7 +8,7 @@ #include -#include +#include "bfd.h" typedef BFD_HOST_U_64_BIT ia64_insn; diff --git a/include/opcode/mips.h b/include/opcode/mips.h index 96c7a576e5c..801999c05c8 100644 --- a/include/opcode/mips.h +++ b/include/opcode/mips.h @@ -133,6 +133,16 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * #define OP_MASK_SEL 0x7 /* The sel field of mfcZ and mtcZ. */ #define OP_SH_CODE19 6 /* 19 bit wait code. */ #define OP_MASK_CODE19 0x7ffff +#define OP_SH_ALN 21 +#define OP_MASK_ALN 0x7 +#define OP_SH_VSEL 21 +#define OP_MASK_VSEL 0x1f + +/* Values in the 'VSEL' field. */ +#define MDMX_FMTSEL_IMM_QH 0x1d +#define MDMX_FMTSEL_IMM_OB 0x1e +#define MDMX_FMTSEL_VEC_QH 0x15 +#define MDMX_FMTSEL_VEC_OB 0x16 /* This structure holds information for a particular instruction. */ @@ -220,13 +230,21 @@ struct mips_opcode "f" 32 bit floating point constant "l" 32 bit floating point constant in .lit4 + MDMX instruction operands (note that while these use the FP register + fields, they accept both $fN and $vN names for the registers): + "O" MDMX alignment offset (OP_*_ALN) + "Q" MDMX vector/scalar/immediate source (OP_*_VSEL and OP_*_FT) + "X" MDMX destination register (OP_*_FD) + "Y" MDMX source register (OP_*_FS) + "Z" MDMX source register (OP_*_FT) + Other: "()" parens surrounding optional value "," separates operands Characters used so far, for quick reference when adding more: "<>()," - "ABCDEFGHIJLMNPRSTUVW" + "ABCDEFGHIJLMNOPQRSTUVWXYZ" "abcdfhijklopqrstuvwxz" */ @@ -297,6 +315,10 @@ struct mips_opcode #define INSN_MULT 0x40000000 /* Instruction synchronize shared memory. */ #define INSN_SYNC 0x80000000 +/* Instruction reads MDMX accumulator. XXX FIXME: No bits left! */ +#define INSN_READ_MDMX_ACC 0 +/* Instruction writes MDMX accumulator. XXX FIXME: No bits left! */ +#define INSN_WRITE_MDMX_ACC 0 /* Instruction is actually a macro. It should be ignored by the disassembler, and requires special treatment by the assembler. */ @@ -320,6 +342,8 @@ struct mips_opcode /* MIPS-3D ASE */ #define INSN_MIPS3D 0x00004000 +/* MDMX ASE */ +#define INSN_MDMX 0x00008000 /* Chip specific instructions. These are bitmasks. */ @@ -526,9 +550,13 @@ enum M_REM_3I, M_REMU_3, M_REMU_3I, + M_DROL, M_ROL, + M_DROL_I, M_ROL_I, + M_DROR, M_ROR, + M_DROR_I, M_ROR_I, M_S_DA, M_S_DOB, diff --git a/include/opcode/or32.h b/include/opcode/or32.h index 05c532667da..4609a48db56 100644 --- a/include/opcode/or32.h +++ b/include/opcode/or32.h @@ -31,10 +31,6 @@ #define PARAMS(x) x #endif -#ifndef CONST -#define CONST const -#endif - #define MAX_GPRS 32 #define PAGE_SIZE 4096 #undef __HALF_WORD_INSN__ diff --git a/include/opcode/sparc.h b/include/opcode/sparc.h index 5b6b5d14932..c41292364b1 100644 --- a/include/opcode/sparc.h +++ b/include/opcode/sparc.h @@ -1,5 +1,5 @@ /* Definitions for opcode table for the sparc. - Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000 + Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and @@ -20,7 +20,7 @@ along with GAS or GDB; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "ansidecl.h" /* The SPARC opcode table (and other related data) is defined in the opcodes library in sparc-opc.c. If you change anything here, make diff --git a/include/remote-sim.h b/include/remote-sim.h deleted file mode 100644 index 726ec623fbd..00000000000 --- a/include/remote-sim.h +++ /dev/null @@ -1,354 +0,0 @@ -/* This file defines the interface between the simulator and gdb. - Copyright 1993, 1994, 1996, 1997, 1998, 2000 - Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#if !defined (REMOTE_SIM_H) -#define REMOTE_SIM_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* This file is used when building stand-alone simulators, so isolate this - file from gdb. */ - -/* Pick up CORE_ADDR_TYPE if defined (from gdb), otherwise use same value as - gdb does (unsigned int - from defs.h). */ - -#ifndef CORE_ADDR_TYPE -typedef unsigned int SIM_ADDR; -#else -typedef CORE_ADDR_TYPE SIM_ADDR; -#endif - - -/* Semi-opaque type used as result of sim_open and passed back to all - other routines. "desc" is short for "descriptor". - It is up to each simulator to define `sim_state'. */ - -typedef struct sim_state *SIM_DESC; - - -/* Values for `kind' arg to sim_open. */ - -typedef enum { - SIM_OPEN_STANDALONE, /* simulator used standalone (run.c) */ - SIM_OPEN_DEBUG /* simulator used by debugger (gdb) */ -} SIM_OPEN_KIND; - - -/* Return codes from various functions. */ - -typedef enum { - SIM_RC_FAIL = 0, - SIM_RC_OK = 1, - SIM_RC_UNKNOWN_BREAKPOINT = 2, - SIM_RC_INSUFFICIENT_RESOURCES = 3, - SIM_RC_DUPLICATE_BREAKPOINT = 4 -} SIM_RC; - - -/* The bfd struct, as an opaque type. */ - -struct _bfd; - - -/* Main simulator entry points. */ - - -/* Create a fully initialized simulator instance. - - (This function is called when the simulator is selected from the - gdb command line.) - - KIND specifies how the simulator shall be used. Currently there - are only two kinds: stand-alone and debug. - - CALLBACK specifies a standard host callback (defined in callback.h). - - ABFD, when non NULL, designates a target program. The program is - not loaded. - - ARGV is a standard ARGV pointer such as that passed from the - command line. The syntax of the argument list is is assumed to be - ``SIM-PROG { SIM-OPTION } [ TARGET-PROGRAM { TARGET-OPTION } ]''. - The trailing TARGET-PROGRAM and args are only valid for a - stand-alone simulator. - - On success, the result is a non NULL descriptor that shall be - passed to the other sim_foo functions. While the simulator - configuration can be parameterized by (in decreasing precedence) - ARGV's SIM-OPTION, ARGV's TARGET-PROGRAM and the ABFD argument, the - successful creation of the simulator shall not dependent on the - presence of any of these arguments/options. - - Hardware simulator: The created simulator shall be sufficiently - initialized to handle, with out restrictions any client requests - (including memory reads/writes, register fetch/stores and a - resume). - - Process simulator: that process is not created until a call to - sim_create_inferior. FIXME: What should the state of the simulator - be? */ - -SIM_DESC sim_open PARAMS ((SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct _bfd *abfd, char **argv)); - - -/* Destory a simulator instance. - - QUITTING is non-zero if we cannot hang on errors. - - This may involve freeing target memory and closing any open files - and mmap'd areas. You cannot assume sim_kill has already been - called. */ - -void sim_close PARAMS ((SIM_DESC sd, int quitting)); - - -/* Load program PROG into the simulators memory. - - If ABFD is non-NULL, the bfd for the file has already been opened. - The result is a return code indicating success. - - Hardware simulator: Normally, each program section is written into - memory according to that sections LMA using physical (direct) - addressing. The exception being systems, such as PPC/CHRP, which - support more complicated program loaders. A call to this function - should not effect the state of the processor registers. Multiple - calls to this function are permitted and have an accumulative - effect. - - Process simulator: Calls to this function may be ignored. - - FIXME: Most hardware simulators load the image at the VMA using - virtual addressing. - - FIXME: For some hardware targets, before a loaded program can be - executed, it requires the manipulation of VM registers and tables. - Such manipulation should probably (?) occure in - sim_create_inferior. */ - -SIM_RC sim_load PARAMS ((SIM_DESC sd, char *prog, struct _bfd *abfd, int from_tty)); - - -/* Prepare to run the simulated program. - - ABFD, if not NULL, provides initial processor state information. - ARGV and ENV, if non NULL, are NULL terminated lists of pointers. - - Hardware simulator: This function shall initialize the processor - registers to a known value. The program counter and possibly stack - pointer shall be set using information obtained from ABFD (or - hardware reset defaults). ARGV and ENV, dependant on the target - ABI, may be written to memory. - - Process simulator: After a call to this function, a new process - instance shall exist. The TEXT, DATA, BSS and stack regions shall - all be initialized, ARGV and ENV shall be written to process - address space (according to the applicable ABI) and the program - counter and stack pointer set accordingly. */ - -SIM_RC sim_create_inferior PARAMS ((SIM_DESC sd, struct _bfd *abfd, char **argv, char **env)); - - -/* Fetch LENGTH bytes of the simulated program's memory. Start fetch - at virtual address MEM and store in BUF. Result is number of bytes - read, or zero if error. */ - -int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); - - -/* Store LENGTH bytes from BUF into the simulated program's - memory. Store bytes starting at virtual address MEM. Result is - number of bytes write, or zero if error. */ - -int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); - - -/* Fetch register REGNO storing its raw (target endian) value in the - LENGTH byte buffer BUF. Return the actual size of the register or - zero if REGNO is not applicable. - - Legacy implementations ignore LENGTH and always return -1. - - If LENGTH does not match the size of REGNO no data is transfered - (the actual register size is still returned). */ - -int sim_fetch_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); - - -/* Store register REGNO from the raw (target endian) value in BUF. - Return the actual size of the register or zero if REGNO is not - applicable. - - Legacy implementations ignore LENGTH and always return -1. - - If LENGTH does not match the size of REGNO no data is transfered - (the actual register size is still returned). */ - -int sim_store_register PARAMS ((SIM_DESC sd, int regno, unsigned char *buf, int length)); - - -/* Print whatever statistics the simulator has collected. - - VERBOSE is currently unused and must always be zero. */ - -void sim_info PARAMS ((SIM_DESC sd, int verbose)); - - -/* Run (or resume) the simulated program. - - STEP, when non-zero indicates that only a single simulator cycle - should be emulated. - - SIGGNAL, if non-zero is a (HOST) SIGRC value indicating the type of - event (hardware interrupt, signal) to be delivered to the simulated - program. - - Hardware simulator: If the SIGRC value returned by - sim_stop_reason() is passed back to the simulator via SIGGNAL then - the hardware simulator shall correctly deliver the hardware event - indicated by that signal. If a value of zero is passed in then the - simulation will continue as if there were no outstanding signal. - The effect of any other SIGGNAL value is is implementation - dependant. - - Process simulator: If SIGRC is non-zero then the corresponding - signal is delivered to the simulated program and execution is then - continued. A zero SIGRC value indicates that the program should - continue as normal. */ - -void sim_resume PARAMS ((SIM_DESC sd, int step, int siggnal)); - - -/* Asynchronous request to stop the simulation. - A nonzero return indicates that the simulator is able to handle - the request */ - -int sim_stop PARAMS ((SIM_DESC sd)); - - -/* Fetch the REASON why the program stopped. - - SIM_EXITED: The program has terminated. SIGRC indicates the target - dependant exit status. - - SIM_STOPPED: The program has stopped. SIGRC uses the host's signal - numbering as a way of identifying the reaon: program interrupted by - user via a sim_stop request (SIGINT); a breakpoint instruction - (SIGTRAP); a completed single step (SIGTRAP); an internal error - condition (SIGABRT); an illegal instruction (SIGILL); Access to an - undefined memory region (SIGSEGV); Mis-aligned memory access - (SIGBUS). For some signals information in addition to the signal - number may be retained by the simulator (e.g. offending address), - that information is not directly accessable via this interface. - - SIM_SIGNALLED: The program has been terminated by a signal. The - simulator has encountered target code that causes the the program - to exit with signal SIGRC. - - SIM_RUNNING, SIM_POLLING: The return of one of these values - indicates a problem internal to the simulator. */ - -enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, sim_signalled }; - -void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); - - -/* Passthru for other commands that the simulator might support. - Simulators should be prepared to deal with any combination of NULL - or empty CMD. */ - -void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); - -/* Call these functions to set and clear breakpoints at ADDR. */ - -SIM_RC sim_set_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_clear_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_clear_all_breakpoints PARAMS ((SIM_DESC sd)); - -/* These functions are used to enable and disable breakpoints. */ - -SIM_RC sim_enable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_disable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_enable_all_breakpoints PARAMS ((SIM_DESC sd)); -SIM_RC sim_disable_all_breakpoints PARAMS ((SIM_DESC sd)); - - -/* Provide simulator with a default (global) host_callback_struct. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ - -void sim_set_callbacks PARAMS ((struct host_callback_struct *)); - - -/* Set the size of the simulator memory array. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ - -void sim_size PARAMS ((int i)); - - -/* Single-step simulator with tracing enabled. - THIS PROCEDURE IS DEPRECIATED. - THIS PROCEDURE IS EVEN MORE DEPRECATED THAN SIM_SET_TRACE - GDB and NRUN do not use this interface. - This procedure returns: ``0'' indicating that the simulator should - be continued using sim_trace() calls; ``1'' indicating that the - simulation has finished. */ - -int sim_trace PARAMS ((SIM_DESC sd)); - - -/* Enable tracing. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure returns: ``0'' indicating that the simulator should - be continued using sim_trace() calls; ``1'' indicating that the - simulation has finished. */ - -void sim_set_trace PARAMS ((void)); - - -/* Configure the size of the profile buffer. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure does not take a SIM_DESC argument as it is - used before sim_open. */ - -void sim_set_profile_size PARAMS ((int n)); - - -/* Kill the running program. - THIS PROCEDURE IS DEPRECIATED. - GDB and NRUN do not use this interface. - This procedure will be replaced as part of the introduction of - multi-cpu simulators. */ - -void sim_kill PARAMS ((SIM_DESC sd)); - -#ifdef __cplusplus -} -#endif - -#endif /* !defined (REMOTE_SIM_H) */ diff --git a/include/sim-d10v.h b/include/sim-d10v.h deleted file mode 100644 index 9d29e05841b..00000000000 --- a/include/sim-d10v.h +++ /dev/null @@ -1,103 +0,0 @@ -/* This file defines the interface between the d10v simulator and gdb. - Copyright 1999 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#if !defined (SIM_D10V_H) -#define SIM_D10V_H - -#ifdef __cplusplus -extern "C" { // } -#endif - -/* GDB interprets addresses as: - - 0x00xxxxxx: Physical unified memory segment (Unified memory) - 0x01xxxxxx: Physical instruction memory segment (On-chip insn memory) - 0x02xxxxxx: Physical data memory segment (On-chip data memory) - 0x10xxxxxx: Logical data address segment (DMAP translated memory) - 0x11xxxxxx: Logical instruction address segment (IMAP translated memory) - - The remote d10v board interprets addresses as: - - 0x00xxxxxx: Physical unified memory segment (Unified memory) - 0x01xxxxxx: Physical instruction memory segment (On-chip insn memory) - 0x02xxxxxx: Physical data memory segment (On-chip data memory) - - The following translate a virtual DMAP/IMAP offset into a physical - memory segment assigning the translated address to PHYS. Since a - memory access may cross a page boundrary the number of bytes for - which the translation is applicable (or 0 for an invalid virtual - offset) is returned. */ - -enum - { - SIM_D10V_MEMORY_UNIFIED = 0x00000000, - SIM_D10V_MEMORY_INSN = 0x01000000, - SIM_D10V_MEMORY_DATA = 0x02000000, - SIM_D10V_MEMORY_DMAP = 0x10000000, - SIM_D10V_MEMORY_IMAP = 0x11000000 - }; - -extern unsigned long sim_d10v_translate_dmap_addr - (unsigned long offset, - int nr_bytes, - unsigned long *phys, - unsigned long (*dmap_register) (int reg_nr)); - -extern unsigned long sim_d10v_translate_imap_addr - (unsigned long offset, - int nr_bytes, - unsigned long *phys, - unsigned long (*imap_register) (int reg_nr)); - -extern unsigned long sim_d10v_translate_addr - (unsigned long vaddr, - int nr_bytes, - unsigned long *phys, - unsigned long (*dmap_register) (int reg_nr), - unsigned long (*imap_register) (int reg_nr)); - - -/* The simulator makes use of the following register information. */ - -enum - { - SIM_D10V_R0_REGNUM = 0, - SIM_D10V_CR0_REGNUM = 16, - SIM_D10V_A0_REGNUM = 32, - SIM_D10V_SPI_REGNUM = 34, - SIM_D10V_SPU_REGNUM = 35, - SIM_D10V_IMAP0_REGNUM = 36, - SIM_D10V_DMAP0_REGNUM = 38, - SIM_D10V_TS2_DMAP_REGNUM = 40 - }; - -enum - { - SIM_D10V_NR_R_REGS = 16, - SIM_D10V_NR_A_REGS = 2, - SIM_D10V_NR_IMAP_REGS = 2, - SIM_D10V_NR_DMAP_REGS = 4, - SIM_D10V_NR_CR_REGS = 16 - }; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 7024c37fb64..916995e5b12 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,26 @@ +2002-06-05 Geoffrey Keating + + * hashtab.c (htab_create): New stub function for backward + compatibility. + (htab_try_create): Likewise. + +2002-06-03 Geoffrey Keating + + * hashtab.c (htab_create): Delete. + (htab_try_create): Delete. + (htab_create_alloc): New. + (htab_delete): Support user-specified memory allocation. + (htab_expand): Likewise. + +2002-05-22 Roman Lechtchinsky + + * configure.in: Fix typo in the code checking for sys_errlist. + * configure: Regenerated. + +2002-05-13 Andreas Schwab + + * config.table: Use mh-x86pic also for x86-64. + 2002-05-08 Alexandre Oliva * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at @@ -26,7 +49,7 @@ 2002-03-30 Bryce McKinlay - * cp-demangle.c (java_demangle_v3): Don't try to release "demangled" + * cp-demangle.c (java_demangle_v3): Don't try to release "demangled" if it is NULL. 2002-03-27 DJ Delorie @@ -85,7 +108,7 @@ * xmalloc.c (xmalloc_fail): Clarify error message. -2002-02-21 Jim Blandy +2002-02-22 Jim Blandy * splay-tree.c (splay_tree_xmalloc_allocate, splay_tree_xmalloc_deallocate): New functions. diff --git a/libiberty/config.table b/libiberty/config.table index 6118a9c8256..b9a2479aac7 100644 --- a/libiberty/config.table +++ b/libiberty/config.table @@ -34,7 +34,8 @@ if [ "${shared}" = "yes" ]; then alpha*-*-linux*) frag=mh-elfalphapic ;; arm*-*-*) frag=mh-armpic ;; hppa*-*-*) frag=mh-papic ;; - i[3456]86-*-*) frag=mh-x86pic ;; + i[3456]86-*-* | x86_64-*-*) + frag=mh-x86pic ;; powerpc*-*-aix*) ;; powerpc*-*-*) frag=mh-ppcpic ;; sparc*-*-*) frag=mh-sparcpic ;; diff --git a/libiberty/configure b/libiberty/configure index fc89885f305..7f2c0a931a3 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -2860,7 +2860,7 @@ else #include "confdefs.h" int *p; int main() { -extern int $v []; p = &$v; +extern int $v []; p = $v; ; return 0; } EOF if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then diff --git a/libiberty/configure.in b/libiberty/configure.in index f6d92bcb03e..c84ece4ef41 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -401,7 +401,7 @@ if test -z "${setobjs}"; then for v in $vars; do AC_MSG_CHECKING([for $v]) AC_CACHE_VAL(libiberty_cv_var_$v, - [AC_TRY_LINK([int *p;], [extern int $v []; p = &$v;], + [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;], [eval "libiberty_cv_var_$v=yes"], [eval "libiberty_cv_var_$v=no"])]) if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 7477c35c3bc..6bf59ff7378 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -158,60 +158,60 @@ eq_pointer (p1, p2) /* This function creates table with length slightly longer than given source length. Created hash table is initiated as empty (all the hash table entries are EMPTY_ENTRY). The function returns the - created hash table. Memory allocation must not fail. */ + created hash table, or NULL if memory allocation fails. */ htab_t -htab_create (size, hash_f, eq_f, del_f) +htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f) size_t size; htab_hash hash_f; htab_eq eq_f; htab_del del_f; + htab_alloc alloc_f; + htab_free free_f; { htab_t result; size = higher_prime_number (size); - result = (htab_t) xcalloc (1, sizeof (struct htab)); - result->entries = (PTR *) xcalloc (size, sizeof (PTR)); + result = (htab_t) (*alloc_f) (1, sizeof (struct htab)); + if (result == NULL) + return NULL; + result->entries = (PTR *) (*alloc_f) (size, sizeof (PTR)); + if (result->entries == NULL) + { + if (free_f != NULL) + (*free_f) (result); + return NULL; + } result->size = size; result->hash_f = hash_f; result->eq_f = eq_f; result->del_f = del_f; - result->return_allocation_failure = 0; + result->alloc_f = alloc_f; + result->free_f = free_f; return result; } -/* This function creates table with length slightly longer than given - source length. The created hash table is initiated as empty (all the - hash table entries are EMPTY_ENTRY). The function returns the created - hash table. Memory allocation may fail; it may return NULL. */ +/* These functions exist solely for backward compatibility. */ +#undef htab_create htab_t -htab_try_create (size, hash_f, eq_f, del_f) +htab_create (size, hash_f, eq_f, del_f) size_t size; htab_hash hash_f; htab_eq eq_f; htab_del del_f; { - htab_t result; - - size = higher_prime_number (size); - result = (htab_t) calloc (1, sizeof (struct htab)); - if (result == NULL) - return NULL; - - result->entries = (PTR *) calloc (size, sizeof (PTR)); - if (result->entries == NULL) - { - free (result); - return NULL; - } + return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free); +} - result->size = size; - result->hash_f = hash_f; - result->eq_f = eq_f; - result->del_f = del_f; - result->return_allocation_failure = 1; - return result; +htab_t +htab_try_create (size, hash_f, eq_f, del_f) + size_t size; + htab_hash hash_f; + htab_eq eq_f; + htab_del del_f; +{ + return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free); } /* This function frees all memory allocated for given hash table. @@ -229,8 +229,11 @@ htab_delete (htab) && htab->entries[i] != DELETED_ENTRY) (*htab->del_f) (htab->entries[i]); - free (htab->entries); - free (htab); + if (htab->free_f != NULL) + { + (*htab->free_f) (htab->entries); + (*htab->free_f) (htab); + } } /* This function clears all entries in the given hash table. */ @@ -302,21 +305,17 @@ htab_expand (htab) PTR *oentries; PTR *olimit; PTR *p; + PTR *nentries; oentries = htab->entries; olimit = oentries + htab->size; htab->size = higher_prime_number (htab->size * 2); - if (htab->return_allocation_failure) - { - PTR *nentries = (PTR *) calloc (htab->size, sizeof (PTR *)); - if (nentries == NULL) - return 0; - htab->entries = nentries; - } - else - htab->entries = (PTR *) xcalloc (htab->size, sizeof (PTR *)); + nentries = (PTR *) (*htab->alloc_f) (htab->size, sizeof (PTR *)); + if (nentries == NULL) + return 0; + htab->entries = nentries; htab->n_elements -= htab->n_deleted; htab->n_deleted = 0; @@ -337,7 +336,8 @@ htab_expand (htab) } while (p < olimit); - free (oentries); + if (htab->free_f != NULL) + (*htab->free_f) (oentries); return 1; } diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 9db7dec8ee9..542313e9445 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,132 @@ +2002-06-08 Alan Modra + + * a29k-dis.c: Replace CONST with const. + * h8300-dis.c: Likewise. + * m68k-dis.c: Likewise. + * or32-dis.c: Likewise. + * sparc-dis.c: Likewise. + +2002-06-04 Jason Thorpe + + * configure.in: Add "sh5*-*" to list of targets which include + sh64 support. + * configure: Regenerate. + +2002-05-31 Chris G. Demetriou + + * 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 + Ed Satterthwaite + + * mips-opc.c: Add support for SB-1 MDMX subset and extensions. + +2002-05-31 Alan Modra + + * Makefile.am: Run "make dep-am". + * Makefile.in: Regenerate. + * po/POTFILES.in: Regenerate. + +2002-05-30 Chris G. Demetriou + Ed Satterthwaite + + * 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 + bit mask for bfd_mach_mipsisa64. + * mips-opc.c: Add support for MDMX instructions. + (MX): New definition. + + * mips-dis.c: Update copyright years to include 2002. + +2002-05-30 Diego Novillo + + * d10v-opc.c (d10v_opcodes): `btsti' does not modify its + arguments. + +2002-05-28 Kuang Hwa Lin + + * configure.in: Add DLX configuraton support. + * configure: Regenerate. + * Makefile.am: Add DLX configuraton support. + * Makefile.in: Regenerate. + * disassemble.c: Add DLX support. + * dlx-dis.c: New file. + +2002-05-25 Alan Modra + + * Makefile.am (sh-dis.lo): Don't put make commands in deps. + * Makefile.in: Regenerate. + * arc-dis.c: Use #include "" instead of <> for local header files. + * m68k-dis.c: Likewise. + +Wed May 22 20:11:51 2002 J"orn Rennecke + + * Makefile.am (sh-dis.lo): Compile with @archdefs@. + * Makefile.in: regenerate. + + * sh-dis.c (print_insn_sh): If coff and bfd_mach_sh, use arch_sh4 + for disassembly. + +2002-05-22 Thiemo Seufer + + * mips-opc.c (mips_builtin_opcodes): Add drol, dror macros. + +Fri May 17 14:26:44 2002 J"orn Rennecke + + * disassemble.c (disassembler): Just use print_insn_sh for bfd_arch_sh. + * sh-dis.c (LITTLE_BIT): Delete. + (print_insn_sh, print_insn_shl): Deleted. + (print_insn_shx): Renamed to + (print_insn_sh). No longer static. Handle SHmedia instructions. + Use info->endian to determine endianness. + * sh64-dis.c (print_insn_sh64, print_insn_sh64l): Delete. + (print_insn_sh64x): No longer static. Renamed to + (print_insn_sh64). Removed pfun_compact and endian arguments. + If we got an uneven address to indicate SHmedia, adjust it. + Return -2 for SHcompact instructions. + +2002-05-17 Alan Modra + + * acinclude.m4 (AM_INSTALL_LIBBFD): Fake to fool autotools. + * configure.in: Invoke AM_INSTALL_LIBBFD. + * Makefile.am (install-data-local): Move to.. + (install_libopcodes): .. New target. + (uninstall_libopcodes): Likewise. + (install-bfdlibLTLIBRARIES): Likewise. + (uninstall-bfdlibLTLIBRARIES): Likewise. + (bfdlibdir): New. + (bfdincludedir): New. + (lib_LTLIBRARIES): Rename to bfdlib_LTLIBRARIES. + * aclocal.m4: Regenerate. + * configure: Regenerate. + * Makefile.in: Regenerate. + +2002-05-15 Nick Clifton + + * fr30-asm.c: Regenerate. + * fr30-desc.c: Regenerate. + * fr30-dis.c: Regenerate. + * m32r-asm.c: Regenerate. + * m32r-desc.c: Regenerate. + * m32r-dis.c: Regenerate. + * openrisc-asm.c: Regenerate. + * openrisc-desc.c: Regenerate. + * openrisc-dis.c: Regenerate. + * xstormy16-asm.c: Regenerate. + * xstormy16-desc.c: Regenerate. + * xstormy16-dis.c: Regenerate. + +2002-05-15 Thiemo Seufer + + * mips-dis.c (is_newabi): EABI is not a NewABI. + +2002-05-13 Jason Thorpe + + * configure.in (shle-*-*elf*): Include sh64 support. + * configure: Regenerate. + 2002-04-28 Jason Thorpe * vax-dis.c (print_insn_arg): Pass the insn info to print_insn_mode. @@ -180,7 +309,7 @@ Mon Mar 18 21:10:43 CET 2002 Jan Hubicka 2002-02-20 Tom Rix - * ppc-opc.c (powerpc_operands): Add WS feild. Use for tlbre, tlbwe. + * ppc-opc.c (powerpc_operands): Add WS field. Use for tlbre, tlbwe. 2002-02-19 Martin Schwidefsky diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index ad3bdf4b548..7ee8c32b944 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -11,7 +11,10 @@ MKDEP = gcc -MM WARN_CFLAGS = @WARN_CFLAGS@ AM_CFLAGS = $(WARN_CFLAGS) -lib_LTLIBRARIES = libopcodes.la +bfdlibdir = @bfdlibdir@ +bfdincludedir = @bfdincludedir@ + +bfdlib_LTLIBRARIES = libopcodes.la # This is where bfd.h lives. BFD_H = ../bfd/bfd.h @@ -55,6 +58,7 @@ CFILES = \ d10v-opc.c \ d30v-dis.c \ d30v-opc.c \ + dlx-dis.c \ dis-buf.c \ disassemble.c \ fr30-asm.c \ @@ -158,6 +162,7 @@ ALL_MACHINES = \ d10v-opc.lo \ d30v-dis.lo \ d30v-opc.lo \ + dlx-dis.lo \ fr30-asm.lo \ fr30-desc.lo \ fr30-dis.lo \ @@ -271,11 +276,29 @@ po/POTFILES.in: @MAINT@ Makefile config.status: $(srcdir)/configure $(srcdir)/../bfd/configure.in $(SHELL) ./config.status --recheck -# Install libopcodes include file. -install-data-local: +install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libopcodes @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(includedir)/dis-asm.h + +uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libopcodes + @$(NORMAL_UNINSTALL) + +.PHONY: install_libopcodes uninstall_libopcodes +install_libopcodes: $(bfdlib_LTLIBRARIES) + $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) + $(mkinstalldirs) $(DESTDIR)$(bfdincludedir) + @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \ + else :; fi; \ + done + $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(bfdincludedir)/dis-asm.h + +uninstall_libopcodes: + list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \ + done + rm -f $(DESTDIR)$(bfdincludedir)/dis-asm.h CLEANFILES = \ stamp-m32r stamp-fr30 stamp-openrisc \ @@ -350,6 +373,9 @@ s390-mkopc: s390-mkopc.c s390-opc.tab: s390-mkopc s390-opc.txt ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab +sh-dis.lo: sh-dis.c + $(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $< + Makefile: $(BFDDIR)/configure.in # This dependency stuff is copied from BFD. @@ -447,6 +473,8 @@ d30v-dis.lo: d30v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h opintl.h d30v-opc.lo: d30v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d30v.h +dlx-dis.lo: dlx-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/dlx.h dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \ diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 48c863006fe..f7147e14bb8 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -121,7 +121,10 @@ MKDEP = gcc -MM WARN_CFLAGS = @WARN_CFLAGS@ AM_CFLAGS = $(WARN_CFLAGS) -lib_LTLIBRARIES = libopcodes.la +bfdlibdir = @bfdlibdir@ +bfdincludedir = @bfdincludedir@ + +bfdlib_LTLIBRARIES = libopcodes.la # This is where bfd.h lives. BFD_H = ../bfd/bfd.h @@ -166,6 +169,7 @@ CFILES = \ d10v-opc.c \ d30v-dis.c \ d30v-opc.c \ + dlx-dis.c \ dis-buf.c \ disassemble.c \ fr30-asm.c \ @@ -270,6 +274,7 @@ ALL_MACHINES = \ d10v-opc.lo \ d30v-dis.lo \ d30v-opc.lo \ + dlx-dis.lo \ fr30-asm.lo \ fr30-desc.lo \ fr30-dis.lo \ @@ -402,7 +407,7 @@ LIBS = @LIBS@ libopcodes_a_LIBADD = libopcodes_a_SOURCES = libopcodes.a.c libopcodes_a_OBJECTS = libopcodes.a.$(OBJEXT) -LTLIBRARIES = $(lib_LTLIBRARIES) +LTLIBRARIES = $(bfdlib_LTLIBRARIES) libopcodes_la_OBJECTS = dis-buf.lo disassemble.lo CFLAGS = @CFLAGS@ @@ -517,33 +522,17 @@ distclean-libtool: maintainer-clean-libtool: -mostlyclean-libLTLIBRARIES: - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) +mostlyclean-bfdlibLTLIBRARIES: -distclean-libLTLIBRARIES: +clean-bfdlibLTLIBRARIES: + -test -z "$(bfdlib_LTLIBRARIES)" || rm -f $(bfdlib_LTLIBRARIES) -maintainer-clean-libLTLIBRARIES: +distclean-bfdlibLTLIBRARIES: -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ - done +maintainer-clean-bfdlibLTLIBRARIES: libopcodes.la: $(libopcodes_la_OBJECTS) $(libopcodes_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libopcodes_la_LDFLAGS) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS) + $(LINK) -rpath $(bfdlibdir) $(libopcodes_la_LDFLAGS) $(libopcodes_la_OBJECTS) $(libopcodes_la_LIBADD) $(LIBS) # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -705,16 +694,16 @@ install-info: install-info-recursive all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive -install-exec-am: install-libLTLIBRARIES +install-exec-am: install-exec: install-exec-recursive -install-data-am: install-data-local +install-data-am: install-bfdlibLTLIBRARIES install-data: install-data-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-recursive -uninstall-am: uninstall-libLTLIBRARIES +uninstall-am: uninstall-bfdlibLTLIBRARIES uninstall: uninstall-recursive all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h all-redirect: all-recursive-am @@ -722,7 +711,7 @@ install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: installdirs-recursive installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(libdir) + $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) mostlyclean-generic: @@ -737,19 +726,19 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-noinstLIBRARIES \ mostlyclean-compile mostlyclean-libtool \ - mostlyclean-libLTLIBRARIES mostlyclean-tags \ + mostlyclean-bfdlibLTLIBRARIES mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-recursive clean-am: clean-hdr clean-noinstLIBRARIES clean-compile clean-libtool \ - clean-libLTLIBRARIES clean-tags clean-generic \ + clean-bfdlibLTLIBRARIES clean-tags clean-generic \ mostlyclean-am clean: clean-recursive distclean-am: distclean-hdr distclean-noinstLIBRARIES distclean-compile \ - distclean-libtool distclean-libLTLIBRARIES \ + distclean-libtool distclean-bfdlibLTLIBRARIES \ distclean-tags distclean-generic clean-am -rm -f libtool @@ -759,8 +748,9 @@ distclean: distclean-recursive maintainer-clean-am: maintainer-clean-hdr \ maintainer-clean-noinstLIBRARIES \ maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-libLTLIBRARIES maintainer-clean-tags \ - maintainer-clean-generic distclean-am + maintainer-clean-bfdlibLTLIBRARIES \ + maintainer-clean-tags maintainer-clean-generic \ + distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@ -772,22 +762,22 @@ mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile mostlyclean-libtool distclean-libtool \ -clean-libtool maintainer-clean-libtool mostlyclean-libLTLIBRARIES \ -distclean-libLTLIBRARIES clean-libLTLIBRARIES \ -maintainer-clean-libLTLIBRARIES uninstall-libLTLIBRARIES \ -install-libLTLIBRARIES install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ +clean-libtool maintainer-clean-libtool mostlyclean-bfdlibLTLIBRARIES \ +distclean-bfdlibLTLIBRARIES clean-bfdlibLTLIBRARIES \ +maintainer-clean-bfdlibLTLIBRARIES uninstall-bfdlibLTLIBRARIES \ +install-bfdlibLTLIBRARIES install-data-recursive \ +uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-am installcheck install-info-am \ install-info all-recursive-am install-exec-am install-exec \ -install-data-local install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs-am \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs-am installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean disassemble.lo: disassemble.c $(INCDIR)/dis-asm.h @@ -812,11 +802,29 @@ po/POTFILES.in: @MAINT@ Makefile config.status: $(srcdir)/configure $(srcdir)/../bfd/configure.in $(SHELL) ./config.status --recheck -# Install libopcodes include file. -install-data-local: +install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libopcodes @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(includedir)/dis-asm.h + +uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libopcodes + @$(NORMAL_UNINSTALL) + +.PHONY: install_libopcodes uninstall_libopcodes +install_libopcodes: $(bfdlib_LTLIBRARIES) + $(mkinstalldirs) $(DESTDIR)$(bfdlibdir) + $(mkinstalldirs) $(DESTDIR)$(bfdincludedir) + @list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \ + else :; fi; \ + done + $(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(bfdincludedir)/dis-asm.h + +uninstall_libopcodes: + list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \ + done + rm -f $(DESTDIR)$(bfdincludedir)/dis-asm.h run-cgen: $(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \ @@ -861,6 +869,9 @@ s390-mkopc: s390-mkopc.c s390-opc.tab: s390-mkopc s390-opc.txt ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab +sh-dis.lo: sh-dis.c + $(LIBTOOL) --mode=compile $(COMPILE) -c @archdefs@ $< + Makefile: $(BFDDIR)/configure.in # This dependency stuff is copied from BFD. @@ -958,6 +969,8 @@ d30v-dis.lo: d30v-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h opintl.h d30v-opc.lo: d30v-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/opcode/d30v.h +dlx-dis.lo: dlx-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h $(INCDIR)/opcode/dlx.h dis-buf.lo: dis-buf.c sysdep.h config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/dis-asm.h $(BFD_H) $(INCDIR)/symcat.h opintl.h disassemble.lo: disassemble.c sysdep.h config.h $(INCDIR)/ansidecl.h \ diff --git a/opcodes/a29k-dis.c b/opcodes/a29k-dis.c index 0e937ba0eab..a3090c3e21b 100644 --- a/opcodes/a29k-dis.c +++ b/opcodes/a29k-dis.c @@ -1,5 +1,5 @@ /* Instruction printing code for the AMD 29000 - Copyright 1990, 1993, 1994, 1995, 1998, 2000, 2001 + Copyright 1990, 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Jim Kingdon. @@ -153,7 +153,7 @@ print_insn (memaddr, info) find_byte_func_type find_byte_func = (find_byte_func_type)info->private_data; - struct a29k_opcode CONST * opcode; + struct a29k_opcode const * opcode; { int status = diff --git a/opcodes/acinclude.m4 b/opcodes/acinclude.m4 index bb689a5ce8f..3a47b1b67c4 100644 --- a/opcodes/acinclude.m4 +++ b/opcodes/acinclude.m4 @@ -15,3 +15,10 @@ ifelse(yes,no,[ AC_DEFUN([CY_WITH_NLS],) AC_SUBST(INTLLIBS) ]) + +dnl AM_INSTALL_LIBBFD already included in bfd/acinclude.m4 +ifelse(yes,no,[ +AC_DEFUN([AM_INSTALL_LIBBFD],) +AC_SUBST(bfdlibdir) +AC_SUBST(bfdincludedir) +]) diff --git a/opcodes/aclocal.m4 b/opcodes/aclocal.m4 index 5858db78bf1..184bf3665ad 100644 --- a/opcodes/aclocal.m4 +++ b/opcodes/aclocal.m4 @@ -28,6 +28,13 @@ AC_DEFUN([CY_WITH_NLS],) AC_SUBST(INTLLIBS) ]) +dnl AM_INSTALL_LIBBFD already included in bfd/acinclude.m4 +ifelse(yes,no,[ +AC_DEFUN([AM_INSTALL_LIBBFD],) +AC_SUBST(bfdlibdir) +AC_SUBST(bfdincludedir) +]) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c index d38e2fa81d2..194a75ac9fe 100644 --- a/opcodes/arc-dis.c +++ b/opcodes/arc-dis.c @@ -1,5 +1,5 @@ /* Instruction printing code for the ARC. - Copyright 1994, 1995, 1997, 1998, 2000, 2001 + Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Doug Evans (dje@cygnus.com). @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include +#include "ansidecl.h" +#include "libiberty.h" #include "dis-asm.h" #include "opcode/arc.h" #include "elf-bfd.h" diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 7e9b3309008..f3785f2ed9b 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -1,5 +1,5 @@ /* Instruction printing code for the ARM - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modification by James G. Smith (jsmith@cygnus.co.uk) @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libcoff.h" #include "opintl.h" -/* FIXME: This shouldn't be done here */ +/* FIXME: This shouldn't be done here. */ #include "elf-bfd.h" #include "elf/internal.h" #include "elf/arm.h" @@ -99,15 +99,16 @@ int get_arm_regnames (int option, const char **setname, const char **setdescription, const char ***register_names); -/* Functions. */ +/* Functions. */ int -get_arm_regname_num_options (void) +get_arm_regname_num_options () { return NUM_ARM_REGNAMES; } int -set_arm_regname_option (int option) +set_arm_regname_option (option) + int option; { int old = regname_selected; regname_selected = option; @@ -115,9 +116,11 @@ set_arm_regname_option (int option) } int -get_arm_regnames (int option, const char **setname, - const char **setdescription, - const char ***register_names) +get_arm_regnames (option, setname, setdescription, register_names) + int option; + const char **setname; + const char **setdescription; + const char ***register_names; { *setname = regnames[option].name; *setdescription = regnames[option].description; @@ -161,6 +164,7 @@ arm_decode_shift (given, func, stream) /* Print one instruction from PC on INFO->STREAM. Return the size of the instruction (always 4 on ARM). */ + static int print_insn_arm (pc, info, given) bfd_vma pc; @@ -200,7 +204,7 @@ print_insn_arm (pc, info, given) if ((given & 0x00800000) == 0) offset = - offset; - /* pre-indexed */ + /* Pre-indexed. */ func (stream, ", #%d]", offset); offset += pc + 8; @@ -217,7 +221,8 @@ print_insn_arm (pc, info, given) /* Post indexed. */ func (stream, "], #%d", offset); - offset = pc + 8; /* ie ignore the offset. */ + /* ie ignore the offset. */ + offset = pc + 8; } func (stream, "\t; "); @@ -740,6 +745,7 @@ print_insn_arm (pc, info, given) /* Print one instruction from PC on INFO->STREAM. Return the size of the instruction. */ + static int print_insn_thumb (pc, info, given) bfd_vma pc; @@ -765,26 +771,17 @@ print_insn_thumb (pc, info, given) info->bytes_per_line = 4; offset = BDISP23 (given); - + offset = offset * 2 + pc + 4; + if ((given & 0x10000000) == 0) { func (stream, "blx\t"); - - /* The spec says that bit 1 of the branch's destination - address comes from bit 1 of the instruction's - address and not from the offset in the instruction. */ - if (offset & 0x1) - { - /* func (stream, "*malformed!* "); */ - offset &= ~ 0x1; - } - - offset |= ((pc & 0x2) >> 1); + offset &= 0xfffffffc; } else func (stream, "bl\t"); - info->print_address_func (offset * 2 + pc + 4, info); + info->print_address_func (offset, info); return 4; } else @@ -988,6 +985,7 @@ print_insn_thumb (pc, info, given) } /* Parse an individual disassembler option. */ + void parse_arm_disassembler_option (option) char * option; @@ -1022,6 +1020,7 @@ parse_arm_disassembler_option (option) } /* Parse the string of disassembler options, spliting it at whitespaces. */ + static void parse_disassembler_options (options) char * options; @@ -1050,6 +1049,7 @@ parse_disassembler_options (options) /* NOTE: There are no checks in these routines that the relevant number of data bytes exist. */ + static int print_insn (pc, info, little) bfd_vma pc; diff --git a/opcodes/configure b/opcodes/configure index d8f162a1dac..4d0b55f891f 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -32,6 +32,8 @@ ac_help="$ac_help ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --install-libbfd controls installation of libbfd and related headers" ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help @@ -548,12 +550,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:552: checking for Cygwin environment" >&5 +echo "configure:554: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -581,19 +583,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:585: checking for mingw32 environment" >&5 +echo "configure:587: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -658,7 +660,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:662: checking host system type" >&5 +echo "configure:664: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -679,7 +681,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:683: checking target system type" >&5 +echo "configure:685: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -697,7 +699,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:701: checking build system type" >&5 +echo "configure:703: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -722,7 +724,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:726: checking for $ac_word" >&5 +echo "configure:728: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -752,7 +754,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:756: checking for $ac_word" >&5 +echo "configure:758: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -803,7 +805,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:807: checking for $ac_word" >&5 +echo "configure:809: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -835,7 +837,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:839: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:841: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -846,12 +848,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 850 "configure" +#line 852 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -877,12 +879,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:881: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:886: checking whether we are using GNU C" >&5 +echo "configure:888: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -891,7 +893,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -910,7 +912,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:914: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:916: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -942,7 +944,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:946: checking for POSIXized ISC" >&5 +echo "configure:948: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -980,7 +982,7 @@ BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:984: checking for a BSD compatible install" >&5 +echo "configure:986: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1033,7 +1035,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:1037: checking whether build environment is sane" >&5 +echo "configure:1039: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -1090,7 +1092,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1094: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1096: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1136,7 +1138,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1140: checking for working aclocal" >&5 +echo "configure:1142: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1149,7 +1151,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1153: checking for working autoconf" >&5 +echo "configure:1155: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1162,7 +1164,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1166: checking for working automake" >&5 +echo "configure:1168: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1175,7 +1177,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1179: checking for working autoheader" >&5 +echo "configure:1181: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1188,7 +1190,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1192: checking for working makeinfo" >&5 +echo "configure:1194: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1211,7 +1213,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1215: checking for $ac_word" >&5 +echo "configure:1217: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1243,7 +1245,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1247: checking for $ac_word" >&5 +echo "configure:1249: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1275,7 +1277,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1279: checking for $ac_word" >&5 +echo "configure:1281: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1390,7 +1392,7 @@ ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1394: checking for ld used by GCC" >&5 +echo "configure:1396: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1420,10 +1422,10 @@ echo "configure:1394: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1424: checking for GNU ld" >&5 +echo "configure:1426: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1427: checking for non-GNU ld" >&5 +echo "configure:1429: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1458,7 +1460,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1462: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1464: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1475,7 +1477,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1479: checking for $LD option to reload object files" >&5 +echo "configure:1481: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1487,7 +1489,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1491: checking for BSD-compatible nm" >&5 +echo "configure:1493: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1525,7 +1527,7 @@ NM="$lt_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1529: checking whether ln -s works" >&5 +echo "configure:1531: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1546,7 +1548,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1550: checking how to recognise dependant libraries" >&5 +echo "configure:1552: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1719,13 +1721,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1723: checking for object suffix" >&5 +echo "configure:1725: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1745,7 +1747,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1749: checking for executable suffix" >&5 +echo "configure:1751: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1755,7 +1757,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1782,7 +1784,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1786: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1788: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1844,7 +1846,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1848: checking for file" >&5 +echo "configure:1850: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1915,7 +1917,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1919: checking for $ac_word" >&5 +echo "configure:1921: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1947,7 +1949,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1951: checking for $ac_word" >&5 +echo "configure:1953: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1982,7 +1984,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1986: checking for $ac_word" >&5 +echo "configure:1988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2014,7 +2016,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2018: checking for $ac_word" >&5 +echo "configure:2020: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2081,8 +2083,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2085 "configure"' > conftest.$ac_ext - if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2087 "configure"' > conftest.$ac_ext + if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" @@ -2101,7 +2103,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:2105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:2107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -2119,7 +2121,7 @@ ia64-*-hpux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2123: checking whether the C compiler needs -belf" >&5 +echo "configure:2125: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2132,14 +2134,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2307,7 +2309,7 @@ if test -z "$target" ; then fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2311: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2313: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2329,10 +2331,45 @@ fi MAINT=$MAINTAINER_MODE_TRUE +echo $ac_n "checking whether to install libbfd""... $ac_c" 1>&6 +echo "configure:2336: checking whether to install libbfd" >&5 + # Check whether --enable-install-libbfd or --disable-install-libbfd was given. +if test "${enable_install_libbfd+set}" = set; then + enableval="$enable_install_libbfd" + install_libbfd_p=$enableval +else + if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then + install_libbfd_p=yes + else + install_libbfd_p=no + fi +fi + + echo "$ac_t""$install_libbfd_p" 1>&6 + + +if test $install_libbfd_p = yes; then + INSTALL_LIBBFD_TRUE= + INSTALL_LIBBFD_FALSE='#' +else + INSTALL_LIBBFD_TRUE='#' + INSTALL_LIBBFD_FALSE= +fi + # libbfd.a is a host library containing target dependent code + bfdlibdir='$(libdir)' + bfdincludedir='$(includedir)' + if test "${host}" != "${target}"; then + bfdlibdir='$(exec_prefix)/$(host_alias)/$(target_alias)/lib' + bfdincludedir='$(exec_prefix)/$(host_alias)/$(target_alias)/include' + fi + + + + echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2336: checking for executable suffix" >&5 +echo "configure:2373: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2342,7 +2379,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -2368,7 +2405,7 @@ ac_exeext=$EXEEXT # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2372: checking for $ac_word" >&5 +echo "configure:2409: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2398,7 +2435,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2402: checking for $ac_word" >&5 +echo "configure:2439: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2449,7 +2486,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2453: checking for $ac_word" >&5 +echo "configure:2490: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2481,7 +2518,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2485: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2522: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2492,12 +2529,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2496 "configure" +#line 2533 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2523,12 +2560,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2527: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2564: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2532: checking whether we are using GNU C" >&5 +echo "configure:2569: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2537,7 +2574,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2541: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2556,7 +2593,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2560: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2597: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2590,7 +2627,7 @@ fi ALL_LINGUAS="fr sv tr es da de id" echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2594: checking how to run the C preprocessor" >&5 +echo "configure:2631: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2605,13 +2642,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2652: \"$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 : @@ -2622,13 +2659,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2669: \"$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 : @@ -2639,13 +2676,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2686: \"$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 : @@ -2672,7 +2709,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2676: checking for $ac_word" >&5 +echo "configure:2713: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2700,12 +2737,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2704: checking for ANSI C header files" >&5 +echo "configure:2741: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2713,7 +2750,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2730,7 +2767,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2748,7 +2785,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2769,7 +2806,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2780,7 +2817,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2804,12 +2841,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2808: checking for working const" >&5 +echo "configure:2845: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2879,21 +2916,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2883: checking for inline" >&5 +echo "configure:2920: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2934: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2919,12 +2956,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2923: checking for off_t" >&5 +echo "configure:2960: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2952,12 +2989,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2956: checking for size_t" >&5 +echo "configure:2993: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2987,19 +3024,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2991: checking for working alloca.h" >&5 +echo "configure:3028: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3020,12 +3057,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3024: checking for alloca" >&5 +echo "configure:3061: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3085,12 +3122,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3089: checking whether alloca needs Cray hooks" >&5 +echo "configure:3126: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3119: checking for $ac_func" >&5 +echo "configure:3156: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3184: \"$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 @@ -3170,7 +3207,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3174: checking stack direction for C alloca" >&5 +echo "configure:3211: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3178,7 +3215,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3218,21 +3255,21 @@ EOF fi -for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h +for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3226: checking for $ac_hdr" >&5 +echo "configure:3263: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3273: \"$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* @@ -3261,12 +3298,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3265: checking for $ac_func" >&5 +echo "configure:3302: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3330: \"$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 @@ -3314,7 +3351,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3318: checking for working mmap" >&5 +echo "configure:3355: 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 @@ -3322,7 +3359,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < #include -#if HAVE_SYS_TYPES_H -# include -#endif - -#if HAVE_STDLIB_H -# include -#endif - -#if HAVE_SYS_STAT_H -# include -#endif - -#if HAVE_UNISTD_H -# include -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif /* Assume that all systems that can run configure have sys/param.h. */ # ifndef HAVE_SYS_PARAM_H @@ -3475,7 +3499,7 @@ main() } EOF -if { (eval echo configure:3479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3503: \"$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 @@ -3503,17 +3527,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3507: checking for $ac_hdr" >&5 +echo "configure:3531: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3541: \"$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* @@ -3543,12 +3567,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3547: checking for $ac_func" >&5 +echo "configure:3571: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3599: \"$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 @@ -3600,12 +3624,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3604: checking for $ac_func" >&5 +echo "configure:3628: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3656: \"$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 @@ -3662,19 +3686,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3666: checking for LC_MESSAGES" >&5 +echo "configure:3690: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3695,7 +3719,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3699: checking whether NLS is requested" >&5 +echo "configure:3723: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3715,7 +3739,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3719: checking whether included gettext is requested" >&5 +echo "configure:3743: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3734,17 +3758,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3738: checking for libintl.h" >&5 +echo "configure:3762: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3772: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3761,19 +3785,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3765: checking for gettext in libc" >&5 +echo "configure:3789: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3789,7 +3813,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3793: checking for bindtextdomain in -lintl" >&5 +echo "configure:3817: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3797,7 +3821,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3824,19 +3848,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3828: checking for gettext in libintl" >&5 +echo "configure:3852: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3864,7 +3888,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3868: checking for $ac_word" >&5 +echo "configure:3892: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3898,12 +3922,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3902: checking for $ac_func" >&5 +echo "configure:3926: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3954: \"$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 @@ -3953,7 +3977,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3957: checking for $ac_word" >&5 +echo "configure:3981: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3989,7 +4013,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3993: checking for $ac_word" >&5 +echo "configure:4017: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4021,7 +4045,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4061,7 +4085,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4065: checking for $ac_word" >&5 +echo "configure:4089: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4095,7 +4119,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4099: checking for $ac_word" >&5 +echo "configure:4123: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4131,7 +4155,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4135: checking for $ac_word" >&5 +echo "configure:4159: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4221,7 +4245,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4225: checking for catalogs to be installed" >&5 +echo "configure:4249: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4249,17 +4273,17 @@ echo "configure:4225: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4253: checking for linux/version.h" >&5 +echo "configure:4277: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4337,7 +4361,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4341: checking for build system executable suffix" >&5 +echo "configure:4365: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4374,7 +4398,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4378: checking for a BSD compatible install" >&5 +echo "configure:4402: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4431,17 +4455,17 @@ for ac_hdr in string.h strings.h stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4435: checking for $ac_hdr" >&5 +echo "configure:4459: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4445: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4469: \"$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* @@ -4567,6 +4591,7 @@ if test x${all_targets} = xfalse ; then bfd_cris_arch) ta="$ta cris-dis.lo cris-opc.lo" ;; bfd_d10v_arch) ta="$ta d10v-dis.lo d10v-opc.lo" ;; bfd_d30v_arch) ta="$ta d30v-dis.lo d30v-opc.lo" ;; + bfd_dlx_arch) ta="$ta dlx-dis.lo" ;; bfd_fr30_arch) ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;; bfd_h8300_arch) ta="$ta h8300-dis.lo" ;; bfd_h8500_arch) ta="$ta h8500-dis.lo" ;; @@ -4604,7 +4629,8 @@ if test x${all_targets} = xfalse ; then # Include it just for ELF targets, since the SH5 bfd:s are ELF only. for t in $target $canon_targets; do case $t in - all | sh64-* | sh-*-*elf* | shl-*-*elf* | sh-*-linux* | shl-*-linux*) + all | sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \ + sh-*-linux* | shl-*-linux*) ta="$ta sh64-dis.lo sh64-opc.lo" archdefs="$archdefs -DINCLUDE_SHMEDIA" break;; @@ -4835,6 +4861,10 @@ s%@WARN_CFLAGS@%$WARN_CFLAGS%g s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g s%@MAINT@%$MAINT%g +s%@INSTALL_LIBBFD_TRUE@%$INSTALL_LIBBFD_TRUE%g +s%@INSTALL_LIBBFD_FALSE@%$INSTALL_LIBBFD_FALSE%g +s%@bfdlibdir@%$bfdlibdir%g +s%@bfdincludedir@%$bfdincludedir%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g s%@USE_NLS@%$USE_NLS%g diff --git a/opcodes/configure.in b/opcodes/configure.in index 699f9be06f7..c09fad0600e 100644 --- a/opcodes/configure.in +++ b/opcodes/configure.in @@ -71,6 +71,7 @@ if test -z "$target" ; then fi AM_MAINTAINER_MODE +AM_INSTALL_LIBBFD AC_EXEEXT # host-specific stuff: @@ -178,6 +179,7 @@ if test x${all_targets} = xfalse ; then bfd_cris_arch) ta="$ta cris-dis.lo cris-opc.lo" ;; bfd_d10v_arch) ta="$ta d10v-dis.lo d10v-opc.lo" ;; bfd_d30v_arch) ta="$ta d30v-dis.lo d30v-opc.lo" ;; + bfd_dlx_arch) ta="$ta dlx-dis.lo" ;; bfd_fr30_arch) ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;; bfd_h8300_arch) ta="$ta h8300-dis.lo" ;; bfd_h8500_arch) ta="$ta h8500-dis.lo" ;; @@ -215,7 +217,8 @@ if test x${all_targets} = xfalse ; then # Include it just for ELF targets, since the SH5 bfd:s are ELF only. for t in $target $canon_targets; do case $t in - all | sh64-* | sh-*-*elf* | shl-*-*elf* | sh-*-linux* | shl-*-linux*) + all | sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \ + sh-*-linux* | shl-*-linux*) ta="$ta sh64-dis.lo sh64-opc.lo" archdefs="$archdefs -DINCLUDE_SHMEDIA" break;; diff --git a/opcodes/d10v-opc.c b/opcodes/d10v-opc.c index b2ce10f6163..868217775b1 100644 --- a/opcodes/d10v-opc.c +++ b/opcodes/d10v-opc.c @@ -1,5 +1,5 @@ /* d10v-opc.c -- D10V opcode list - Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Written by Martin Hunt, Cygnus Support This file is part of GDB, GAS, and the GNU binutils. @@ -196,7 +196,7 @@ const struct d10v_opcode d10v_opcodes[] = { { "brf0t.s", SHORT_B, 3, MU, BRANCH|PAR|RF0, 0x4b00, 0x7f00, { ANUM8 } }, { "brf0t.l", LONG_B, 3, MU, SEQ, 0x25800000, 0x3fff0000, { ANUM16 } }, { "bseti", SHORT_2, 1, IU, PAR, 0x801, 0x7e01, { RDST, UNUM4 } }, - { "btsti", SHORT_2, 1, IU, PAR|WF0, 0xe01, 0x7e01, { RDST, UNUM4 } }, + { "btsti", SHORT_2, 1, IU, PAR|WF0, 0xe01, 0x7e01, { RSRC2, UNUM4 } }, { "clrac", SHORT_2, 1, IU, PAR, 0x5601, 0x7eff, { ADST } }, { "cmp", SHORT_2, 1, EITHER, PAR|WF0, 0x600, 0x7e01, { RSRC2, RSRC } }, { "cmp", SHORT_2, 1, IU, PAR|WF0, 0x1603, 0x7eef, { ASRC2, ASRC } }, diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 93f3f005a45..bfb22c2c188 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define ARCH_cris #define ARCH_d10v #define ARCH_d30v +#define ARCH_dlx #define ARCH_h8300 #define ARCH_h8500 #define ARCH_hppa @@ -126,6 +127,12 @@ disassembler (abfd) disassemble = print_insn_d30v; break; #endif +#ifdef ARCH_dlx + case bfd_arch_dlx: + /* As far as I know we only handle big-endian DLX objects. */ + disassemble = print_insn_dlx; + break; +#endif #ifdef ARCH_h8300 case bfd_arch_h8300: if (bfd_get_mach(abfd) == bfd_mach_h8300h) @@ -278,20 +285,7 @@ disassembler (abfd) #endif #ifdef ARCH_sh case bfd_arch_sh: -#ifdef INCLUDE_SHMEDIA - if (bfd_get_mach (abfd) == bfd_mach_sh5) - { - if (bfd_big_endian (abfd)) - disassemble = print_insn_sh64; - else - disassemble = print_insn_sh64l; - break; - } -#endif - if (bfd_big_endian (abfd)) - disassemble = print_insn_sh; - else - disassemble = print_insn_shl; + disassemble = print_insn_sh; break; #endif #ifdef ARCH_sparc diff --git a/opcodes/fr30-asm.c b/opcodes/fr30-asm.c index 40f015ad035..be9c36c947c 100644 --- a/opcodes/fr30-asm.c +++ b/opcodes/fr30-asm.c @@ -571,7 +571,7 @@ parse_insn_normal (cd, insn, strp, fields) } /* We have an operand of some sort. */ - errmsg = fr30_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), + errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), &str, fields); if (errmsg) return errmsg; diff --git a/opcodes/fr30-desc.c b/opcodes/fr30-desc.c index fd6afee7d2d..18963b9f168 100644 --- a/opcodes/fr30-desc.c +++ b/opcodes/fr30-desc.c @@ -1747,10 +1747,43 @@ void fr30_cgen_cpu_close (cd) CGEN_CPU_DESC cd; { + unsigned int i; + CGEN_INSN *insns; + + if (cd->macro_insn_table.init_entries) + { + insns = cd->macro_insn_table.init_entries; + for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX ((insns))) + regfree(CGEN_INSN_RX (insns)); + } + } + + if (cd->insn_table.init_entries) + { + insns = cd->insn_table.init_entries; + for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX (insns)) + regfree(CGEN_INSN_RX (insns)); + } + } + + + + if (cd->macro_insn_table.init_entries) + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + if (cd->insn_table.init_entries) free ((CGEN_INSN *) cd->insn_table.init_entries); + if (cd->hw_table.entries) free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + + if (cd->operand_table.entries) + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); + free (cd); } diff --git a/opcodes/fr30-dis.c b/opcodes/fr30-dis.c index 961ce220290..7affa860f4f 100644 --- a/opcodes/fr30-dis.c +++ b/opcodes/fr30-dis.c @@ -632,11 +632,21 @@ default_print_insn (cd, pc, info) Print one instruction from PC on INFO->STREAM. Return the size of the instruction (in bytes). */ +typedef struct cpu_desc_list { + struct cpu_desc_list *next; + int isa; + int mach; + int endian; + CGEN_CPU_DESC cd; +} cpu_desc_list; + int print_insn_fr30 (pc, info) bfd_vma pc; disassemble_info *info; { + static cpu_desc_list *cd_list = 0; + cpu_desc_list *cl = 0; static CGEN_CPU_DESC cd = 0; static int prev_isa; static int prev_mach; @@ -667,18 +677,27 @@ print_insn_fr30 (pc, info) #ifdef CGEN_COMPUTE_ISA isa = CGEN_COMPUTE_ISA (info); #else - isa = 0; + isa = info->insn_sets; #endif - /* If we've switched cpu's, close the current table and open a new one. */ + /* If we've switched cpu's, try to find a handle we've used before */ if (cd && (isa != prev_isa || mach != prev_mach || endian != prev_endian)) { - fr30_cgen_cpu_close (cd); cd = 0; - } + for (cl = cd_list; cl; cl = cl->next) + { + if (cl->isa == isa && + cl->mach == mach && + cl->endian == endian) + { + cd = cl->cd; + break; + } + } + } /* If we haven't initialized yet, initialize the opcode table. */ if (! cd) @@ -699,6 +718,16 @@ print_insn_fr30 (pc, info) CGEN_CPU_OPEN_END); if (!cd) abort (); + + /* save this away for future reference */ + cl = xmalloc (sizeof (struct cpu_desc_list)); + cl->cd = cd; + cl->isa = isa; + cl->mach = mach; + cl->endian = endian; + cl->next = cd_list; + cd_list = cl; + fr30_cgen_init_dis (cd); } diff --git a/opcodes/h8300-dis.c b/opcodes/h8300-dis.c index c521c773fce..d14fda9858b 100644 --- a/opcodes/h8300-dis.c +++ b/opcodes/h8300-dis.c @@ -1,5 +1,6 @@ /* Disassemble h8300 instructions. - Copyright 1993, 1994, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright 1993, 1994, 1996, 1998, 2000, 2001, 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 @@ -69,17 +70,17 @@ bfd_h8_disassemble (addr, info, mode) int mode; { /* Find the first entry in the table for this opcode. */ - static CONST char *regnames[] = + static const char *regnames[] = { "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h", "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l" }; - static CONST char *wregnames[] = + static const char *wregnames[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7" }; - static CONST char *lregnames[] = + static const char *lregnames[] = { "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7", "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7" @@ -92,7 +93,7 @@ bfd_h8_disassemble (addr, info, mode) int plen = 0; static boolean init = 0; struct h8_opcode *q; - char CONST **pregnames = mode != 0 ? lregnames : wregnames; + char const **pregnames = mode != 0 ? lregnames : wregnames; int status; int l; unsigned char data[20]; diff --git a/opcodes/m32r-asm.c b/opcodes/m32r-asm.c index 718dd994ce1..4abe187b81f 100644 --- a/opcodes/m32r-asm.c +++ b/opcodes/m32r-asm.c @@ -573,7 +573,7 @@ parse_insn_normal (cd, insn, strp, fields) } /* We have an operand of some sort. */ - errmsg = m32r_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), + errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), &str, fields); if (errmsg) return errmsg; diff --git a/opcodes/m32r-desc.c b/opcodes/m32r-desc.c index 4acf72044c5..de7bde44fdc 100644 --- a/opcodes/m32r-desc.c +++ b/opcodes/m32r-desc.c @@ -1441,10 +1441,43 @@ void m32r_cgen_cpu_close (cd) CGEN_CPU_DESC cd; { + unsigned int i; + CGEN_INSN *insns; + + if (cd->macro_insn_table.init_entries) + { + insns = cd->macro_insn_table.init_entries; + for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX ((insns))) + regfree(CGEN_INSN_RX (insns)); + } + } + + if (cd->insn_table.init_entries) + { + insns = cd->insn_table.init_entries; + for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX (insns)) + regfree(CGEN_INSN_RX (insns)); + } + } + + + + if (cd->macro_insn_table.init_entries) + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + if (cd->insn_table.init_entries) free ((CGEN_INSN *) cd->insn_table.init_entries); + if (cd->hw_table.entries) free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + + if (cd->operand_table.entries) + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); + free (cd); } diff --git a/opcodes/m32r-dis.c b/opcodes/m32r-dis.c index 40d7679907e..07560e15ff5 100644 --- a/opcodes/m32r-dis.c +++ b/opcodes/m32r-dis.c @@ -563,11 +563,21 @@ default_print_insn (cd, pc, info) Print one instruction from PC on INFO->STREAM. Return the size of the instruction (in bytes). */ +typedef struct cpu_desc_list { + struct cpu_desc_list *next; + int isa; + int mach; + int endian; + CGEN_CPU_DESC cd; +} cpu_desc_list; + int print_insn_m32r (pc, info) bfd_vma pc; disassemble_info *info; { + static cpu_desc_list *cd_list = 0; + cpu_desc_list *cl = 0; static CGEN_CPU_DESC cd = 0; static int prev_isa; static int prev_mach; @@ -598,18 +608,27 @@ print_insn_m32r (pc, info) #ifdef CGEN_COMPUTE_ISA isa = CGEN_COMPUTE_ISA (info); #else - isa = 0; + isa = info->insn_sets; #endif - /* If we've switched cpu's, close the current table and open a new one. */ + /* If we've switched cpu's, try to find a handle we've used before */ if (cd && (isa != prev_isa || mach != prev_mach || endian != prev_endian)) { - m32r_cgen_cpu_close (cd); cd = 0; - } + for (cl = cd_list; cl; cl = cl->next) + { + if (cl->isa == isa && + cl->mach == mach && + cl->endian == endian) + { + cd = cl->cd; + break; + } + } + } /* If we haven't initialized yet, initialize the opcode table. */ if (! cd) @@ -630,6 +649,16 @@ print_insn_m32r (pc, info) CGEN_CPU_OPEN_END); if (!cd) abort (); + + /* save this away for future reference */ + cl = xmalloc (sizeof (struct cpu_desc_list)); + cl->cd = cd; + cl->isa = isa; + cl->mach = mach; + cl->endian = endian; + cl->next = cd_list; + cd_list = cl; + m32r_cgen_init_dis (cd); } diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c index 0e9afb02f9a..12c0b9460ef 100644 --- a/opcodes/m68k-dis.c +++ b/opcodes/m68k-dis.c @@ -1,6 +1,6 @@ /* Print Motorola 68k instructions. Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001 + 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "dis-asm.h" #include "floatformat.h" -#include +#include "libiberty.h" #include "opintl.h" #include "opcode/m68k.h" @@ -46,7 +46,7 @@ static int print_insn_arg PARAMS ((const char *, unsigned char *, unsigned char *, bfd_vma, disassemble_info *)); -CONST char * CONST fpcr_names[] = { +const char * const fpcr_names[] = { "", "%fpiar", "%fpsr", "%fpiar/%fpsr", "%fpcr", "%fpiar/%fpcr", "%fpsr/%fpcr", "%fpiar/%fpsr/%fpcr" }; @@ -478,7 +478,7 @@ print_insn_arg (d, buffer, p0, addr, info) register int place = d[1]; register unsigned char *p = p0; int regno; - register CONST char *regname; + register const char *regname; register unsigned char *p1; double flval; int flt_p; diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c index 9931a1882e1..b832ca2ce45 100644 --- a/opcodes/mips-dis.c +++ b/opcodes/mips-dis.c @@ -284,6 +284,53 @@ print_insn_arg (d, l, pc, info) (l >> OP_SH_SEL) & OP_MASK_SEL); break; + case 'O': + (*info->fprintf_func) (info->stream, "%d", + (l >> OP_SH_ALN) & OP_MASK_ALN); + break; + + case 'Q': + { + unsigned int vsel = (l >> OP_SH_VSEL) & OP_MASK_VSEL; + if ((vsel & 0x10) == 0) + { + int fmt; + vsel &= 0x0f; + for (fmt = 0; fmt < 3; fmt++, vsel >>= 1) + if ((vsel & 1) == 0) + break; + (*info->fprintf_func) (info->stream, "$v%d[%d]", + (l >> OP_SH_FT) & OP_MASK_FT, + vsel >> 1); + } + else if ((vsel & 0x08) == 0) + { + (*info->fprintf_func) (info->stream, "$v%d", + (l >> OP_SH_FT) & OP_MASK_FT); + } + else + { + (*info->fprintf_func) (info->stream, "0x%x", + (l >> OP_SH_FT) & OP_MASK_FT); + } + } + break; + + case 'X': + (*info->fprintf_func) (info->stream, "$v%d", + (l >> OP_SH_FD) & OP_MASK_FD); + break; + + case 'Y': + (*info->fprintf_func) (info->stream, "$v%d", + (l >> OP_SH_FS) & OP_MASK_FS); + break; + + case 'Z': + (*info->fprintf_func) (info->stream, "$v%d", + (l >> OP_SH_FT) & OP_MASK_FT); + break; + default: /* xgettext:c-format */ (*info->fprintf_func) (info->stream, @@ -378,8 +425,8 @@ mips_isa_type (mach, isa, cputype) case bfd_mach_mipsisa32: *cputype = CPU_MIPS32; /* For stock MIPS32, disassemble all applicable MIPS-specified ASEs. - Note that MIPS-3D is not applicable to MIPS32. (See _MIPS32 - Architecture For Programmers Volume I: Introduction to the + Note that MIPS-3D and MDMX are not applicable to MIPS32. (See + _MIPS32 Architecture For Programmers Volume I: Introduction to the MIPS32 Architecture_ (MIPS Document Number MD00082, Revision 0.95), page 1. */ *isa = ISA_MIPS32; @@ -387,7 +434,7 @@ mips_isa_type (mach, isa, cputype) case bfd_mach_mipsisa64: *cputype = CPU_MIPS64; /* For stock MIPS64, disassemble all applicable MIPS-specified ASEs. */ - *isa = ISA_MIPS64 | INSN_MIPS3D; + *isa = ISA_MIPS64 | INSN_MDMX | INSN_MIPS3D; break; default: @@ -407,10 +454,8 @@ is_newabi (header) if (header->e_ident[EI_CLASS] == ELFCLASS64) return 1; - /* If a 32-bit ELF file, N32, EABI32, and EABI64 are new-style ABIs. */ - if ((header->e_flags & EF_MIPS_ABI2) != 0 - || (header->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI32 - || (header->e_flags & EF_MIPS_ABI) == E_MIPS_ABI_EABI64) + /* If a 32-bit ELF file, n32 is a new-style ABI. */ + if ((header->e_flags & EF_MIPS_ABI2) != 0) return 1; return 0; diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c index d3776d6f445..cbf92230a9a 100644 --- a/opcodes/mips-opc.c +++ b/opcodes/mips-opc.c @@ -4,7 +4,7 @@ Contributed by Ralph Campbell and OSF Commented and modified by Ian Lance Taylor, Cygnus Support Extended for MIPS32 support by Anders Norlander, and by SiByte, Inc. - MIPS-3D support added by Broadcom Corporation (SiByte). + MIPS-3D and MDMX support added by Broadcom Corporation (SiByte). This file is part of GDB, GAS, and the GNU binutils. @@ -75,6 +75,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * #define IS_M INSN_MULT +#define WR_MACC INSN_WRITE_MDMX_ACC +#define RD_MACC INSN_READ_MDMX_ACC + #define I1 INSN_ISA1 #define I2 INSN_ISA2 #define I3 INSN_ISA3 @@ -86,6 +89,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * /* MIPS64 MIPS-3D ASE support. */ #define M3D INSN_MIPS3D +/* MIPS64 MDMX ASE support. */ +#define MX INSN_MDMX + #define P3 INSN_4650 #define L1 INSN_4010 #define V1 INSN_4100 @@ -144,15 +150,27 @@ const struct mips_opcode mips_builtin_opcodes[] = {"add", "t,r,I", 0, (int) M_ADD_I, INSN_MACRO, I1 }, {"add.s", "D,V,T", 0x46000000, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 }, {"add.d", "D,V,T", 0x46200000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 }, +{"add.ob", "X,Y,Q", 0x7800000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, {"add.ps", "D,V,T", 0x46c00000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, +{"add.qh", "X,Y,Q", 0x7820000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"adda.ob", "Y,Q", 0x78000037, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"adda.qh", "Y,Q", 0x78200037, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"addi", "t,r,j", 0x20000000, 0xfc000000, WR_t|RD_s, I1 }, {"addiu", "t,r,j", 0x24000000, 0xfc000000, WR_t|RD_s, I1 }, +{"addl.ob", "Y,Q", 0x78000437, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"addl.qh", "Y,Q", 0x78200437, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"addr.ps", "D,S,T", 0x46c00018, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D }, {"addu", "d,v,t", 0x00000021, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"addu", "t,r,I", 0, (int) M_ADDU_I, INSN_MACRO, I1 }, +{"alni.ob", "X,Y,Z,O", 0x78000018, 0xff00003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"alni.qh", "X,Y,Z,O", 0x7800001a, 0xff00003f, WR_D|RD_S|RD_T|FP_D, MX }, {"alnv.ps", "D,V,T,s", 0x4c00001e, 0xfc00003f, WR_D|RD_S|RD_T|FP_D, I5 }, +{"alnv.ob", "X,Y,Z,s", 0x78000019, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, MX|SB1 }, +{"alnv.qh", "X,Y,Z,s", 0x7800001b, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, MX }, {"and", "d,v,t", 0x00000024, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"and", "t,r,I", 0, (int) M_AND_I, INSN_MACRO, I1 }, +{"and.ob", "X,Y,Q", 0x7800000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"and.qh", "X,Y,Q", 0x7820000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"andi", "t,r,i", 0x30000000, 0xfc000000, WR_t|RD_s, I1 }, /* b is at the top of the table. */ /* bal is at the top of the table. */ @@ -256,8 +274,10 @@ const struct mips_opcode mips_builtin_opcodes[] = {"c.eq.d", "M,S,T", 0x46200032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 }, {"c.eq.s", "S,T", 0x46000032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, {"c.eq.s", "M,S,T", 0x46000032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 }, +{"c.eq.ob", "Y,Q", 0x78000001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 }, {"c.eq.ps", "S,T", 0x46c00032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.eq.ps", "M,S,T", 0x46c00032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 }, +{"c.eq.qh", "Y,Q", 0x78200001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX }, {"c.ueq.d", "S,T", 0x46200033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I1 }, {"c.ueq.d", "M,S,T", 0x46200033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 }, {"c.ueq.s", "S,T", 0x46000033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, @@ -316,8 +336,10 @@ const struct mips_opcode mips_builtin_opcodes[] = {"c.lt.d", "M,S,T", 0x4620003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 }, {"c.lt.s", "S,T", 0x4600003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, {"c.lt.s", "M,S,T", 0x4600003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 }, +{"c.lt.ob", "Y,Q", 0x78000004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 }, {"c.lt.ps", "S,T", 0x46c0003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.lt.ps", "M,S,T", 0x46c0003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 }, +{"c.lt.qh", "Y,Q", 0x78200004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX }, {"c.nge.d", "S,T", 0x4620003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I1 }, {"c.nge.d", "M,S,T", 0x4620003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 }, {"c.nge.s", "S,T", 0x4600003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, @@ -328,8 +350,10 @@ const struct mips_opcode mips_builtin_opcodes[] = {"c.le.d", "M,S,T", 0x4620003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 }, {"c.le.s", "S,T", 0x4600003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, {"c.le.s", "M,S,T", 0x4600003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, I4|I32 }, +{"c.le.ob", "Y,Q", 0x78000005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX|SB1 }, {"c.le.ps", "S,T", 0x46c0003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I5 }, {"c.le.ps", "M,S,T", 0x46c0003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I5 }, +{"c.le.qh", "Y,Q", 0x78200005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, MX }, {"c.ngt.d", "S,T", 0x4620003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, I1 }, {"c.ngt.d", "M,S,T", 0x4620003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, I4|I32 }, {"c.ngt.s", "S,T", 0x4600003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, I1 }, @@ -492,6 +516,10 @@ const struct mips_opcode mips_builtin_opcodes[] = {"dremu", "z,s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, I3 }, {"dremu", "d,v,t", 3, (int) M_DREMU_3, INSN_MACRO, I3 }, {"dremu", "d,v,I", 3, (int) M_DREMU_3I, INSN_MACRO, I3 }, +{"drol", "d,v,t", 0, (int) M_DROL, INSN_MACRO, I3 }, +{"drol", "d,v,I", 0, (int) M_DROL_I, INSN_MACRO, I3 }, +{"dror", "d,v,t", 0, (int) M_DROR, INSN_MACRO, I3 }, +{"dror", "d,v,I", 0, (int) M_DROR_I, INSN_MACRO, I3 }, {"dsllv", "d,t,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, I3 }, {"dsll32", "d,w,<", 0x0000003c, 0xffe0003f, WR_d|RD_t, I3 }, {"dsll", "d,w,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, I3 }, /* dsllv */ @@ -622,6 +650,8 @@ const struct mips_opcode mips_builtin_opcodes[] = {"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, G1 }, {"maddu", "d,s,t", 0x70000001, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 }, {"madd16", "s,t", 0x00000028, 0xfc00ffff, RD_s|RD_t|MOD_HILO, V1 }, +{"max.ob", "X,Y,Q", 0x78000007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"max.qh", "X,Y,Q", 0x78200007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"mfpc", "t,P", 0x4000c801, 0xffe0ffc1, LCD|WR_t|RD_C0, M1 }, {"mfps", "t,P", 0x4000c800, 0xffe0ffc1, LCD|WR_t|RD_C0, M1 }, {"mfc0", "t,G", 0x40000000, 0xffe007ff, LCD|WR_t|RD_C0, I1 }, @@ -634,28 +664,39 @@ const struct mips_opcode mips_builtin_opcodes[] = {"mfc3", "t,G,H", 0x4c000000, 0xffe007f8, LCD|WR_t|RD_C3, I32 }, {"mfhi", "d", 0x00000010, 0xffff07ff, WR_d|RD_HI, I1 }, {"mflo", "d", 0x00000012, 0xffff07ff, WR_d|RD_LO, I1 }, +{"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"min.qh", "X,Y,Q", 0x78200006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"mov.d", "D,S", 0x46200006, 0xffff003f, WR_D|RD_S|FP_D, I1 }, {"mov.s", "D,S", 0x46000006, 0xffff003f, WR_D|RD_S|FP_S, I1 }, {"mov.ps", "D,S", 0x46c00006, 0xffff003f, WR_D|RD_S|FP_D, I5 }, {"movf", "d,s,N", 0x00000001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_D|FP_S, I4|I32}, {"movf.d", "D,S,N", 0x46200011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I4|I32 }, +{"movf.l", "D,S,N", 0x46a00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 }, +{"movf.l", "X,Y,N", 0x46a00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 }, {"movf.s", "D,S,N", 0x46000011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S, I4|I32 }, {"movf.ps", "D,S,N", 0x46c00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I5 }, {"movn", "d,v,t", 0x0000000b, 0xfc0007ff, WR_d|RD_s|RD_t, I4|I32 }, {"ffc", "d,v", 0x0000000b, 0xfc1f07ff, WR_d|RD_s, L1 }, {"movn.d", "D,S,t", 0x46200013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I4|I32 }, +{"movn.l", "D,S,t", 0x46a00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 }, +{"movn.l", "X,Y,t", 0x46a00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 }, {"movn.s", "D,S,t", 0x46000013, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, I4|I32 }, {"movn.ps", "D,S,t", 0x46c00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I5 }, {"movt", "d,s,N", 0x00010001, 0xfc0307ff, WR_d|RD_s|RD_CC, I4|I32 }, {"movt.d", "D,S,N", 0x46210011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I4|I32 }, +{"movt.l", "D,S,N", 0x46a10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 }, +{"movt.l", "X,Y,N", 0x46a10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, MX|SB1 }, {"movt.s", "D,S,N", 0x46010011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S, I4|I32 }, {"movt.ps", "D,S,N", 0x46c10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, I5 }, {"movz", "d,v,t", 0x0000000a, 0xfc0007ff, WR_d|RD_s|RD_t, I4|I32 }, {"ffs", "d,v", 0x0000000a, 0xfc1f07ff, WR_d|RD_s, L1 }, {"movz.d", "D,S,t", 0x46200012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I4|I32 }, +{"movz.l", "D,S,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 }, +{"movz.l", "X,Y,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, MX|SB1 }, {"movz.s", "D,S,t", 0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, I4|I32 }, {"movz.ps", "D,S,t", 0x46c00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, I5 }, /* move is at the top of the table. */ +{"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I4 }, {"msub.s", "D,R,S,T", 0x4c000028, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, I4 }, {"msub.ps", "D,R,S,T", 0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, I5 }, @@ -677,15 +718,25 @@ const struct mips_opcode mips_builtin_opcodes[] = {"mtlo", "s", 0x00000013, 0xfc1fffff, RD_s|WR_LO, I1 }, {"mul.d", "D,V,T", 0x46200002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 }, {"mul.s", "D,V,T", 0x46000002, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 }, +{"mul.ob", "X,Y,Q", 0x78000030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, {"mul.ps", "D,V,T", 0x46c00002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, +{"mul.qh", "X,Y,Q", 0x78200030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"mul", "d,v,t", 0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, I32|P3 }, {"mul", "d,v,t", 0, (int) M_MUL, INSN_MACRO, I1 }, {"mul", "d,v,I", 0, (int) M_MUL_I, INSN_MACRO, I1 }, +{"mula.ob", "Y,Q", 0x78000033, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"mula.qh", "Y,Q", 0x78200033, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, +{"mull.ob", "Y,Q", 0x78000433, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"mull.qh", "Y,Q", 0x78200433, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"mulo", "d,v,t", 0, (int) M_MULO, INSN_MACRO, I1 }, {"mulo", "d,v,I", 0, (int) M_MULO_I, INSN_MACRO, I1 }, {"mulou", "d,v,t", 0, (int) M_MULOU, INSN_MACRO, I1 }, {"mulou", "d,v,I", 0, (int) M_MULOU_I, INSN_MACRO, I1 }, {"mulr.ps", "D,S,T", 0x46c0001a, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D }, +{"muls.ob", "Y,Q", 0x78000032, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"muls.qh", "Y,Q", 0x78200032, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, +{"mulsl.ob", "Y,Q", 0x78000432, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"mulsl.qh", "Y,Q", 0x78200432, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"mult", "s,t", 0x00000018, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1 }, {"mult", "d,s,t", 0x00000018, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, G1 }, {"multu", "s,t", 0x00000019, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, I1 }, @@ -704,19 +755,32 @@ const struct mips_opcode mips_builtin_opcodes[] = /* nop is at the start of the table. */ {"nor", "d,v,t", 0x00000027, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"nor", "t,r,I", 0, (int) M_NOR_I, INSN_MACRO, I1 }, +{"nor.ob", "X,Y,Q", 0x7800000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"nor.qh", "X,Y,Q", 0x7820000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"not", "d,v", 0x00000027, 0xfc1f07ff, WR_d|RD_s|RD_t, I1 },/*nor d,s,0*/ {"or", "d,v,t", 0x00000025, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"or", "t,r,I", 0, (int) M_OR_I, INSN_MACRO, I1 }, +{"or.ob", "X,Y,Q", 0x7800000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"or.qh", "X,Y,Q", 0x7820000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"ori", "t,r,i", 0x34000000, 0xfc000000, WR_t|RD_s, I1 }, - +{"pabsdiff.ob", "X,Y,Q",0x78000009, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, SB1 }, +{"pabsdiffc.ob", "Y,Q", 0x78000035, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, SB1 }, +{"pavg.ob", "X,Y,Q", 0x78000008, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, SB1 }, +{"pickf.ob", "X,Y,Q", 0x78000002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"pickf.qh", "X,Y,Q", 0x78200002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"pickt.ob", "X,Y,Q", 0x78000003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"pickt.qh", "X,Y,Q", 0x78200003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"pll.ps", "D,V,T", 0x46c0002c, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"plu.ps", "D,V,T", 0x46c0002d, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, - /* pref and prefx are at the start of the table. */ - {"pul.ps", "D,V,T", 0x46c0002e, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, {"puu.ps", "D,V,T", 0x46c0002f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, - +{"rach.ob", "X", 0x7a00003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 }, +{"rach.qh", "X", 0x7a20003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX }, +{"racl.ob", "X", 0x7800003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 }, +{"racl.qh", "X", 0x7820003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX }, +{"racm.ob", "X", 0x7900003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX|SB1 }, +{"racm.qh", "X", 0x7920003f, 0xfffff83f, WR_D|RD_MACC|FP_D, MX }, {"recip.d", "D,S", 0x46200015, 0xffff003f, WR_D|RD_S|FP_D, I4 }, {"recip.ps","D,S", 0x46c00015, 0xffff003f, WR_D|RD_S|FP_D, SB1 }, {"recip.s", "D,S", 0x46000015, 0xffff003f, WR_D|RD_S|FP_S, I4 }, @@ -733,6 +797,12 @@ const struct mips_opcode mips_builtin_opcodes[] = {"remu", "d,v,t", 0, (int) M_REMU_3, INSN_MACRO, I1 }, {"remu", "d,v,I", 0, (int) M_REMU_3I, INSN_MACRO, I1 }, {"rfe", "", 0x42000010, 0xffffffff, 0, I1|T3 }, +{"rnas.qh", "X,Q", 0x78200025, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, +{"rnau.ob", "X,Q", 0x78000021, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 }, +{"rnau.qh", "X,Q", 0x78200021, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, +{"rnes.qh", "X,Q", 0x78200026, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, +{"rneu.ob", "X,Q", 0x78000022, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 }, +{"rneu.qh", "X,Q", 0x78200022, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, {"rol", "d,v,t", 0, (int) M_ROL, INSN_MACRO, I1 }, {"rol", "d,v,I", 0, (int) M_ROL_I, INSN_MACRO, I1 }, {"ror", "d,v,t", 0, (int) M_ROR, INSN_MACRO, I1 }, @@ -750,6 +820,9 @@ const struct mips_opcode mips_builtin_opcodes[] = {"rsqrt2.d", "D,S,T", 0x4620001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, M3D }, {"rsqrt2.ps", "D,S,T", 0x46c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, M3D }, {"rsqrt2.s", "D,S,T", 0x4600001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, M3D }, +{"rzs.qh", "X,Q", 0x78200024, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, +{"rzu.ob", "X,Q", 0x78000020, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX|SB1 }, +{"rzu.qh", "X,Q", 0x78200020, 0xfc20f83f, WR_D|RD_MACC|RD_T|FP_D, MX }, {"sb", "t,o(b)", 0xa0000000, 0xfc000000, SM|RD_t|RD_b, I1 }, {"sb", "t,A(b)", 0, (int) M_SB_AB, INSN_MACRO, I1 }, {"sc", "t,o(b)", 0xe0000000, 0xfc000000, SM|RD_t|WR_t|RD_b, I2 }, @@ -794,6 +867,16 @@ const struct mips_opcode mips_builtin_opcodes[] = {"sgtu", "d,v,I", 0, (int) M_SGTU_I, INSN_MACRO, I1 }, {"sh", "t,o(b)", 0xa4000000, 0xfc000000, SM|RD_t|RD_b, I1 }, {"sh", "t,A(b)", 0, (int) M_SH_AB, INSN_MACRO, I1 }, +{"shfl.bfla.qh", "X,Y,Z", 0x7a20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.mixh.ob", "X,Y,Z", 0x7980001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"shfl.mixh.qh", "X,Y,Z", 0x7820001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.mixl.ob", "X,Y,Z", 0x79c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"shfl.mixl.qh", "X,Y,Z", 0x78a0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.pach.ob", "X,Y,Z", 0x7900001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"shfl.pach.qh", "X,Y,Z", 0x7920001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.repa.qh", "X,Y,Z", 0x7b20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.repb.qh", "X,Y,Z", 0x7ba0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"shfl.upsl.ob", "X,Y,Z", 0x78c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, {"sle", "d,v,t", 0, (int) M_SLE, INSN_MACRO, I1 }, {"sle", "d,v,I", 0, (int) M_SLE_I, INSN_MACRO, I1 }, {"sleu", "d,v,t", 0, (int) M_SLEU, INSN_MACRO, I1 }, @@ -801,6 +884,8 @@ const struct mips_opcode mips_builtin_opcodes[] = {"sllv", "d,t,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, {"sll", "d,w,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* sllv */ {"sll", "d,w,<", 0x00000000, 0xffe0003f, WR_d|RD_t, I1 }, +{"sll.ob", "X,Y,Q", 0x78000010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"sll.qh", "X,Y,Q", 0x78200010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"slt", "d,v,t", 0x0000002a, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"slt", "d,v,I", 0, (int) M_SLT_I, INSN_MACRO, I1 }, {"slti", "t,r,j", 0x28000000, 0xfc000000, WR_t|RD_s, I1 }, @@ -815,16 +900,25 @@ const struct mips_opcode mips_builtin_opcodes[] = {"srav", "d,t,s", 0x00000007, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, {"sra", "d,w,s", 0x00000007, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* srav */ {"sra", "d,w,<", 0x00000003, 0xffe0003f, WR_d|RD_t, I1 }, +{"sra.qh", "X,Y,Q", 0x78200013, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, {"srlv", "d,t,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, {"srl", "d,w,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, I1 }, /* srlv */ {"srl", "d,w,<", 0x00000002, 0xffe0003f, WR_d|RD_t, I1 }, +{"srl.ob", "X,Y,Q", 0x78000012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"srl.qh", "X,Y,Q", 0x78200012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, /* ssnop is at the start of the table. */ {"standby", "", 0x42000021, 0xffffffff, 0, V1 }, {"sub", "d,v,t", 0x00000022, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"sub", "d,v,I", 0, (int) M_SUB_I, INSN_MACRO, I1 }, {"sub.d", "D,V,T", 0x46200001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I1 }, {"sub.s", "D,V,T", 0x46000001, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, I1 }, +{"sub.ob", "X,Y,Q", 0x7800000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, {"sub.ps", "D,V,T", 0x46c00001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, I5 }, +{"sub.qh", "X,Y,Q", 0x7820000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"suba.ob", "Y,Q", 0x78000036, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"suba.qh", "Y,Q", 0x78200036, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, +{"subl.ob", "Y,Q", 0x78000436, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"subl.qh", "Y,Q", 0x78200436, 0xfc2007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"subu", "d,v,t", 0x00000023, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, {"subu", "d,v,I", 0, (int) M_SUBU_I, INSN_MACRO, I1 }, {"suspend", "", 0x42000022, 0xffffffff, 0, V1 }, @@ -913,13 +1007,20 @@ const struct mips_opcode mips_builtin_opcodes[] = {"ush", "t,A(b)", 0, (int) M_USH_A, INSN_MACRO, I1 }, {"usw", "t,o(b)", 0, (int) M_USW, INSN_MACRO, I1 }, {"usw", "t,A(b)", 0, (int) M_USW_A, INSN_MACRO, I1 }, -{"xor", "d,v,t", 0x00000026, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, -{"xor", "t,r,I", 0, (int) M_XOR_I, INSN_MACRO, I1 }, -{"xori", "t,r,i", 0x38000000, 0xfc000000, WR_t|RD_s, I1 }, +{"wach.ob", "Y", 0x7a00003e, 0xffff07ff, WR_MACC|RD_S|FP_D, MX|SB1 }, +{"wach.qh", "Y", 0x7a20003e, 0xffff07ff, WR_MACC|RD_S|FP_D, MX }, +{"wacl.ob", "Y,Z", 0x7800003e, 0xffe007ff, WR_MACC|RD_S|RD_T|FP_D, MX|SB1 }, +{"wacl.qh", "Y,Z", 0x7820003e, 0xffe007ff, WR_MACC|RD_S|RD_T|FP_D, MX }, {"wait", "", 0x42000020, 0xffffffff, TRAP, I3|I32 }, {"wait", "J", 0x42000020, 0xfe00003f, TRAP, I32 }, {"waiti", "", 0x42000020, 0xffffffff, TRAP, L1 }, {"wb", "o(b)", 0xbc040000, 0xfc1f0000, SM|RD_b, L1 }, +{"xor", "d,v,t", 0x00000026, 0xfc0007ff, WR_d|RD_s|RD_t, I1 }, +{"xor", "t,r,I", 0, (int) M_XOR_I, INSN_MACRO, I1 }, +{"xor.ob", "X,Y,Q", 0x7800000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX|SB1 }, +{"xor.qh", "X,Y,Q", 0x7820000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, MX }, +{"xori", "t,r,i", 0x38000000, 0xfc000000, WR_t|RD_s, I1 }, + /* No hazard protection on coprocessor instructions--they shouldn't change the state of the processor and if they do it's up to the user to put in nops as necessary. These are at the end so that the diff --git a/opcodes/openrisc-asm.c b/opcodes/openrisc-asm.c index 96a6c4d2b7b..d47659b8c8f 100644 --- a/opcodes/openrisc-asm.c +++ b/opcodes/openrisc-asm.c @@ -492,7 +492,7 @@ parse_insn_normal (cd, insn, strp, fields) } /* We have an operand of some sort. */ - errmsg = openrisc_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), + errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), &str, fields); if (errmsg) return errmsg; diff --git a/opcodes/openrisc-desc.c b/opcodes/openrisc-desc.c index e5eded9e73c..f66514c002b 100644 --- a/opcodes/openrisc-desc.c +++ b/opcodes/openrisc-desc.c @@ -1017,10 +1017,43 @@ void openrisc_cgen_cpu_close (cd) CGEN_CPU_DESC cd; { + unsigned int i; + CGEN_INSN *insns; + + if (cd->macro_insn_table.init_entries) + { + insns = cd->macro_insn_table.init_entries; + for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX ((insns))) + regfree(CGEN_INSN_RX (insns)); + } + } + + if (cd->insn_table.init_entries) + { + insns = cd->insn_table.init_entries; + for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX (insns)) + regfree(CGEN_INSN_RX (insns)); + } + } + + + + if (cd->macro_insn_table.init_entries) + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + if (cd->insn_table.init_entries) free ((CGEN_INSN *) cd->insn_table.init_entries); + if (cd->hw_table.entries) free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + + if (cd->operand_table.entries) + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); + free (cd); } diff --git a/opcodes/openrisc-dis.c b/opcodes/openrisc-dis.c index 628a86c8304..e6a7d6a9d85 100644 --- a/opcodes/openrisc-dis.c +++ b/opcodes/openrisc-dis.c @@ -450,11 +450,21 @@ default_print_insn (cd, pc, info) Print one instruction from PC on INFO->STREAM. Return the size of the instruction (in bytes). */ +typedef struct cpu_desc_list { + struct cpu_desc_list *next; + int isa; + int mach; + int endian; + CGEN_CPU_DESC cd; +} cpu_desc_list; + int print_insn_openrisc (pc, info) bfd_vma pc; disassemble_info *info; { + static cpu_desc_list *cd_list = 0; + cpu_desc_list *cl = 0; static CGEN_CPU_DESC cd = 0; static int prev_isa; static int prev_mach; @@ -485,18 +495,27 @@ print_insn_openrisc (pc, info) #ifdef CGEN_COMPUTE_ISA isa = CGEN_COMPUTE_ISA (info); #else - isa = 0; + isa = info->insn_sets; #endif - /* If we've switched cpu's, close the current table and open a new one. */ + /* If we've switched cpu's, try to find a handle we've used before */ if (cd && (isa != prev_isa || mach != prev_mach || endian != prev_endian)) { - openrisc_cgen_cpu_close (cd); cd = 0; - } + for (cl = cd_list; cl; cl = cl->next) + { + if (cl->isa == isa && + cl->mach == mach && + cl->endian == endian) + { + cd = cl->cd; + break; + } + } + } /* If we haven't initialized yet, initialize the opcode table. */ if (! cd) @@ -517,6 +536,16 @@ print_insn_openrisc (pc, info) CGEN_CPU_OPEN_END); if (!cd) abort (); + + /* save this away for future reference */ + cl = xmalloc (sizeof (struct cpu_desc_list)); + cl->cd = cd; + cl->isa = isa; + cl->mach = mach; + cl->endian = endian; + cl->next = cd_list; + cd_list = cl; + openrisc_cgen_init_dis (cd); } diff --git a/opcodes/or32-dis.c b/opcodes/or32-dis.c index 8876a303666..d5f467944d2 100644 --- a/opcodes/or32-dis.c +++ b/opcodes/or32-dis.c @@ -261,7 +261,7 @@ print_insn (memaddr, info) /* The four bytes of the instruction. */ unsigned long insn; find_byte_func_type find_byte_func = (find_byte_func_type)info->private_data; - struct or32_opcode CONST * opcode; + struct or32_opcode const * opcode; { int status = diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in index 0cb531b31b2..f247acb58e4 100644 --- a/opcodes/po/POTFILES.in +++ b/opcodes/po/POTFILES.in @@ -18,6 +18,7 @@ d30v-dis.c d30v-opc.c dis-buf.c disassemble.c +dlx-dis.c fr30-asm.c fr30-desc.c fr30-desc.h diff --git a/opcodes/sh-dis.c b/opcodes/sh-dis.c index 92d7139d224..24d4b41eaff 100644 --- a/opcodes/sh-dis.c +++ b/opcodes/sh-dis.c @@ -24,14 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sh-opc.h" #include "dis-asm.h" -#define LITTLE_BIT 2 - static void print_movxy PARAMS ((sh_opcode_info *, int, int, fprintf_ftype, void *)); static void print_insn_ddt PARAMS ((int, struct disassemble_info *)); static void print_dsp_reg PARAMS ((int, fprintf_ftype, void *)); static void print_insn_ppi PARAMS ((int, struct disassemble_info *)); -static int print_insn_shx PARAMS ((bfd_vma, struct disassemble_info *)); static void print_movxy (op, rn, rm, fprintf_fn, stream) @@ -286,8 +283,8 @@ print_insn_ppi (field_b, info) fprintf_fn (stream, ".word 0x%x", field_b); } -static int -print_insn_shx (memaddr, info) +int +print_insn_sh (memaddr, info) bfd_vma memaddr; struct disassemble_info *info; { @@ -304,6 +301,12 @@ print_insn_shx (memaddr, info) { case bfd_mach_sh: target_arch = arch_sh1; + /* SH coff object files lack information about the machine type, so + we end up with bfd_mach_sh unless it was set explicitly (which + could have happended if this is a call from gdb or the simulator.) */ + if (info->symbols + && bfd_asymbol_flavour(*info->symbols) == bfd_target_coff_flavour) + target_arch = arch_sh4; break; case bfd_mach_sh2: target_arch = arch_sh2; @@ -324,6 +327,11 @@ print_insn_shx (memaddr, info) target_arch = arch_sh4; break; case bfd_mach_sh5: +#ifdef INCLUDE_SHMEDIA + status = print_insn_sh64 (memaddr, info); + if (status != -2) + return status; +#endif /* When we get here for sh64, it's because we want to disassemble SHcompact, i.e. arch_sh4. */ target_arch = arch_sh4; @@ -340,7 +348,7 @@ print_insn_shx (memaddr, info) return -1; } - if (info->flags & LITTLE_BIT) + if (info->endian == BFD_ENDIAN_LITTLE) { nibs[0] = (insn[1] >> 4) & 0xf; nibs[1] = insn[1] & 0xf; @@ -371,7 +379,7 @@ print_insn_shx (memaddr, info) return -1; } - if (info->flags & LITTLE_BIT) + if (info->endian == BFD_ENDIAN_LITTLE) field_b = insn[1] << 8 | insn[0]; else field_b = insn[0] << 8 | insn[1]; @@ -677,7 +685,7 @@ print_insn_shx (memaddr, info) { info->flags |= 1; fprintf_fn (stream, "\t(slot "); - print_insn_shx (memaddr + 2, info); + print_insn_sh (memaddr + 2, info); info->flags &= ~1; fprintf_fn (stream, ")"); return 4; @@ -700,14 +708,14 @@ print_insn_shx (memaddr, info) if (size == 2) { - if ((info->flags & LITTLE_BIT) != 0) + if (info->endian == BFD_ENDIAN_LITTLE) val = bfd_getl16 (bytes); else val = bfd_getb16 (bytes); } else { - if ((info->flags & LITTLE_BIT) != 0) + if (info->endian == BFD_ENDIAN_LITTLE) val = bfd_getl32 (bytes); else val = bfd_getb32 (bytes); @@ -724,27 +732,3 @@ print_insn_shx (memaddr, info) fprintf_fn (stream, ".word 0x%x%x%x%x", nibs[0], nibs[1], nibs[2], nibs[3]); return 2; } - -int -print_insn_shl (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - int r; - - info->flags = LITTLE_BIT; - r = print_insn_shx (memaddr, info); - return r; -} - -int -print_insn_sh (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - int r; - - info->flags = 0; - r = print_insn_shx (memaddr, info); - return r; -} diff --git a/opcodes/sh64-dis.c b/opcodes/sh64-dis.c index 2c760673bd2..10c0f3102e8 100644 --- a/opcodes/sh64-dis.c +++ b/opcodes/sh64-dis.c @@ -55,10 +55,6 @@ static unsigned long *shmedia_opcode_mask_table; static void initialize_shmedia_opcode_mask_table PARAMS ((void)); static int print_insn_shmedia PARAMS ((bfd_vma, disassemble_info *)); -static int print_insn_sh64x - PARAMS ((bfd_vma, disassemble_info *, - int (*) PARAMS ((bfd_vma, struct disassemble_info *)), - enum bfd_endian)); static const char *creg_name PARAMS ((int)); static boolean init_sh64_disasm_info PARAMS ((struct disassemble_info *)); static enum sh64_elf_cr_type sh64_get_contents_type_disasm @@ -555,15 +551,15 @@ print_insn_sh64x_media (memaddr, info) return print_insn_shmedia (memaddr, info); } -/* Main entry to disassemble SHcompact or SHmedia insns. */ +/* Main entry to disassemble SHmedia insns. + If we see an SHcompact instruction, return -2. */ -static int -print_insn_sh64x (memaddr, info, pfun_compact, endian) +int +print_insn_sh64 (memaddr, info) bfd_vma memaddr; struct disassemble_info *info; - int (*pfun_compact) PARAMS ((bfd_vma, struct disassemble_info *)); - enum bfd_endian endian; { + enum bfd_endian endian = info->endian; enum sh64_elf_cr_type cr_type; if (info->private_data == NULL && ! init_sh64_disasm_info (info)) @@ -575,6 +571,10 @@ print_insn_sh64x (memaddr, info, pfun_compact, endian) int length = 4 - (memaddr % 4); info->display_endian = endian; + /* If we got an uneven address to indicate SHmedia, adjust it. */ + if (cr_type == CRT_SH5_ISA32 && length == 3) + memaddr--, length = 4; + /* Only disassemble on four-byte boundaries. Addresses that are not a multiple of four can happen after a data region. */ if (cr_type == CRT_SH5_ISA32 && length == 4) @@ -633,27 +633,6 @@ print_insn_sh64x (memaddr, info, pfun_compact, endian) } } - return (*pfun_compact) (memaddr, info); -} - -/* Main entry to disassemble SHcompact or SHmedia insns, big endian. */ - -int -print_insn_sh64 (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - return - print_insn_sh64x (memaddr, info, print_insn_sh, BFD_ENDIAN_BIG); -} - -/* Main entry to disassemble SHcompact or SHmedia insns, little endian. */ - -int -print_insn_sh64l (memaddr, info) - bfd_vma memaddr; - struct disassemble_info *info; -{ - return - print_insn_sh64x (memaddr, info, print_insn_shl, BFD_ENDIAN_LITTLE); + /* SH1 .. SH4 instruction, let caller handle it. */ + return -2; } diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c index 4c59398d54d..47ebb313744 100644 --- a/opcodes/sparc-dis.c +++ b/opcodes/sparc-dis.c @@ -1,6 +1,6 @@ /* Print SPARC instructions. Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000 Free Software Foundation, Inc. + 2000, 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 @@ -188,7 +188,7 @@ is_delayed_branch (insn) for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next) { - CONST struct sparc_opcode *opcode = op->opcode; + const struct sparc_opcode *opcode = op->opcode; if ((opcode->match & insn) == opcode->match && (opcode->lose & insn) == 0) return (opcode->flags & F_DELAYED); @@ -272,7 +272,7 @@ print_insn_sparc (memaddr, info) for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next) { - CONST struct sparc_opcode *opcode = op->opcode; + const struct sparc_opcode *opcode = op->opcode; /* If the insn isn't supported by the current architecture, skip it. */ if (! (opcode->architecture & current_arch_mask)) @@ -312,7 +312,7 @@ print_insn_sparc (memaddr, info) (*info->fprintf_func) (stream, opcode->name); { - register CONST char *s; + register const char *s; if (opcode->args[0] != ',') (*info->fprintf_func) (stream, " "); diff --git a/opcodes/xstormy16-asm.c b/opcodes/xstormy16-asm.c index 3f26b18562c..047339dadd8 100644 --- a/opcodes/xstormy16-asm.c +++ b/opcodes/xstormy16-asm.c @@ -479,7 +479,7 @@ parse_insn_normal (cd, insn, strp, fields) } /* We have an operand of some sort. */ - errmsg = xstormy16_cgen_parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), + errmsg = cd->parse_operand (cd, CGEN_SYNTAX_FIELD (*syn), &str, fields); if (errmsg) return errmsg; diff --git a/opcodes/xstormy16-desc.c b/opcodes/xstormy16-desc.c index 41da91ba9c7..0c506252e45 100644 --- a/opcodes/xstormy16-desc.c +++ b/opcodes/xstormy16-desc.c @@ -1458,10 +1458,43 @@ void xstormy16_cgen_cpu_close (cd) CGEN_CPU_DESC cd; { + unsigned int i; + CGEN_INSN *insns; + + if (cd->macro_insn_table.init_entries) + { + insns = cd->macro_insn_table.init_entries; + for (i = 0; i < cd->macro_insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX ((insns))) + regfree(CGEN_INSN_RX (insns)); + } + } + + if (cd->insn_table.init_entries) + { + insns = cd->insn_table.init_entries; + for (i = 0; i < cd->insn_table.num_init_entries; ++i, ++insns) + { + if (CGEN_INSN_RX (insns)) + regfree(CGEN_INSN_RX (insns)); + } + } + + + + if (cd->macro_insn_table.init_entries) + free ((CGEN_INSN *) cd->macro_insn_table.init_entries); + if (cd->insn_table.init_entries) free ((CGEN_INSN *) cd->insn_table.init_entries); + if (cd->hw_table.entries) free ((CGEN_HW_ENTRY *) cd->hw_table.entries); + + if (cd->operand_table.entries) + free ((CGEN_HW_ENTRY *) cd->operand_table.entries); + free (cd); } diff --git a/opcodes/xstormy16-dis.c b/opcodes/xstormy16-dis.c index bd6c593f494..f3cc8e6327a 100644 --- a/opcodes/xstormy16-dis.c +++ b/opcodes/xstormy16-dis.c @@ -483,11 +483,21 @@ default_print_insn (cd, pc, info) Print one instruction from PC on INFO->STREAM. Return the size of the instruction (in bytes). */ +typedef struct cpu_desc_list { + struct cpu_desc_list *next; + int isa; + int mach; + int endian; + CGEN_CPU_DESC cd; +} cpu_desc_list; + int print_insn_xstormy16 (pc, info) bfd_vma pc; disassemble_info *info; { + static cpu_desc_list *cd_list = 0; + cpu_desc_list *cl = 0; static CGEN_CPU_DESC cd = 0; static int prev_isa; static int prev_mach; @@ -518,18 +528,27 @@ print_insn_xstormy16 (pc, info) #ifdef CGEN_COMPUTE_ISA isa = CGEN_COMPUTE_ISA (info); #else - isa = 0; + isa = info->insn_sets; #endif - /* If we've switched cpu's, close the current table and open a new one. */ + /* If we've switched cpu's, try to find a handle we've used before */ if (cd && (isa != prev_isa || mach != prev_mach || endian != prev_endian)) { - xstormy16_cgen_cpu_close (cd); cd = 0; - } + for (cl = cd_list; cl; cl = cl->next) + { + if (cl->isa == isa && + cl->mach == mach && + cl->endian == endian) + { + cd = cl->cd; + break; + } + } + } /* If we haven't initialized yet, initialize the opcode table. */ if (! cd) @@ -550,6 +569,16 @@ print_insn_xstormy16 (pc, info) CGEN_CPU_OPEN_END); if (!cd) abort (); + + /* save this away for future reference */ + cl = xmalloc (sizeof (struct cpu_desc_list)); + cl->cd = cd; + cl->isa = isa; + cl->mach = mach; + cl->endian = endian; + cl->next = cd_list; + cd_list = cl; + xstormy16_cgen_init_dis (cd); } diff --git a/sim/ChangeLog b/sim/ChangeLog index 0376c56aea8..2a1bb25790a 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,16 @@ +Thu Jun 6 12:34:13 2002 Andrew Cagney + + * Makefile.in (ChangeLog): New makefile variable. + * README-HACKING: Mention the ChangeLog makefile variable. + +2002-06-01 Andrew Cagney + + * tic80/: Delete directory. + +2002-05-16 Stephane Carrez + + * MAINTAINERS: Update my email address. + 2002-03-06 Stephane Carrez * MAINTAINERS: Record self as maintainer of m68hc11 simulator. diff --git a/sim/MAINTAINERS b/sim/MAINTAINERS index ac5073f7697..9615a13bb07 100644 --- a/sim/MAINTAINERS +++ b/sim/MAINTAINERS @@ -12,7 +12,7 @@ gdb-patches@sources.redhat.com arm Nick Clifton ppc Andrew Cagney ppc Geoff Keating -m68hc11 Stephane Carrez +m68hc11 Stephane Carrez mips Andrew Cagney mips Chris Demetriou common Ben Elliston diff --git a/sim/Makefile.in b/sim/Makefile.in index 1e53780fd5d..aebdab3b2ab 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -73,6 +73,10 @@ CC_FOR_BUILD = $(CC) # @target_makefile_frag@ ### +# Name of the ChangeLog file. +ChangeLog = ChangeLog + + RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \ echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \ fi` @@ -229,7 +233,7 @@ autoconf-changelog autoheader-changelog: do \ if [ -d $$d -a -f $$d/configure.in ] ; \ then \ - echo "Creating new-ChangeLog in $$d ..." ; \ + echo "Creating new-$(ChangeLog) in $$d ..." ; \ ( echo "$$date $$name <$$id@$$host>" ; \ echo "" ; \ echo " * configure: Regenerated to track ../common/aclocal.m4 changes." ; \ @@ -238,8 +242,8 @@ autoconf-changelog autoheader-changelog: echo " * config.in: Ditto." ; \ fi ; \ echo "" ; \ - cat $$d/ChangeLog \ - ) > $$d/new-ChangeLog ; \ + cat $$d/$(ChangeLog) \ + ) > $$d/new-$(ChangeLog) ; \ fi ; \ done @@ -248,7 +252,7 @@ autoconf-install autoheader-install: do \ if [ -d $$d -a -f $$d/configure.in ] ; \ then \ - echo "Moving $$d/new-ChangeLog to $$d/ChangeLog ..." ; \ - mv $$d/new-ChangeLog $$d/ChangeLog ; \ + echo "Moving $$d/new-$(ChangeLog) to $$d/$(ChangeLog) ..." ; \ + mv $$d/new-$(ChangeLog) $$d/$(ChangeLog) ; \ fi ; \ done diff --git a/sim/README-HACKING b/sim/README-HACKING index e4efeb155b0..bee504aa1e8 100644 --- a/sim/README-HACKING +++ b/sim/README-HACKING @@ -153,6 +153,11 @@ updated using the sequence: $ make -f Makefile.in SHELL=/bin/sh autoheader-changelog $ more */new-ChangeLog $ make -f Makefile.in SHELL=/bin/sh autoheader-install + +To add the entries to an alternative ChangeLog file, use: + + $ make ChangeLog=MyChangeLog .... + tconfig.in ========== diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index e10ef891d14..f9f7160adb2 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,86 @@ +2002-06-12 Andrew Cagney + + * Makefile.in: Update copyright. + (wrapper.o): Specify dependencies. + * wrapper.c: Include "gdb/sim-arm.h". + (sim_store_register, sim_fetch_register): Rewrite using `enum + arm_sim_regs' and a switch. + +2002-06-09 Andrew Cagney + + * wrapper.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + * armos.c: Include "gdb/callback.h". + +2002-05-29 Nick Clifton + + * armcopro.c (XScale_check_memacc): Set the FSR and FAR registers + if a Data Abort is detected. + +2002-05-27 Nick Clifton + + * armvirt.c (GetWord): Only perform access checks if 'check' + is set. + (PutWord): Likewise. + * wrapper.c (sim_create_inferior): Report unknown machine + numbers. + * thumbemu.c (ARMul_ThumbDecode, Case 31): Do not set LR to pc + + 2, it has already been advanced. + +2002-05-23 Nick Clifton + + * thumbemu.c (ARMul_ThumbDecode): When decoding a BLX(1) + instruction do not add in the second bit of the base address - + this has already been accounted for. + +2002-05-21 Nick Clifton + + * armcopro.c (check_cp13_access): Allow access to register 1 when + CRm is 1. + (write_cp13_reg): Allow bit 0 of reg 1 of CRm 1 to be written to. + +2002-05-20 Nick Clifton + + * Makefile.in (SWI_TARGET_SWITCHES): Define. + * armos.c (swi_mask): Define. Initialise to supporting all + SWI emulations. + (ARMul_OSInit): For XScale targets, only support the ANGEL + SWI interface. (This is at the request if Intel). + (ARMul_OSHandleSWI): Examine swi_mask to see if a particular + SWI call should be emulated. + Do not fall through from AngelSWI_Reason_WriteC. + Propagate exit code from RedBoot Exit SWI. + * rdi-dgb.h (swi_mask): Prototype. + (SWI_MASK_DEMON, SWI_MASK_ANGEL, SWI_MASK_REDBOOT): Define. + * wrapper.c: Include run-sim.h. + (sim_target_parse_command_line): New function. Look for and + handle --swi-support switch. + (sim_target_parse_arg_array): New function. Process an argv + array for parsing by sim_target_parse_command_line. + (sim_target_display_usage): New function. Describe syntax of + --swi-suppoort switch. + (sim_open): Add call to sim_target_parse_arg_array). + +2002-05-17 Nick Clifton + + * Makefile.in (SWI_TARGET_SWITCHES): Define. + * armos.c (swi_mask): Define. Initialise to supporting all + SWI emulations. + (ARMul_OSInit): For XScale targets, only support the ANGEL + SWI interface. (This is at the request if Intel). + (ARMul_OSHandleSWI): Examine swi_mask to see if a particular + SWI call should be emulated. + Do not fall through from AngelSWI_Reason_WriteC. + Propagate exit code from RedBoot Exit SWI. + * rdi-dgb.h (swi_mask): Prototype. + (SWI_MASK_DEMON, SWI_MASK_ANGEL, SWI_MASK_REDBOOT): Define. + * wrapper.c (sim_target_parse_command_line): New function. + Look for and handle --swi-support switch. + (sim_target_parse_arg_array): New function. Process an argv + array for parsing by sim_target_parse_command_line. + (sim_target_display_usage): New function. Describe syntax of + --swi-suppoort switch. + (sim_open): Add call to sim_target_parse_arg_array). + 2002-05-09 Nick Clifton * armos.c (ARMul_OSHandleSWI): Support the RedBoot SWI in ARM diff --git a/sim/arm/Makefile.in b/sim/arm/Makefile.in index cb7c0d90481..0da765fd703 100644 --- a/sim/arm/Makefile.in +++ b/sim/arm/Makefile.in @@ -1,5 +1,5 @@ # Makefile template for Configure for the arm sim library. -# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +# Copyright 1995, 1996, 1997, 2002 Free Software Foundation, Inc. # Written by Cygnus Support. # # This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ ## COMMON_PRE_CONFIG_FRAG -SIM_EXTRA_CFLAGS = -DMODET -DNEED_UI_LOOP_HOOK +SIM_EXTRA_CFLAGS = -DMODET -DNEED_UI_LOOP_HOOK -DSIM_TARGET_SWITCHES COPRO=@COPRO@ @@ -48,3 +48,9 @@ armsupp.o: armsupp.c armdefs.h armemu.h thumbemu.o: thumbemu.c armdefs.h armemu.h bag.o: bag.c bag.h + +wrapper.o: armdefs.h armemu.h dbg_rdi.h \ + $(srcdir)/../common/run-sim.h \ + $(srcdir)/../common/sim-utils.h \ + $(srcdir)/../../include/gdb/sim-arm.h \ + $(srcdir)/../../include/gdb/remote-sim.h diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c index 75c6bfca62b..2c2ca8505a6 100644 --- a/sim/arm/armcopro.c +++ b/sim/arm/armcopro.c @@ -85,7 +85,6 @@ XScale_cp15_init (ARMul_State * state ATTRIBUTE_UNUSED) /* Initialise the ARM Control Register. */ XScale_cp15_opcode_2_is_0_Regs[1] = 0x00000078; - } /* Check an access to a register. */ @@ -253,7 +252,7 @@ write_cp15_reg (ARMul_State * state, value &= 0x00003b87; value |= 0x00000078; - /* Change the endianness if necessary */ + /* Change the endianness if necessary. */ if ((value & ARMul_CP15_R1_ENDIAN) != (XScale_cp15_opcode_2_is_0_Regs [reg] & ARMul_CP15_R1_ENDIAN)) { @@ -475,12 +474,19 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store) /* Check for PID-ification. XXX BTB access support will require this test failing. */ r0 = (read_cp15_reg (13, 0, 0) & 0xfe000000); - if (r0 && (*address & 0xfe000000) == 0) - *address |= r0; + if (r0 && (* address & 0xfe000000) == 0) + * address |= r0; /* Check alignment fault enable/disable. */ - if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN) && (*address & 3)) - ARMul_Abort (state, ARMul_DataAbortV); + if ((read_cp15_reg (1, 0, 0) & ARMul_CP15_R1_ALIGN) && (* address & 3)) + { + /* Set the FSR and FAR. + Do not use XScale_set_fsr_far as this checks the DCSR register. */ + write_cp15_reg (state, 5, 0, 0, ARMul_CP15_R5_MMU_EXCPT); + write_cp15_reg (state, 6, 0, 0, * address); + + ARMul_Abort (state, ARMul_DataAbortV); + } if (XScale_debug_moe (state, -1)) return; @@ -495,7 +501,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store) { /* r1 is a inverse mask. */ if (e0 != 0 && ((store && e0 != 3) || (!store && e0 != 1)) - && ((*address & ~r1) == (r0 & ~r1))) + && ((* address & ~r1) == (r0 & ~r1))) { XScale_debug_moe (state, ARMul_CP14_R10_MOE_DB); ARMul_OSHandleSWI (state, SWI_Breakpoint); @@ -504,7 +510,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store) else { if (e0 != 0 && ((store && e0 != 3) || (!store && e0 != 1)) - && ((*address & ~3) == (r0 & ~3))) + && ((* address & ~3) == (r0 & ~3))) { XScale_debug_moe (state, ARMul_CP14_R10_MOE_DB); ARMul_OSHandleSWI (state, SWI_Breakpoint); @@ -512,7 +518,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store) e1 = (dbcon & ARMul_CP15_DBCON_E1) >> 2; if (e1 != 0 && ((store && e1 != 3) || (!store && e1 != 1)) - && ((*address & ~3) == (r1 & ~3))) + && ((* address & ~3) == (r1 & ~3))) { XScale_debug_moe (state, ARMul_CP14_R10_MOE_DB); ARMul_OSHandleSWI (state, SWI_Breakpoint); @@ -520,7 +526,7 @@ XScale_check_memacc (ARMul_State * state, ARMword * address, int store) } } -/* Check set. */ +/* Set the XScale FSR and FAR registers. */ void XScale_set_fsr_far (ARMul_State * state, ARMword fsr, ARMword far) @@ -587,7 +593,7 @@ check_cp13_access (ARMul_State * state, unsigned opcode_1, unsigned opcode_2) { - /* Do not allow access to these register in USER mode. */ + /* Do not allow access to these registers in USER mode. */ if (state->Mode == USER26MODE || state->Mode == USER32MODE) return ARMul_CANT; @@ -601,7 +607,7 @@ check_cp13_access (ARMul_State * state, return ARMul_CANT; /* Registers 0, 4 and 8 are defined when CRm == 0. - Registers 0, 4, 5, 6, 7, 8 are defined when CRm == 1. + Registers 0, 1, 4, 5, 6, 7, 8 are defined when CRm == 1. For all other CRm values undefined behaviour results. */ if (CRm == 0) { @@ -610,7 +616,7 @@ check_cp13_access (ARMul_State * state, } else if (CRm == 1) { - if (reg == 0 || (reg >= 4 && reg <= 8)) + if (reg == 0 || reg == 1 || (reg >= 4 && reg <= 8)) return ARMul_DONE; } @@ -659,6 +665,12 @@ write_cp13_reg (unsigned reg, unsigned CRm, ARMword value) value |= XScale_cp13_CR1_Regs[0] & (1UL << 31); break; + case 1: /* BCUMOD */ + /* Only bit 0 is accecssible. */ + value &= 1; + value |= XScale_cp13_CR1_Regs[1] & ~ 1; + break; + case 4: /* ELOG0 */ case 5: /* ELOG1 */ case 6: /* ECAR0 */ @@ -841,7 +853,7 @@ write_cp14_reg (unsigned reg, ARMword value) /* Only BITS (27:12), BITS (10:8) and BITS (6:0) can be written. */ value &= 0x0ffff77f; - /* Reset the clock counter if necessary */ + /* Reset the clock counter if necessary. */ if (value & ARMul_CP14_R0_CLKRST) XScale_cp14_Regs [1] = 0; break; diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index ea2bdfda568..8e719264e7f 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -3206,7 +3206,7 @@ check_PMUintr: ARMul_UndefInstr (state, instr); else { - /* XScale MAR insn. Move two registers into accumulator. */ + /* XScale MAR insn. Move two registers into accumulator. */ state->Accumulator = state->Reg[BITS (12, 15)]; state->Accumulator += (ARMdword) state->Reg[BITS (16, 19)] << 32; } diff --git a/sim/arm/armos.c b/sim/arm/armos.c index d833665ac2d..ccf9a576e87 100644 --- a/sim/arm/armos.c +++ b/sim/arm/armos.c @@ -83,7 +83,7 @@ extern int _fisatty (FILE *); /* For RDIError_BreakpointReached. */ #include "dbg_rdi.h" -#include "callback.h" +#include "gdb/callback.h" extern host_callback *sim_callback; extern unsigned ARMul_OSInit (ARMul_State *); @@ -125,6 +125,10 @@ struct OSblock #define FIXCRLF(t,c) c #endif +/* Bit mask of enabled SWI implementations. */ +unsigned int swi_mask = -1; + + static ARMword softvectorcode[] = { /* Basic: swi tidyexception + event; mov pc, lr; @@ -226,7 +230,11 @@ ARMul_OSInit (ARMul_State * state) #endif /* VALIDATE */ #endif /* NOOS */ - return TRUE; + /* Intel do not want DEMON SWI support. */ + if (state->is_XScale) + swi_mask = SWI_MASK_ANGEL; + + return TRUE; } void @@ -397,110 +405,134 @@ SWIflen (ARMul_State * state, ARMword fh) unsigned ARMul_OSHandleSWI (ARMul_State * state, ARMword number) { - ARMword addr; - ARMword temp; - ARMword saved_number = 0; struct OSblock * OSptr = (struct OSblock *) state->OSptr; - - /* Intel do not want DEMON SWI support. */ - if (state->is_XScale) - switch (number) - { - case SWI_Read: - case SWI_Write: - case SWI_Open: - case SWI_Clock: - case SWI_Time: - case SWI_Close: - case SWI_Flen: - case SWI_Exit: - case SWI_Seek: - case SWI_WriteC: - case SWI_Write0: - case SWI_GetErrno: - case SWI_GetEnv: - saved_number = number; - number = -1; - default: - break; - } - + int unhandled = FALSE; + switch (number) { case SWI_Read: - SWIread (state, state->Reg[0], state->Reg[1], state->Reg[2]); + if (swi_mask & SWI_MASK_DEMON) + SWIread (state, state->Reg[0], state->Reg[1], state->Reg[2]); + else + unhandled = TRUE; break; case SWI_Write: - SWIwrite (state, state->Reg[0], state->Reg[1], state->Reg[2]); + if (swi_mask & SWI_MASK_DEMON) + SWIwrite (state, state->Reg[0], state->Reg[1], state->Reg[2]); + else + unhandled = TRUE; break; case SWI_Open: - SWIopen (state, state->Reg[0], state->Reg[1]); + if (swi_mask & SWI_MASK_DEMON) + SWIopen (state, state->Reg[0], state->Reg[1]); + else + unhandled = TRUE; break; case SWI_Clock: - /* Return number of centi-seconds. */ - state->Reg[0] = + if (swi_mask & SWI_MASK_DEMON) + { + /* Return number of centi-seconds. */ + state->Reg[0] = #ifdef CLOCKS_PER_SEC - (CLOCKS_PER_SEC >= 100) - ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100)) - : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC); + (CLOCKS_PER_SEC >= 100) + ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100)) + : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC); #else - /* Presume unix... clock() returns microseconds. */ - (ARMword) (clock () / 10000); + /* Presume unix... clock() returns microseconds. */ + (ARMword) (clock () / 10000); #endif - OSptr->ErrorNo = errno; + OSptr->ErrorNo = errno; + } + else + unhandled = TRUE; break; case SWI_Time: - state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + if (swi_mask & SWI_MASK_DEMON) + { + state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + } + else + unhandled = TRUE; break; case SWI_Close: - state->Reg[0] = sim_callback->close (sim_callback, state->Reg[0]); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + if (swi_mask & SWI_MASK_DEMON) + { + state->Reg[0] = sim_callback->close (sim_callback, state->Reg[0]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + } + else + unhandled = TRUE; break; case SWI_Flen: - SWIflen (state, state->Reg[0]); + if (swi_mask & SWI_MASK_DEMON) + SWIflen (state, state->Reg[0]); + else + unhandled = TRUE; break; case SWI_Exit: - state->Emulate = FALSE; + if (swi_mask & SWI_MASK_DEMON) + state->Emulate = FALSE; + else + unhandled = TRUE; break; case SWI_Seek: - /* We must return non-zero for failure. */ - state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, state->Reg[0], state->Reg[1], SEEK_SET); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + if (swi_mask & SWI_MASK_DEMON) + { + /* We must return non-zero for failure. */ + state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, state->Reg[0], state->Reg[1], SEEK_SET); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + } + else + unhandled = TRUE; break; case SWI_WriteC: - { - char tmp = state->Reg[0]; - (void) sim_callback->write_stdout (sim_callback, &tmp, 1); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - } + if (swi_mask & SWI_MASK_DEMON) + { + char tmp = state->Reg[0]; + (void) sim_callback->write_stdout (sim_callback, &tmp, 1); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + } + else + unhandled = TRUE; break; case SWI_Write0: - SWIWrite0 (state, state->Reg[0]); + if (swi_mask & SWI_MASK_DEMON) + SWIWrite0 (state, state->Reg[0]); + else + unhandled = TRUE; break; case SWI_GetErrno: - state->Reg[0] = OSptr->ErrorNo; + if (swi_mask & SWI_MASK_DEMON) + state->Reg[0] = OSptr->ErrorNo; + else + unhandled = TRUE; break; case SWI_GetEnv: - state->Reg[0] = ADDRCMDLINE; - if (state->MemSize) - state->Reg[1] = state->MemSize; - else - state->Reg[1] = ADDRUSERSTACK; + if (swi_mask & SWI_MASK_DEMON) + { + state->Reg[0] = ADDRCMDLINE; + if (state->MemSize) + state->Reg[1] = state->MemSize; + else + state->Reg[1] = ADDRUSERSTACK; - WriteCommandLineTo (state, state->Reg[0]); + WriteCommandLineTo (state, state->Reg[0]); + } + else + unhandled = TRUE; break; case SWI_Breakpoint: @@ -511,132 +543,141 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) /* Handle Angel SWIs as well as Demon ones. */ case AngelSWI_ARM: case AngelSWI_Thumb: - /* R1 is almost always a parameter block. */ - addr = state->Reg[1]; - /* R0 is a reason code. */ - switch (state->Reg[0]) + if (swi_mask & SWI_MASK_ANGEL) { - /* Unimplemented reason codes. */ - case AngelSWI_Reason_ReadC: - case AngelSWI_Reason_IsTTY: - case AngelSWI_Reason_TmpNam: - case AngelSWI_Reason_Remove: - case AngelSWI_Reason_Rename: - case AngelSWI_Reason_System: - case AngelSWI_Reason_EnterSVC: - default: - state->Emulate = FALSE; - return FALSE; - - case AngelSWI_Reason_Clock: - /* Return number of centi-seconds. */ - state->Reg[0] = + ARMword addr; + ARMword temp; + + /* R1 is almost always a parameter block. */ + addr = state->Reg[1]; + /* R0 is a reason code. */ + switch (state->Reg[0]) + { + /* Unimplemented reason codes. */ + case AngelSWI_Reason_ReadC: + case AngelSWI_Reason_IsTTY: + case AngelSWI_Reason_TmpNam: + case AngelSWI_Reason_Remove: + case AngelSWI_Reason_Rename: + case AngelSWI_Reason_System: + case AngelSWI_Reason_EnterSVC: + default: + state->Emulate = FALSE; + return FALSE; + + case AngelSWI_Reason_Clock: + /* Return number of centi-seconds. */ + state->Reg[0] = #ifdef CLOCKS_PER_SEC - (CLOCKS_PER_SEC >= 100) - ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100)) - : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC); + (CLOCKS_PER_SEC >= 100) + ? (ARMword) (clock () / (CLOCKS_PER_SEC / 100)) + : (ARMword) ((clock () * 100) / CLOCKS_PER_SEC); #else - /* Presume unix... clock() returns microseconds. */ - (ARMword) (clock () / 10000); + /* Presume unix... clock() returns microseconds. */ + (ARMword) (clock () / 10000); #endif - OSptr->ErrorNo = errno; - break; - - case AngelSWI_Reason_Time: - state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - break; - - case AngelSWI_Reason_WriteC: - { - char tmp = ARMul_SafeReadByte (state, addr); - (void) sim_callback->write_stdout (sim_callback, &tmp, 1); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - } - /* Fall thgrough. */ - - case AngelSWI_Reason_Write0: - SWIWrite0 (state, addr); - break; - - case AngelSWI_Reason_Close: - state->Reg[0] = sim_callback->close (sim_callback, ARMul_ReadWord (state, addr)); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - break; - - case AngelSWI_Reason_Seek: - state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, ARMul_ReadWord (state, addr), - ARMul_ReadWord (state, addr + 4), - SEEK_SET); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - break; - - case AngelSWI_Reason_FLen: - SWIflen (state, ARMul_ReadWord (state, addr)); - break; - - case AngelSWI_Reason_GetCmdLine: - WriteCommandLineTo (state, ARMul_ReadWord (state, addr)); - break; - - case AngelSWI_Reason_HeapInfo: - /* R1 is a pointer to a pointer. */ - addr = ARMul_ReadWord (state, addr); - - /* Pick up the right memory limit. */ - if (state->MemSize) - temp = state->MemSize; - else - temp = ADDRUSERSTACK; - - ARMul_WriteWord (state, addr, 0); /* Heap base. */ - ARMul_WriteWord (state, addr + 4, temp); /* Heap limit. */ - ARMul_WriteWord (state, addr + 8, temp); /* Stack base. */ - ARMul_WriteWord (state, addr + 12, temp); /* Stack limit. */ - break; - - case AngelSWI_Reason_ReportException: - if (state->Reg[1] == ADP_Stopped_ApplicationExit) - state->Reg[0] = 0; - else - state->Reg[0] = -1; - state->Emulate = FALSE; - break; - - case ADP_Stopped_ApplicationExit: - state->Reg[0] = 0; - state->Emulate = FALSE; - break; - - case ADP_Stopped_RunTimeError: - state->Reg[0] = -1; - state->Emulate = FALSE; - break; - - case AngelSWI_Reason_Errno: - state->Reg[0] = OSptr->ErrorNo; - break; - - case AngelSWI_Reason_Open: - SWIopen (state, - ARMul_ReadWord (state, addr), - ARMul_ReadWord (state, addr + 4)); - break; - - case AngelSWI_Reason_Read: - SWIread (state, - ARMul_ReadWord (state, addr), - ARMul_ReadWord (state, addr + 4), - ARMul_ReadWord (state, addr + 8)); - break; - - case AngelSWI_Reason_Write: - SWIwrite (state, - ARMul_ReadWord (state, addr), - ARMul_ReadWord (state, addr + 4), - ARMul_ReadWord (state, addr + 8)); - break; + OSptr->ErrorNo = errno; + break; + + case AngelSWI_Reason_Time: + state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + + case AngelSWI_Reason_WriteC: + { + char tmp = ARMul_SafeReadByte (state, addr); + (void) sim_callback->write_stdout (sim_callback, &tmp, 1); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + } + + case AngelSWI_Reason_Write0: + SWIWrite0 (state, addr); + break; + + case AngelSWI_Reason_Close: + state->Reg[0] = sim_callback->close (sim_callback, ARMul_ReadWord (state, addr)); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + + case AngelSWI_Reason_Seek: + state->Reg[0] = -1 >= sim_callback->lseek (sim_callback, ARMul_ReadWord (state, addr), + ARMul_ReadWord (state, addr + 4), + SEEK_SET); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + + case AngelSWI_Reason_FLen: + SWIflen (state, ARMul_ReadWord (state, addr)); + break; + + case AngelSWI_Reason_GetCmdLine: + WriteCommandLineTo (state, ARMul_ReadWord (state, addr)); + break; + + case AngelSWI_Reason_HeapInfo: + /* R1 is a pointer to a pointer. */ + addr = ARMul_ReadWord (state, addr); + + /* Pick up the right memory limit. */ + if (state->MemSize) + temp = state->MemSize; + else + temp = ADDRUSERSTACK; + + ARMul_WriteWord (state, addr, 0); /* Heap base. */ + ARMul_WriteWord (state, addr + 4, temp); /* Heap limit. */ + ARMul_WriteWord (state, addr + 8, temp); /* Stack base. */ + ARMul_WriteWord (state, addr + 12, temp); /* Stack limit. */ + break; + + case AngelSWI_Reason_ReportException: + if (state->Reg[1] == ADP_Stopped_ApplicationExit) + state->Reg[0] = 0; + else + state->Reg[0] = -1; + state->Emulate = FALSE; + break; + + case ADP_Stopped_ApplicationExit: + state->Reg[0] = 0; + state->Emulate = FALSE; + break; + + case ADP_Stopped_RunTimeError: + state->Reg[0] = -1; + state->Emulate = FALSE; + break; + + case AngelSWI_Reason_Errno: + state->Reg[0] = OSptr->ErrorNo; + break; + + case AngelSWI_Reason_Open: + SWIopen (state, + ARMul_ReadWord (state, addr), + ARMul_ReadWord (state, addr + 4)); + break; + + case AngelSWI_Reason_Read: + SWIread (state, + ARMul_ReadWord (state, addr), + ARMul_ReadWord (state, addr + 4), + ARMul_ReadWord (state, addr + 8)); + break; + + case AngelSWI_Reason_Write: + SWIwrite (state, + ARMul_ReadWord (state, addr), + ARMul_ReadWord (state, addr + 4), + ARMul_ReadWord (state, addr + 8)); + break; + } } + else + unhandled = TRUE; + break; case 0x90: case 0x91: @@ -645,78 +686,84 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number) break; case 0x180001: /* RedBoot's Syscall SWI in ARM mode. */ - switch (state->Reg[0]) + if (swi_mask & SWI_MASK_REDBOOT) { - /* These numbers are defined in libgloss/syscall.h - but the simulator should not be dependend upon - libgloss being installed. */ - case 1: /* Exit. */ - state->Emulate = FALSE; - return TRUE; - - case 2: /* Open. */ - SWIopen (state, state->Reg[1], state->Reg[2]); - return TRUE; - - case 3: /* Close. */ - state->Reg[0] = sim_callback->close (sim_callback, state->Reg[1]); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - return TRUE; - - case 4: /* Read. */ - SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]); - return TRUE; - - case 5: /* Write. */ - SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]); - return TRUE; - - case 6: /* Lseek. */ - state->Reg[0] = sim_callback->lseek (sim_callback, - state->Reg[1], - state->Reg[2], - state->Reg[3]); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - return TRUE; - - case 17: /* Utime. */ - state->Reg[0] = (ARMword) sim_callback->time (sim_callback, - (long *) state->Reg[1]); - OSptr->ErrorNo = sim_callback->get_errno (sim_callback); - return TRUE; - - case 7: /* Unlink. */ - case 8: /* Getpid. */ - case 9: /* Kill. */ - case 10: /* Fstat. */ - case 11: /* Sbrk. */ - case 12: /* Argvlen. */ - case 13: /* Argv. */ - case 14: /* ChDir. */ - case 15: /* Stat. */ - case 16: /* Chmod. */ - case 18: /* Time. */ - sim_callback->printf_filtered - (sim_callback, - "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n", - state->Reg[0]); - return FALSE; - - default: - sim_callback->printf_filtered - (sim_callback, - "sim: unknown RedBoot syscall '%d' encountered - ignoring\n", - state->Reg[0]); - return FALSE; + switch (state->Reg[0]) + { + /* These numbers are defined in libgloss/syscall.h + but the simulator should not be dependend upon + libgloss being installed. */ + case 1: /* Exit. */ + state->Emulate = FALSE; + /* Copy exit code into r0. */ + state->Reg[0] = state->Reg[1]; + break; + + case 2: /* Open. */ + SWIopen (state, state->Reg[1], state->Reg[2]); + break; + + case 3: /* Close. */ + state->Reg[0] = sim_callback->close (sim_callback, state->Reg[1]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + + case 4: /* Read. */ + SWIread (state, state->Reg[1], state->Reg[2], state->Reg[3]); + break; + + case 5: /* Write. */ + SWIwrite (state, state->Reg[1], state->Reg[2], state->Reg[3]); + break; + + case 6: /* Lseek. */ + state->Reg[0] = sim_callback->lseek (sim_callback, + state->Reg[1], + state->Reg[2], + state->Reg[3]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + + case 17: /* Utime. */ + state->Reg[0] = (ARMword) sim_callback->time (sim_callback, + (long *) state->Reg[1]); + OSptr->ErrorNo = sim_callback->get_errno (sim_callback); + break; + + case 7: /* Unlink. */ + case 8: /* Getpid. */ + case 9: /* Kill. */ + case 10: /* Fstat. */ + case 11: /* Sbrk. */ + case 12: /* Argvlen. */ + case 13: /* Argv. */ + case 14: /* ChDir. */ + case 15: /* Stat. */ + case 16: /* Chmod. */ + case 18: /* Time. */ + sim_callback->printf_filtered + (sim_callback, + "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n", + state->Reg[0]); + return FALSE; + + default: + sim_callback->printf_filtered + (sim_callback, + "sim: unknown RedBoot syscall '%d' encountered - ignoring\n", + state->Reg[0]); + return FALSE; + } + break; } - return TRUE; default: - /* If there is a SWI vector installed use it. */ - if (state->is_XScale && saved_number != -1) - number = saved_number; - - if (SWI_vector_installed && number != SWI_Breakpoint) + unhandled = TRUE; + } + + if (unhandled) + { + if (SWI_vector_installed) { ARMword cpsr; ARMword i_size; diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c index 027a9622134..6e22ac771c9 100644 --- a/sim/arm/armsupp.c +++ b/sim/arm/armsupp.c @@ -138,6 +138,7 @@ void ARMul_FixCPSR (ARMul_State * state, ARMword instr, ARMword rhs) { state->Cpsr = ARMul_GetCPSR (state); + if (state->Mode != USER26MODE && state->Mode != USER32MODE) { @@ -569,7 +570,6 @@ ARMul_STC (ARMul_State * state, ARMword instr, ARMword address) #ifndef MODE32 if (ADDREXCEPT (address) || VECTORACCESS (address)) INTERNALABORT (address); - #endif BUSUSEDINCPCN; if (BIT (21)) diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c index ce1e77d8c45..26fd905ac36 100644 --- a/sim/arm/armvirt.c +++ b/sim/arm/armvirt.c @@ -64,7 +64,8 @@ GetWord (ARMul_State * state, ARMword address, int check) ARMword **pagetable; ARMword *pageptr; - XScale_check_memacc (state, &address, 0); + if (check) + XScale_check_memacc (state, &address, 0); page = address >> PAGEBITS; offset = (address & OFFSETBITS) >> 2; @@ -99,7 +100,8 @@ PutWord (ARMul_State * state, ARMword address, ARMword data, int check) ARMword **pagetable; ARMword *pageptr; - XScale_check_memacc (state, &address, 1); + if (check) + XScale_check_memacc (state, &address, 1); page = address >> PAGEBITS; offset = (address & OFFSETBITS) >> 2; diff --git a/sim/arm/dbg_rdi.h b/sim/arm/dbg_rdi.h index 35924ec2267..14d9d703916 100644 --- a/sim/arm/dbg_rdi.h +++ b/sim/arm/dbg_rdi.h @@ -330,3 +330,9 @@ struct RDIProcVec }; #endif + +extern unsigned int swi_mask; + +#define SWI_MASK_DEMON (1 << 0) +#define SWI_MASK_ANGEL (1 << 1) +#define SWI_MASK_REDBOOT (1 << 2) diff --git a/sim/arm/thumbemu.c b/sim/arm/thumbemu.c index 4f007333363..1b28edf80f0 100644 --- a/sim/arm/thumbemu.c +++ b/sim/arm/thumbemu.c @@ -489,7 +489,7 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr) if r14 is not suitably initialised. */ { ARMword tmp = (pc + 2); - + state->Reg[15] = ((state->Reg[14] + ((tinstr & 0x07FF) << 1)) & 0xFFFFFFFC); CLEART; @@ -509,8 +509,9 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr) second half of this BL, and if it is we simulate it immediately. */ state->Reg[14] = state->Reg[15] \ - +(((tinstr & 0x07FF) << 12) \ - |((tinstr & (1 << 10)) ? 0xFF800000 : 0)); + + (((tinstr & 0x07FF) << 12) \ + | ((tinstr & (1 << 10)) ? 0xFF800000 : 0)); + valid = t_branch; /* in-case we don't have the 2nd half */ tinstr = next_instr; /* move the instruction down */ pc += 2; /* point the pc at the 2nd half */ @@ -520,12 +521,8 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr) { ARMword tmp = (pc + 2); - /* Bit one of the destination address comes from bit one of the - address of the first (H == 10) half of the instruction, not - from the offset in the instruction. */ state->Reg[15] = ((state->Reg[14] - + ((tinstr & 0x07FE) << 1) - + ((pc - 2) & 2)) + + ((tinstr & 0x07FE) << 1)) & 0xFFFFFFFC); CLEART; state->Reg[14] = (tmp | 1); @@ -538,6 +535,7 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr) break; } /* else we fall through to process the second half of the BL */ + pc += 2; /* point the pc at the 2nd half */ case 31: /* BL instruction 2 */ /* Format 19 */ /* There is no single ARM instruction equivalent for this @@ -546,7 +544,8 @@ tdstate ARMul_ThumbDecode (state, pc, tinstr, ainstr) the simulation of it on its own, with undefined results if r14 is not suitably initialised. */ { - ARMword tmp = (pc + 2); + ARMword tmp = pc; + state->Reg[15] = (state->Reg[14] + ((tinstr & 0x07FF) << 1)); state->Reg[14] = (tmp | 1); valid = t_branch; diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 773ef354d86..c8361ba9fae 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -28,13 +28,15 @@ #include #include #include -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "armdefs.h" #include "armemu.h" #include "dbg_rdi.h" #include "ansidecl.h" #include "sim-utils.h" +#include "run-sim.h" +#include "gdb/sim-arm.h" host_callback *sim_callback; @@ -222,7 +224,8 @@ sim_create_inferior (sd, abfd, argv, env) default: (*sim_callback->printf_filtered) (sim_callback, - "Unknown machine type; please update sim_create_inferior.\n"); + "Unknown machine type '%d'; please update sim_create_inferior.\n", + mach); /* fall through */ case 0: @@ -384,13 +387,45 @@ sim_store_register (sd, rn, memory, length) { init (); - if (rn == 25) + switch ((enum sim_arm_regs) rn) { + case SIM_ARM_R0_REGNUM: + case SIM_ARM_R1_REGNUM: + case SIM_ARM_R2_REGNUM: + case SIM_ARM_R3_REGNUM: + case SIM_ARM_R4_REGNUM: + case SIM_ARM_R5_REGNUM: + case SIM_ARM_R6_REGNUM: + case SIM_ARM_R7_REGNUM: + case SIM_ARM_R8_REGNUM: + case SIM_ARM_R9_REGNUM: + case SIM_ARM_R10_REGNUM: + case SIM_ARM_R11_REGNUM: + case SIM_ARM_R12_REGNUM: + case SIM_ARM_R13_REGNUM: + case SIM_ARM_R14_REGNUM: + case SIM_ARM_R15_REGNUM: /* PC */ + case SIM_ARM_FP0_REGNUM: + case SIM_ARM_FP1_REGNUM: + case SIM_ARM_FP2_REGNUM: + case SIM_ARM_FP3_REGNUM: + case SIM_ARM_FP4_REGNUM: + case SIM_ARM_FP5_REGNUM: + case SIM_ARM_FP6_REGNUM: + case SIM_ARM_FP7_REGNUM: + case SIM_ARM_FPS_REGNUM: + ARMul_SetReg (state, state->Mode, rn, frommem (state, memory)); + break; + + case SIM_ARM_PS_REGNUM: state->Cpsr = frommem (state, memory); - ARMul_CPSRAltered (state); + ARMul_CPSRAltered (state); + break; + + default: + return 0; } - else - ARMul_SetReg (state, state->Mode, rn, frommem (state, memory)); + return -1; } @@ -405,14 +440,46 @@ sim_fetch_register (sd, rn, memory, length) init (); - if (rn < 16) - regval = ARMul_GetReg (state, state->Mode, rn); - else if (rn == 25) - /* FIXME: use PS_REGNUM from gdb/config/arm/tm-arm.h. */ - regval = ARMul_GetCPSR (state); - else - /* FIXME: should report an error. */ - regval = 0; + switch ((enum sim_arm_regs) rn) + { + case SIM_ARM_R0_REGNUM: + case SIM_ARM_R1_REGNUM: + case SIM_ARM_R2_REGNUM: + case SIM_ARM_R3_REGNUM: + case SIM_ARM_R4_REGNUM: + case SIM_ARM_R5_REGNUM: + case SIM_ARM_R6_REGNUM: + case SIM_ARM_R7_REGNUM: + case SIM_ARM_R8_REGNUM: + case SIM_ARM_R9_REGNUM: + case SIM_ARM_R10_REGNUM: + case SIM_ARM_R11_REGNUM: + case SIM_ARM_R12_REGNUM: + case SIM_ARM_R13_REGNUM: + case SIM_ARM_R14_REGNUM: + case SIM_ARM_R15_REGNUM: /* PC */ + regval = ARMul_GetReg (state, state->Mode, rn); + break; + + case SIM_ARM_FP0_REGNUM: + case SIM_ARM_FP1_REGNUM: + case SIM_ARM_FP2_REGNUM: + case SIM_ARM_FP3_REGNUM: + case SIM_ARM_FP4_REGNUM: + case SIM_ARM_FP5_REGNUM: + case SIM_ARM_FP6_REGNUM: + case SIM_ARM_FP7_REGNUM: + case SIM_ARM_FPS_REGNUM: + memset (memory, 0, length); + return 0; + + case SIM_ARM_PS_REGNUM: + regval = ARMul_GetCPSR (state); + break; + + default: + return 0; + } while (length) { @@ -426,6 +493,119 @@ sim_fetch_register (sd, rn, memory, length) return -1; } +#ifdef SIM_TARGET_SWITCHES + +static void sim_target_parse_arg_array PARAMS ((char **)); + +typedef struct +{ + char * swi_option; + unsigned int swi_mask; +} swi_options; + +#define SWI_SWITCH "--swi-support" + +static swi_options options[] = + { + { "none", 0 }, + { "demon", SWI_MASK_DEMON }, + { "angel", SWI_MASK_ANGEL }, + { "redboot", SWI_MASK_REDBOOT }, + { "all", -1 }, + { "NONE", 0 }, + { "DEMON", SWI_MASK_DEMON }, + { "ANGEL", SWI_MASK_ANGEL }, + { "REDBOOT", SWI_MASK_REDBOOT }, + { "ALL", -1 } + }; + + +int +sim_target_parse_command_line (argc, argv) + int argc; + char ** argv; +{ + int i; + + for (i = 1; i < argc; i++) + { + char * ptr = argv[i]; + int arg; + + if ((ptr == NULL) || (* ptr != '-')) + break; + + if (strncmp (ptr, SWI_SWITCH, sizeof SWI_SWITCH - 1) != 0) + continue; + + if (ptr[sizeof SWI_SWITCH - 1] == 0) + { + /* Remove this option from the argv array. */ + for (arg = i; arg < argc; arg ++) + argv[arg] = argv[arg + 1]; + argc --; + + ptr = argv[i]; + } + else + ptr += sizeof SWI_SWITCH; + + swi_mask = 0; + + while (* ptr) + { + int i; + + for (i = sizeof options / sizeof options[0]; i--;) + if (strncmp (ptr, options[i].swi_option, + strlen (options[i].swi_option)) == 0) + { + swi_mask |= options[i].swi_mask; + ptr += strlen (options[i].swi_option); + + if (* ptr == ',') + ++ ptr; + + break; + } + + if (i < 0) + break; + } + + if (* ptr != 0) + fprintf (stderr, "Ignoring swi options: %s\n", ptr); + + /* Remove this option from the argv array. */ + for (arg = i; arg < argc; arg ++) + argv[arg] = argv[arg + 1]; + argc --; + i --; + } + return argc; +} + +static void +sim_target_parse_arg_array (argv) + char ** argv; +{ + int i; + + for (i = 0; argv[i]; i++) + ; + + return (void) sim_target_parse_command_line (i, argv); +} + +void +sim_target_display_usage () +{ + fprintf (stderr, "%s= Comma seperated list of SWI protocols to supoport.\n\ + This list can contain: NONE, DEMON, ANGEL, REDBOOT and/or ALL.\n", + SWI_SWITCH); +} +#endif + SIM_DESC sim_open (kind, ptr, abfd, argv) SIM_OPEN_KIND kind; @@ -438,6 +618,10 @@ sim_open (kind, ptr, abfd, argv) myname = (char *) xstrdup (argv[0]); sim_callback = ptr; +#ifdef SIM_TARGET_SWITCHES + sim_target_parse_arg_array (argv); +#endif + /* Decide upon the endian-ness of the processor. If we can, get the information from the bfd itself. Otherwise look to see if we have been given a command diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 6935b013c79..979c1ee945b 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,51 @@ +2002-06-09 Aldy Hernandez + + * sim-fpu.c (unpack_fpu): Initialize exponent for + sim_fpu_class_zero. + (i2fpu): Same. + (sim_fpu_sqrt): Same. + +2002-06-08 Andrew Cagney + + * gentmap.c (gen_targ_map_c): Generate "gdb/callback.h". + * sim-basics.h: Include "gdb/callback.h" and "gdb/remote-sim.h". + * run.c: Ditto. + * sim-load.c: Ditto. + * callback.c: Ditto. + * syscall.c: Ditto. + * Make-common.in (callback_h): Define. + (remote_sim_h): Define. + (run.o): Update. + (callback.o): Update. + (syscall.o): Update. + (sim-load.o): + (nrun.o): Update. + (sim-hload.o): Update. + (sim-io.o): Update. + (sim-reason.o): Update. + (sim-reg.o): Update. + (sim-resume.o): Update. + +2002-05-30 Kazu Hirata + + * run.c: Fix formatting. + +2002-05-20 Nick Clifton + + * run-sim.h: New header. Provide prototypes for functions used + between run() and libsim.a which are not used by GDB. + * run.c: Include run-sim.h. + (main): If SIM_TARGET_SWITCHES is defined call + sim_target_parse_command_line. + (usage): If SIM_TARGET_SWITCHES is defined call + sim_target_display_usage. + +2002-05-17 Andrey Volkov + + * run.c: Made h8300s as new target, not h8300h alias. + Added new option -S (h8300s target) + * sim-options.c: Ditto. + 2002-05-01 Chris Demetriou * callback.c: Use 'deprecated' rather than 'depreciated.' diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 519b213da73..6662efd748a 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -248,6 +248,9 @@ LIB_OBJS = callback.o syscall.o targ-map.o $(SIM_OBJS) RUNTESTFLAGS = +callback_h = $(srcroot)/include/gdb/callback.h +remote_sim_h = $(srcroot)/include/gdb/remote-sim.h + all: $(SIM_EXTRA_ALL) libsim.a run .gdbinit libsim.a: $(LIB_OBJS) @@ -259,8 +262,7 @@ run: $(SIM_RUN_OBJS) libsim.a $(LIBDEPS) $(CC) $(ALL_CFLAGS) -o run$(EXEEXT) \ $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS) -run.o: $(srccom)/run.c config.h tconfig.h \ - $(srcroot)/include/remote-sim.h $(srcroot)/include/callback.h +run.o: $(srccom)/run.c config.h tconfig.h $(remote_sim_h) $(callback_h) $(CC) -c $(srccom)/run.c $(ALL_CFLAGS) # FIXME: Ideally, callback.o and friends live in a library outside of @@ -268,12 +270,10 @@ run.o: $(srccom)/run.c config.h tconfig.h \ # devo/libremote because this directory would contain more than just # a library). -callback.o: $(srccom)/callback.c config.h tconfig.h \ - $(srcroot)/include/callback.h targ-vals.h +callback.o: $(srccom)/callback.c config.h tconfig.h $(callback_h) targ-vals.h $(CC) -c $(srccom)/callback.c $(ALL_CFLAGS) -syscall.o: $(srccom)/syscall.c config.h tconfig.h \ - $(srcroot)/include/callback.h targ-vals.h +syscall.o: $(srccom)/syscall.c config.h tconfig.h $(callback_h) targ-vals.h $(CC) -c $(srccom)/syscall.c $(ALL_CFLAGS) targ-map.o: targ-map.c targ-vals.h @@ -399,21 +399,18 @@ sim-fpu.o: $(srccom)/sim-fpu.c $(sim-fpu_h) \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-fpu.c $(ALL_CFLAGS) -sim-hload.o: $(srccom)/sim-hload.c $(sim-assert_h) \ - $(srcroot)/include/remote-sim.h \ +sim-hload.o: $(srccom)/sim-hload.c $(sim-assert_h) $(remote_sim_h) \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-hload.c $(ALL_CFLAGS) -sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) $(sim_core_h) \ - $(srcroot)/include/remote-sim.h \ +sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) $(sim_core_h) $(remote_sim_h) \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-hrw.c $(ALL_CFLAGS) sim-hw.o: $(srccom)/sim-hw.c $(sim_main_headers) $(CC) -c $(srccom)/sim-hw.c $(ALL_CFLAGS) -sim-info.o: $(srccom)/sim-info.c $(sim-assert_h) \ - $(srcroot)/include/remote-sim.h \ +sim-info.o: $(srccom)/sim-info.c $(sim-assert_h) $(remote_sim_h) \ $(SIM_EXTRA_DEPS) $(CC) -c $(srccom)/sim-info.c $(ALL_CFLAGS) @@ -423,8 +420,8 @@ sim-inline.c: $(srccom)/sim-inline.c cat $(srccom)/$@ >> tmp-$@ $(SHELL) $(srcdir)/../../move-if-change tmp-$@ $@ -sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h) \ - $(srcroot)/include/remote-sim.h targ-vals.h +sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h) $(remote_sim_h) \ + targ-vals.h $(CC) -c $(srccom)/sim-io.c $(ALL_CFLAGS) sim-memopt.o: $(srccom)/sim-memopt.c $(sim_main_headers) \ @@ -439,16 +436,13 @@ sim-options.o: $(srccom)/sim-options.c $(sim_main_headers) \ $(sim-options_h) $(sim-io_h) $(CC) -c $(srccom)/sim-options.c $(ALL_CFLAGS) -sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers) \ - $(srcroot)/include/remote-sim.h +sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers) $(remote_sim_h) $(CC) -c $(srccom)/sim-reason.c $(ALL_CFLAGS) -sim-reg.o: $(srccom)/sim-reg.c $(sim_main_headers) \ - $(srcroot)/include/remote-sim.h +sim-reg.o: $(srccom)/sim-reg.c $(sim_main_headers) $(remote_sim_h) $(CC) -c $(srccom)/sim-reg.c $(ALL_CFLAGS) -sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers) \ - $(srcroot)/include/remote-sim.h +sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers) $(remote_sim_h) $(CC) -c $(srccom)/sim-resume.c $(ALL_CFLAGS) sim-run.o: $(srccom)/sim-run.c $(sim_main_headers) @@ -478,7 +472,7 @@ sim-utils.o: $(srccom)/sim-utils.c $(sim_main_headers) sim-watch.o: $(srccom)/sim-watch.c $(sim_main_headers) $(CC) -c $(srccom)/sim-watch.c $(ALL_CFLAGS) -sim-load.o: $(srccom)/sim-load.c $(srcroot)/include/callback.h +sim-load.o: $(srccom)/sim-load.c $(callback_h) $(CC) -c $(srccom)/sim-load.c $(ALL_CFLAGS) sim-break.o: $(srccom)/sim-break.c $(sim_main_headers) \ @@ -547,8 +541,7 @@ dv-sockser.o: $(srccom)/dv-sockser.h $(sim_main_headers) $(CC) -c $(srccom)/dv-sockser.c $(ALL_CFLAGS) -nrun.o: $(srccom)/nrun.c config.h tconfig.h \ - $(srcroot)/include/remote-sim.h $(srcroot)/include/callback.h \ +nrun.o: $(srccom)/nrun.c config.h tconfig.h $(remote_sim_h) $(callback_h) \ $(sim_main_headers) $(CC) -c $(srccom)/nrun.c $(ALL_CFLAGS) @@ -685,7 +678,7 @@ cgen-arch: force $(SHELL) $(srccom)/cgen.sh arch $(srcdir) \ $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ $(arch) "$(FLAGS)" ignored "$(isa)" $(mach) ignored ignored - + cgen-cpu: force $(SHELL) $(srccom)/cgen.sh cpu $(srcdir) \ $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ diff --git a/sim/common/callback.c b/sim/common/callback.c index af5de148ad0..db0fff68e80 100644 --- a/sim/common/callback.c +++ b/sim/common/callback.c @@ -46,7 +46,7 @@ #include #include #include -#include "callback.h" +#include "gdb/callback.h" #include "targ-vals.h" #ifdef HAVE_UNISTD_H diff --git a/sim/common/gentmap.c b/sim/common/gentmap.c index e4f5d0dc8b4..897a6f70c77 100644 --- a/sim/common/gentmap.c +++ b/sim/common/gentmap.c @@ -68,7 +68,7 @@ gen_targ_map_c () printf ("#include \n"); printf ("#include \n"); printf ("#include \"ansidecl.h\"\n"); - printf ("#include \"callback.h\"\n"); + printf ("#include \"gdb/callback.h\"\n"); printf ("#include \"targ-vals.h\"\n"); printf ("\n"); diff --git a/sim/common/run.c b/sim/common/run.c index c34d5e6a124..d8c86cdd701 100644 --- a/sim/common/run.c +++ b/sim/common/run.c @@ -1,5 +1,5 @@ /* run front end support for all the simulators. - Copyright (C) 1992, 93-96, 1997 Free Software Foundation, Inc. + Copyright (C) 1992, 93-96, 1997, 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 @@ -43,9 +43,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "libiberty.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "ansidecl.h" +#include "run-sim.h" static void usage PARAMS ((void)); extern int optind; @@ -58,7 +59,7 @@ static char *myname; extern int getopt (); #ifdef NEED_UI_LOOP_HOOK -/* Gdb foolery. This is only needed for gdb using a gui. */ +/* Gdb foolery. This is only needed for gdb using a gui. */ int (*ui_loop_hook) PARAMS ((int signo)); #endif @@ -107,17 +108,21 @@ main (ac, av) /* FIXME: This is currently being migrated into sim_open. Simulators that use functions such as sim_size() still require - this. */ + this. */ default_callback.init (&default_callback); sim_set_callbacks (&default_callback); +#ifdef SIM_TARGET_SWITCHES + ac = sim_target_parse_command_line (ac, av); +#endif + /* FIXME: This is currently being rewritten to have each simulator do all argv processing. */ #ifdef SIM_H8300 /* FIXME: quick hack */ - while ((i = getopt (ac, av, "a:c:m:op:s:htv")) != EOF) + while ((i = getopt (ac, av, "a:c:m:op:s:hStv")) != EOF) #else - while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF) + while ((i = getopt (ac, av, "a:c:m:op:s:tv")) != EOF) #endif switch (i) { @@ -148,7 +153,7 @@ main (ac, av) #ifdef SIM_HAVE_ENVIRONMENT case 'o': /* Operating enironment where any signals are delivered to the - target. */ + target. */ operating_p = 1; break; #endif SIM_HAVE_ENVIRONMENT @@ -173,7 +178,10 @@ main (ac, av) /* FIXME: Quick hack, to be replaced by more general facility. */ #ifdef SIM_H8300 case 'h': - set_h8300h (1); + set_h8300h (1, 0); + break; + case 'S': + set_h8300h (1, 1); break; #endif default: @@ -194,9 +202,9 @@ main (ac, av) } abfd = bfd_openr (name, 0); - if (!abfd) + if (!abfd) { - fprintf (stderr, "%s: can't open %s: %s\n", + fprintf (stderr, "%s: can't open %s: %s\n", myname, name, bfd_errmsg (bfd_get_error ())); exit (1); } @@ -223,7 +231,7 @@ main (ac, av) #endif /* Ensure that any run-time initialisation that needs to be - performed by the simulator can occur. */ + performed by the simulator can occur. */ sd = sim_open (SIM_OPEN_STANDALONE, &default_callback, abfd, sim_argv); if (sd == 0) exit (1); @@ -237,7 +245,7 @@ main (ac, av) #ifdef SIM_HAVE_ENVIRONMENT /* NOTE: An old simulator supporting the operating environment MUST provide sim_set_trace() and not sim_trace(). That way - sim_stop_reason() can be used to determine any stop reason. */ + sim_stop_reason() can be used to determine any stop reason. */ if (trace) sim_set_trace (); sigrc = 0; @@ -291,14 +299,14 @@ main (ac, av) case sim_signalled: case sim_stopped: if (sigrc != 0) - fprintf (stderr, "program stopped with signal %d.\n", sigrc); + fprintf (stderr, "program stopped with signal %d.\n", sigrc); break; case sim_exited: break; case sim_running: - case sim_polling: /* these indicate a serious problem */ + case sim_polling: /* These indicate a serious problem. */ abort (); break; @@ -318,7 +326,8 @@ usage () fprintf (stderr, "-c size Set simulator cache size to `size'.\n"); #endif #ifdef SIM_H8300 - fprintf (stderr, "-h Executable is for H8/300H or H8/S.\n"); + fprintf (stderr, "-h Executable is for h8/300h.\n"); + fprintf (stderr, "-S Executable is for h8/300s.\n"); #endif fprintf (stderr, "-m size Set memory size of simulator, in bytes.\n"); #ifdef SIM_HAVE_ENVIRONMENT @@ -334,5 +343,9 @@ usage () fprintf (stderr, "\n"); fprintf (stderr, "program args Arguments to pass to simulated program.\n"); fprintf (stderr, " Note: Very few simulators support this.\n"); +#ifdef SIM_TARGET_SWITCHES + fprintf (stderr, "\nTarget specific options:\n"); + sim_target_display_usage (); +#endif exit (1); } diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h index fc34b21618f..a7d7a1ed472 100644 --- a/sim/common/sim-basics.h +++ b/sim/common/sim-basics.h @@ -132,8 +132,8 @@ typedef enum { #endif #include "ansidecl.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "sim-config.h" diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c index 7639175170e..28d61a565fe 100644 --- a/sim/common/sim-fpu.c +++ b/sim/common/sim-fpu.c @@ -330,6 +330,7 @@ unpack_fpu (sim_fpu *dst, unsigned64 packed, int is_double) /* tastes like zero */ dst->class = sim_fpu_class_zero; dst->sign = sign; + dst->normal_exp = 0; } else { @@ -520,6 +521,7 @@ i2fpu (sim_fpu *f, signed64 i, int is_64bit) { f->class = sim_fpu_class_zero; f->sign = 0; + f->normal_exp = 0; } else { @@ -648,6 +650,7 @@ u2fpu (sim_fpu *f, unsigned64 u, int is_64bit) { f->class = sim_fpu_class_zero; f->sign = 0; + f->normal_exp = 0; } else { @@ -1799,6 +1802,7 @@ sim_fpu_sqrt (sim_fpu *f, { f->class = sim_fpu_class_zero; f->sign = r->sign; + f->normal_exp = 0; return 0; } if (sim_fpu_is_infinity (r)) diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c index bfe3f15c4bd..314d2dd173c 100644 --- a/sim/common/sim-load.c +++ b/sim/common/sim-load.c @@ -36,8 +36,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., #include "bfd.h" #include "sim-utils.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" static void eprintf PARAMS ((host_callback *, const char *, ...)); static void xprintf PARAMS ((host_callback *, const char *, ...)); diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 9ccc51dc3d9..aae0245613e 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -110,6 +110,7 @@ typedef enum { OPTION_HELP, #ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ OPTION_H8300, + OPTION_H8300S, #endif OPTION_LOAD_LMA, OPTION_LOAD_VMA, @@ -152,7 +153,10 @@ static const OPTION standard_options[] = #ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ { {"h8300h", no_argument, NULL, OPTION_H8300}, - 'h', NULL, "Indicate the CPU is h8/300h or h8/300s", + 'h', NULL, "Indicate the CPU is h8/300h", + standard_option_handler }, + { {"h8300s", no_argument, NULL, OPTION_H8300S}, + 'S', NULL, "Indicate the CPU is h8/300s", standard_option_handler }, #endif @@ -354,7 +358,10 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, #ifdef SIM_H8300 /* FIXME: Can be moved to h8300 dir. */ case OPTION_H8300: - set_h8300h (1); + set_h8300h (1,0); + break; + case OPTION_H8300S: + set_h8300h (1,1); break; #endif diff --git a/sim/common/syscall.c b/sim/common/syscall.c index e0a3b880b84..75121cf2fc4 100644 --- a/sim/common/syscall.c +++ b/sim/common/syscall.c @@ -46,7 +46,7 @@ #include #include #include -#include "callback.h" +#include "gdb/callback.h" #include "targ-vals.h" #ifndef ENOSYS diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index 5f7ad2e09f1..91d71f3f512 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,42 @@ +2002-06-09 Andrew Cagney + + * Makefile.in (INCLUDE): Update path to callback.h. + * gencode.c: Do not include "callback.h". + * d10v_sim.h: Include "gdb/callback.h" and "gdb/remote-sim.h". + * interp.c: Ditto. + +2002-06-08 Andrew Cagney + + * interp.c (sim_fetch_register): Fix name of enum used in cast. + (sim_store_register): Ditto. + +2002-06-02 Elena Zannoni + + From Jason Eckhardt + * d10v_sim.h (INC_ADDR): Correctly handle the case where MOD_E is + less than MOD_S (post-decrement). + +2002-06-01 Andrew Cagney + + * interp.c (sim_fetch_register, sim_store_register): Use a switch + statement and enums from "sim-d10v.h". + +2002-05-28 Elena Zannoni + + * interp.c (sim_create_inferior): Add comment. + + From Alan Matsuoka : + From 2001-04-27 Jason Eckhardt : + * simops.c (OP_4400): Output "mvf0f" instead of "mf0f". + (OP_4401): Output "mvf0t" instead of "mf0t". + (OP_460B): Do not output a flag register. + (OP_4609): Do not output a flag register. + +2002-05-23 Andrew Cagney + + * Makefile.in (INCLUDE): Add "gdb/sim-d10v.h". + * interp.c: Include "gdb/sim-d10v.h" instead of "sim-d10v.h". + 2001-08-01 John R. Moore * interp.c (sim_create_inferior): Removed a hack that stated diff --git a/sim/d10v/Makefile.in b/sim/d10v/Makefile.in index 82d7e11ceb3..f46c54dd388 100644 --- a/sim/d10v/Makefile.in +++ b/sim/d10v/Makefile.in @@ -22,7 +22,8 @@ SIM_OBJS = interp.o table.o simops.o endian.o sim-load.o SIM_EXTRA_CLEAN = clean-extra SIM_EXTRA_CFLAGS = -DNEED_UI_LOOP_HOOK -DSIM_HAVE_ENVIRONMENT -INCLUDE = d10v_sim.h $(srcroot)/include/callback.h targ-vals.h endian.c +INCLUDE = d10v_sim.h $(srcroot)/include/gdb/callback.h targ-vals.h endian.c \ + $(srcroot)/include/gdb/sim-d10v.h # This selects the d10v newlib/libgloss syscall definitions. NL_TARGET = -DNL_TARGET_d10v diff --git a/sim/d10v/d10v_sim.h b/sim/d10v/d10v_sim.h index 3566da01d26..ca14006fbce 100644 --- a/sim/d10v/d10v_sim.h +++ b/sim/d10v/d10v_sim.h @@ -3,7 +3,7 @@ #include #include #include "ansidecl.h" -#include "callback.h" +#include "gdb/callback.h" #include "opcode/d10v.h" #include "bfd.h" @@ -21,7 +21,7 @@ extern int d10v_debug; -#include "remote-sim.h" +#include "gdb/remote-sim.h" #include "sim-config.h" #include "sim-types.h" @@ -435,7 +435,7 @@ do \ { \ int test_i = i < 0 ? i : ~((i) - 1); \ if (PSW_MD && GPR (x) == (MOD_E & test_i)) \ - SET_GPR (x, MOD_S); \ + SET_GPR (x, MOD_S & test_i); \ else \ SET_GPR (x, GPR (x) + (i)); \ } \ diff --git a/sim/d10v/gencode.c b/sim/d10v/gencode.c index 2d1269be996..b66297d0146 100644 --- a/sim/d10v/gencode.c +++ b/sim/d10v/gencode.c @@ -3,7 +3,6 @@ #include #include #include "ansidecl.h" -#include "callback.h" #include "opcode/d10v.h" static void write_header PARAMS ((void)); diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index ea1828c3e0e..e465a809d02 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -1,11 +1,11 @@ #include #include "sysdep.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "d10v_sim.h" -#include "sim-d10v.h" +#include "gdb/sim-d10v.h" enum _leftright { LEFT_FIRST, RIGHT_FIRST }; @@ -1202,6 +1202,14 @@ sim_create_inferior (sd, abfd, argv, env) /* reset all state information */ memset (&State.regs, 0, (int)&State.mem - (int)&State.regs); + /* There was a hack here to copy the values of argc and argv into r0 + and r1. The values were also saved into some high memory that + won't be overwritten by the stack (0x7C00). The reason for doing + this was to allow the 'run' program to accept arguments. Without + the hack, this is not possible anymore. If the simulator is run + from the debugger, arguments cannot be passed in, so this makes + no difference. */ + /* set PC */ if (abfd != NULL) start_address = bfd_get_start_address (abfd); @@ -1299,54 +1307,82 @@ sim_fetch_register (sd, rn, memory, length) int length; { int size; - if (rn < 0) - size = 0; - else if (rn >= SIM_D10V_R0_REGNUM - && rn < SIM_D10V_R0_REGNUM + SIM_D10V_NR_R_REGS) + switch ((enum sim_d10v_regs) rn) { + case SIM_D10V_R0_REGNUM: + case SIM_D10V_R1_REGNUM: + case SIM_D10V_R2_REGNUM: + case SIM_D10V_R3_REGNUM: + case SIM_D10V_R4_REGNUM: + case SIM_D10V_R5_REGNUM: + case SIM_D10V_R6_REGNUM: + case SIM_D10V_R7_REGNUM: + case SIM_D10V_R8_REGNUM: + case SIM_D10V_R9_REGNUM: + case SIM_D10V_R10_REGNUM: + case SIM_D10V_R11_REGNUM: + case SIM_D10V_R12_REGNUM: + case SIM_D10V_R13_REGNUM: + case SIM_D10V_R14_REGNUM: + case SIM_D10V_R15_REGNUM: WRITE_16 (memory, GPR (rn - SIM_D10V_R0_REGNUM)); size = 2; - } - else if (rn >= SIM_D10V_CR0_REGNUM - && rn < SIM_D10V_CR0_REGNUM + SIM_D10V_NR_CR_REGS) - { + break; + case SIM_D10V_CR0_REGNUM: + case SIM_D10V_CR1_REGNUM: + case SIM_D10V_CR2_REGNUM: + case SIM_D10V_CR3_REGNUM: + case SIM_D10V_CR4_REGNUM: + case SIM_D10V_CR5_REGNUM: + case SIM_D10V_CR6_REGNUM: + case SIM_D10V_CR7_REGNUM: + case SIM_D10V_CR8_REGNUM: + case SIM_D10V_CR9_REGNUM: + case SIM_D10V_CR10_REGNUM: + case SIM_D10V_CR11_REGNUM: + case SIM_D10V_CR12_REGNUM: + case SIM_D10V_CR13_REGNUM: + case SIM_D10V_CR14_REGNUM: + case SIM_D10V_CR15_REGNUM: WRITE_16 (memory, CREG (rn - SIM_D10V_CR0_REGNUM)); size = 2; - } - else if (rn >= SIM_D10V_A0_REGNUM - && rn < SIM_D10V_A0_REGNUM + SIM_D10V_NR_A_REGS) - { + break; + case SIM_D10V_A0_REGNUM: + case SIM_D10V_A1_REGNUM: WRITE_64 (memory, ACC (rn - SIM_D10V_A0_REGNUM)); size = 8; - } - else if (rn == SIM_D10V_SPI_REGNUM) - { + break; + case SIM_D10V_SPI_REGNUM: /* PSW_SM indicates that the current SP is the USER stack-pointer. */ WRITE_16 (memory, spi_register ()); size = 2; - } - else if (rn == SIM_D10V_SPU_REGNUM) - { + break; + case SIM_D10V_SPU_REGNUM: /* PSW_SM indicates that the current SP is the USER stack-pointer. */ WRITE_16 (memory, spu_register ()); size = 2; - } - else if (rn >= SIM_D10V_IMAP0_REGNUM - && rn < SIM_D10V_IMAP0_REGNUM + SIM_D10V_NR_IMAP_REGS) - { + break; + case SIM_D10V_IMAP0_REGNUM: + case SIM_D10V_IMAP1_REGNUM: WRITE_16 (memory, imap_register (rn - SIM_D10V_IMAP0_REGNUM)); size = 2; - } - else if (rn >= SIM_D10V_DMAP0_REGNUM - && rn < SIM_D10V_DMAP0_REGNUM + SIM_D10V_NR_DMAP_REGS) - { + break; + case SIM_D10V_DMAP0_REGNUM: + case SIM_D10V_DMAP1_REGNUM: + case SIM_D10V_DMAP2_REGNUM: + case SIM_D10V_DMAP3_REGNUM: WRITE_16 (memory, dmap_register (rn - SIM_D10V_DMAP0_REGNUM)); size = 2; + break; + case SIM_D10V_TS2_DMAP_REGNUM: + size = 0; + break; + default: + size = 0; + break; } - else - size = 0; return size; } @@ -1358,52 +1394,80 @@ sim_store_register (sd, rn, memory, length) int length; { int size; - if (rn < 0) - size = 0; - else if (rn >= SIM_D10V_R0_REGNUM - && rn < SIM_D10V_R0_REGNUM + SIM_D10V_NR_R_REGS) + switch ((enum sim_d10v_regs) rn) { + case SIM_D10V_R0_REGNUM: + case SIM_D10V_R1_REGNUM: + case SIM_D10V_R2_REGNUM: + case SIM_D10V_R3_REGNUM: + case SIM_D10V_R4_REGNUM: + case SIM_D10V_R5_REGNUM: + case SIM_D10V_R6_REGNUM: + case SIM_D10V_R7_REGNUM: + case SIM_D10V_R8_REGNUM: + case SIM_D10V_R9_REGNUM: + case SIM_D10V_R10_REGNUM: + case SIM_D10V_R11_REGNUM: + case SIM_D10V_R12_REGNUM: + case SIM_D10V_R13_REGNUM: + case SIM_D10V_R14_REGNUM: + case SIM_D10V_R15_REGNUM: SET_GPR (rn - SIM_D10V_R0_REGNUM, READ_16 (memory)); size = 2; - } - else if (rn >= SIM_D10V_CR0_REGNUM - && rn < SIM_D10V_CR0_REGNUM + SIM_D10V_NR_CR_REGS) - { + break; + case SIM_D10V_CR0_REGNUM: + case SIM_D10V_CR1_REGNUM: + case SIM_D10V_CR2_REGNUM: + case SIM_D10V_CR3_REGNUM: + case SIM_D10V_CR4_REGNUM: + case SIM_D10V_CR5_REGNUM: + case SIM_D10V_CR6_REGNUM: + case SIM_D10V_CR7_REGNUM: + case SIM_D10V_CR8_REGNUM: + case SIM_D10V_CR9_REGNUM: + case SIM_D10V_CR10_REGNUM: + case SIM_D10V_CR11_REGNUM: + case SIM_D10V_CR12_REGNUM: + case SIM_D10V_CR13_REGNUM: + case SIM_D10V_CR14_REGNUM: + case SIM_D10V_CR15_REGNUM: SET_CREG (rn - SIM_D10V_CR0_REGNUM, READ_16 (memory)); size = 2; - } - else if (rn >= SIM_D10V_A0_REGNUM - && rn < SIM_D10V_A0_REGNUM + SIM_D10V_NR_A_REGS) - { + break; + case SIM_D10V_A0_REGNUM: + case SIM_D10V_A1_REGNUM: SET_ACC (rn - SIM_D10V_A0_REGNUM, READ_64 (memory) & MASK40); size = 8; - } - else if (rn == SIM_D10V_SPI_REGNUM) - { + break; + case SIM_D10V_SPI_REGNUM: /* PSW_SM indicates that the current SP is the USER stack-pointer. */ set_spi_register (READ_16 (memory)); size = 2; - } - else if (rn == SIM_D10V_SPU_REGNUM) - { + break; + case SIM_D10V_SPU_REGNUM: set_spu_register (READ_16 (memory)); size = 2; - } - else if (rn >= SIM_D10V_IMAP0_REGNUM - && rn < SIM_D10V_IMAP0_REGNUM + SIM_D10V_NR_IMAP_REGS) - { + break; + case SIM_D10V_IMAP0_REGNUM: + case SIM_D10V_IMAP1_REGNUM: set_imap_register (rn - SIM_D10V_IMAP0_REGNUM, READ_16(memory)); size = 2; - } - else if (rn >= SIM_D10V_DMAP0_REGNUM - && rn < SIM_D10V_DMAP0_REGNUM + SIM_D10V_NR_DMAP_REGS) - { + break; + case SIM_D10V_DMAP0_REGNUM: + case SIM_D10V_DMAP1_REGNUM: + case SIM_D10V_DMAP2_REGNUM: + case SIM_D10V_DMAP3_REGNUM: set_dmap_register (rn - SIM_D10V_DMAP0_REGNUM, READ_16(memory)); size = 2; + break; + case SIM_D10V_TS2_DMAP_REGNUM: + size = 0; + break; + default: + size = 0; + break; } - else - size = 0; SLOT_FLUSH (); return size; } diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c index cb0fa56c888..1c0ecfe7479 100644 --- a/sim/d10v/simops.c +++ b/sim/d10v/simops.c @@ -1972,7 +1972,7 @@ void OP_4400 () { int16 tmp; - trace_input ("mf0f", OP_REG_OUTPUT, OP_REG, OP_VOID); + trace_input ("mvf0f", OP_REG_OUTPUT, OP_REG, OP_VOID); if (PSW_F0 == 0) { tmp = GPR (OP[1]); @@ -1988,7 +1988,7 @@ void OP_4401 () { int16 tmp; - trace_input ("mf0t", OP_REG_OUTPUT, OP_REG, OP_VOID); + trace_input ("mvf0t", OP_REG_OUTPUT, OP_REG, OP_VOID); if (PSW_F0) { tmp = GPR (OP[1]); @@ -2604,7 +2604,7 @@ void OP_460B () { int16 tmp; - trace_input ("slx", OP_REG, OP_FLAG, OP_VOID); + trace_input ("slx", OP_REG, OP_VOID, OP_VOID); tmp = ((GPR (OP[0]) << 1) | PSW_F0); SET_GPR (OP[0], tmp); trace_output_16 (tmp); @@ -2726,7 +2726,7 @@ void OP_4609 () { uint16 tmp; - trace_input ("srx", OP_REG, OP_FLAG, OP_VOID); + trace_input ("srx", OP_REG, OP_VOID, OP_VOID); tmp = PSW_F0 << 15; tmp = ((GPR (OP[0]) >> 1) | tmp); SET_GPR (OP[0], tmp); diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog index f2ff60050a1..d68e6639a2b 100644 --- a/sim/erc32/ChangeLog +++ b/sim/erc32/ChangeLog @@ -1,3 +1,8 @@ +2002-06-08 Andrew Cagney + + * sis.h: Include "gdb/remote-sim.h" and "gdb/callback.h". + * interf.c: Include "gdb/remote-sim.h". + Tue May 23 21:39:23 2000 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index d0a781eb937..19318864534 100644 --- a/sim/erc32/interf.c +++ b/sim/erc32/interf.c @@ -31,7 +31,7 @@ #include #include "sim-config.h" -#include "remote-sim.h" +#include "gdb/remote-sim.h" #ifndef fprintf extern fprintf(); diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h index 2a895c0277d..5bdd7704e24 100644 --- a/sim/erc32/sis.h +++ b/sim/erc32/sis.h @@ -21,8 +21,8 @@ */ #include "ansidecl.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "end.h" diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 63925e647d9..443b2228ba7 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,38 @@ +2002-06-08 Andrew Cagney + + * compile.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + +2002-05-19 Kazu Hirata + + * compile.c: Fix formatting. + +2002-05-18 Kazu Hirata + + * compile.c: Fix formatting. + +2002-05-17 Andrey Volkov (avolkov@transas.com) + + * compile.c: Add absented opcodes: LDC, STC, EEPMOV, TAS. + +2002-05-17 Andrey Volkov (avolkov@transas.com) + + * compile.c: Add support of EXR register + * inst.h: Ditto. + +2002-05-17 Andrey Volkov (avolkov@transas.com) + + * compile.c: Made h8300s as new target, not h8300h alias. + * inst.h: Ditto. + +2002-05-17 Andrey Volkov (avolkov@transas.com) + + * compile.c: Add additional CCR flags (I,UI,H,U) + +2002-05-17 Andrey Volkov (avolkov@transas.com) + + * compile.c: Change literal regnumbers to REGNUMS. + Fix instruction and cycles counting + 2001-12-20 Kazu Hirata * compile.c: Fix formatting. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 5e66dcb0954..b8c5ef3f568 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -32,8 +32,8 @@ #endif #include "ansidecl.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #ifndef SIGTRAP # define SIGTRAP 5 @@ -67,6 +67,7 @@ void sim_set_simcache_size PARAMS ((int)); #define OP_CCR 7 #define OP_IMM 8 #define OP_ABS 10 +#define OP_EXR 11 #define h8_opcodes ops #define DEFINE_TABLE #include "opcode/h8300.h" @@ -81,13 +82,26 @@ void sim_set_simcache_size PARAMS ((int)); #define HIGH_BYTE(x) (((x) >> 8) & 0xff) #define P(X,Y) ((X << 8) | Y) -#define BUILDSR() cpu.ccr = (N << 3) | (Z << 2) | (V << 1) | C; +#define BUILDSR() cpu.ccr = (I << 7) | (UI << 6)| (H<<5) | (U<<4) | \ + (N << 3) | (Z << 2) | (V<<1) | C; + +#define BUILDEXR() \ + if (h8300smode) cpu.exr = (trace<<7) | intMask; #define GETSR() \ c = (cpu.ccr >> 0) & 1;\ v = (cpu.ccr >> 1) & 1;\ nz = !((cpu.ccr >> 2) & 1);\ - n = (cpu.ccr >> 3) & 1; + n = (cpu.ccr >> 3) & 1;\ + u = (cpu.ccr >> 4) & 1;\ + h = (cpu.ccr >> 5) & 1;\ + ui = ((cpu.ccr >> 6) & 1);\ + intMaskBit = (cpu.ccr >> 7) & 1; + +#define GETEXR() \ + if (h8300smode) { \ + trace = (cpu.exr >> 7) & 1;\ + intMask = cpu.exr & 7; } #ifdef __CHAR_IS_SIGNED__ #define SEXTCHAR(x) ((char) (x)) @@ -111,10 +125,7 @@ static int memory_size; static int get_now () { -#ifndef WIN32 - return time (0); -#endif - return 0; + return time (0); /* WinXX HAS UNIX like 'time', so why not using it? */ } static int @@ -155,7 +166,7 @@ lvalue (x, rn) return X (OP_MEM, SP); default: - abort (); + abort (); /* ?? May be something more usefull? */ } } @@ -410,6 +421,10 @@ decode (addr, data, dst) { p->type = OP_CCR; } + else if (x & EXR) + { + p->type = OP_EXR; + } else printf ("Hmmmm %x", x); @@ -608,7 +623,7 @@ fetch (arg, n) return t; default: - abort (); + abort (); /* ?? May be something more usefull? */ } } @@ -702,7 +717,9 @@ init_pointers () init = 1; littleendian.i = 1; - if (h8300hmode) + if (h8300smode) + memory_size = H8300S_MSIZE; + else if (h8300hmode) memory_size = H8300H_MSIZE; else memory_size = H8300_MSIZE; @@ -778,6 +795,10 @@ control_c (sig, code, scp, addr) #define Z (nz == 0) #define V (v != 0) #define N (n != 0) +#define U (u != 0) +#define H (h != 0) +#define UI (ui != 0) +#define I (intMaskBit != 0) static int mop (code, bsize, sign) @@ -829,7 +850,7 @@ mop (code, bsize, sign) } #define ONOT(name, how) \ -case O(name, SB): \ +case O (name, SB): \ { \ int t; \ int hm = 0x80; \ @@ -837,7 +858,7 @@ case O(name, SB): \ how; \ goto shift8; \ } \ -case O(name, SW): \ +case O (name, SW): \ { \ int t; \ int hm = 0x8000; \ @@ -845,7 +866,7 @@ case O(name, SW): \ how; \ goto shift16; \ } \ -case O(name, SL): \ +case O (name, SL): \ { \ int t; \ int hm = 0x80000000; \ @@ -855,7 +876,7 @@ case O(name, SL): \ } #define OSHIFTS(name, how1, how2) \ -case O(name, SB): \ +case O (name, SB): \ { \ int t; \ int hm = 0x80; \ @@ -870,7 +891,7 @@ case O(name, SB): \ } \ goto shift8; \ } \ -case O(name, SW): \ +case O (name, SW): \ { \ int t; \ int hm = 0x8000; \ @@ -885,7 +906,7 @@ case O(name, SW): \ } \ goto shift16; \ } \ -case O(name, SL): \ +case O (name, SL): \ { \ int t; \ int hm = 0x80000000; \ @@ -902,14 +923,14 @@ case O(name, SL): \ } #define OBITOP(name,f, s, op) \ -case O(name, SB): \ +case O (name, SB): \ { \ int m; \ int b; \ if (f) ea = fetch (&code->dst); \ - m=1<< fetch(&code->src); \ + m=1<< fetch (&code->src); \ op; \ - if(s) store (&code->dst,ea); goto next; \ + if (s) store (&code->dst,ea); goto next; \ } int @@ -921,6 +942,28 @@ sim_stop (sd) return 1; } +#define R0_REGNUM 0 +#define R1_REGNUM 1 +#define R2_REGNUM 2 +#define R3_REGNUM 3 +#define R4_REGNUM 4 +#define R5_REGNUM 5 +#define R6_REGNUM 6 +#define R7_REGNUM 7 + +#define SP_REGNUM R7_REGNUM /* Contains address of top of stack */ +#define FP_REGNUM R6_REGNUM /* Contains address of executing + * stack frame */ + +#define CCR_REGNUM 8 /* Contains processor status */ +#define PC_REGNUM 9 /* Contains program counter */ + +#define CYCLE_REGNUM 10 + +#define EXR_REGNUM 11 +#define INST_REGNUM 12 +#define TICK_REGNUM 13 + void sim_resume (sd, step, siggnal) SIM_DESC sd; @@ -937,7 +980,8 @@ sim_resume (sd, step, siggnal) int ea; int bit; int pc; - int c, nz, v, n; + int c, nz, v, n, u, h, ui, intMaskBit; + int trace, intMask; int oldmask; init_pointers (); @@ -961,6 +1005,8 @@ sim_resume (sd, step, siggnal) abort (); GETSR (); + GETEXR (); + oldmask = cpu.mask; if (!h8300hmode) cpu.mask = 0xffff; @@ -975,15 +1021,15 @@ sim_resume (sd, step, siggnal) #define ALUOP(STORE, NAME, HOW) \ - case O(NAME,SB): HOW; if(STORE)goto alu8;else goto just_flags_alu8; \ - case O(NAME, SW): HOW; if(STORE)goto alu16;else goto just_flags_alu16; \ - case O(NAME,SL): HOW; if(STORE)goto alu32;else goto just_flags_alu32; + case O (NAME,SB): HOW; if (STORE)goto alu8;else goto just_flags_alu8; \ + case O (NAME, SW): HOW; if (STORE)goto alu16;else goto just_flags_alu16; \ + case O (NAME,SL): HOW; if (STORE)goto alu32;else goto just_flags_alu32; #define LOGOP(NAME, HOW) \ - case O(NAME,SB): HOW; goto log8;\ - case O(NAME, SW): HOW; goto log16;\ - case O(NAME,SL): HOW; goto log32; + case O (NAME,SB): HOW; goto log8;\ + case O (NAME, SW): HOW; goto log16;\ + case O (NAME,SL): HOW; goto log32; @@ -997,8 +1043,12 @@ sim_resume (sd, step, siggnal) #endif - cycles += code->cycles; - insts++; + if (code->opcode) + { + cycles += code->cycles; + insts++; + } + switch (code->opcode) { case 0: @@ -1025,8 +1075,8 @@ sim_resume (sd, step, siggnal) res = rd + ea; goto alu8; -#define EA ea = fetch(&code->src); -#define RD_EA ea = fetch(&code->src); rd = fetch(&code->dst); +#define EA ea = fetch (&code->src); +#define RD_EA ea = fetch (&code->src); rd = fetch (&code->dst); ALUOP (1, O_SUB, RD_EA; ea = -ea; @@ -1087,6 +1137,37 @@ sim_resume (sd, step, siggnal) SET_L_REG (code->dst.reg, res); goto just_flags_log32; + case O (O_EEPMOV, SB): + case O (O_EEPMOV, SW): + if (h8300hmode||h8300smode) + { + register unsigned char *_src,*_dst; + unsigned int count = (code->opcode == O(O_EEPMOV, SW))?cpu.regs[R4_REGNUM]&0xffff: + cpu.regs[R4_REGNUM]&0xff; + + _src = cpu.regs[R5_REGNUM] < memory_size ? cpu.memory+cpu.regs[R5_REGNUM] : + cpu.eightbit + (cpu.regs[R5_REGNUM] & 0xff); + if ((_src+count)>=(cpu.memory+memory_size)) + { + if ((_src+count)>=(cpu.eightbit+0x100)) + goto illegal; + } + _dst = cpu.regs[R6_REGNUM] < memory_size ? cpu.memory+cpu.regs[R6_REGNUM] : + cpu.eightbit + (cpu.regs[R6_REGNUM] & 0xff); + if ((_dst+count)>=(cpu.memory+memory_size)) + { + if ((_dst+count)>=(cpu.eightbit+0x100)) + goto illegal; + } + memcpy(_dst,_src,count); + + cpu.regs[R5_REGNUM]+=count; + cpu.regs[R6_REGNUM]+=count; + cpu.regs[R4_REGNUM]&=(code->opcode == O(O_EEPMOV, SW))?(~0xffff):(~0xff); + cycles += 2*count; + goto next; + } + goto illegal; case O (O_ADDS, SL): SET_L_REG (code->dst.reg, @@ -1166,23 +1247,69 @@ sim_resume (sd, step, siggnal) SET_L_REG (code->dst.reg, res); goto just_flags_inc32; - #define GET_CCR(x) BUILDSR();x = cpu.ccr +#define GET_EXR(x) BUILDEXR ();x = cpu.exr + + case O (O_LDC, SB): + case O (O_LDC, SW): + res = fetch (&code->src); + goto setc; + case O (O_STC, SB): + case O (O_STC, SW): + if (code->src.type == OP_CCR) + { + GET_CCR (res); + } + else if (code->src.type == OP_EXR && h8300smode) + { + GET_EXR (res); + } + else + goto illegal; + store (&code->dst, res); + goto next; case O (O_ANDC, SB): - GET_CCR (rd); + if (code->dst.type == OP_CCR) + { + GET_CCR (rd); + } + else if (code->dst.type == OP_EXR && h8300smode) + { + GET_EXR (rd); + } + else + goto illegal; ea = code->src.literal; res = rd & ea; goto setc; case O (O_ORC, SB): - GET_CCR (rd); + if (code->dst.type == OP_CCR) + { + GET_CCR (rd); + } + else if (code->dst.type == OP_EXR && h8300smode) + { + GET_EXR (rd); + } + else + goto illegal; ea = code->src.literal; res = rd | ea; goto setc; case O (O_XORC, SB): - GET_CCR (rd); + if (code->dst.type == OP_CCR) + { + GET_CCR (rd); + } + else if (code->dst.type == OP_EXR && h8300smode) + { + GET_EXR (rd); + } + else + goto illegal; ea = code->src.literal; res = rd ^ ea; goto setc; @@ -1283,7 +1410,7 @@ sim_resume (sd, step, siggnal) c = rd & (hm >> 1); v = (rd & (hm >> 1)) != ((rd & (hm >> 2)) << 2); rd <<= 2); OSHIFTS (O_SHAR, t = rd & hm; c = rd & 1; v = 0; rd >>= 1; rd |= t, - t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1 ); + t = rd & hm; c = rd & 2; v = 0; rd >>= 2; rd |= t | t >> 1); OSHIFTS (O_ROTL, c = rd & hm; v = 0; rd <<= 1; rd |= C, c = rd & hm; v = 0; rd <<= 1; rd |= C; c = rd & hm; rd <<= 1; rd |= C); @@ -1362,7 +1489,7 @@ sim_resume (sd, step, siggnal) the macros here instead of looking for .../sys/wait.h. */ #define SIM_WIFEXITED(v) (((v) & 0xff) == 0) #define SIM_WIFSIGNALED(v) (((v) & 0x7f) > 0 && (((v) & 0x7f) < 0x7f)) - if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0])) + if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0])) cpu.exception = SIGILL; else cpu.exception = SIGTRAP; @@ -1375,7 +1502,7 @@ sim_resume (sd, step, siggnal) OBITOP (O_BNOT, 1, 1, ea ^= m); OBITOP (O_BTST, 1, 0, nz = ea & m); OBITOP (O_BCLR, 1, 1, ea &= ~m); - OBITOP (O_BSET, 1, 1, ea |= m); + OBITOP (O_BSET, 1, 1, ea |= m); OBITOP (O_BLD, 1, 0, c = ea & m); OBITOP (O_BILD, 1, 0, c = !(ea & m)); OBITOP (O_BST, 1, 1, ea &= ~m; @@ -1406,6 +1533,22 @@ sim_resume (sd, step, siggnal) MOP (0, 0); break; + case O (O_TAS, SB): + if (!h8300smode || code->src.type != X (OP_REG, SL)) + goto illegal; + switch (code->src.reg) + { + case R0_REGNUM: + case R1_REGNUM: + case R4_REGNUM: + case R5_REGNUM: + break; + default: + goto illegal; + } + res = fetch (&code->src); + store (&code->src,res|0x80); + goto just_flags_log8; case O (O_DIVU, SB): { @@ -1529,6 +1672,7 @@ sim_resume (sd, step, siggnal) goto next; default: + illegal: cpu.state = SIM_STATE_STOPPED; cpu.exception = SIGILL; goto end; @@ -1537,8 +1681,19 @@ sim_resume (sd, step, siggnal) abort (); setc: - cpu.ccr = res; - GETSR (); + if (code->dst.type == OP_CCR) + { + cpu.ccr = res; + GETSR (); + } + else if (code->dst.type == OP_EXR && h8300smode) + { + cpu.exr = res; + GETEXR (); + } + else + goto illegal; + goto next; condtrue: @@ -1718,6 +1873,7 @@ sim_resume (sd, step, siggnal) cpu.pc = pc; BUILDSR (); + BUILDEXR (); cpu.mask = oldmask; signal (SIGINT, prev); } @@ -1773,27 +1929,6 @@ sim_read (sd, addr, buffer, size) } -#define R0_REGNUM 0 -#define R1_REGNUM 1 -#define R2_REGNUM 2 -#define R3_REGNUM 3 -#define R4_REGNUM 4 -#define R5_REGNUM 5 -#define R6_REGNUM 6 -#define R7_REGNUM 7 - -#define SP_REGNUM R7_REGNUM /* Contains address of top of stack */ -#define FP_REGNUM R6_REGNUM /* Contains address of executing - * stack frame */ - -#define CCR_REGNUM 8 /* Contains processor status */ -#define PC_REGNUM 9 /* Contains program counter */ - -#define CYCLE_REGNUM 10 -#define INST_REGNUM 11 -#define TICK_REGNUM 12 - - int sim_store_register (sd, rn, value, length) SIM_DESC sd; @@ -1829,6 +1964,9 @@ sim_store_register (sd, rn, value, length) case CCR_REGNUM: cpu.ccr = intval; break; + case EXR_REGNUM: + cpu.exr = intval; + break; case CYCLE_REGNUM: cpu.cycles = longval; break; @@ -1856,14 +1994,19 @@ sim_fetch_register (sd, rn, buf, length) init_pointers (); + if (!h8300smode && rn >=EXR_REGNUM) + rn++; switch (rn) { default: abort (); - case 8: + case CCR_REGNUM: v = cpu.ccr; break; - case 9: + case EXR_REGNUM: + v = cpu.exr; + break; + case PC_REGNUM: v = cpu.pc; break; case R0_REGNUM: @@ -1876,15 +2019,15 @@ sim_fetch_register (sd, rn, buf, length) case R7_REGNUM: v = cpu.regs[rn]; break; - case 10: + case CYCLE_REGNUM: v = cpu.cycles; longreg = 1; break; - case 11: + case TICK_REGNUM: v = cpu.ticks; longreg = 1; break; - case 12: + case INST_REGNUM: v = cpu.insts; longreg = 1; break; @@ -1998,13 +2141,14 @@ sim_info (sd, verbose) FLAG is non-zero for the H8/300H. */ void -set_h8300h (flag) - int flag; +set_h8300h (h_flag, s_flag) + int h_flag, s_flag; { /* FIXME: Much of the code in sim_load can be moved to sim_open. This function being replaced by a sim_open:ARGV configuration option. */ - h8300hmode = flag; + h8300hmode = h_flag; + h8300smode = s_flag; } SIM_DESC @@ -2059,8 +2203,8 @@ sim_load (sd, prog, abfd, from_tty) if (bfd_check_format (prog_bfd, bfd_object)) { unsigned long mach = bfd_get_mach (prog_bfd); - set_h8300h (mach == bfd_mach_h8300h - || mach == bfd_mach_h8300s); + set_h8300h (mach == bfd_mach_h8300h || mach == bfd_mach_h8300s, + mach == bfd_mach_h8300s); } } @@ -2078,7 +2222,10 @@ sim_load (sd, prog, abfd, from_tty) so we just reallocate memory now; this will also allow us to handle switching between H8/300 and H8/300H programs without exiting gdb. */ - if (h8300hmode) + + if (h8300smode) + memory_size = H8300S_MSIZE; + else if (h8300hmode) memory_size = H8300H_MSIZE; else memory_size = H8300_MSIZE; diff --git a/sim/h8300/inst.h b/sim/h8300/inst.h index ce930c3a7fd..bcf8e4a6b33 100644 --- a/sim/h8300/inst.h +++ b/sim/h8300/inst.h @@ -15,7 +15,13 @@ can only happen when simulating H8/300H programs). We make no attempt to catch overlapping addresses, wrapped addresses, etc etc. */ #define H8300_MSIZE (1<<16) -#define H8300H_MSIZE (1<<18) + +/* avolkov: + Next 2 macros are ugly for any workstation, but while they're work. + Memory size MUST be configurable. + */ +#define H8300H_MSIZE (1<<18) +#define H8300S_MSIZE (1<<24) #define CSIZE 1000 @@ -26,6 +32,7 @@ typedef enum R_ZERO, R_PC, R_CCR, + R_EXR, R_HARD_0, R_LAST, } reg_type; @@ -67,7 +74,7 @@ typedef struct unsigned int regs[9]; int pc; int ccr; - + int exr; unsigned char *memory; unsigned char *eightbit; diff --git a/sim/h8500/ChangeLog b/sim/h8500/ChangeLog index af4f78470bb..eeb4d6ddc48 100644 --- a/sim/h8500/ChangeLog +++ b/sim/h8500/ChangeLog @@ -1,3 +1,7 @@ +2002-06-08 Andrew Cagney + + * compile.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + Tue May 23 21:39:23 2000 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/h8500/compile.c b/sim/h8500/compile.c index 1aad644fa8a..aec8ce97372 100644 --- a/sim/h8500/compile.c +++ b/sim/h8500/compile.c @@ -31,8 +31,8 @@ #include #include "ansidecl.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #define O_RECOMPILE 85 #define DEFINE_TABLE diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog index d5ba8abf638..f6cb513f650 100644 --- a/sim/igen/ChangeLog +++ b/sim/igen/ChangeLog @@ -1,3 +1,8 @@ +2002-06-03 Richard Henderson + + * gen-engine.c (print_run_body): Avoid multi-line strings. + * lf.c (lf_print__gnu_copyleft): Likewise. + 2002-05-01 Chris Demetriou * igen.c: Use 'deprecated' rather than 'depreciated.' diff --git a/sim/igen/gen-engine.c b/sim/igen/gen-engine.c index 4b6861ed97e..ee27e680317 100644 --- a/sim/igen/gen-engine.c +++ b/sim/igen/gen-engine.c @@ -98,21 +98,21 @@ print_run_body (lf *file, if (!options.gen.smp) { - lf_putstr (file, " -/* CASE 1: NO SMP (with or with out instruction cache). - -In this case, we can take advantage of the fact that the current -instruction address (CIA) does not need to be read from / written to -the CPU object after the execution of an instruction. - -Instead, CIA is only saved when the main loop exits. This occures -when either sim_engine_halt or sim_engine_restart is called. Both of -these functions save the current instruction address before halting / -restarting the simulator. - -As a variation, there may also be support for an instruction cracking -cache. */ - + lf_putstr (file, "\ +/* CASE 1: NO SMP (with or with out instruction cache).\n\ +\n\ +In this case, we can take advantage of the fact that the current\n\ +instruction address (CIA) does not need to be read from / written to\n\ +the CPU object after the execution of an instruction.\n\ +\n\ +Instead, CIA is only saved when the main loop exits. This occures\n\ +when either sim_engine_halt or sim_engine_restart is called. Both of\n\ +these functions save the current instruction address before halting /\n\ +restarting the simulator.\n\ +\n\ +As a variation, there may also be support for an instruction cracking\n\ +cache. */\n\ +\n\ "); lf_putstr (file, "\n"); @@ -215,14 +215,14 @@ cache. */ if (options.gen.smp) { - lf_putstr (file, " -/* CASE 2: SMP (With or without ICACHE) - -The complexity here comes from needing to correctly halt the simulator -when it is aborted. For instance, if cpu0 requests a restart then -cpu1 will normally be the next cpu that is run. Cpu0 being restarted -after all the other CPU's and the event queue have been processed */ - + lf_putstr (file, "\ +/* CASE 2: SMP (With or without ICACHE)\n\ +\n\ +The complexity here comes from needing to correctly halt the simulator\n\ +when it is aborted. For instance, if cpu0 requests a restart then\n\ +cpu1 will normally be the next cpu that is run. Cpu0 being restarted\n\ +after all the other CPU's and the event queue have been processed */\n\ +\n\ "); lf_putstr (file, "\n"); diff --git a/sim/igen/lf.c b/sim/igen/lf.c index 1b4a5f136ec..d2098585657 100644 --- a/sim/igen/lf.c +++ b/sim/igen/lf.c @@ -259,27 +259,27 @@ lf_print__gnu_copyleft (lf *file) case lf_is_c: case lf_is_h: nr += lf_printf(file, "\ -/* This file is part of the program psim. - - Copyright (C) 1994-1997, Andrew Cagney - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -- - - This file was generated by the program %s */ +/* This file is part of the program psim.\n\ +\n\ + Copyright (C) 1994-1997, Andrew Cagney \n\ +\n\ + This program is free software; you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation; either version 2 of the License, or\n\ + (at your option) any later version.\n\ +\n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details.\n\ + \n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; if not, write to the Free Software\n\ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\ +\n\ + --\n\ +\n\ + This file was generated by the program %s */\n\ ", filter_filename(file->program)); break; default: diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog index 12734148c17..ee0cd2eac7a 100644 --- a/sim/m68hc11/ChangeLog +++ b/sim/m68hc11/ChangeLog @@ -1,3 +1,8 @@ +2002-06-09 Andrew Cagney + + * Makefile.in (INCLUDE): Update path to callback.h. + * sim-main.h: Include "gdb/callback.h" and "gdb/remote-sim.h". + 2002-03-07 Stephane Carrez * m68hc11_sim.c (cpu_move8): Call sim_engine_abort in default case. diff --git a/sim/m68hc11/Makefile.in b/sim/m68hc11/Makefile.in index 51e873bbbeb..a054a329c7d 100644 --- a/sim/m68hc11/Makefile.in +++ b/sim/m68hc11/Makefile.in @@ -42,7 +42,7 @@ SIM_EXTRA_CLEAN = clean-extra SIM_EXTRA_OBJS = @m68hc11_extra_objs@ -INCLUDE = $(srcdir)/../../include/callback.h \ +INCLUDE = $(srcdir)/../../include/gdb/callback.h \ interrupts.h sim-main.h diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h index a47e7aa36e9..75c3b5b8451 100644 --- a/sim/m68hc11/sim-main.h +++ b/sim/m68hc11/sim-main.h @@ -36,8 +36,8 @@ typedef address_word sim_cia; #include "opcode/m68hc11.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "opcode/m68hc11.h" #include "sim-types.h" diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog index a5e5ef97c94..066f0f3bedb 100644 --- a/sim/mcore/ChangeLog +++ b/sim/mcore/ChangeLog @@ -1,3 +1,7 @@ +2002-06-08 Andrew Cagney + + * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + Tue May 23 21:39:23 2000 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index 456e4811cd4..79c7d2ede0b 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -24,9 +24,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include /* for byte ordering macros */ #include "bfd.h" -#include "callback.h" +#include "gdb/callback.h" #include "libiberty.h" -#include "remote-sim.h" +#include "gdb/remote-sim.h" #ifndef NUM_ELEM #define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0]) diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 388753966c5..d08971d8d77 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,241 @@ +2002-06-14 Chris Demetriou + Ed Satterthwaite + + * mips3d.igen: New file which contains MIPS-3D ASE instructions. + * Makefile.in (IGEN_INCLUDE): Add mips3d.igen. + * mips.igen: Include mips3d.igen. + (mips3d): New model name for MIPS-3D ASE instructions. + (CVT.W.fmt): Don't use this instruction for word (source) format + instructions. + * cp1.c (fp_binary_r, fp_add_r, fp_mul_r, fpu_inv1, fpu_inv1_32) + (fpu_inv1_64, fp_recip1, fp_recip2, fpu_inv_sqrt1, fpu_inv_sqrt1_32) + (fpu_inv_sqrt1_64, fp_rsqrt1, fp_rsqrt2): New functions. + (NR_FRAC_GUARD, IMPLICIT_1): New macros. + * sim-main.h (fmt_pw, CompareAbs, AddR, MultiplyR, Recip1, Recip2) + (RSquareRoot1, RSquareRoot2): New macros. + (fp_add_r, fp_mul_r, fp_recip1, fp_recip2, fp_rsqrt1) + (fp_rsqrt2): New functions. + * configure.in: Add MIPS-3D support to mipsisa64 simulator. + * configure: Regenerate. + +2002-06-13 Chris Demetriou + Ed Satterthwaite + + * cp1.c (FP_PS_upper, FP_PS_lower, FP_PS_cat, FPQNaN_PS): New macros. + (value_fpr, store_fpr, fp_cmp, fp_unary, fp_binary, fp_mac) + (fp_inv_sqrt, fpu_format_name): Add paired-single support. + (convert): Note that this function is not used for paired-single + format conversions. + (ps_lower, ps_upper, pack_ps, convert_ps): New functions. + * mips.igen (FMT, MOVtf.fmt): Add paired-single support. + (check_fmt_p): Enable paired-single support. + (ALNV.PS, CVT.PS.S, CVT.S.PL, CVT.S.PU, PLL.PS, PLU.PS, PUL.PS) + (PUU.PS): New instructions. + (CVT.S.fmt): Don't use this instruction for paired-single format + destinations. + * sim-main.h (FP_formats): New value 'fmt_ps.' + (ps_lower, ps_upper, pack_ps, convert_ps): New prototypes. + (PSLower, PSUpper, PackPS, ConvertPS): New macros. + +2002-06-12 Chris Demetriou + + * mips.igen: Fix formatting of function calls in + many FP operations. + +2002-06-12 Chris Demetriou + + * mips.igen (MOVN, MOVZ): Trace result. + (TNEI): Print "tnei" as the opcode name in traces. + (CEIL.W): Add disassembly string for traces. + (RSQRT.fmt): Make location of disassembly string consistent + with other instructions. + +2002-06-12 Chris Demetriou + + * mips.igen (X): Delete unused function. + +2002-06-08 Andrew Cagney + + * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + +2002-06-07 Chris Demetriou + Ed Satterthwaite + + * cp1.c (inner_mac, fp_mac, inner_rsqrt, fp_inv_sqrt) + (fp_rsqrt, fp_madd, fp_msub, fp_nmadd, fp_nmsub): New functions. + * sim-main.h (fp_rsqrt, fp_madd, fp_msub, fp_nmadd) + (fp_nmsub): New prototypes. + (RSquareRoot, MultiplyAdd, MultiplySub, NegMultiplyAdd) + (NegMultiplySub): New defines. + * mips.igen (RSQRT.fmt): Use RSquareRoot(). + (MADD.D, MADD.S): Replace with... + (MADD.fmt): New instruction. + (MSUB.D, MSUB.S): Replace with... + (MSUB.fmt): New instruction. + (NMADD.D, NMADD.S): Replace with... + (NMADD.fmt): New instruction. + (NMSUB.D, MSUB.S): Replace with... + (NMSUB.fmt): New instruction. + +2002-06-07 Chris Demetriou + Ed Satterthwaite + + * cp1.c: Fix more comment spelling and formatting. + (value_fcr, store_fcr): Use fenr_FS rather than hard-coding value. + (denorm_mode): New function. + (fpu_unary, fpu_binary): Round results after operation, collect + status from rounding operations, and update the FCSR. + (convert): Collect status from integer conversions and rounding + operations, and update the FCSR. Adjust NaN values that result + from conversions. Convert to use sim_io_eprintf rather than + fprintf, and remove some debugging code. + * cp1.h (fenr_FS): New define. + +2002-06-07 Chris Demetriou + + * cp1.c (convert): Remove unusable debugging code, and move MIPS + rounding mode to sim FP rounding mode flag conversion code into... + (rounding_mode): New function. + +2002-06-07 Chris Demetriou + + * cp1.c: Clean up formatting of a few comments. + (value_fpr): Reformat switch statement. + +2002-06-06 Chris Demetriou + Ed Satterthwaite + + * cp1.h: New file. + * sim-main.h: Include cp1.h. + (SETFCC, GETFCC, IR, UF, OF, DX, IO, UO, FP_FLAGS, FP_ENABLE) + (FP_CAUSE, GETFS, FP_RM_NEAREST, FP_RM_TOZERO, FP_RM_TOPINF) + (FP_RM_TOMINF, GETRM): Remove. Moved to cp1.h. + (FP_FS, FP_MASK_RM, FP_SH_RM, Nan, Less, Equal): Remove. + (value_fcr, store_fcr, test_fcsr, fp_cmp): New prototypes. + (ValueFCR, StoreFCR, TestFCSR, Compare): New macros. + * cp1.c: Don't include sim-fpu.h; already included by + sim-main.h. Clean up formatting of some comments. + (NaN, Equal, Less): Remove. + (test_fcsr, value_fcr, store_fcr, update_fcsr, fp_test) + (fp_cmp): New functions. + * mips.igen (do_c_cond_fmt): Remove. + (C.cond.fmta, C.cond.fmtb): Replace uses of do_c_cond_fmt_a with + Compare. Add result tracing. + (CxC1): Remove, replace with... + (CFC1a, CFC1b, CFC1c, CTC1a, CTC1b, CTC1c): New instructions. + (DMxC1): Remove, replace with... + (DMFC1a, DMFC1b, DMTC1a, DMTC1b): New instructions. + (MxC1): Remove, replace with... + (MFC1a, MFC1b, MTC1a, MTC1b): New instructions. + +2002-06-04 Chris Demetriou + + * sim-main.h (FGRIDX): Remove, replace all uses with... + (FGR_BASE): New macro. + (FP0_REGNUM, FCRCS_REGNUM, FCRIR_REGNUM): New macros. + (_sim_cpu): Move 'fgr' member to be right before 'fpr_state' member. + (NR_FGR, FGR): Likewise. + * interp.c: Replace all uses of FGRIDX with FGR_BASE. + * mips.igen: Likewise. + +2002-06-04 Chris Demetriou + + * cp1.c: Add an FSF Copyright notice to this file. + +2002-06-04 Chris Demetriou + Ed Satterthwaite + + * cp1.c (Infinity): Remove. + * sim-main.h (Infinity): Likewise. + + * cp1.c (fp_unary, fp_binary): New functions. + (fp_abs, fp_neg, fp_add, fp_sub, fp_mul, fp_div, fp_recip) + (fp_sqrt): New functions, implemented in terms of the above. + (AbsoluteValue, Negate, Add, Sub, Multiply, Divide) + (Recip, SquareRoot): Remove (replaced by functions above). + * sim-main.h (fp_abs, fp_neg, fp_add, fp_sub, fp_mul, fp_div) + (fp_recip, fp_sqrt): New prototypes. + (AbsoluteValue, Negate, Add, Sub, Multiply, Divide) + (Recip, SquareRoot): Replace prototypes with #defines which + invoke the functions above. + +2002-06-03 Chris Demetriou + + * sim-main.h (Nan, Infinity, Less, Equal, AbsoluteValue, Negate) + (Add, Sub, Multiply, Divide, Recip, SquareRoot): Move lower in + file, remove PARAMS from prototypes. + (value_fpr, store_fpr, convert): Likewise. Use SIM_STATE to provide + simulator state arguments. + (ValueFPR, StoreFPR, Convert): Move lower in file. Use SIM_ARGS to + pass simulator state arguments. + * cp1.c (SD): Redefine as CPU_STATE(cpu). + (store_fpr, convert): Remove 'sd' argument. + (value_fpr): Likewise. Convert to use 'SD' instead. + +2002-06-03 Chris Demetriou + + * cp1.c (Min, Max): Remove #if 0'd functions. + * sim-main.h (Min, Max): Remove. + +2002-06-03 Chris Demetriou + + * cp1.c: fix formatting of switch case and default labels. + * interp.c: Likewise. + * sim-main.c: Likewise. + +2002-06-03 Chris Demetriou + + * cp1.c: Clean up comments which describe FP formats. + (FPQNaN_DOUBLE, FPQNaN_LONG): Generate using UNSIGNED64. + +2002-06-03 Chris Demetriou + Ed Satterthwaite + + * configure.in (mipsisa64sb1*-*-*): New target for supporting + Broadcom SiByte SB-1 processor configurations. + * configure: Regenerate. + * sb1.igen: New file. + * mips.igen: Include sb1.igen. + (sb1): New model. + * Makefile.in (IGEN_INCLUDE): Add sb1.igen. + * mdmx.igen: Add "sb1" model to all appropriate functions and + instructions. + * mdmx.c (AbsDiffOB, AvgOB, AccAbsDiffOB): New functions. + (ob_func, ob_acc): Reference the above. + (qh_acc): Adjust to keep the same size as ob_acc. + * sim-main.h (status_SBX, MX_VECT_ABSD, MX_VECT_AVG, MX_AbsDiff) + (MX_Avg, MX_VECT_ABSDA, MX_AbsDiffC): New macros. + +2002-06-03 Chris Demetriou + + * Makefile.in (IGEN_INCLUDE): Add mdmx.igen. + +2002-06-02 Chris Demetriou + Ed Satterthwaite + + * mips.igen (mdmx): New (pseudo-)model. + * mdmx.c, mdmx.igen: New files. + * Makefile.in (SIM_OBJS): Add mdmx.o. + * sim-main.h (MDMX_accumulator, MX_fmtsel, signed24, signed48): + New typedefs. + (ACC, MX_Add, MX_AddA, MX_AddL, MX_And, MX_C_EQ, MX_C_LT, MX_Comp) + (MX_FMT_OB, MX_FMT_QH, MX_Max, MX_Min, MX_Msgn, MX_Mul, MX_MulA) + (MX_MulL, MX_MulS, MX_MulSL, MX_Nor, MX_Or, MX_Pick, MX_RAC) + (MX_RAC_H, MX_RAC_L, MX_RAC_M, MX_RNAS, MX_RNAU, MX_RND_AS) + (MX_RND_AU, MX_RND_ES, MX_RND_EU, MX_RND_ZS, MX_RND_ZU, MX_RNES) + (MX_RNEU, MX_RZS, MX_RZU, MX_SHFL, MX_ShiftLeftLogical) + (MX_ShiftRightArith, MX_ShiftRightLogical, MX_Sub, MX_SubA, MX_SubL) + (MX_VECT_ADD, MX_VECT_ADDA, MX_VECT_ADDL, MX_VECT_AND) + (MX_VECT_MAX, MX_VECT_MIN, MX_VECT_MSGN, MX_VECT_MUL, MX_VECT_MULA) + (MX_VECT_MULL, MX_VECT_MULS, MX_VECT_MULSL, MX_VECT_NOR) + (MX_VECT_OR, MX_VECT_SLL, MX_VECT_SRA, MX_VECT_SRL, MX_VECT_SUB) + (MX_VECT_SUBA, MX_VECT_SUBL, MX_VECT_XOR, MX_WACH, MX_WACL, MX_Xor) + (SIM_ARGS, SIM_STATE, UnpredictableResult, fmt_mdmx, ob_fmtsel) + (qh_fmtsel): New macros. + (_sim_cpu): New member "acc". + (mdmx_acc_op, mdmx_cc_op, mdmx_cpr_op, mdmx_pick_op, mdmx_rac_op) + (mdmx_round_op, mdmx_shuffle, mdmx_wach, mdmx_wacl): New functions. + 2002-05-01 Chris Demetriou * interp.c: Use 'deprecated' rather than 'depreciated.' diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in index 5d0a3364e8f..e0e9fafcafe 100644 --- a/sim/mips/Makefile.in +++ b/sim/mips/Makefile.in @@ -43,6 +43,7 @@ SIM_OBJS = \ $(MIPS_EXTRA_OBJS) \ cp1.o \ interp.o \ + mdmx.o \ sim-main.o \ sim-hload.o \ sim-engine.o \ @@ -71,6 +72,7 @@ SIM_RUN_OBJS = nrun.o interp.o: $(srcdir)/interp.c config.h sim-main.h itable.h cp1.o: $(srcdir)/cp1.c config.h sim-main.h +mdmx.o: $(srcdir)/mdmx.c $(srcdir)/sim-main.h ../igen/igen: cd ../igen && $(MAKE) @@ -81,6 +83,9 @@ IGEN_DC=$(srcdir)/mips.dc M16_DC=$(srcdir)/m16.dc IGEN_INCLUDE=\ $(srcdir)/m16.igen \ + $(srcdir)/mdmx.igen \ + $(srcdir)/mips3d.igen \ + $(srcdir)/sb1.igen \ $(srcdir)/tx.igen \ $(srcdir)/vr.igen \ diff --git a/sim/mips/configure b/sim/mips/configure index e5f427e10f7..859757a12af 100755 --- a/sim/mips/configure +++ b/sim/mips/configure @@ -4023,8 +4023,12 @@ case "${target}" in sim_igen_machine="-M mips32" sim_igen_filter="32,f" ;; + mipsisa64sb1*-*-*) sim_gen=IGEN + sim_igen_machine="-M mips64,sb1" + sim_igen_filter="32,64,f" + ;; mipsisa64*-*-*) sim_gen=IGEN - sim_igen_machine="-M mips64" + sim_igen_machine="-M mips64,mips3d" sim_igen_filter="32,64,f" ;; mips*lsi*) sim_gen=M16 @@ -4132,7 +4136,7 @@ esac # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:4136: checking for X" >&5 +echo "configure:4140: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -4194,12 +4198,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4207: \"$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* @@ -4268,14 +4272,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -4368,17 +4372,17 @@ for ac_hdr in string.h strings.h stdlib.h stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4372: checking for $ac_hdr" >&5 +echo "configure:4376: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4382: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4386: \"$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* @@ -4405,7 +4409,7 @@ fi done echo $ac_n "checking for fabs in -lm""... $ac_c" 1>&6 -echo "configure:4409: checking for fabs in -lm" >&5 +echo "configure:4413: checking for fabs in -lm" >&5 ac_lib_var=`echo m'_'fabs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4413,7 +4417,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4454,12 +4458,12 @@ fi for ac_func in aint anint sqrt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4458: checking for $ac_func" >&5 +echo "configure:4462: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4490: \"$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/sim/mips/configure.in b/sim/mips/configure.in index d8c40232695..3672b66e73a 100644 --- a/sim/mips/configure.in +++ b/sim/mips/configure.in @@ -128,8 +128,12 @@ case "${target}" in sim_igen_machine="-M mips32" sim_igen_filter="32,f" ;; + mipsisa64sb1*-*-*) sim_gen=IGEN + sim_igen_machine="-M mips64,sb1" + sim_igen_filter="32,64,f" + ;; mipsisa64*-*-*) sim_gen=IGEN - sim_igen_machine="-M mips64" + sim_igen_machine="-M mips64,mips3d" sim_igen_filter="32,64,f" ;; mips*lsi*) sim_gen=M16 diff --git a/sim/mips/cp1.c b/sim/mips/cp1.c index 063c241c277..26249f00bfe 100644 --- a/sim/mips/cp1.c +++ b/sim/mips/cp1.c @@ -1,9 +1,33 @@ /*> cp1.c <*/ +/* MIPS Simulator FPU (CoProcessor 1) support. + Copyright (C) 2002 Free Software Foundation, Inc. + Originally created by Cygnus Solutions, modified substially + by Broadcom Corporation (SiByte). Paired-single operation support + and MIPS-3D support contributed by Broadcom Corporation (SiByte). + +This file is part of GDB, the GNU debugger. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* XXX: The following notice should be removed as soon as is practical: */ /* Floating Point Support for gdb MIPS simulators This file is part of the MIPS sim THIS SOFTWARE IS NOT COPYRIGHTED + (by Cygnus.) Cygnus offers the following for use in the public domain. Cygnus makes no warranty with regard to the software or it's performance @@ -17,44 +41,59 @@ */ #include "sim-main.h" -#include "sim-fpu.h" /* Within cp1.c we refer to sim_cpu directly. */ #define CPU cpu -#define SD sd +#define SD CPU_STATE(cpu) /*-- FPU support routines ---------------------------------------------------*/ /* Numbers are held in normalized form. The SINGLE and DOUBLE binary - formats conform to ANSI/IEEE Std 754-1985. */ -/* SINGLE precision floating: - * seeeeeeeefffffffffffffffffffffff - * s = 1bit = sign - * e = 8bits = exponent - * f = 23bits = fraction - */ -/* SINGLE precision fixed: - * siiiiiiiiiiiiiiiiiiiiiiiiiiiiiii - * s = 1bit = sign - * i = 31bits = integer - */ -/* DOUBLE precision floating: - * seeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff - * s = 1bit = sign - * e = 11bits = exponent - * f = 52bits = fraction - */ -/* DOUBLE precision fixed: - * siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii - * s = 1bit = sign - * i = 63bits = integer + formats conform to ANSI/IEEE Std 754-1985. + + SINGLE precision floating: + seeeeeeeefffffffffffffffffffffff + s = 1bit = sign + e = 8bits = exponent + f = 23bits = fraction + + SINGLE precision fixed: + siiiiiiiiiiiiiiiiiiiiiiiiiiiiiii + s = 1bit = sign + i = 31bits = integer + + DOUBLE precision floating: + seeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffffffffffffff + s = 1bit = sign + e = 11bits = exponent + f = 52bits = fraction + + DOUBLE precision fixed: + siiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii + s = 1bit = sign + i = 63bits = integer + + PAIRED SINGLE precision floating: + seeeeeeeefffffffffffffffffffffffseeeeeeeefffffffffffffffffffffff + | upper || lower | + s = 1bit = sign + e = 8bits = exponent + f = 23bits = fraction + Note: upper = [63..32], lower = [31..0] */ -/* Explicit QNaN values used when value required: */ +/* Extract packed single values: */ +#define FP_PS_upper(v) (((v) >> 32) & (unsigned)0xFFFFFFFF) +#define FP_PS_lower(v) ((v) & (unsigned)0xFFFFFFFF) +#define FP_PS_cat(u,l) (((unsigned64)((u) & (unsigned)0xFFFFFFFF) << 32) \ + | (unsigned64)((l) & 0xFFFFFFFF)) + +/* Explicit QNaN values. */ #define FPQNaN_SINGLE (0x7FBFFFFF) #define FPQNaN_WORD (0x7FFFFFFF) -#define FPQNaN_DOUBLE ((((uword64) 0x7FF7FFFF) << 32) | 0xFFFFFFFF) -#define FPQNaN_LONG ((((uword64) 0x7FFFFFFF) << 32) | 0xFFFFFFFF) +#define FPQNaN_DOUBLE (UNSIGNED64 (0x7FF7FFFFFFFFFFFF)) +#define FPQNaN_LONG (UNSIGNED64 (0x7FFFFFFFFFFFFFFF)) +#define FPQNaN_PS (FP_PS_cat (FPQNaN_SINGLE, FPQNaN_SINGLE)) static const char *fpu_format_name (FP_formats fmt); #ifdef DEBUG @@ -62,8 +101,7 @@ static const char *fpu_rounding_mode_name (int rm); #endif uword64 -value_fpr (SIM_DESC sd, - sim_cpu *cpu, +value_fpr (sim_cpu *cpu, address_word cia, int fpr, FP_formats fmt) @@ -71,7 +109,7 @@ value_fpr (SIM_DESC sd, uword64 value = 0; int err = 0; - /* Treat unused register values, as fixed-point 64bit values: */ + /* Treat unused register values, as fixed-point 64bit values. */ if ((fmt == fmt_uninterpreted) || (fmt == fmt_unknown)) { #if 1 @@ -83,7 +121,7 @@ value_fpr (SIM_DESC sd, #endif } - /* For values not yet accessed, set to the desired format: */ + /* For values not yet accessed, set to the desired format. */ if (FPR_STATE[fpr] == fmt_uninterpreted) { FPR_STATE[fpr] = fmt; @@ -94,7 +132,7 @@ value_fpr (SIM_DESC sd, } if (fmt != FPR_STATE[fpr]) { - sim_io_eprintf (sd, "FPR %d (format %s) being accessed with format %s - setting to unknown (PC = 0x%s)\n", + sim_io_eprintf (SD, "FPR %d (format %s) being accessed with format %s - setting to unknown (PC = 0x%s)\n", fpr, fpu_format_name (FPR_STATE[fpr]), fpu_format_name (fmt), pr_addr (cia)); FPR_STATE[fpr] = fmt_unknown; @@ -105,25 +143,12 @@ value_fpr (SIM_DESC sd, /* Set QNaN value: */ switch (fmt) { - case fmt_single: - value = FPQNaN_SINGLE; - break; - - case fmt_double: - value = FPQNaN_DOUBLE; - break; - - case fmt_word: - value = FPQNaN_WORD; - break; - - case fmt_long: - value = FPQNaN_LONG; - break; - - default: - err = -1; - break; + case fmt_single: value = FPQNaN_SINGLE; break; + case fmt_double: value = FPQNaN_DOUBLE; break; + case fmt_word: value = FPQNaN_WORD; break; + case fmt_long: value = FPQNaN_LONG; break; + case fmt_ps: value = FPQNaN_PS; break; + default: err = -1; break; } } else if (SizeFGR () == 64) @@ -138,6 +163,7 @@ value_fpr (SIM_DESC sd, case fmt_uninterpreted: case fmt_double: case fmt_long: + case fmt_ps: value = FGR[fpr]; break; @@ -160,7 +186,7 @@ value_fpr (SIM_DESC sd, case fmt_long: if ((fpr & 1) == 0) { - /* even registers only */ + /* Even register numbers only. */ #ifdef DEBUG printf ("DBG: ValueFPR: FGR[%d] = %s, FGR[%d] = %s\n", fpr + 1, pr_uword64 ((uword64) FGR[fpr+1]), @@ -175,7 +201,11 @@ value_fpr (SIM_DESC sd, } break; - default : + case fmt_ps: + SignalException (ReservedInstruction, 0); + break; + + default: err = -1; break; } @@ -194,8 +224,7 @@ value_fpr (SIM_DESC sd, } void -store_fpr (SIM_DESC sd, - sim_cpu *cpu, +store_fpr (sim_cpu *cpu, address_word cia, int fpr, FP_formats fmt, @@ -215,8 +244,8 @@ store_fpr (SIM_DESC sd, { case fmt_uninterpreted_32: fmt = fmt_uninterpreted; - case fmt_single : - case fmt_word : + case fmt_single: + case fmt_word: if (STATE_VERBOSE_P (SD)) sim_io_eprintf (SD, "Warning: PC 0x%s: interp.c store_fpr DEADCODE\n", @@ -228,13 +257,14 @@ store_fpr (SIM_DESC sd, case fmt_uninterpreted_64: fmt = fmt_uninterpreted; case fmt_uninterpreted: - case fmt_double : - case fmt_long : + case fmt_double: + case fmt_long: + case fmt_ps: FGR[fpr] = value; FPR_STATE[fpr] = fmt; break; - default : + default: FPR_STATE[fpr] = fmt_unknown; err = -1; break; @@ -246,8 +276,8 @@ store_fpr (SIM_DESC sd, { case fmt_uninterpreted_32: fmt = fmt_uninterpreted; - case fmt_single : - case fmt_word : + case fmt_single: + case fmt_word: FGR[fpr] = (value & 0xFFFFFFFF); FPR_STATE[fpr] = fmt; break; @@ -255,11 +285,11 @@ store_fpr (SIM_DESC sd, case fmt_uninterpreted_64: fmt = fmt_uninterpreted; case fmt_uninterpreted: - case fmt_double : - case fmt_long : + case fmt_double: + case fmt_long: if ((fpr & 1) == 0) { - /* even register number only */ + /* Even register numbers only. */ FGR[fpr+1] = (value >> 32); FGR[fpr] = (value & 0xFFFFFFFF); FPR_STATE[fpr + 1] = fmt; @@ -273,7 +303,12 @@ store_fpr (SIM_DESC sd, } break; - default : + case fmt_ps: + FPR_STATE[fpr] = fmt_unknown; + SignalException (ReservedInstruction, 0); + break; + + default: FPR_STATE[fpr] = fmt_unknown; err = -1; break; @@ -291,168 +326,216 @@ store_fpr (SIM_DESC sd, return; } -int -NaN (op, fmt) - uword64 op; - FP_formats fmt; + +/* CP1 control/status register access functions. */ + +void +test_fcsr (sim_cpu *cpu, + address_word cia) { - int boolean = 0; - switch (fmt) + unsigned int cause; + + cause = (FCSR & fcsr_CAUSE_mask) >> fcsr_CAUSE_shift; + if ((cause & ((FCSR & fcsr_ENABLES_mask) >> fcsr_ENABLES_shift)) != 0 + || (cause & (1 << UO))) { - case fmt_single: - case fmt_word: - { - sim_fpu wop; - sim_fpu_32to (&wop, op); - boolean = sim_fpu_is_nan (&wop); - break; - } - case fmt_double: - case fmt_long: - { - sim_fpu wop; - sim_fpu_64to (&wop, op); - boolean = sim_fpu_is_nan (&wop); - break; - } - default: - fprintf (stderr, "Bad switch\n"); - abort (); + SignalExceptionFPE(); } - -#ifdef DEBUG - printf ("DBG: NaN: returning %d for 0x%s (format = %s)\n", - boolean, pr_addr (op), fpu_format_name (fmt)); -#endif /* DEBUG */ - - return (boolean); } -int -Infinity (op, fmt) - uword64 op; - FP_formats fmt; +unsigned_word +value_fcr(sim_cpu *cpu, + address_word cia, + int fcr) { - int boolean = 0; - -#ifdef DEBUG - printf ("DBG: Infinity: format %s 0x%s\n", - fpu_format_name (fmt), pr_addr (op)); -#endif /* DEBUG */ + unsigned32 value = 0; - switch (fmt) + switch (fcr) { - case fmt_single: - { - sim_fpu wop; - sim_fpu_32to (&wop, op); - boolean = sim_fpu_is_infinity (&wop); - break; - } - case fmt_double: - { - sim_fpu wop; - sim_fpu_64to (&wop, op); - boolean = sim_fpu_is_infinity (&wop); - break; - } - default: - printf ("DBG: TODO: unrecognised format (%s) for Infinity check\n", - fpu_format_name (fmt)); + case 0: /* FP Implementation and Revision Register. */ + value = FCR0; + break; + case 25: /* FP Condition Codes Register (derived from FCSR). */ + value = (FCR31 & fcsr_FCC_mask) >> fcsr_FCC_shift; + value = (value & 0x1) | (value >> 1); /* Close FCC gap. */ + break; + case 26: /* FP Exceptions Register (derived from FCSR). */ + value = FCR31 & (fcsr_CAUSE_mask | fcsr_FLAGS_mask); + break; + case 28: /* FP Enables Register (derived from FCSR). */ + value = FCR31 & (fcsr_ENABLES_mask | fcsr_RM_mask); + if ((FCR31 & fcsr_FS) != 0) + value |= fenr_FS; + break; + case 31: /* FP Control/Status Register (FCSR). */ + value = FCR31 & ~fcsr_ZERO_mask; break; } -#ifdef DEBUG - printf ("DBG: Infinity: returning %d for 0x%s (format = %s)\n", - boolean, pr_addr (op), fpu_format_name (fmt)); -#endif /* DEBUG */ + return (EXTEND32 (value)); +} + +void +store_fcr(sim_cpu *cpu, + address_word cia, + int fcr, + unsigned_word value) +{ + unsigned32 v; - return (boolean); + v = VL4_8(value); + switch (fcr) + { + case 25: /* FP Condition Codes Register (stored into FCSR). */ + v = (v << 1) | (v & 0x1); /* Adjust for FCC gap. */ + FCR31 &= ~fcsr_FCC_mask; + FCR31 |= ((v << fcsr_FCC_shift) & fcsr_FCC_mask); + break; + case 26: /* FP Exceptions Register (stored into FCSR). */ + FCR31 &= ~(fcsr_CAUSE_mask | fcsr_FLAGS_mask); + FCR31 |= (v & (fcsr_CAUSE_mask | fcsr_FLAGS_mask)); + test_fcsr(cpu, cia); + break; + case 28: /* FP Enables Register (stored into FCSR). */ + if ((v & fenr_FS) != 0) + v |= fcsr_FS; + else + v &= ~fcsr_FS; + FCR31 &= (fcsr_FCC_mask | fcsr_CAUSE_mask | fcsr_FLAGS_mask); + FCR31 |= (v & (fcsr_FS | fcsr_ENABLES_mask | fcsr_RM_mask)); + test_fcsr(cpu, cia); + break; + case 31: /* FP Control/Status Register (FCSR). */ + FCR31 = v & ~fcsr_ZERO_mask; + test_fcsr(cpu, cia); + break; + } } -int -Less (op1, op2, fmt) - uword64 op1; - uword64 op2; - FP_formats fmt; +void +update_fcsr (sim_cpu *cpu, + address_word cia, + sim_fpu_status status) { - int boolean = 0; + FCSR &= ~fcsr_CAUSE_mask; - /* Argument checking already performed by the FPCOMPARE code */ + if (status != 0) + { + unsigned int cause = 0; + + /* map between sim_fpu codes and MIPS FCSR */ + if (status & (sim_fpu_status_invalid_snan + | sim_fpu_status_invalid_isi + | sim_fpu_status_invalid_idi + | sim_fpu_status_invalid_zdz + | sim_fpu_status_invalid_imz + | sim_fpu_status_invalid_cmp + | sim_fpu_status_invalid_sqrt + | sim_fpu_status_invalid_cvi)) + cause |= (1 << IO); + if (status & sim_fpu_status_invalid_div0) + cause |= (1 << DZ); + if (status & sim_fpu_status_overflow) + cause |= (1 << OF); + if (status & sim_fpu_status_underflow) + cause |= (1 << UF); + if (status & sim_fpu_status_inexact) + cause |= (1 << IR); +#if 0 /* Not yet. */ + /* Implicit clearing of other bits by unimplemented done by callers. */ + if (status & sim_fpu_status_unimplemented) + cause |= (1 << UO); +#endif -#ifdef DEBUG - printf ("DBG: Less: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ + FCSR |= (cause << fcsr_CAUSE_shift); + test_fcsr (cpu, cia); + FCSR |= ((cause & ~(1 << UO)) << fcsr_FLAGS_shift); + } + return; +} - /* The format type should already have been checked: */ - switch (fmt) +static sim_fpu_round +rounding_mode(int rm) +{ + sim_fpu_round round; + + switch (rm) { - case fmt_single: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu_32to (&wop1, op1); - sim_fpu_32to (&wop2, op2); - boolean = sim_fpu_is_lt (&wop1, &wop2); - break; - } - case fmt_double: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu_64to (&wop1, op1); - sim_fpu_64to (&wop2, op2); - boolean = sim_fpu_is_lt (&wop1, &wop2); - break; - } + case FP_RM_NEAREST: + /* Round result to nearest representable value. When two + representable values are equally near, round to the value + that has a least significant bit of zero (i.e. is even). */ + round = sim_fpu_round_near; + break; + case FP_RM_TOZERO: + /* Round result to the value closest to, and not greater in + magnitude than, the result. */ + round = sim_fpu_round_zero; + break; + case FP_RM_TOPINF: + /* Round result to the value closest to, and not less than, + the result. */ + round = sim_fpu_round_up; + break; + case FP_RM_TOMINF: + /* Round result to the value closest to, and not greater than, + the result. */ + round = sim_fpu_round_down; + break; default: + round = 0; fprintf (stderr, "Bad switch\n"); abort (); } + return round; +} -#ifdef DEBUG - printf ("DBG: Less: returning %d (format = %s)\n", - boolean, fpu_format_name (fmt)); -#endif /* DEBUG */ +/* When the FS bit is set, MIPS processors return zero for + denormalized results and optionally replace denormalized inputs + with zero. When FS is clear, some implementation trap on input + and/or output, while other perform the operation in hardware. */ +static sim_fpu_denorm +denorm_mode(sim_cpu *cpu) +{ + sim_fpu_denorm denorm; - return (boolean); + /* XXX: FIXME: Eventually should be CPU model dependent. */ + if (GETFS()) + denorm = sim_fpu_denorm_zero; + else + denorm = 0; + return denorm; } -int -Equal (op1, op2, fmt) - uword64 op1; - uword64 op2; - FP_formats fmt; -{ - int boolean = 0; - /* Argument checking already performed by the FPCOMPARE code */ +/* Comparison operations. */ -#ifdef DEBUG - printf ("DBG: Equal: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ +static sim_fpu_status +fp_test(unsigned64 op1, + unsigned64 op2, + FP_formats fmt, + int abs, + int cond, + int *condition) +{ + sim_fpu wop1; + sim_fpu wop2; + sim_fpu_status status = 0; + int less, equal, unordered; - /* The format type should already have been checked: */ + /* The format type has already been checked: */ switch (fmt) { case fmt_single: { - sim_fpu wop1; - sim_fpu wop2; sim_fpu_32to (&wop1, op1); sim_fpu_32to (&wop2, op2); - boolean = sim_fpu_is_eq (&wop1, &wop2); break; } case fmt_double: { - sim_fpu wop1; - sim_fpu wop2; sim_fpu_64to (&wop1, op1); sim_fpu_64to (&wop2, op2); - boolean = sim_fpu_is_eq (&wop1, &wop2); break; } default: @@ -460,585 +543,816 @@ Equal (op1, op2, fmt) abort (); } -#ifdef DEBUG - printf ("DBG: Equal: returning %d (format = %s)\n", - boolean, fpu_format_name (fmt)); -#endif /* DEBUG */ - - return (boolean); + if (sim_fpu_is_nan (&wop1) || sim_fpu_is_nan (&wop2)) + { + if ((cond & (1 << 3)) || + sim_fpu_is_snan (&wop1) || sim_fpu_is_snan (&wop2)) + status = sim_fpu_status_invalid_snan; + less = 0; + equal = 0; + unordered = 1; + } + else + { + if (abs) + { + status |= sim_fpu_abs (&wop1, &wop1); + status |= sim_fpu_abs (&wop2, &wop2); + } + equal = sim_fpu_is_eq (&wop1, &wop2); + less = !equal && sim_fpu_is_lt (&wop1, &wop2); + unordered = 0; + } + *condition = (((cond & (1 << 2)) && less) + || ((cond & (1 << 1)) && equal) + || ((cond & (1 << 0)) && unordered)); + return status; } -uword64 -AbsoluteValue (op, fmt) - uword64 op; - FP_formats fmt; +void +fp_cmp(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt, + int abs, + int cond, + int cc) { - uword64 result = 0; + sim_fpu_status status = 0; -#ifdef DEBUG - printf ("DBG: AbsoluteValue: %s: op = 0x%s\n", - fpu_format_name (fmt), pr_addr (op)); -#endif /* DEBUG */ - - /* The format type should already have been checked: */ + /* The format type should already have been checked. The FCSR is + updated before the condition codes so that any exceptions will + be signalled before the condition codes are changed. */ switch (fmt) { case fmt_single: + case fmt_double: { - sim_fpu wop; - unsigned32 ans; - sim_fpu_32to (&wop, op); - sim_fpu_abs (&wop, &wop); - sim_fpu_to32 (&ans, &wop); - result = ans; + int result; + status = fp_test(op1, op2, fmt, abs, cond, &result); + update_fcsr (cpu, cia, status); + SETFCC (cc, result); break; } - case fmt_double: + case fmt_ps: { - sim_fpu wop; - unsigned64 ans; - sim_fpu_64to (&wop, op); - sim_fpu_abs (&wop, &wop); - sim_fpu_to64 (&ans, &wop); - result = ans; + int result0, result1; + status = fp_test(FP_PS_lower (op1), FP_PS_lower (op2), fmt_single, + abs, cond, &result0); + status |= fp_test(FP_PS_upper (op1), FP_PS_upper (op2), fmt_single, + abs, cond, &result1); + update_fcsr (cpu, cia, status); + SETFCC (cc, result0); + SETFCC (cc+1, result1); break; } default: - fprintf (stderr, "Bad switch\n"); + sim_io_eprintf (SD, "Bad switch\n"); abort (); } - - return (result); } -uword64 -Negate (op, fmt) - uword64 op; - FP_formats fmt; -{ - uword64 result = 0; -#ifdef DEBUG - printf ("DBG: Negate: %s: op = 0x%s\n", - fpu_format_name (fmt), pr_addr (op)); -#endif /* DEBUG */ +/* Basic arithmetic operations. */ + +static unsigned64 +fp_unary(sim_cpu *cpu, + address_word cia, + int (*sim_fpu_op)(sim_fpu *, const sim_fpu *), + unsigned64 op, + FP_formats fmt) +{ + sim_fpu wop; + sim_fpu ans; + sim_fpu_round round = rounding_mode (GETRM()); + sim_fpu_denorm denorm = denorm_mode (cpu); + sim_fpu_status status = 0; + unsigned64 result = 0; - /* The format type should already have been checked: */ + /* The format type has already been checked: */ switch (fmt) { case fmt_single: { - sim_fpu wop; - unsigned32 ans; + unsigned32 res; sim_fpu_32to (&wop, op); - sim_fpu_neg (&wop, &wop); - sim_fpu_to32 (&ans, &wop); - result = ans; + status |= (*sim_fpu_op) (&ans, &wop); + status |= sim_fpu_round_32 (&ans, round, denorm); + sim_fpu_to32 (&res, &ans); + result = res; break; } case fmt_double: { - sim_fpu wop; - unsigned64 ans; + unsigned64 res; sim_fpu_64to (&wop, op); - sim_fpu_neg (&wop, &wop); - sim_fpu_to64 (&ans, &wop); - result = ans; + status |= (*sim_fpu_op) (&ans, &wop); + status |= sim_fpu_round_64 (&ans, round, denorm); + sim_fpu_to64 (&res, &ans); + result = res; + break; + } + case fmt_ps: + { + int status_u = 0, status_l = 0; + unsigned32 res_u, res_l; + sim_fpu_32to (&wop, FP_PS_upper(op)); + status_u |= (*sim_fpu_op) (&ans, &wop); + sim_fpu_to32 (&res_u, &ans); + sim_fpu_32to (&wop, FP_PS_lower(op)); + status_l |= (*sim_fpu_op) (&ans, &wop); + sim_fpu_to32 (&res_l, &ans); + result = FP_PS_cat(res_u, res_l); + status = status_u | status_l; break; } default: - fprintf (stderr, "Bad switch\n"); + sim_io_eprintf (SD, "Bad switch\n"); abort (); } - return (result); + update_fcsr (cpu, cia, status); + return result; } -uword64 -Add (op1, op2, fmt) - uword64 op1; - uword64 op2; - FP_formats fmt; +static unsigned64 +fp_binary(sim_cpu *cpu, + address_word cia, + int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *), + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) { - uword64 result = 0; - -#ifdef DEBUG - printf ("DBG: Add: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ - - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ - - /* The format type should already have been checked: */ + sim_fpu wop1; + sim_fpu wop2; + sim_fpu ans; + sim_fpu_round round = rounding_mode (GETRM()); + sim_fpu_denorm denorm = denorm_mode (cpu); + sim_fpu_status status = 0; + unsigned64 result = 0; + + /* The format type has already been checked: */ switch (fmt) { case fmt_single: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; unsigned32 res; sim_fpu_32to (&wop1, op1); sim_fpu_32to (&wop2, op2); - sim_fpu_add (&ans, &wop1, &wop2); + status |= (*sim_fpu_op) (&ans, &wop1, &wop2); + status |= sim_fpu_round_32 (&ans, round, denorm); sim_fpu_to32 (&res, &ans); result = res; break; } case fmt_double: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; unsigned64 res; sim_fpu_64to (&wop1, op1); sim_fpu_64to (&wop2, op2); - sim_fpu_add (&ans, &wop1, &wop2); + status |= (*sim_fpu_op) (&ans, &wop1, &wop2); + status |= sim_fpu_round_64 (&ans, round, denorm); sim_fpu_to64 (&res, &ans); result = res; break; } + case fmt_ps: + { + int status_u = 0, status_l = 0; + unsigned32 res_u, res_l; + sim_fpu_32to (&wop1, FP_PS_upper(op1)); + sim_fpu_32to (&wop2, FP_PS_upper(op2)); + status_u |= (*sim_fpu_op) (&ans, &wop1, &wop2); + sim_fpu_to32 (&res_u, &ans); + sim_fpu_32to (&wop1, FP_PS_lower(op1)); + sim_fpu_32to (&wop2, FP_PS_lower(op2)); + status_l |= (*sim_fpu_op) (&ans, &wop1, &wop2); + sim_fpu_to32 (&res_l, &ans); + result = FP_PS_cat(res_u, res_l); + status = status_u | status_l; + break; + } default: - fprintf (stderr, "Bad switch\n"); + sim_io_eprintf (SD, "Bad switch\n"); abort (); } -#ifdef DEBUG - printf ("DBG: Add: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ - - return (result); + update_fcsr (cpu, cia, status); + return result; } -uword64 -Sub (op1, op2, fmt) - uword64 op1; - uword64 op2; - FP_formats fmt; +/* Common MAC code for single operands (.s or .d), defers setting FCSR. */ +static sim_fpu_status +inner_mac(int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *), + unsigned64 op1, + unsigned64 op2, + unsigned64 op3, + int scale, + int negate, + FP_formats fmt, + sim_fpu_round round, + sim_fpu_denorm denorm, + unsigned64 *result) { - uword64 result = 0; - -#ifdef DEBUG - printf ("DBG: Sub: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ + sim_fpu wop1; + sim_fpu wop2; + sim_fpu ans; + sim_fpu_status status = 0; + sim_fpu_status op_status; + unsigned64 temp = 0; - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ - - /* The format type should already have been checked: */ switch (fmt) { case fmt_single: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; unsigned32 res; sim_fpu_32to (&wop1, op1); sim_fpu_32to (&wop2, op2); - sim_fpu_sub (&ans, &wop1, &wop2); + status |= sim_fpu_mul (&ans, &wop1, &wop2); + if (scale != 0 && sim_fpu_is_number (&ans)) /* number or denorm */ + ans.normal_exp += scale; + status |= sim_fpu_round_32 (&ans, round, denorm); + wop1 = ans; + op_status = 0; + sim_fpu_32to (&wop2, op3); + op_status |= (*sim_fpu_op) (&ans, &wop1, &wop2); + op_status |= sim_fpu_round_32 (&ans, round, denorm); + status |= op_status; + if (negate) + { + wop1 = ans; + op_status = sim_fpu_neg (&ans, &wop1); + op_status |= sim_fpu_round_32 (&ans, round, denorm); + status |= op_status; + } sim_fpu_to32 (&res, &ans); - result = res; + temp = res; + break; } - break; case fmt_double: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; unsigned64 res; sim_fpu_64to (&wop1, op1); sim_fpu_64to (&wop2, op2); - sim_fpu_sub (&ans, &wop1, &wop2); + status |= sim_fpu_mul (&ans, &wop1, &wop2); + if (scale != 0 && sim_fpu_is_number (&ans)) /* number or denorm */ + ans.normal_exp += scale; + status |= sim_fpu_round_64 (&ans, round, denorm); + wop1 = ans; + op_status = 0; + sim_fpu_64to (&wop2, op3); + op_status |= (*sim_fpu_op) (&ans, &wop1, &wop2); + op_status |= sim_fpu_round_64 (&ans, round, denorm); + status |= op_status; + if (negate) + { + wop1 = ans; + op_status = sim_fpu_neg (&ans, &wop1); + op_status |= sim_fpu_round_64 (&ans, round, denorm); + status |= op_status; + } sim_fpu_to64 (&res, &ans); - result = res; + temp = res; + break; } - break; default: fprintf (stderr, "Bad switch\n"); abort (); } - -#ifdef DEBUG - printf ("DBG: Sub: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ - - return (result); + *result = temp; + return status; } -uword64 -Multiply (op1, op2, fmt) - uword64 op1; - uword64 op2; - FP_formats fmt; +/* Common implementation of madd, nmadd, msub, nmsub that does + intermediate rounding per spec. Also used for recip2 and rsqrt2, + which are transformed into equivalent nmsub operations. The scale + argument is an adjustment to the exponent of the intermediate + product op1*op2. It is currently non-zero for rsqrt2 (-1), which + requires an effective division by 2. */ +static unsigned64 +fp_mac(sim_cpu *cpu, + address_word cia, + int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *), + unsigned64 op1, + unsigned64 op2, + unsigned64 op3, + int scale, + int negate, + FP_formats fmt) { - uword64 result = 0; + sim_fpu_round round = rounding_mode (GETRM()); + sim_fpu_denorm denorm = denorm_mode (cpu); + sim_fpu_status status = 0; + unsigned64 result = 0; -#ifdef DEBUG - printf ("DBG: Multiply: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ + /* The format type has already been checked: */ + switch (fmt) + { + case fmt_single: + case fmt_double: + status = inner_mac(sim_fpu_op, op1, op2, op3, scale, + negate, fmt, round, denorm, &result); + break; + case fmt_ps: + { + int status_u, status_l; + unsigned64 result_u, result_l; + status_u = inner_mac(sim_fpu_op, FP_PS_upper(op1), FP_PS_upper(op2), + FP_PS_upper(op3), scale, negate, fmt_single, + round, denorm, &result_u); + status_l = inner_mac(sim_fpu_op, FP_PS_lower(op1), FP_PS_lower(op2), + FP_PS_lower(op3), scale, negate, fmt_single, + round, denorm, &result_l); + result = FP_PS_cat(result_u, result_l); + status = status_u | status_l; + break; + } + default: + sim_io_eprintf (SD, "Bad switch\n"); + abort (); + } - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ + update_fcsr (cpu, cia, status); + return result; +} + +/* Common rsqrt code for single operands (.s or .d), intermediate rounding. */ +static sim_fpu_status +inner_rsqrt(unsigned64 op1, + FP_formats fmt, + sim_fpu_round round, + sim_fpu_denorm denorm, + unsigned64 *result) +{ + sim_fpu wop1; + sim_fpu ans; + sim_fpu_status status = 0; + sim_fpu_status op_status; + unsigned64 temp = 0; - /* The format type should already have been checked: */ switch (fmt) { case fmt_single: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; unsigned32 res; sim_fpu_32to (&wop1, op1); - sim_fpu_32to (&wop2, op2); - sim_fpu_mul (&ans, &wop1, &wop2); + status |= sim_fpu_sqrt (&ans, &wop1); + status |= sim_fpu_round_32 (&ans, status, round); + wop1 = ans; + op_status = sim_fpu_inv (&ans, &wop1); + op_status |= sim_fpu_round_32 (&ans, round, denorm); sim_fpu_to32 (&res, &ans); - result = res; + temp = res; + status |= op_status; break; } case fmt_double: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; unsigned64 res; sim_fpu_64to (&wop1, op1); - sim_fpu_64to (&wop2, op2); - sim_fpu_mul (&ans, &wop1, &wop2); + status |= sim_fpu_sqrt (&ans, &wop1); + status |= sim_fpu_round_64 (&ans, round, denorm); + wop1 = ans; + op_status = sim_fpu_inv (&ans, &wop1); + op_status |= sim_fpu_round_64 (&ans, round, denorm); sim_fpu_to64 (&res, &ans); - result = res; + temp = res; + status |= op_status; break; } default: fprintf (stderr, "Bad switch\n"); abort (); } - -#ifdef DEBUG - printf ("DBG: Multiply: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ - - return (result); + *result = temp; + return status; } -uword64 -Divide (op1, op2, fmt) - uword64 op1; - uword64 op2; - FP_formats fmt; +static unsigned64 +fp_inv_sqrt(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + FP_formats fmt) { - uword64 result = 0; + sim_fpu_round round = rounding_mode (GETRM()); + sim_fpu_round denorm = denorm_mode (cpu); + sim_fpu_status status = 0; + unsigned64 result = 0; -#ifdef DEBUG - printf ("DBG: Divide: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ - - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ - - /* The format type should already have been checked: */ + /* The format type has already been checked: */ switch (fmt) { case fmt_single: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; - unsigned32 res; - sim_fpu_32to (&wop1, op1); - sim_fpu_32to (&wop2, op2); - sim_fpu_div (&ans, &wop1, &wop2); - sim_fpu_to32 (&res, &ans); - result = res; - break; - } case fmt_double: + status = inner_rsqrt (op1, fmt, round, denorm, &result); + break; + case fmt_ps: { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu ans; - unsigned64 res; - sim_fpu_64to (&wop1, op1); - sim_fpu_64to (&wop2, op2); - sim_fpu_div (&ans, &wop1, &wop2); - sim_fpu_to64 (&res, &ans); - result = res; + int status_u, status_l; + unsigned64 result_u, result_l; + status_u = inner_rsqrt (FP_PS_upper(op1), fmt_single, round, denorm, + &result_u); + status_l = inner_rsqrt (FP_PS_lower(op1), fmt_single, round, denorm, + &result_l); + result = FP_PS_cat(result_u, result_l); + status = status_u | status_l; break; } default: - fprintf (stderr, "Bad switch\n"); + sim_io_eprintf (SD, "Bad switch\n"); abort (); } -#ifdef DEBUG - printf ("DBG: Divide: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ + update_fcsr (cpu, cia, status); + return result; +} - return (result); + +unsigned64 +fp_abs(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) +{ + return fp_unary(cpu, cia, &sim_fpu_abs, op, fmt); } -uword64 UNUSED -Recip (op, fmt) - uword64 op; - FP_formats fmt; +unsigned64 +fp_neg(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) { - uword64 result = 0; + return fp_unary(cpu, cia, &sim_fpu_neg, op, fmt); +} -#ifdef DEBUG - printf ("DBG: Recip: %s: op = 0x%s\n", - fpu_format_name (fmt), pr_addr (op)); -#endif /* DEBUG */ +unsigned64 +fp_add(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + return fp_binary(cpu, cia, &sim_fpu_add, op1, op2, fmt); +} - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ +unsigned64 +fp_sub(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + return fp_binary(cpu, cia, &sim_fpu_sub, op1, op2, fmt); +} - /* The format type should already have been checked: */ - switch (fmt) - { - case fmt_single: - { - sim_fpu wop; - sim_fpu ans; - unsigned32 res; - sim_fpu_32to (&wop, op); - sim_fpu_inv (&ans, &wop); - sim_fpu_to32 (&res, &ans); - result = res; - break; - } - case fmt_double: - { - sim_fpu wop; - sim_fpu ans; - unsigned64 res; - sim_fpu_64to (&wop, op); - sim_fpu_inv (&ans, &wop); - sim_fpu_to64 (&res, &ans); - result = res; - break; - } - default: - fprintf (stderr, "Bad switch\n"); - abort (); - } +unsigned64 +fp_mul(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + return fp_binary(cpu, cia, &sim_fpu_mul, op1, op2, fmt); +} -#ifdef DEBUG - printf ("DBG: Recip: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ +unsigned64 +fp_div(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + return fp_binary(cpu, cia, &sim_fpu_div, op1, op2, fmt); +} - return (result); +unsigned64 +fp_recip(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) +{ + return fp_unary(cpu, cia, &sim_fpu_inv, op, fmt); } -uword64 -SquareRoot (op, fmt) - uword64 op; - FP_formats fmt; +unsigned64 +fp_sqrt(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) { - uword64 result = 0; + return fp_unary(cpu, cia, &sim_fpu_sqrt, op, fmt); +} -#ifdef DEBUG - printf ("DBG: SquareRoot: %s: op = 0x%s\n", - fpu_format_name (fmt), pr_addr (op)); -#endif /* DEBUG */ +unsigned64 +fp_rsqrt(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) +{ + return fp_inv_sqrt(cpu, cia, op, fmt); +} - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ +unsigned64 +fp_madd(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + unsigned64 op3, + FP_formats fmt) +{ + return fp_mac(cpu, cia, &sim_fpu_add, op1, op2, op3, 0, 0, fmt); +} - /* The format type should already have been checked: */ - switch (fmt) - { - case fmt_single: - { - sim_fpu wop; - sim_fpu ans; - unsigned32 res; - sim_fpu_32to (&wop, op); - sim_fpu_sqrt (&ans, &wop); - sim_fpu_to32 (&res, &ans); - result = res; - break; - } - case fmt_double: - { - sim_fpu wop; - sim_fpu ans; - unsigned64 res; - sim_fpu_64to (&wop, op); - sim_fpu_sqrt (&ans, &wop); - sim_fpu_to64 (&res, &ans); - result = res; - break; - } - default: - fprintf (stderr, "Bad switch\n"); - abort (); - } +unsigned64 +fp_msub(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + unsigned64 op3, + FP_formats fmt) +{ + return fp_mac(cpu, cia, &sim_fpu_sub, op1, op2, op3, 0, 0, fmt); +} -#ifdef DEBUG - printf ("DBG: SquareRoot: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ +unsigned64 +fp_nmadd(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + unsigned64 op3, + FP_formats fmt) +{ + return fp_mac(cpu, cia, &sim_fpu_add, op1, op2, op3, 0, 1, fmt); +} - return (result); +unsigned64 +fp_nmsub(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + unsigned64 op3, + FP_formats fmt) +{ + return fp_mac(cpu, cia, &sim_fpu_sub, op1, op2, op3, 0, 1, fmt); } -#if 0 -uword64 -Max (uword64 op1, - uword64 op2, - FP_formats fmt) + +/* MIPS-3D ASE operations. */ + +/* Variant of fp_binary for *r.ps MIPS-3D operations. */ +static unsigned64 +fp_binary_r(sim_cpu *cpu, + address_word cia, + int (*sim_fpu_op)(sim_fpu *, const sim_fpu *, const sim_fpu *), + unsigned64 op1, + unsigned64 op2) { - int cmp; + sim_fpu wop1; + sim_fpu wop2; + sim_fpu ans; + sim_fpu_round round = rounding_mode (GETRM ()); + sim_fpu_denorm denorm = denorm_mode (cpu); + sim_fpu_status status_u, status_l; unsigned64 result; + unsigned32 res_u, res_l; + + /* The format must be fmt_ps. */ + status_u = 0; + sim_fpu_32to (&wop1, FP_PS_upper (op1)); + sim_fpu_32to (&wop2, FP_PS_lower (op1)); + status_u |= (*sim_fpu_op) (&ans, &wop1, &wop2); + status_u |= sim_fpu_round_32 (&ans, round, denorm); + sim_fpu_to32 (&res_u, &ans); + status_l = 0; + sim_fpu_32to (&wop1, FP_PS_upper (op2)); + sim_fpu_32to (&wop2, FP_PS_lower (op2)); + status_l |= (*sim_fpu_op) (&ans, &wop1, &wop2); + status_l |= sim_fpu_round_32 (&ans, round, denorm); + sim_fpu_to32 (&res_l, &ans); + result = FP_PS_cat (res_u, res_l); + + update_fcsr (cpu, cia, status_u | status_l); + return result; +} -#ifdef DEBUG - printf ("DBG: Max: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ +unsigned64 +fp_add_r(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + return fp_binary_r (cpu, cia, &sim_fpu_add, op1, op2); +} - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ +unsigned64 +fp_mul_r(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + return fp_binary_r (cpu, cia, &sim_fpu_mul, op1, op2); +} + +#define NR_FRAC_GUARD (60) +#define IMPLICIT_1 LSBIT64 (NR_FRAC_GUARD) + +static int +fpu_inv1(sim_fpu *f, const sim_fpu *l) +{ + static const sim_fpu sim_fpu_one = { + sim_fpu_class_number, 0, IMPLICIT_1, 0 + }; + int status = 0; + sim_fpu t; + + if (sim_fpu_is_zero (l)) + { + *f = sim_fpu_maxfp; + f->sign = l->sign; + return sim_fpu_status_invalid_div0; + } + if (sim_fpu_is_infinity (l)) + { + *f = sim_fpu_zero; + f->sign = l->sign; + return status; + } + status |= sim_fpu_div (f, &sim_fpu_one, l); + return status; +} + +static int +fpu_inv1_32(sim_fpu *f, const sim_fpu *l) +{ + if (sim_fpu_is_zero (l)) + { + *f = sim_fpu_max32; + f->sign = l->sign; + return sim_fpu_status_invalid_div0; + } + return fpu_inv1 (f, l); +} - /* The format type should already have been checked: */ +static int +fpu_inv1_64(sim_fpu *f, const sim_fpu *l) +{ + if (sim_fpu_is_zero (l)) + { + *f = sim_fpu_max64; + f->sign = l->sign; + return sim_fpu_status_invalid_div0; + } + return fpu_inv1 (f, l); +} + +unsigned64 +fp_recip1(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) +{ switch (fmt) { case fmt_single: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu_32to (&wop1, op1); - sim_fpu_32to (&wop2, op2); - cmp = sim_fpu_cmp (&wop1, &wop2); - break; - } + case fmt_ps: + return fp_unary (cpu, cia, &fpu_inv1_32, op, fmt); case fmt_double: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu_64to (&wop1, op1); - sim_fpu_64to (&wop2, op2); - cmp = sim_fpu_cmp (&wop1, &wop2); - break; - } - default: - fprintf (stderr, "Bad switch\n"); - abort (); + return fp_unary (cpu, cia, &fpu_inv1_64, op, fmt); } + return 0; +} - switch (cmp) +unsigned64 +fp_recip2(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + static const unsigned64 one_single = UNSIGNED64 (0x3F800000); + static const unsigned64 one_double = UNSIGNED64 (0x3FF0000000000000); + static const unsigned64 one_ps = (one_single << 32 | one_single); + unsigned64 one; + + /* Implemented as nmsub fd, 1, fs, ft. */ + switch (fmt) { - case SIM_FPU_IS_SNAN: - case SIM_FPU_IS_QNAN: - result = op1; - case SIM_FPU_IS_NINF: - case SIM_FPU_IS_NNUMBER: - case SIM_FPU_IS_NDENORM: - case SIM_FPU_IS_NZERO: - result = op2; /* op1 - op2 < 0 */ - case SIM_FPU_IS_PINF: - case SIM_FPU_IS_PNUMBER: - case SIM_FPU_IS_PDENORM: - case SIM_FPU_IS_PZERO: - result = op1; /* op1 - op2 > 0 */ - default: - fprintf (stderr, "Bad switch\n"); - abort (); + case fmt_single: one = one_single; break; + case fmt_double: one = one_double; break; + case fmt_ps: one = one_ps; break; + default: one = 0; abort (); } + return fp_mac (cpu, cia, &sim_fpu_sub, op1, op2, one, 0, 1, fmt); +} -#ifdef DEBUG - printf ("DBG: Max: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ +static int +fpu_inv_sqrt1(sim_fpu *f, const sim_fpu *l) +{ + static const sim_fpu sim_fpu_one = { + sim_fpu_class_number, 0, IMPLICIT_1, 0 + }; + int status = 0; + sim_fpu t; - return (result); + if (sim_fpu_is_zero (l)) + { + *f = sim_fpu_maxfp; + f->sign = l->sign; + return sim_fpu_status_invalid_div0; + } + if (sim_fpu_is_infinity (l)) + { + if (!l->sign) + { + f->class = sim_fpu_class_zero; + f->sign = 0; + } + else + { + *f = sim_fpu_qnan; + status = sim_fpu_status_invalid_sqrt; + } + return status; + } + status |= sim_fpu_sqrt (&t, l); + status |= sim_fpu_div (f, &sim_fpu_one, &t); + return status; } -#endif -#if 0 -uword64 -Min (uword64 op1, - uword64 op2, - FP_formats fmt) +static int +fpu_inv_sqrt1_32(sim_fpu *f, const sim_fpu *l) { - int cmp; - unsigned64 result; - -#ifdef DEBUG - printf ("DBG: Min: %s: op1 = 0x%s : op2 = 0x%s\n", - fpu_format_name (fmt), pr_addr (op1), pr_addr (op2)); -#endif /* DEBUG */ + if (sim_fpu_is_zero (l)) + { + *f = sim_fpu_max32; + f->sign = l->sign; + return sim_fpu_status_invalid_div0; + } + return fpu_inv_sqrt1 (f, l); +} - /* The registers must specify FPRs valid for operands of type - "fmt". If they are not valid, the result is undefined. */ +static int +fpu_inv_sqrt1_64(sim_fpu *f, const sim_fpu *l) +{ + if (sim_fpu_is_zero (l)) + { + *f = sim_fpu_max64; + f->sign = l->sign; + return sim_fpu_status_invalid_div0; + } + return fpu_inv_sqrt1 (f, l); +} - /* The format type should already have been checked: */ +unsigned64 +fp_rsqrt1(sim_cpu *cpu, + address_word cia, + unsigned64 op, + FP_formats fmt) +{ switch (fmt) { case fmt_single: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu_32to (&wop1, op1); - sim_fpu_32to (&wop2, op2); - cmp = sim_fpu_cmp (&wop1, &wop2); - break; - } + case fmt_ps: + return fp_unary (cpu, cia, &fpu_inv_sqrt1_32, op, fmt); case fmt_double: - { - sim_fpu wop1; - sim_fpu wop2; - sim_fpu_64to (&wop1, op1); - sim_fpu_64to (&wop2, op2); - cmp = sim_fpu_cmp (&wop1, &wop2); - break; - } - default: - fprintf (stderr, "Bad switch\n"); - abort (); + return fp_unary (cpu, cia, &fpu_inv_sqrt1_64, op, fmt); } + return 0; +} + +unsigned64 +fp_rsqrt2(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + static const unsigned64 half_single = UNSIGNED64 (0x3F000000); + static const unsigned64 half_double = UNSIGNED64 (0x3FE0000000000000); + static const unsigned64 half_ps = (half_single << 32 | half_single); + unsigned64 half; - switch (cmp) + /* Implemented as (nmsub fd, 0.5, fs, ft)/2, where the divide is + done by scaling the exponent during multiply. */ + switch (fmt) { - case SIM_FPU_IS_SNAN: - case SIM_FPU_IS_QNAN: - result = op1; - case SIM_FPU_IS_NINF: - case SIM_FPU_IS_NNUMBER: - case SIM_FPU_IS_NDENORM: - case SIM_FPU_IS_NZERO: - result = op1; /* op1 - op2 < 0 */ - case SIM_FPU_IS_PINF: - case SIM_FPU_IS_PNUMBER: - case SIM_FPU_IS_PDENORM: - case SIM_FPU_IS_PZERO: - result = op2; /* op1 - op2 > 0 */ - default: - fprintf (stderr, "Bad switch\n"); - abort (); + case fmt_single: half = half_single; break; + case fmt_double: half = half_double; break; + case fmt_ps: half = half_ps; break; + default: half = 0; abort (); } + return fp_mac (cpu, cia, &sim_fpu_sub, op1, op2, half, -1, 1, fmt); +} -#ifdef DEBUG - printf ("DBG: Min: returning 0x%s (format = %s)\n", - pr_addr (result), fpu_format_name (fmt)); -#endif /* DEBUG */ - return (result); -} -#endif +/* Conversion operations. */ uword64 -convert (SIM_DESC sd, - sim_cpu *cpu, +convert (sim_cpu *cpu, address_word cia, int rm, uword64 op, @@ -1046,47 +1360,11 @@ convert (SIM_DESC sd, FP_formats to) { sim_fpu wop; - sim_fpu_round round; + sim_fpu_round round = rounding_mode (rm); + sim_fpu_denorm denorm = denorm_mode (cpu); unsigned32 result32; unsigned64 result64; - -#ifdef DEBUG -#if 0 /* FIXME: doesn't compile */ - printf ("DBG: Convert: mode %s : op 0x%s : from %s : to %s : (PC = 0x%s)\n", - fpu_rounding_mode_name (rm), pr_addr (op), fpu_format_name (from), - fpu_format_name (to), pr_addr (IPC)); -#endif -#endif /* DEBUG */ - - switch (rm) - { - case FP_RM_NEAREST: - /* Round result to nearest representable value. When two - representable values are equally near, round to the value - that has a least significant bit of zero (i.e. is even). */ - round = sim_fpu_round_near; - break; - case FP_RM_TOZERO: - /* Round result to the value closest to, and not greater in - magnitude than, the result. */ - round = sim_fpu_round_zero; - break; - case FP_RM_TOPINF: - /* Round result to the value closest to, and not less than, - the result. */ - round = sim_fpu_round_up; - break; - - case FP_RM_TOMINF: - /* Round result to the value closest to, and not greater than, - the result. */ - round = sim_fpu_round_down; - break; - default: - round = 0; - fprintf (stderr, "Bad switch\n"); - abort (); - } + sim_fpu_status status = 0; /* Convert the input to sim_fpu internal format */ switch (from) @@ -1098,13 +1376,13 @@ convert (SIM_DESC sd, sim_fpu_32to (&wop, op); break; case fmt_word: - sim_fpu_i32to (&wop, op, round); + status = sim_fpu_i32to (&wop, op, round); break; case fmt_long: - sim_fpu_i64to (&wop, op, round); + status = sim_fpu_i64to (&wop, op, round); break; default: - fprintf (stderr, "Bad switch\n"); + sim_io_eprintf (SD, "Bad switch\n"); abort (); } @@ -1112,38 +1390,148 @@ convert (SIM_DESC sd, /* The value WOP is converted to the destination format, rounding using mode RM. When the destination is a fixed-point format, then a source value of Infinity, NaN or one which would round to an - integer outside the fixed point range then an IEEE Invalid - Operation condition is raised. */ + integer outside the fixed point range then an IEEE Invalid Operation + condition is raised. Not used if destination format is PS. */ switch (to) { case fmt_single: - sim_fpu_round_32 (&wop, round, 0); + status |= sim_fpu_round_32 (&wop, round, denorm); + /* For a NaN, normalize mantissa bits (cvt.s.d can't preserve them) */ + if (sim_fpu_is_qnan (&wop)) + wop = sim_fpu_qnan; sim_fpu_to32 (&result32, &wop); result64 = result32; break; case fmt_double: - sim_fpu_round_64 (&wop, round, 0); + status |= sim_fpu_round_64 (&wop, round, denorm); + /* For a NaN, normalize mantissa bits (make cvt.d.s consistent) */ + if (sim_fpu_is_qnan (&wop)) + wop = sim_fpu_qnan; sim_fpu_to64 (&result64, &wop); break; case fmt_word: - sim_fpu_to32i (&result32, &wop, round); + status |= sim_fpu_to32i (&result32, &wop, round); result64 = result32; break; case fmt_long: - sim_fpu_to64i (&result64, &wop, round); + status |= sim_fpu_to64i (&result64, &wop, round); break; default: result64 = 0; - fprintf (stderr, "Bad switch\n"); + sim_io_eprintf (SD, "Bad switch\n"); abort (); } -#ifdef DEBUG - printf ("DBG: Convert: returning 0x%s (to format = %s)\n", - pr_addr (result64), fpu_format_name (to)); -#endif /* DEBUG */ + update_fcsr (cpu, cia, status); + return result64; +} + +unsigned64 +ps_lower(sim_cpu *cpu, + address_word cia, + unsigned64 op) +{ + return FP_PS_lower (op); +} + +unsigned64 +ps_upper(sim_cpu *cpu, + address_word cia, + unsigned64 op) +{ + return FP_PS_upper(op); +} + +unsigned64 +pack_ps(sim_cpu *cpu, + address_word cia, + unsigned64 op1, + unsigned64 op2, + FP_formats fmt) +{ + unsigned64 result = 0; + + /* The registers must specify FPRs valid for operands of type + "fmt". If they are not valid, the result is undefined. */ + + /* The format type should already have been checked: */ + switch (fmt) + { + case fmt_single: + { + sim_fpu wop; + unsigned32 res_u, res_l; + sim_fpu_32to (&wop, op1); + sim_fpu_to32 (&res_u, &wop); + sim_fpu_32to (&wop, op2); + sim_fpu_to32 (&res_l, &wop); + result = FP_PS_cat(res_u, res_l); + break; + } + default: + sim_io_eprintf (SD, "Bad switch\n"); + abort (); + } + + return result; +} + +unsigned64 +convert_ps (sim_cpu *cpu, + address_word cia, + int rm, + unsigned64 op, + FP_formats from, + FP_formats to) +{ + sim_fpu wop_u, wop_l; + sim_fpu_round round = rounding_mode (rm); + sim_fpu_denorm denorm = denorm_mode (cpu); + unsigned32 res_u, res_l; + unsigned64 result; + sim_fpu_status status_u = 0, status_l = 0; + + /* As convert, but used only for paired values (formats PS, PW) */ + + /* Convert the input to sim_fpu internal format */ + switch (from) + { + case fmt_word: /* fmt_pw */ + sim_fpu_i32to (&wop_u, (op >> 32) & (unsigned)0xFFFFFFFF, round); + sim_fpu_i32to (&wop_l, op & (unsigned)0xFFFFFFFF, round); + break; + case fmt_ps: + sim_fpu_32to (&wop_u, FP_PS_upper(op)); + sim_fpu_32to (&wop_l, FP_PS_lower(op)); + break; + default: + sim_io_eprintf (SD, "Bad switch\n"); + abort (); + } + + /* Convert sim_fpu format into the output */ + switch (to) + { + case fmt_word: /* fmt_pw */ + status_u |= sim_fpu_to32i (&res_u, &wop_u, round); + status_l |= sim_fpu_to32i (&res_l, &wop_l, round); + result = (((unsigned64)res_u) << 32) | (unsigned64)res_l; + break; + case fmt_ps: + status_u |= sim_fpu_round_32 (&wop_u, 0, round); + status_l |= sim_fpu_round_32 (&wop_l, 0, round); + sim_fpu_to32 (&res_u, &wop_u); + sim_fpu_to32 (&res_l, &wop_l); + result = FP_PS_cat(res_u, res_l); + break; + default: + result = 0; + sim_io_eprintf (SD, "Bad switch\n"); + abort (); + } - return (result64); + update_fcsr (cpu, cia, status_u | status_l); + return result; } static const char * @@ -1159,6 +1547,8 @@ fpu_format_name (FP_formats fmt) return "word"; case fmt_long: return "long"; + case fmt_ps: + return "ps"; case fmt_unknown: return ""; case fmt_uninterpreted: diff --git a/sim/mips/interp.c b/sim/mips/interp.c index 805f72a9236..d069d2bc834 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -61,8 +61,8 @@ code on the hardware. #include "getopt.h" #include "libiberty.h" #include "bfd.h" -#include "callback.h" /* GDB simulator callback interface */ -#include "remote-sim.h" /* GDB simulator interface */ +#include "gdb/callback.h" /* GDB simulator callback interface */ +#include "gdb/remote-sim.h" /* GDB simulator interface */ #include "sysdep.h" @@ -575,7 +575,7 @@ sim_open (kind, cb, abfd, argv) { if (rn < 32) cpu->register_widths[rn] = WITH_TARGET_WORD_BITSIZE; - else if ((rn >= FGRIDX) && (rn < (FGRIDX + NR_FGR))) + else if ((rn >= FGR_BASE) && (rn < (FGR_BASE + NR_FGR))) cpu->register_widths[rn] = WITH_TARGET_FLOATING_POINT_BITSIZE; else if ((rn >= 33) && (rn <= 37)) cpu->register_widths[rn] = WITH_TARGET_WORD_BITSIZE; @@ -849,26 +849,26 @@ sim_store_register (sd,rn,memory,length) - if (rn >= FGRIDX && rn < FGRIDX + NR_FGR) + if (rn >= FGR_BASE && rn < FGR_BASE + NR_FGR) { - cpu->fpr_state[rn - FGRIDX] = fmt_uninterpreted; + cpu->fpr_state[rn - FGR_BASE] = fmt_uninterpreted; if (cpu->register_widths[rn] == 32) { if (length == 8) { - cpu->fgr[rn - FGRIDX] = + cpu->fgr[rn - FGR_BASE] = (unsigned32) T2H_8 (*(unsigned64*)memory); return 8; } else { - cpu->fgr[rn - FGRIDX] = T2H_4 (*(unsigned32*)memory); + cpu->fgr[rn - FGR_BASE] = T2H_4 (*(unsigned32*)memory); return 4; } } else { - cpu->fgr[rn - FGRIDX] = T2H_8 (*(unsigned64*)memory); + cpu->fgr[rn - FGR_BASE] = T2H_8 (*(unsigned64*)memory); return 8; } } @@ -921,25 +921,25 @@ sim_fetch_register (sd,rn,memory,length) /* Any floating point register */ - if (rn >= FGRIDX && rn < FGRIDX + NR_FGR) + if (rn >= FGR_BASE && rn < FGR_BASE + NR_FGR) { if (cpu->register_widths[rn] == 32) { if (length == 8) { *(unsigned64*)memory = - H2T_8 ((unsigned32) (cpu->fgr[rn - FGRIDX])); + H2T_8 ((unsigned32) (cpu->fgr[rn - FGR_BASE])); return 8; } else { - *(unsigned32*)memory = H2T_4 (cpu->fgr[rn - FGRIDX]); + *(unsigned32*)memory = H2T_4 (cpu->fgr[rn - FGR_BASE]); return 4; } } else { - *(unsigned64*)memory = H2T_8 (cpu->fgr[rn - FGRIDX]); + *(unsigned64*)memory = H2T_8 (cpu->fgr[rn - FGR_BASE]); return 8; } } @@ -1223,7 +1223,7 @@ sim_monitor (SIM_DESC sd, break; } - case 28 : /* PMON flush_cache */ + case 28: /* PMON flush_cache */ break; case 55: /* void get_mem_info(unsigned int *ptr) */ @@ -1242,7 +1242,7 @@ sim_monitor (SIM_DESC sd, break; } - case 158 : /* PMON printf */ + case 158: /* PMON printf */ /* in: A0 = pointer to format string */ /* A1 = optional argument 1 */ /* A2 = optional argument 2 */ @@ -1671,7 +1671,7 @@ signal_exception (SIM_DESC sd, switch (exception) { - case DebugBreakPoint : + case DebugBreakPoint: if (! (Debug & Debug_DM)) { if (INDELAYSLOT()) @@ -1694,7 +1694,7 @@ signal_exception (SIM_DESC sd, } break; - case ReservedInstruction : + case ReservedInstruction: { va_list ap; unsigned int instruction; @@ -1845,7 +1845,7 @@ signal_exception (SIM_DESC sd, sim_engine_halt (SD, CPU, NULL, PC, sim_stopped, SIM_SIGTRAP); - default : /* Unknown internal exception */ + default: /* Unknown internal exception */ PC = EPC; sim_engine_halt (SD, CPU, NULL, PC, sim_stopped, SIM_SIGABRT); diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen index cd96766d885..1e558258153 100644 --- a/sim/mips/mips.igen +++ b/sim/mips/mips.igen @@ -61,7 +61,16 @@ // MIPS Application Specific Extensions (ASEs) // // Instructions for the ASEs are in separate .igen files. +// ASEs add instructions on to a base ISA. :model:::mips16:mips16: // m16.igen (and m16.dc) +:model:::mips3d:mips3d: // mips3d.igen +:model:::mdmx:mdmx: // mdmx.igen + +// Vendor Extensions +// +// Instructions specific to these extensions are in separate .igen files. +// Extensions add instructions on to a base ISA. +:model:::sb1:sb1: // sb1.igen // Pseudo instructions known by IGEN @@ -2274,7 +2283,10 @@ *vr5000: { if (GPR[RT] != 0) - GPR[RD] = GPR[RS]; + { + GPR[RD] = GPR[RS]; + TRACE_ALU_RESULT (GPR[RD]); + } } @@ -2288,7 +2300,10 @@ *vr5000: { if (GPR[RT] == 0) - GPR[RD] = GPR[RS]; + { + GPR[RD] = GPR[RS]; + TRACE_ALU_RESULT (GPR[RD]); + } } @@ -3430,7 +3445,7 @@ 000001,5.RS,01110,16.IMMEDIATE:REGIMM:32::TNEI -"tne r, " +"tnei r, " *mipsII: *mipsIII: *mipsIV: @@ -3508,16 +3523,7 @@ case fmt_double: return "d"; case fmt_word: return "w"; case fmt_long: return "l"; - default: return "?"; - } -} - -:%s::::X:int x -{ - switch (x) - { - case 0: return "f"; - case 1: return "t"; + case fmt_ps: return "ps"; default: return "?"; } } @@ -3606,13 +3612,9 @@ *mipsV: *mips64: { -#if 0 /* XXX FIXME: FP code doesn't yet support paired single ops. */ if ((fmt != fmt_single) && (fmt != fmt_double) && (fmt != fmt_ps || (UserMode && (SR & (status_UX|status_PX)) == 0))) SignalException (ReservedInstruction, insn); -#else - check_fmt (SD_, fmt, insn); -#endif } @@ -3655,7 +3657,7 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,AbsoluteValue(ValueFPR(FS,fmt),fmt)); + StoreFPR (FD, fmt, AbsoluteValue (ValueFPR (FS, fmt), fmt)); } @@ -3676,10 +3678,36 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Add(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt)); + StoreFPR (FD, fmt, Add (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt)); } +010011,5.RS,5.FT,5.FS,5.FD,011,110:COP1X:64,f::ALNV.PS +"alnv.ps f, f, f, r" +*mipsV: +*mips64: +{ + unsigned64 fs; + unsigned64 ft; + unsigned64 fd; + check_fpu (SD_); + check_u64 (SD_, instruction_0); + fs = ValueFPR (FS, fmt_ps); + if ((GPR[RS] & 0x3) != 0) + Unpredictable (); + if ((GPR[RS] & 0x4) == 0) + fd = fs; + else + { + ft = ValueFPR (FT, fmt_ps); + if (BigEndianCPU) + fd = PackPS (PSLower (fs), PSUpper (ft)); + else + fd = PackPS (PSLower (ft), PSUpper (fs)); + } + StoreFPR (FD, fmt_ps, fd); +} + // BC1F // BC1FL @@ -3739,45 +3767,6 @@ } - - - - -// C.EQ.S -// C.EQ.D -// ... - -:function:::void:do_c_cond_fmt:int fmt, int ft, int fs, int cc, int cond, instruction_word insn -{ - int less; - int equal; - int unordered; - int condition; - unsigned64 ofs = ValueFPR (fs, fmt); - unsigned64 oft = ValueFPR (ft, fmt); - if (NaN (ofs, fmt) || NaN (oft, fmt)) - { - if (FCSR & FP_ENABLE (IO)) - { - FCSR |= FP_CAUSE (IO); - SignalExceptionFPE (); - } - less = 0; - equal = 0; - unordered = 1; - } - else - { - less = Less (ofs, oft, fmt); - equal = Equal (ofs, oft, fmt); - unordered = 0; - } - condition = (((cond & (1 << 2)) && less) - || ((cond & (1 << 1)) && equal) - || ((cond & (1 << 0)) && unordered)); - SETFCC (cc, condition); -} - 010001,10,3.FMT,5.FT,5.FS,3.0,00,11,4.COND:COP1:32,f::C.cond.fmta "c.%s.%s f, f" *mipsI: @@ -3787,7 +3776,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - do_c_cond_fmt (SD_, fmt, FT, FS, 0, COND, instruction_0); + Compare (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, 0); + TRACE_ALU_RESULT (ValueFCR (31)); } 010001,10,3.FMT,5.FT,5.FS,3.CC,00,11,4.COND:COP1:32,f::C.cond.fmtb @@ -3804,7 +3794,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - do_c_cond_fmt (SD_, fmt, FT, FS, CC, COND, instruction_0); + Compare (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt, COND, CC); + TRACE_ALU_RESULT (ValueFCR (31)); } @@ -3821,11 +3812,13 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_long,Convert(FP_RM_TOPINF,ValueFPR(FS,fmt),fmt,fmt_long)); + StoreFPR (FD, fmt_long, Convert (FP_RM_TOPINF, ValueFPR (FS, fmt), fmt, + fmt_long)); } 010001,10,3.FMT,00000,5.FS,5.FD,001110:COP1:32,f::CEIL.W +"ceil.w.%s f, f" *mipsII: *mipsIII: *mipsIV: @@ -3839,84 +3832,97 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_word,Convert(FP_RM_TOPINF,ValueFPR(FS,fmt),fmt,fmt_word)); + StoreFPR (FD, fmt_word, Convert (FP_RM_TOPINF, ValueFPR (FS, fmt), fmt, + fmt_word)); } -// CFC1 -// CTC1 -010001,00,X,10,5.RT,5.FS,00000000000:COP1Sa:32,f::CxC1 -"c%sc1 r, f" +010001,00010,5.RT,5.FS,00000000000:COP1:32,f::CFC1a +"cfc1 r, f" *mipsI: *mipsII: *mipsIII: { check_fpu (SD_); - if (X) + if (FS == 0) + PENDING_FILL (RT, EXTEND32 (FCR0)); + else if (FS == 31) + PENDING_FILL (RT, EXTEND32 (FCR31)); + /* else NOP */ +} + +010001,00010,5.RT,5.FS,00000000000:COP1:32,f::CFC1b +"cfc1 r, f" +*mipsIV: +*vr4100: +*vr5000: +*r3900: +{ + check_fpu (SD_); + if (FS == 0 || FS == 31) { - if (FS == 0) - PENDING_FILL(FCR0IDX,VL4_8(GPR[RT])); - else if (FS == 31) - PENDING_FILL(FCR31IDX,VL4_8(GPR[RT])); - /* else NOP */ - PENDING_SCHED(FCSR, FCR31 & (1<<23), 1, 23); - } - else - { /* control from */ - if (FS == 0) - PENDING_FILL(RT, EXTEND32 (FCR0)); - else if (FS == 31) - PENDING_FILL(RT, EXTEND32 (FCR31)); - /* else NOP */ + unsigned_word fcr = ValueFCR (FS); + TRACE_ALU_INPUT1 (fcr); + GPR[RT] = fcr; } + /* else NOP */ + TRACE_ALU_RESULT (GPR[RT]); } -010001,00,X,10,5.RT,5.FS,00000000000:COP1Sb:32,f::CxC1 -"c%sc1 r, f" -*mipsIV: + +010001,00010,5.RT,5.FS,00000000000:COP1:32,f::CFC1c +"cfc1 r, f" *mipsV: *mips32: *mips64: +{ + check_fpu (SD_); + if (FS == 0 || FS == 25 || FS == 26 || FS == 28 || FS == 31) + { + unsigned_word fcr = ValueFCR (FS); + TRACE_ALU_INPUT1 (fcr); + GPR[RT] = fcr; + } + /* else NOP */ + TRACE_ALU_RESULT (GPR[RT]); +} + +010001,00110,5.RT,5.FS,00000000000:COP1:32,f::CTC1a +"ctc1 r, f" +*mipsI: +*mipsII: +*mipsIII: +{ + check_fpu (SD_); + if (FS == 31) + PENDING_FILL (FCRCS_REGNUM, VL4_8 (GPR[RT])); + /* else NOP */ +} + +010001,00110,5.RT,5.FS,00000000000:COP1:32,f::CTC1b +"ctc1 r, f" +*mipsIV: *vr4100: *vr5000: *r3900: { check_fpu (SD_); - if (X) - { - /* control to */ - TRACE_ALU_INPUT1 (GPR[RT]); - if (FS == 0) - { - FCR0 = VL4_8(GPR[RT]); - TRACE_ALU_RESULT (FCR0); - } - else if (FS == 31) - { - FCR31 = VL4_8(GPR[RT]); - SETFCC(0,((FCR31 & (1 << 23)) ? 1 : 0)); - TRACE_ALU_RESULT (FCR31); - } - else - { - TRACE_ALU_RESULT0 (); - } - /* else NOP */ - } - else - { /* control from */ - if (FS == 0) - { - TRACE_ALU_INPUT1 (FCR0); - GPR[RT] = EXTEND32 (FCR0); - } - else if (FS == 31) - { - TRACE_ALU_INPUT1 (FCR31); - GPR[RT] = EXTEND32 (FCR31); - } - TRACE_ALU_RESULT (GPR[RT]); - /* else NOP */ - } + TRACE_ALU_INPUT1 (GPR[RT]); + if (FS == 31) + StoreFCR (FS, GPR[RT]); + /* else NOP */ +} + +010001,00110,5.RT,5.FS,00000000000:COP1:32,f::CTC1c +"ctc1 r, f" +*mipsV: +*mips32: +*mips64: +{ + check_fpu (SD_); + TRACE_ALU_INPUT1 (GPR[RT]); + if (FS == 25 || FS == 26 || FS == 28 || FS == 31) + StoreFCR (FS, GPR[RT]); + /* else NOP */ } @@ -3938,12 +3944,10 @@ { int fmt = FMT; check_fpu (SD_); - { - if ((fmt == fmt_double) | 0) - SignalException (ReservedInstruction, instruction_0); - else - StoreFPR(FD,fmt_double,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_double)); - } + if ((fmt == fmt_double) | 0) + SignalException (ReservedInstruction, instruction_0); + StoreFPR (FD, fmt_double, Convert (GETRM (), ValueFPR (FS, fmt), fmt, + fmt_double)); } @@ -3959,19 +3963,29 @@ { int fmt = FMT; check_fpu (SD_); - { - if ((fmt == fmt_long) | ((fmt == fmt_long) || (fmt == fmt_word))) - SignalException (ReservedInstruction, instruction_0); - else - StoreFPR(FD,fmt_long,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_long)); - } + if ((fmt == fmt_long) | ((fmt == fmt_long) || (fmt == fmt_word))) + SignalException (ReservedInstruction, instruction_0); + StoreFPR (FD, fmt_long, Convert (GETRM (), ValueFPR (FS, fmt), fmt, + fmt_long)); +} + + +010001,10,000,5.FT,5.FS,5.FD,100110:COP1:64,f::CVT.PS.S +"cvt.ps.s f, f, f" +*mipsV: +*mips64: +{ + check_fpu (SD_); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_ps, PackPS (ValueFPR (FS, fmt_single), + ValueFPR (FT, fmt_single))); } // // FIXME: Does not correctly differentiate between mips* // -010001,10,3.FMT,00000,5.FS,5.FD,100000:COP1:32,f::CVT.S.fmt +010001,10,3.FMT!6,00000,5.FS,5.FD,100000:COP1:32,f::CVT.S.fmt "cvt.s.%s f, f" *mipsI: *mipsII: @@ -3986,16 +4000,36 @@ { int fmt = FMT; check_fpu (SD_); - { - if ((fmt == fmt_single) | 0) - SignalException (ReservedInstruction, instruction_0); - else - StoreFPR(FD,fmt_single,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_single)); - } + if ((fmt == fmt_single) | 0) + SignalException (ReservedInstruction, instruction_0); + StoreFPR (FD, fmt_single, Convert (GETRM (), ValueFPR (FS, fmt), fmt, + fmt_single)); } -010001,10,3.FMT,00000,5.FS,5.FD,100100:COP1:32,f::CVT.W.fmt +010001,10,110,00000,5.FS,5.FD,101000:COP1:64,f::CVT.S.PL +"cvt.s.pl f, f" +*mipsV: +*mips64: +{ + check_fpu (SD_); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_single, PSLower (ValueFPR (FS, fmt_ps))); +} + + +010001,10,110,00000,5.FS,5.FD,100000:COP1:64,f::CVT.S.PU +"cvt.s.pu f, f" +*mipsV: +*mips64: +{ + check_fpu (SD_); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_single, PSUpper (ValueFPR (FS, fmt_ps))); +} + + +010001,10,3.FMT!6,00000,5.FS,5.FD,100100:COP1:32,f::CVT.W.fmt "cvt.w.%s f, f" *mipsI: *mipsII: @@ -4010,12 +4044,10 @@ { int fmt = FMT; check_fpu (SD_); - { - if ((fmt == fmt_word) | ((fmt == fmt_long) || (fmt == fmt_word))) - SignalException (ReservedInstruction, instruction_0); - else - StoreFPR(FD,fmt_word,Convert(GETRM(),ValueFPR(FS,fmt),fmt,fmt_word)); - } + if ((fmt == fmt_word) | ((fmt == fmt_long) || (fmt == fmt_word))) + SignalException (ReservedInstruction, instruction_0); + StoreFPR (FD, fmt_word, Convert (GETRM (), ValueFPR (FS, fmt), fmt, + fmt_word)); } @@ -4035,46 +4067,29 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Divide(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt)); + StoreFPR (FD, fmt, Divide (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt)); } -// DMFC1 -// DMTC1 -010001,00,X,01,5.RT,5.FS,00000000000:COP1Sa:64,f::DMxC1 -"dm%sc1 r, f" +010001,00001,5.RT,5.FS,00000000000:COP1:64,f::DMFC1a +"dmfc1 r, f" *mipsIII: { + unsigned64 v; check_fpu (SD_); check_u64 (SD_, instruction_0); - if (X) - { - if (SizeFGR() == 64) - PENDING_FILL((FS + FGRIDX),GPR[RT]); - else if ((FS & 0x1) == 0) - { - PENDING_FILL(((FS + 1) + FGRIDX),VH4_8(GPR[RT])); - PENDING_FILL((FS + FGRIDX),VL4_8(GPR[RT])); - } - } + if (SizeFGR () == 64) + v = FGR[FS]; + else if ((FS & 0x1) == 0) + v = SET64HI (FGR[FS+1]) | FGR[FS]; else - { - if (SizeFGR() == 64) - PENDING_FILL(RT,FGR[FS]); - else if ((FS & 0x1) == 0) - PENDING_FILL(RT,(SET64HI(FGR[FS+1]) | FGR[FS])); - else - { - if (STATE_VERBOSE_P(SD)) - sim_io_eprintf (SD, - "Warning: PC 0x%lx: semantic_DMxC1_COP1Sa 32-bit use of odd FPR number\n", - (long) CIA); - PENDING_FILL(RT,SET64HI(0xDEADC0DE) | 0xBAD0BAD0); - } - } + v = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; + PENDING_FILL (RT, v); + TRACE_ALU_RESULT (v); } -010001,00,X,01,5.RT,5.FS,00000000000:COP1Sb:64,f::DMxC1 -"dm%sc1 r, f" + +010001,00001,5.RT,5.FS,00000000000:COP1:64,f::DMFC1b +"dmfc1 r, f" *mipsIV: *mipsV: *mips64: @@ -4084,28 +4099,52 @@ { check_fpu (SD_); check_u64 (SD_, instruction_0); - if (X) - { - if (SizeFGR() == 64) - StoreFPR (FS, fmt_uninterpreted_64, GPR[RT]); - else if ((FS & 0x1) == 0) - StoreFPR (FS, fmt_uninterpreted_64, SET64HI (FGR[FS+1]) | FGR[FS]); - } + if (SizeFGR () == 64) + GPR[RT] = FGR[FS]; + else if ((FS & 0x1) == 0) + GPR[RT] = SET64HI (FGR[FS+1]) | FGR[FS]; else + GPR[RT] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; + TRACE_ALU_RESULT (GPR[RT]); +} + + +010001,00101,5.RT,5.FS,00000000000:COP1:64,f::DMTC1a +"dmtc1 r, f" +*mipsIII: +{ + unsigned64 v; + check_fpu (SD_); + check_u64 (SD_, instruction_0); + if (SizeFGR () == 64) + PENDING_FILL ((FS + FGR_BASE), GPR[RT]); + else if ((FS & 0x1) == 0) { - if (SizeFGR() == 64) - GPR[RT] = FGR[FS]; - else if ((FS & 0x1) == 0) - GPR[RT] = SET64HI (FGR[FS+1]) | FGR[FS]; - else - { - if (STATE_VERBOSE_P(SD)) - sim_io_eprintf (SD, - "Warning: PC 0x%lx: DMxC1 32-bit use of odd FPR number\n", - (long) CIA); - GPR[RT] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; - } + PENDING_FILL (((FS + 1) + FGR_BASE), VH4_8 (GPR[RT])); + PENDING_FILL ((FS + FGR_BASE), VL4_8 (GPR[RT])); } + else + Unpredictable (); + TRACE_FP_RESULT (GPR[RT]); +} + +010001,00101,5.RT,5.FS,00000000000:COP1:64,f::DMTC1b +"dmtc1 r, f" +*mipsIV: +*mipsV: +*mips64: +*vr4100: +*vr5000: +*r3900: +{ + check_fpu (SD_); + check_u64 (SD_, instruction_0); + if (SizeFGR () == 64) + StoreFPR (FS, fmt_uninterpreted_64, GPR[RT]); + else if ((FS & 0x1) == 0) + StoreFPR (FS, fmt_uninterpreted_64, GPR[RT]); + else + Unpredictable (); } @@ -4122,7 +4161,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_long,Convert(FP_RM_TOMINF,ValueFPR(FS,fmt),fmt,fmt_long)); + StoreFPR (FD, fmt_long, Convert (FP_RM_TOMINF, ValueFPR (FS, fmt), fmt, + fmt_long)); } @@ -4141,7 +4181,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_word,Convert(FP_RM_TOMINF,ValueFPR(FS,fmt),fmt,fmt_word)); + StoreFPR (FD, fmt_word, Convert (FP_RM_TOMINF, ValueFPR (FS, fmt), fmt, + fmt_word)); } @@ -4208,64 +4249,37 @@ -// -// FIXME: Not correct for mips* -// -010011,5.FR,5.FT,5.FS,5.FD,100,001:COP1X:32,f::MADD.D -"madd.d f, f, f, f" -*mipsIV: -*mipsV: -*mips64: -*vr5000: -{ - check_fpu (SD_); - { - StoreFPR(FD,fmt_double,Add(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double)); - } -} - - -010011,5.FR,5.FT,5.FS,5.FD,100,000:COP1X:32,f::MADD.S -"madd.s f, f, f, f" +010011,5.FR,5.FT,5.FS,5.FD,100,3.FMT:COP1X:64,f::MADD.fmt +"madd.%s f, f, f, f" *mipsIV: *mipsV: *mips64: *vr5000: { + int fmt = FMT; check_fpu (SD_); - { - StoreFPR(FD,fmt_single,Add(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single)); - } + check_u64 (SD_, instruction_0); + check_fmt_p (SD_, fmt, instruction_0); + StoreFPR (FD, fmt, MultiplyAdd (ValueFPR (FS, fmt), ValueFPR (FT, fmt), + ValueFPR (FR, fmt), fmt)); } -// MFC1 -// MTC1 -010001,00,X,00,5.RT,5.FS,00000000000:COP1Sa:32,f::MxC1 -"m%sc1 r, f" +010001,00000,5.RT,5.FS,00000000000:COP1:32,f::MFC1a +"mfc1 r, f" *mipsI: *mipsII: *mipsIII: { + unsigned64 v; check_fpu (SD_); - if (X) - { /*MTC1*/ - if (SizeFGR() == 64) - { - if (STATE_VERBOSE_P(SD)) - sim_io_eprintf (SD, - "Warning: PC 0x%lx: MTC1 not DMTC1 with 64 bit regs\n", - (long) CIA); - PENDING_FILL ((FS + FGRIDX), (SET64HI(0xDEADC0DE) | VL4_8(GPR[RT]))); - } - else - PENDING_FILL ((FS + FGRIDX), VL4_8(GPR[RT])); - } - else /*MFC1*/ - PENDING_FILL (RT, EXTEND32 (FGR[FS])); + v = EXTEND32 (FGR[FS]); + PENDING_FILL (RT, v); + TRACE_ALU_RESULT (v); } -010001,00,X,00,5.RT,5.FS,00000000000:COP1Sb:32,f::MxC1 -"m%sc1 r, f" + +010001,00000,5.RT,5.FS,00000000000:COP1:32,f::MFC1b +"mfc1 r, f" *mipsIV: *mipsV: *mips32: @@ -4273,14 +4287,10 @@ *vr4100: *vr5000: *r3900: -{ - int fs = FS; +{ check_fpu (SD_); - if (X) - /*MTC1*/ - StoreFPR (FS, fmt_uninterpreted_32, VL4_8 (GPR[RT])); - else /*MFC1*/ - GPR[RT] = EXTEND32 (FGR[FS]); + GPR[RT] = EXTEND32 (FGR[FS]); + TRACE_ALU_RESULT (GPR[RT]); } @@ -4300,7 +4310,7 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,ValueFPR(FS,fmt)); + StoreFPR (FD, fmt, ValueFPR (FS, fmt)); } @@ -4332,12 +4342,22 @@ { int fmt = FMT; check_fpu (SD_); - { - if (GETFCC(CC) == TF) - StoreFPR (FD, fmt, ValueFPR (FS, fmt)); - else - StoreFPR (FD, fmt, ValueFPR (FD, fmt)); - } + if (fmt != fmt_ps) + { + if (GETFCC(CC) == TF) + StoreFPR (FD, fmt, ValueFPR (FS, fmt)); + else + StoreFPR (FD, fmt, ValueFPR (FD, fmt)); /* set fmt */ + } + else + { + unsigned64 fd; + fd = PackPS (PSUpper (ValueFPR ((GETFCC (CC+1) == TF) ? FS : FD, + fmt_ps)), + PSLower (ValueFPR ((GETFCC (CC+0) == TF) ? FS : FD, + fmt_ps))); + StoreFPR (FD, fmt_ps, fd); + } } @@ -4380,35 +4400,51 @@ } -// MSUB.fmt -010011,5.FR,5.FT,5.FS,5.FD,101,001:COP1X:32,f::MSUB.D -"msub.d f, f, f, f" +010011,5.FR,5.FT,5.FS,5.FD,101,3.FMT:COP1X:64,f::MSUB.fmt +"msub.%s f, f, f, f" *mipsIV: *mipsV: *mips64: *vr5000: { + int fmt = FMT; check_fpu (SD_); - StoreFPR(FD,fmt_double,Sub(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double)); + check_u64 (SD_, instruction_0); + check_fmt_p (SD_, fmt, instruction_0); + StoreFPR (FD, fmt, MultiplySub (ValueFPR (FS, fmt), ValueFPR (FT, fmt), + ValueFPR (FR, fmt), fmt)); } -// MSUB.fmt -010011,5.FR,5.FT,5.FS,5.FD,101000:COP1X:32,f::MSUB.S -"msub.s f, f, f, f" +010001,00100,5.RT,5.FS,00000000000:COP1:32,f::MTC1a +"mtc1 r, f" +*mipsI: +*mipsII: +*mipsIII: +{ + check_fpu (SD_); + if (SizeFGR () == 64) + PENDING_FILL ((FS + FGR_BASE), (SET64HI (0xDEADC0DE) | VL4_8 (GPR[RT]))); + else + PENDING_FILL ((FS + FGR_BASE), VL4_8 (GPR[RT])); + TRACE_FP_RESULT (GPR[RT]); +} + +010001,00100,5.RT,5.FS,00000000000:COP1:32,f::MTC1b +"mtc1 r, f" *mipsIV: *mipsV: +*mips32: *mips64: +*vr4100: *vr5000: +*r3900: { - check_fpu (SD_); - StoreFPR(FD,fmt_single,Sub(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single)); + check_fpu (SD_); + StoreFPR (FS, fmt_uninterpreted_32, VL4_8 (GPR[RT])); } -// MTC1 see MxC1 - - 010001,10,3.FMT,5.FT,5.FS,5.FD,000010:COP1:32,f::MUL.fmt "mul.%s f, f, f" *mipsI: @@ -4425,7 +4461,7 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Multiply(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt)); + StoreFPR (FD, fmt, Multiply (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt)); } @@ -4445,59 +4481,63 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Negate(ValueFPR(FS,fmt),fmt)); + StoreFPR (FD, fmt, Negate (ValueFPR (FS, fmt), fmt)); } -// NMADD.fmt -010011,5.FR,5.FT,5.FS,5.FD,110001:COP1X:32,f::NMADD.D -"nmadd.d f, f, f, f" +010011,5.FR,5.FT,5.FS,5.FD,110,3.FMT:COP1X:64,f::NMADD.fmt +"nmadd.%s f, f, f, f" *mipsIV: *mipsV: *mips64: *vr5000: { + int fmt = FMT; check_fpu (SD_); - StoreFPR(FD,fmt_double,Negate(Add(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double),fmt_double)); + check_u64 (SD_, instruction_0); + check_fmt_p (SD_, fmt, instruction_0); + StoreFPR (FD, fmt, NegMultiplyAdd (ValueFPR (FS, fmt), ValueFPR (FT, fmt), + ValueFPR (FR, fmt), fmt)); } -// NMADD.fmt -010011,5.FR,5.FT,5.FS,5.FD,110000:COP1X:32,f::NMADD.S -"nmadd.s f, f, f, f" +010011,5.FR,5.FT,5.FS,5.FD,111,3.FMT:COP1X:64,f::NMSUB.fmt +"nmsub.%s f, f, f, f" *mipsIV: *mipsV: *mips64: *vr5000: { + int fmt = FMT; check_fpu (SD_); - StoreFPR(FD,fmt_single,Negate(Add(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single),fmt_single)); + check_u64 (SD_, instruction_0); + check_fmt_p (SD_, fmt, instruction_0); + StoreFPR (FD, fmt, NegMultiplySub (ValueFPR (FS, fmt), ValueFPR (FT, fmt), + ValueFPR (FR, fmt), fmt)); } -// NMSUB.fmt -010011,5.FR,5.FT,5.FS,5.FD,111001:COP1X:32,f::NMSUB.D -"nmsub.d f, f, f, f" -*mipsIV: +010001,10,110,5.FT,5.FS,5.FD,101100:COP1:64,f::PLL.PS +"pll.ps f, f, f" *mipsV: *mips64: -*vr5000: { check_fpu (SD_); - StoreFPR(FD,fmt_double,Negate(Sub(Multiply(ValueFPR(FS,fmt_double),ValueFPR(FT,fmt_double),fmt_double),ValueFPR(FR,fmt_double),fmt_double),fmt_double)); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_ps, PackPS (PSLower (ValueFPR (FS, fmt_ps)), + PSLower (ValueFPR (FT, fmt_ps)))); } -// NMSUB.fmt -010011,5.FR,5.FT,5.FS,5.FD,111000:COP1X:32,f::NMSUB.S -"nmsub.s f, f, f, f" -*mipsIV: +010001,10,110,5.FT,5.FS,5.FD,101101:COP1:64,f::PLU.PS +"plu.ps f, f, f" *mipsV: *mips64: -*vr5000: { check_fpu (SD_); - StoreFPR(FD,fmt_single,Negate(Sub(Multiply(ValueFPR(FS,fmt_single),ValueFPR(FT,fmt_single),fmt_single),ValueFPR(FR,fmt_single),fmt_single),fmt_single)); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_ps, PackPS (PSLower (ValueFPR (FS, fmt_ps)), + PSUpper (ValueFPR (FT, fmt_ps)))); } @@ -4519,6 +4559,31 @@ } } + +010001,10,110,5.FT,5.FS,5.FD,101110:COP1:64,f::PUL.PS +"pul.ps f, f, f" +*mipsV: +*mips64: +{ + check_fpu (SD_); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_ps, PackPS (PSUpper (ValueFPR (FS, fmt_ps)), + PSLower (ValueFPR (FT, fmt_ps)))); +} + + +010001,10,110,5.FT,5.FS,5.FD,101111:COP1:64,f::PUU.PS +"puu.ps f, f, f" +*mipsV: +*mips64: +{ + check_fpu (SD_); + check_u64 (SD_, instruction_0); + StoreFPR (FD, fmt_ps, PackPS (PSUpper (ValueFPR (FS, fmt_ps)), + PSUpper (ValueFPR (FT, fmt_ps)))); +} + + 010001,10,3.FMT,00000,5.FS,5.FD,010101:COP1:32,f::RECIP.fmt "recip.%s f, f" *mipsIV: @@ -4529,7 +4594,7 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Recip(ValueFPR(FS,fmt),fmt)); + StoreFPR (FD, fmt, Recip (ValueFPR (FS, fmt), fmt)); } @@ -4546,7 +4611,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_long,Convert(FP_RM_NEAREST,ValueFPR(FS,fmt),fmt,fmt_long)); + StoreFPR (FD, fmt_long, Convert (FP_RM_NEAREST, ValueFPR (FS, fmt), fmt, + fmt_long)); } @@ -4565,21 +4631,22 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_word,Convert(FP_RM_NEAREST,ValueFPR(FS,fmt),fmt,fmt_word)); + StoreFPR (FD, fmt_word, Convert (FP_RM_NEAREST, ValueFPR (FS, fmt), fmt, + fmt_word)); } 010001,10,3.FMT,00000,5.FS,5.FD,010110:COP1:32,f::RSQRT.fmt +"rsqrt.%s f, f" *mipsIV: *mipsV: *mips64: -"rsqrt.%s f, f" *vr5000: { int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Recip(SquareRoot(ValueFPR(FS,fmt),fmt),fmt)); + StoreFPR (FD, fmt, RSquareRoot (ValueFPR (FS, fmt), fmt)); } @@ -4628,7 +4695,7 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,(SquareRoot(ValueFPR(FS,fmt),fmt))); + StoreFPR (FD, fmt, (SquareRoot (ValueFPR (FS, fmt), fmt))); } @@ -4648,7 +4715,7 @@ int fmt = FMT; check_fpu (SD_); check_fmt_p (SD_, fmt, instruction_0); - StoreFPR(FD,fmt,Sub(ValueFPR(FS,fmt),ValueFPR(FT,fmt),fmt)); + StoreFPR (FD, fmt, Sub (ValueFPR (FS, fmt), ValueFPR (FT, fmt), fmt)); } @@ -4750,7 +4817,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_long,Convert(FP_RM_TOZERO,ValueFPR(FS,fmt),fmt,fmt_long)); + StoreFPR (FD, fmt_long, Convert (FP_RM_TOZERO, ValueFPR (FS, fmt), fmt, + fmt_long)); } @@ -4769,7 +4837,8 @@ int fmt = FMT; check_fpu (SD_); check_fmt (SD_, fmt, instruction_0); - StoreFPR(FD,fmt_word,Convert(FP_RM_TOZERO,ValueFPR(FS,fmt),fmt,fmt_word)); + StoreFPR (FD, fmt_word, Convert (FP_RM_TOZERO, ValueFPR (FS, fmt), fmt, + fmt_word)); } @@ -5054,6 +5123,9 @@ :include:::m16.igen +:include:::mdmx.igen +:include:::mips3d.igen +:include:::sb1.igen :include:::tx.igen :include:::vr.igen diff --git a/sim/mips/sim-main.c b/sim/mips/sim-main.c index 7b3e6c61501..edee498bc94 100644 --- a/sim/mips/sim-main.c +++ b/sim/mips/sim-main.c @@ -163,35 +163,35 @@ load_memory (SIM_DESC SD, switch (AccessLength) { - case AccessLength_QUADWORD : + case AccessLength_QUADWORD: { unsigned_16 val = sim_core_read_aligned_16 (CPU, cia, read_map, pAddr); value1 = VH8_16 (val); value = VL8_16 (val); break; } - case AccessLength_DOUBLEWORD : + case AccessLength_DOUBLEWORD: value = sim_core_read_aligned_8 (CPU, cia, read_map, pAddr); break; - case AccessLength_SEPTIBYTE : + case AccessLength_SEPTIBYTE: value = sim_core_read_misaligned_7 (CPU, cia, read_map, pAddr); break; - case AccessLength_SEXTIBYTE : + case AccessLength_SEXTIBYTE: value = sim_core_read_misaligned_6 (CPU, cia, read_map, pAddr); break; - case AccessLength_QUINTIBYTE : + case AccessLength_QUINTIBYTE: value = sim_core_read_misaligned_5 (CPU, cia, read_map, pAddr); break; - case AccessLength_WORD : + case AccessLength_WORD: value = sim_core_read_aligned_4 (CPU, cia, read_map, pAddr); break; - case AccessLength_TRIPLEBYTE : + case AccessLength_TRIPLEBYTE: value = sim_core_read_misaligned_3 (CPU, cia, read_map, pAddr); break; - case AccessLength_HALFWORD : + case AccessLength_HALFWORD: value = sim_core_read_aligned_2 (CPU, cia, read_map, pAddr); break; - case AccessLength_BYTE : + case AccessLength_BYTE: value = sim_core_read_aligned_1 (CPU, cia, read_map, pAddr); break; default: @@ -292,34 +292,34 @@ store_memory (SIM_DESC SD, switch (AccessLength) { - case AccessLength_QUADWORD : + case AccessLength_QUADWORD: { unsigned_16 val = U16_8 (MemElem1, MemElem); sim_core_write_aligned_16 (CPU, cia, write_map, pAddr, val); break; } - case AccessLength_DOUBLEWORD : + case AccessLength_DOUBLEWORD: sim_core_write_aligned_8 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_SEPTIBYTE : + case AccessLength_SEPTIBYTE: sim_core_write_misaligned_7 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_SEXTIBYTE : + case AccessLength_SEXTIBYTE: sim_core_write_misaligned_6 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_QUINTIBYTE : + case AccessLength_QUINTIBYTE: sim_core_write_misaligned_5 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_WORD : + case AccessLength_WORD: sim_core_write_aligned_4 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_TRIPLEBYTE : + case AccessLength_TRIPLEBYTE: sim_core_write_misaligned_3 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_HALFWORD : + case AccessLength_HALFWORD: sim_core_write_aligned_2 (CPU, cia, write_map, pAddr, MemElem); break; - case AccessLength_BYTE : + case AccessLength_BYTE: sim_core_write_aligned_1 (CPU, cia, write_map, pAddr, MemElem); break; default: diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h index bcdcd80e3fd..fed625ecb54 100644 --- a/sim/mips/sim-main.h +++ b/sim/mips/sim-main.h @@ -64,6 +64,7 @@ typedef unsigned64 uword64; /* Floating-point operations: */ #include "sim-fpu.h" +#include "cp1.h" /* FPU registers must be one of the following types. All other values are reserved (and undefined). */ @@ -72,6 +73,7 @@ typedef enum { fmt_double = 1, fmt_word = 4, fmt_long = 5, + fmt_ps = 6, /* The following are well outside the normal acceptable format range, and are used in the register status vector. */ fmt_unknown = 0x10000000, @@ -80,40 +82,9 @@ typedef enum { fmt_uninterpreted_64 = 0x80000000U, } FP_formats; -unsigned64 value_fpr PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int fpr, FP_formats)); -#define ValueFPR(FPR,FMT) value_fpr (SD, CPU, cia, (FPR), (FMT)) - -void store_fpr PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int fpr, FP_formats fmt, unsigned64 value)); -#define StoreFPR(FPR,FMT,VALUE) store_fpr (SD, CPU, cia, (FPR), (FMT), (VALUE)) - -int NaN PARAMS ((unsigned64 op, FP_formats fmt)); -int Infinity PARAMS ((unsigned64 op, FP_formats fmt)); -int Less PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -int Equal PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 AbsoluteValue PARAMS ((unsigned64 op, FP_formats fmt)); -unsigned64 Negate PARAMS ((unsigned64 op, FP_formats fmt)); -unsigned64 Add PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 Sub PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 Multiply PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 Divide PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 Recip PARAMS ((unsigned64 op, FP_formats fmt)); -unsigned64 SquareRoot PARAMS ((unsigned64 op, FP_formats fmt)); -unsigned64 Max PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 Min PARAMS ((unsigned64 op1, unsigned64 op2, FP_formats fmt)); -unsigned64 convert PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int rm, unsigned64 op, FP_formats from, FP_formats to)); -#define Convert(rm,op,from,to) \ -convert (SD, CPU, cia, rm, op, from, to) - -/* Macro to update FPSR condition-code field. This is complicated by - the fact that there is a hole in the index range of the bits within - the FCSR register. Also, the number of bits visible depends on the - MIPS ISA version being supported. */ - -#define SETFCC(cc,v) {\ - int bit = ((cc == 0) ? 23 : (24 + (cc)));\ - FCSR = ((FCSR & ~(1 << bit)) | ((v) << bit));\ -} -#define GETFCC(cc) (((((cc) == 0) ? (FCSR & (1 << 23)) : (FCSR & (1 << (24 + (cc))))) != 0) ? 1U : 0) +/* For paired word (pw) operations, the opcode representation is fmt_word, + but register transfers (StoreFPR, ValueFPR, etc.) are done as fmt_long. */ +#define fmt_pw fmt_long /* This should be the COC1 value at the start of the preceding instruction: */ @@ -128,36 +99,6 @@ convert (SD, CPU, cia, rm, op, from, to) #define SizeFGR() (WITH_TARGET_FLOATING_POINT_BITSIZE) #endif -/* Standard FCRS bits: */ -#define IR (0) /* Inexact Result */ -#define UF (1) /* UnderFlow */ -#define OF (2) /* OverFlow */ -#define DZ (3) /* Division by Zero */ -#define IO (4) /* Invalid Operation */ -#define UO (5) /* Unimplemented Operation */ - -/* Get masks for individual flags: */ -#if 1 /* SAFE version */ -#define FP_FLAGS(b) (((unsigned)(b) < 5) ? (1 << ((b) + 2)) : 0) -#define FP_ENABLE(b) (((unsigned)(b) < 5) ? (1 << ((b) + 7)) : 0) -#define FP_CAUSE(b) (((unsigned)(b) < 6) ? (1 << ((b) + 12)) : 0) -#else -#define FP_FLAGS(b) (1 << ((b) + 2)) -#define FP_ENABLE(b) (1 << ((b) + 7)) -#define FP_CAUSE(b) (1 << ((b) + 12)) -#endif - -#define FP_FS (1 << 24) /* MIPS III onwards : Flush to Zero */ - -#define FP_MASK_RM (0x3) -#define FP_SH_RM (0) -#define FP_RM_NEAREST (0) /* Round to nearest (Round) */ -#define FP_RM_TOZERO (1) /* Round to zero (Trunc) */ -#define FP_RM_TOPINF (2) /* Round to Plus infinity (Ceil) */ -#define FP_RM_TOMINF (3) /* Round to Minus infinity (Floor) */ -#define GETRM() (int)((FCSR >> FP_SH_RM) & FP_MASK_RM) - - @@ -278,10 +219,10 @@ memset (&(CPU)->pending, 0, sizeof ((CPU)->pending)) /* For backward compatibility */ #define PENDING_FILL(R,VAL) \ do { \ - if ((R) >= FGRIDX && (R) < FGRIDX + NR_FGR) \ + if ((R) >= FGR_BASE && (R) < FGR_BASE + NR_FGR) \ { \ - PENDING_SCHED(FGR[(R) - FGRIDX], VAL, 1, -1); \ - PENDING_SCHED(FPR_STATE[(R) - FGRIDX], fmt_uninterpreted, 1, -1); \ + PENDING_SCHED(FGR[(R) - FGR_BASE], VAL, 1, -1); \ + PENDING_SCHED(FPR_STATE[(R) - FGR_BASE], fmt_uninterpreted, 1, -1); \ } \ else \ PENDING_SCHED(GPR[(R)], VAL, 1, -1); \ @@ -296,6 +237,24 @@ enum float_operation }; +/* The internal representation of an MDMX accumulator. + Note that 24 and 48 bit accumulator elements are represented in + 32 or 64 bits. Since the accumulators are 2's complement with + overflow suppressed, high-order bits can be ignored in most contexts. */ + +typedef signed32 signed24; +typedef signed64 signed48; + +typedef union { + signed24 ob[8]; + signed48 qh[4]; +} MDMX_accumulator; + + +/* Conventional system arguments. */ +#define SIM_STATE sim_cpu *cpu, address_word cia +#define SIM_ARGS CPU, cia + struct _sim_cpu { @@ -356,7 +315,9 @@ struct _sim_cpu { #define LAST_EMBED_REGNUM (89) #define NUM_REGS (LAST_EMBED_REGNUM + 1) - +#define FP0_REGNUM 38 /* Floating point register 0 (single float) */ +#define FCRCS_REGNUM 70 /* FP control/status */ +#define FCRIR_REGNUM 71 /* FP implementation/revision */ #endif @@ -372,15 +333,6 @@ struct _sim_cpu { #define GPR (®ISTERS[0]) #define GPR_SET(N,VAL) (REGISTERS[(N)] = (VAL)) - /* While space is allocated for the floating point registers in the - main registers array, they are stored separatly. This is because - their size may not necessarily match the size of either the - general-purpose or system specific registers */ -#define NR_FGR (32) -#define FGRIDX (38) - fp_word fgr[NR_FGR]; -#define FGR ((CPU)->fgr) - #define LO (REGISTERS[33]) #define HI (REGISTERS[34]) #define PCIDX 37 @@ -433,12 +385,25 @@ struct _sim_cpu { #define COP0_GPR ((CPU)->cop0_gpr) #define COP0_BADVADDR ((unsigned32)(COP0_GPR[8])) + /* While space is allocated for the floating point registers in the + main registers array, they are stored separatly. This is because + their size may not necessarily match the size of either the + general-purpose or system specific registers. */ +#define NR_FGR (32) +#define FGR_BASE FP0_REGNUM + fp_word fgr[NR_FGR]; +#define FGR ((CPU)->fgr) + /* Keep the current format state for each register: */ FP_formats fpr_state[32]; #define FPR_STATE ((CPU)->fpr_state) pending_write_queue pending; + /* The MDMX accumulator (used only for MDMX ASE). */ + MDMX_accumulator acc; +#define ACC ((CPU)->acc) + /* LLBIT = Load-Linked bit. A bit of "virtual" state used by atomic read-write instructions. It is set when a linked load occurs. It is tested and cleared by the conditional store. It is cleared @@ -545,6 +510,8 @@ struct sim_state { #define status_CU1 (1 << 29) /* Coprocessor 1 usable */ #define status_CU2 (1 << 30) /* Coprocessor 2 usable */ #define status_CU3 (1 << 31) /* Coprocessor 3 usable */ +/* Bits reserved for implementations: */ +#define status_SBX (1 << 16) /* Enable SiByte SB-1 extensions. */ #define cause_BD ((unsigned)1 << 31) /* L1 Exception in branch delay slot */ #define cause_BD2 (1 << 30) /* L2 Exception in branch delay slot */ @@ -707,6 +674,191 @@ decode_coproc (SD, CPU, cia, (instruction)) int sim_monitor (SIM_DESC sd, sim_cpu *cpu, address_word cia, unsigned int arg); +/* FPR access. */ +unsigned64 value_fpr (SIM_STATE, int fpr, FP_formats); +#define ValueFPR(FPR,FMT) value_fpr (SIM_ARGS, (FPR), (FMT)) +void store_fpr (SIM_STATE, int fpr, FP_formats fmt, unsigned64 value); +#define StoreFPR(FPR,FMT,VALUE) store_fpr (SIM_ARGS, (FPR), (FMT), (VALUE)) +unsigned64 ps_lower (SIM_STATE, unsigned64 op); +#define PSLower(op) ps_lower (SIM_ARGS, op) +unsigned64 ps_upper (SIM_STATE, unsigned64 op); +#define PSUpper(op) ps_upper (SIM_ARGS, op) +unsigned64 pack_ps (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats from); +#define PackPS(op1,op2) pack_ps (SIM_ARGS, op1, op2, fmt_single) + + +/* FCR access. */ +unsigned_word value_fcr (SIM_STATE, int fcr); +#define ValueFCR(FCR) value_fcr (SIM_ARGS, (FCR)) +void store_fcr (SIM_STATE, int fcr, unsigned_word value); +#define StoreFCR(FCR,VALUE) store_fcr (SIM_ARGS, (FCR), (VALUE)) +void test_fcsr (SIM_STATE); +#define TestFCSR() test_fcsr (SIM_ARGS) + + +/* FPU operations. */ +void fp_cmp (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt, int abs, int cond, int cc); +#define Compare(op1,op2,fmt,cond,cc) fp_cmp(SIM_ARGS, op1, op2, fmt, 0, cond, cc) +unsigned64 fp_abs (SIM_STATE, unsigned64 op, FP_formats fmt); +#define AbsoluteValue(op,fmt) fp_abs(SIM_ARGS, op, fmt) +unsigned64 fp_neg (SIM_STATE, unsigned64 op, FP_formats fmt); +#define Negate(op,fmt) fp_neg(SIM_ARGS, op, fmt) +unsigned64 fp_add (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define Add(op1,op2,fmt) fp_add(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_sub (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define Sub(op1,op2,fmt) fp_sub(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_mul (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define Multiply(op1,op2,fmt) fp_mul(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_div (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define Divide(op1,op2,fmt) fp_div(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_recip (SIM_STATE, unsigned64 op, FP_formats fmt); +#define Recip(op,fmt) fp_recip(SIM_ARGS, op, fmt) +unsigned64 fp_sqrt (SIM_STATE, unsigned64 op, FP_formats fmt); +#define SquareRoot(op,fmt) fp_sqrt(SIM_ARGS, op, fmt) +unsigned64 fp_rsqrt (SIM_STATE, unsigned64 op, FP_formats fmt); +#define RSquareRoot(op,fmt) fp_rsqrt(SIM_ARGS, op, fmt) +unsigned64 fp_madd (SIM_STATE, unsigned64 op1, unsigned64 op2, + unsigned64 op3, FP_formats fmt); +#define MultiplyAdd(op1,op2,op3,fmt) fp_madd(SIM_ARGS, op1, op2, op3, fmt) +unsigned64 fp_msub (SIM_STATE, unsigned64 op1, unsigned64 op2, + unsigned64 op3, FP_formats fmt); +#define MultiplySub(op1,op2,op3,fmt) fp_msub(SIM_ARGS, op1, op2, op3, fmt) +unsigned64 fp_nmadd (SIM_STATE, unsigned64 op1, unsigned64 op2, + unsigned64 op3, FP_formats fmt); +#define NegMultiplyAdd(op1,op2,op3,fmt) fp_nmadd(SIM_ARGS, op1, op2, op3, fmt) +unsigned64 fp_nmsub (SIM_STATE, unsigned64 op1, unsigned64 op2, + unsigned64 op3, FP_formats fmt); +#define NegMultiplySub(op1,op2,op3,fmt) fp_nmsub(SIM_ARGS, op1, op2, op3, fmt) +unsigned64 convert (SIM_STATE, int rm, unsigned64 op, FP_formats from, FP_formats to); +#define Convert(rm,op,from,to) convert (SIM_ARGS, rm, op, from, to) +unsigned64 convert_ps (SIM_STATE, int rm, unsigned64 op, FP_formats from, + FP_formats to); +#define ConvertPS(rm,op,from,to) convert_ps (SIM_ARGS, rm, op, from, to) + + +/* MIPS-3D ASE operations. */ +#define CompareAbs(op1,op2,fmt,cond,cc) \ +fp_cmp(SIM_ARGS, op1, op2, fmt, 1, cond, cc) +unsigned64 fp_add_r (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define AddR(op1,op2,fmt) fp_add_r(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_mul_r (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define MultiplyR(op1,op2,fmt) fp_mul_r(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_recip1 (SIM_STATE, unsigned64 op, FP_formats fmt); +#define Recip1(op,fmt) fp_recip1(SIM_ARGS, op, fmt) +unsigned64 fp_recip2 (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define Recip2(op1,op2,fmt) fp_recip2(SIM_ARGS, op1, op2, fmt) +unsigned64 fp_rsqrt1 (SIM_STATE, unsigned64 op, FP_formats fmt); +#define RSquareRoot1(op,fmt) fp_rsqrt1(SIM_ARGS, op, fmt) +unsigned64 fp_rsqrt2 (SIM_STATE, unsigned64 op1, unsigned64 op2, FP_formats fmt); +#define RSquareRoot2(op1,op2,fmt) fp_rsqrt2(SIM_ARGS, op1, op2, fmt) + + +/* MDMX access. */ + +typedef unsigned int MX_fmtsel; /* MDMX format select field (5 bits). */ +#define ob_fmtsel(sel) (((sel)<<1)|0x0) +#define qh_fmtsel(sel) (((sel)<<2)|0x1) + +#define fmt_mdmx fmt_uninterpreted + +#define MX_VECT_AND (0) +#define MX_VECT_NOR (1) +#define MX_VECT_OR (2) +#define MX_VECT_XOR (3) +#define MX_VECT_SLL (4) +#define MX_VECT_SRL (5) +#define MX_VECT_ADD (6) +#define MX_VECT_SUB (7) +#define MX_VECT_MIN (8) +#define MX_VECT_MAX (9) +#define MX_VECT_MUL (10) +#define MX_VECT_MSGN (11) +#define MX_VECT_SRA (12) +#define MX_VECT_ABSD (13) /* SB-1 only. */ +#define MX_VECT_AVG (14) /* SB-1 only. */ + +unsigned64 mdmx_cpr_op (SIM_STATE, int op, unsigned64 op1, int vt, MX_fmtsel fmtsel); +#define MX_Add(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_ADD, op1, vt, fmtsel) +#define MX_And(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_AND, op1, vt, fmtsel) +#define MX_Max(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MAX, op1, vt, fmtsel) +#define MX_Min(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MIN, op1, vt, fmtsel) +#define MX_Msgn(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MSGN, op1, vt, fmtsel) +#define MX_Mul(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_MUL, op1, vt, fmtsel) +#define MX_Nor(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_NOR, op1, vt, fmtsel) +#define MX_Or(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_OR, op1, vt, fmtsel) +#define MX_ShiftLeftLogical(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SLL, op1, vt, fmtsel) +#define MX_ShiftRightArith(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SRA, op1, vt, fmtsel) +#define MX_ShiftRightLogical(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SRL, op1, vt, fmtsel) +#define MX_Sub(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_SUB, op1, vt, fmtsel) +#define MX_Xor(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_XOR, op1, vt, fmtsel) +#define MX_AbsDiff(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_ABSD, op1, vt, fmtsel) +#define MX_Avg(op1,vt,fmtsel) mdmx_cpr_op(SIM_ARGS, MX_VECT_AVG, op1, vt, fmtsel) + +#define MX_C_EQ 0x1 +#define MX_C_LT 0x4 + +void mdmx_cc_op (SIM_STATE, int cond, unsigned64 op1, int vt, MX_fmtsel fmtsel); +#define MX_Comp(op1,cond,vt,fmtsel) mdmx_cc_op(SIM_ARGS, cond, op1, vt, fmtsel) + +unsigned64 mdmx_pick_op (SIM_STATE, int tf, unsigned64 op1, int vt, MX_fmtsel fmtsel); +#define MX_Pick(tf,op1,vt,fmtsel) mdmx_pick_op(SIM_ARGS, tf, op1, vt, fmtsel) + +#define MX_VECT_ADDA (0) +#define MX_VECT_ADDL (1) +#define MX_VECT_MULA (2) +#define MX_VECT_MULL (3) +#define MX_VECT_MULS (4) +#define MX_VECT_MULSL (5) +#define MX_VECT_SUBA (6) +#define MX_VECT_SUBL (7) +#define MX_VECT_ABSDA (8) /* SB-1 only. */ + +void mdmx_acc_op (SIM_STATE, int op, unsigned64 op1, int vt, MX_fmtsel fmtsel); +#define MX_AddA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ADDA, op1, vt, fmtsel) +#define MX_AddL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ADDL, op1, vt, fmtsel) +#define MX_MulA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULA, op1, vt, fmtsel) +#define MX_MulL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULL, op1, vt, fmtsel) +#define MX_MulS(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULS, op1, vt, fmtsel) +#define MX_MulSL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_MULSL, op1, vt, fmtsel) +#define MX_SubA(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_SUBA, op1, vt, fmtsel) +#define MX_SubL(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_SUBL, op1, vt, fmtsel) +#define MX_AbsDiffC(op1,vt,fmtsel) mdmx_acc_op(SIM_ARGS, MX_VECT_ABSDA, op1, vt, fmtsel) + +#define MX_FMT_OB (0) +#define MX_FMT_QH (1) + +/* The following codes chosen to indicate the units of shift. */ +#define MX_RAC_L (0) +#define MX_RAC_M (1) +#define MX_RAC_H (2) + +unsigned64 mdmx_rac_op (SIM_STATE, int, int); +#define MX_RAC(op,fmt) mdmx_rac_op(SIM_ARGS, op, fmt) + +void mdmx_wacl (SIM_STATE, int, unsigned64, unsigned64); +#define MX_WACL(fmt,vs,vt) mdmx_wacl(SIM_ARGS, fmt, vs, vt) +void mdmx_wach (SIM_STATE, int, unsigned64); +#define MX_WACH(fmt,vs) mdmx_wach(SIM_ARGS, fmt, vs) + +#define MX_RND_AS (0) +#define MX_RND_AU (1) +#define MX_RND_ES (2) +#define MX_RND_EU (3) +#define MX_RND_ZS (4) +#define MX_RND_ZU (5) + +unsigned64 mdmx_round_op (SIM_STATE, int, int, MX_fmtsel); +#define MX_RNAS(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_AS, vt, fmt) +#define MX_RNAU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_AU, vt, fmt) +#define MX_RNES(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ES, vt, fmt) +#define MX_RNEU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_EU, vt, fmt) +#define MX_RZS(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ZS, vt, fmt) +#define MX_RZU(vt,fmt) mdmx_round_op(SIM_ARGS, MX_RND_ZU, vt, fmt) + +unsigned64 mdmx_shuffle (SIM_STATE, int, unsigned64, unsigned64); +#define MX_SHFL(shop,op1,op2) mdmx_shuffle(SIM_ARGS, shop, op1, op2) + + /* Memory accesses */ @@ -774,6 +926,7 @@ prefetch (SD, CPU, cia, CCA, pAddr, vAddr, DATA, hint) void unpredictable_action (sim_cpu *cpu, address_word cia); #define NotWordValue(val) not_word_value (SD_, (val)) #define Unpredictable() unpredictable (SD_) +#define UnpredictableResult() /* For now, do nothing. */ INLINE_SIM_MAIN (unsigned32) ifetch32 PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, address_word vaddr)); #define IMEM32(CIA) ifetch32 (SD, CPU, (CIA), (CIA)) diff --git a/sim/mn10200/ChangeLog b/sim/mn10200/ChangeLog index 6e997245746..ddc51c9b8d9 100644 --- a/sim/mn10200/ChangeLog +++ b/sim/mn10200/ChangeLog @@ -1,3 +1,8 @@ +2002-06-09 Andrew Cagney + + * Makefile.in (INCLUDE): Update path to callback.h. + * mn10200_sim.h: Include "gdb/callback.h" and "gdb/remote-sim.h". + 2001-04-15 J.T. Conklin * Makefile.in (simops.o): Add simops.h to dependency list. diff --git a/sim/mn10200/Makefile.in b/sim/mn10200/Makefile.in index bcc15c86834..563a4edec7b 100644 --- a/sim/mn10200/Makefile.in +++ b/sim/mn10200/Makefile.in @@ -25,7 +25,7 @@ SIM_EXTRA_CLEAN = clean-extra # Select mn10200 support in nltvals.def. NL_TARGET = -DNL_TARGET_mn10200 -INCLUDE = mn10200_sim.h $(srcdir)/../../include/callback.h +INCLUDE = mn10200_sim.h $(srcdir)/../../include/gdb/callback.h ## COMMON_POST_CONFIG_FRAG diff --git a/sim/mn10200/mn10200_sim.h b/sim/mn10200/mn10200_sim.h index a7b7c4d888c..2f85aa0cb4f 100644 --- a/sim/mn10200/mn10200_sim.h +++ b/sim/mn10200/mn10200_sim.h @@ -1,10 +1,10 @@ #include #include #include "ansidecl.h" -#include "callback.h" +#include "gdb/callback.h" #include "opcode/mn10200.h" #include -#include "remote-sim.h" +#include "gdb/remote-sim.h" #ifndef INLINE #ifdef __GNUC__ diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog index 59f45155012..7245767f471 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,3 +1,9 @@ +2002-06-09 Andrew Cagney + + * Makefile.in (INCLUDE): Update path to callback.h. + * mn10300_sim.h: Include "gdb/callback.h" and "gdb/remote-sim.h". + * tconfig.in: Ditto. + 2001-05-06 Jim Blandy * mn10300.igen: Doc fixes. diff --git a/sim/mn10300/Makefile.in b/sim/mn10300/Makefile.in index f3a52ed1994..1f493ec467d 100644 --- a/sim/mn10300/Makefile.in +++ b/sim/mn10300/Makefile.in @@ -48,7 +48,7 @@ SIM_EXTRA_CLEAN = clean-extra # Select mn10300 support in nltvals.def. NL_TARGET = -DNL_TARGET_mn10300 -INCLUDE = mn10300_sim.h $(srcdir)/../../include/callback.h +INCLUDE = mn10300_sim.h $(srcdir)/../../include/gdb/callback.h # List of extra flags to always pass to $(CC). SIM_EXTRA_CFLAGS = @sim_gen@ -DPOLL_QUIT_INTERVAL=0x20 diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h index da6c25915be..6a2c5715583 100644 --- a/sim/mn10300/mn10300_sim.h +++ b/sim/mn10300/mn10300_sim.h @@ -1,10 +1,10 @@ #include #include #include "ansidecl.h" -#include "callback.h" +#include "gdb/callback.h" #include "opcode/mn10300.h" #include -#include "remote-sim.h" +#include "gdb/remote-sim.h" #include "bfd.h" #ifndef INLINE diff --git a/sim/mn10300/tconfig.in b/sim/mn10300/tconfig.in index 521b6e77694..14ca8e77645 100644 --- a/sim/mn10300/tconfig.in +++ b/sim/mn10300/tconfig.in @@ -2,8 +2,8 @@ /* FIXME: This is unnecessarily necessary: */ #include "ansidecl.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "sim-module.h" MODULE_INSTALL_FN dv_sockser_install; diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index d8198e1a20d..0aea7d41b49 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,15 @@ +2002-06-08 Andrew Cagney + + * main.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + * sim_calls.c: Ditto. + +2002-05-30 DJ Delorie + + * lf.c (lf_print__gnu_copyleft): Convert multiline strings to + compatible format. + * gen-idecode.c (print_run_until_stop_body): Likewise. + * gen-model.c (gen_model_c): Likewise. + 2002-04-15 Elena Zannoni * sim_calls.c (sim_fetch_register, sim_store_register): Return -1 for diff --git a/sim/ppc/gen-idecode.c b/sim/ppc/gen-idecode.c index 87d76a06029..3b88866aa86 100644 --- a/sim/ppc/gen-idecode.c +++ b/sim/ppc/gen-idecode.c @@ -757,21 +757,21 @@ print_run_until_stop_body(lf *file, if (!generate_smp) { - lf_putstr(file, " -/* CASE 1: NO SMP (with or with out instruction cache). - - In this case, we can take advantage of the fact that the current - instruction address does not need to be returned to the cpu object - after every execution of an instruction. Instead it only needs to - be saved when either A. the main loop exits or B. A cpu-halt or - cpu-restart call forces the loop to be re-enered. The later - functions always save the current cpu instruction address. - - Two subcases also exist that with and that without an instruction - cache. - - An additional complexity is the need to ensure that a 1:1 ratio - is maintained between the execution of an instruction and the + lf_putstr(file, "\n\ +/* CASE 1: NO SMP (with or with out instruction cache).\n\ +\n\ + In this case, we can take advantage of the fact that the current\n\ + instruction address does not need to be returned to the cpu object\n\ + after every execution of an instruction. Instead it only needs to\n\ + be saved when either A. the main loop exits or B. A cpu-halt or\n\ + cpu-restart call forces the loop to be re-enered. The later\n\ + functions always save the current cpu instruction address.\n\ +\n\ + Two subcases also exist that with and that without an instruction\n\ + cache.\n\ +\n\ + An additional complexity is the need to ensure that a 1:1 ratio\n\ + is maintained between the execution of an instruction and the\n\ incrementing of the simulation clock */"); lf_putstr(file, "\n"); @@ -867,12 +867,12 @@ print_run_until_stop_body(lf *file, if (generate_smp) { - lf_putstr(file, " -/* CASE 2: SMP (With or without ICACHE) - - The complexity here comes from needing to correctly restart the - system when it is aborted. In particular if cpu0 requests a - restart, the next cpu is still cpu1. Cpu0 being restarted after + lf_putstr(file, "\n\ +/* CASE 2: SMP (With or without ICACHE)\n\ +\n\ + The complexity here comes from needing to correctly restart the\n\ + system when it is aborted. In particular if cpu0 requests a\n\ + restart, the next cpu is still cpu1. Cpu0 being restarted after\n\ all the other CPU's and the event queue have been processed */"); lf_putstr(file, "\n"); diff --git a/sim/ppc/gen-model.c b/sim/ppc/gen-model.c index 4ec167717c0..34c1b90f5ce 100644 --- a/sim/ppc/gen-model.c +++ b/sim/ppc/gen-model.c @@ -377,7 +377,7 @@ gen_model_c(insn_table *table, lf *file) lf_printf(file, " }\n"); lf_printf(file, " }\n"); lf_printf(file, "\n"); - lf_printf(file, " error(\"Unknown model '%%s', Models which are known are:%%s\n\",\n"); + lf_printf(file, " error(\"Unknown model '%%s', Models which are known are:%%s\\n\",\n"); lf_printf(file, " name,\n"); lf_printf(file, " \""); for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) { diff --git a/sim/ppc/lf.c b/sim/ppc/lf.c index 2a420151efa..fc2a3c13524 100644 --- a/sim/ppc/lf.c +++ b/sim/ppc/lf.c @@ -273,28 +273,28 @@ lf_print__gnu_copyleft(lf *file) switch (file->type) { case lf_is_c: case lf_is_h: - nr += lf_printf(file, "\ -/* This file is part of the program psim. - - Copyright (C) 1994-1995, Andrew Cagney - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -- - - This file was generated by the program %s */ + nr += lf_printf(file, "\n\ +/* This file is part of the program psim.\n\ +\n\ + Copyright (C) 1994-1995, Andrew Cagney \n\ +\n\ + This program is free software; you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation; either version 2 of the License, or\n\ + (at your option) any later version.\n\ +\n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details.\n\ + \n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; if not, write to the Free Software\n\ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\ + \n\ + --\n\ +\n\ + This file was generated by the program %s */\n\ ", filter_filename(file->program)); break; default: diff --git a/sim/ppc/main.c b/sim/ppc/main.c index f6ac87f45fd..4df78ab5aef 100644 --- a/sim/ppc/main.c +++ b/sim/ppc/main.c @@ -31,8 +31,8 @@ #include "events.h" /* FIXME: psim should provide the interface */ #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #ifdef HAVE_STDLIB_H #include diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index 47af5b12a45..f2c2d1950d5 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -42,8 +42,8 @@ #include "defs.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" /* Define the rate at which the simulator should poll the host for a quit. */ diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index 541ed1f27d2..62320a84a69 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,7 @@ +2002-06-08 Andrew Cagney + + * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + 2001-01-30 Ben Elliston * interp.c (sim_create_inferior): Record program arguments for diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 99f51d16a2c..286dd2dccba 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -27,8 +27,8 @@ #include "sysdep.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" /* This file is local - if newlib changes, then so should this. */ #include "syscall.h" diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog deleted file mode 100644 index a98b57dad84..00000000000 --- a/sim/tic80/ChangeLog +++ /dev/null @@ -1,662 +0,0 @@ -Tue Jul 4 13:58:43 2000 Andrew Cagney - - * tic80.igen: Rename insns. Re-format. - * tic80.dc: rename dc. - * tic80.ic: rename ic. Replace ``compute'' with ``cache''. - -Wed May 24 14:40:34 2000 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -2000-04-12 Frank Ch. Eigler - - * cpu.h (GPR_CLEAR): New macro. - (GPR_SET): Removed macro. - -Thu Sep 2 18:15:53 1999 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -1999-05-08 Felix Lee - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Fri May 1 14:41:11 1998 Andrew Cagney - - * insns: Pass correct arguments to sim_engine_abort. - -Tue Apr 28 18:33:31 1998 Geoffrey Noer - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Sun Apr 26 15:31:55 1998 Tom Tromey - - * configure: Regenerated to track ../common/aclocal.m4 changes. - * config.in: Ditto. - -Sun Apr 26 15:19:45 1998 Tom Tromey - - * acconfig.h: New file. - * configure.in: Reverted change of Apr 24; use sinclude again. - -Fri Apr 24 14:16:40 1998 Tom Tromey - - * configure: Regenerated to track ../common/aclocal.m4 changes. - * config.in: Ditto. - -Fri Apr 24 11:18:28 1998 Tom Tromey - - * configure.in: Don't call sinclude. - -Fri Apr 24 19:43:30 1998 Andrew Cagney - - * ic (rBase, rLink): Make the type a pointer. - -Sat Apr 4 20:36:25 1998 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Fri Mar 27 16:15:52 1998 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Wed Mar 25 12:35:29 1998 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Wed Mar 18 12:38:12 1998 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Wed Mar 11 14:12:56 1998 Andrew Cagney - - * alu.h (IMEM32_IMMED, IMEM32, STORE, MEM): Replace sim_core_*_map - with read_map, write_map, exec_map resp. - -Thu Feb 26 19:08:37 1998 Andrew Cagney - - * sim-calls.c (sim_info): Delete. - -Tue Feb 17 14:35:05 1998 Michael Meissner - - * misc.c (tic80_trace_cond_br): Take size/code arguments, and - decode bcond conditions and bbo/bbz comparison bits. - - * cpu.h (tic80_trace_cond_br): Update prototype. - (TRACE_COND_PR): Take size/code additional arguments. - - * insns: (bbo/bbz/bcnd): Update call to TRACE_COND_PR. - -Tue Feb 17 12:50:27 1998 Andrew Cagney - - * sim-calls.c (sim_store_register, sim_fetch_register): Pass in - length parameter. Return -1. - -Fri Feb 13 17:11:22 1998 Michael Meissner - - * insns ({get,set}_fp_reg): Tic80 floating point is little endian, - not big endian. - - * misc.c (tic80_trace_fpu*): Pass address of sim_fpu structure, - not the structure itself. Use %g consistantly to print floating - point. - - * cpu.h: (tic80_trace_fpu*): Update prototypes. - -Tue Feb 3 16:25:47 1998 Andrew Cagney - - * alu.h (IMEM32, IMEM32_IMMED): Rename IMEM and IMEM_IMMED so that - in sync with recent igen change. - -Sun Feb 1 16:47:51 1998 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Sat Jan 31 18:15:41 1998 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Fri Jan 30 11:47:50 1998 Andrew Cagney - - * cpu.h (CPU_CIA): Delete macro, replace with... - (CIA_SET, CIA_GET): Define. - -Wed Jan 28 18:44:33 1998 Michael Meissner - - * misc.c (tic80_trace_cmp_internal): New function to return - compare bits as a string. - (tic80_trace_{,fpu2}cmp): New functions for tracing cmp and fcmp. - - * cpu.h (tic80_trace_{,fpu2}cmp): Add declaration. - (TRACE_{,FPU2}CMP): New macros for tracing compares. - - * insns (do_{,f}cmp): Use compare specific tracing functions to - print out the flag bits. - -Mon Jan 19 22:26:29 1998 Doug Evans - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Mon Dec 15 23:17:11 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - * config.in: Ditto. - -Thu Dec 4 09:21:05 1997 Doug Evans - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Mon Nov 24 14:57:58 1997 Doug Evans - - * cpu.h (TRACE_COND_BR): Use TRACE_BRANCH_P, not TRACE_ALU_P. - -Sat Nov 22 21:42:09 1997 Andrew Cagney - - * interp.c (engine_step): Replace SIGTRAP with SIM_SIGTRAP. - (engine_run_until_stop): Replace SIGINT with SIM_SIGINT. - - * sim-main.h: Include sim-signal.h. - (SIGTRAP): Delete definition. - - * interp.c, sim-calls.c: Do not include signal.h. - - * insns (illegal): SIGILL -> SIM_SIGILL. - (fp_unavailable): SIGFPE -> SIM_SIGFPE. - (do_trap): SIGTRAP -> SIM_SIGTRAP. - -Tue Nov 18 15:33:48 1997 Doug Evans - - * sim-main.h (CIA_ADDR): Define. - - * Makefile.in (SIM_OBJS): Use $(SIM_NEW_COMMON_OBJS). - -Fri Oct 17 17:26:36 1997 Andrew Cagney - - * alu.h (ALU32_END): Use ALU32_RESULT. - -Mon Sep 29 12:49:06 1997 Andrew Cagney - - * insns (get_fp_reg, set_fp_reg): Update to use changed sim_fpu - interface. - (do_fadd, do_fcmp, do_fdiv, do_fmpy, do_frnd, do_fsub): Ditto. - - * misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1, - tic80_trace_fpu2i) Update to use changed sim_fpu interface. - -Fri Oct 3 09:28:00 1997 Andrew Cagney - - * configure.in (SIM_AC_OPTIONS_BITSIZE): Define. - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Wed Sep 24 17:38:57 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Tue Sep 23 11:04:38 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Tue Sep 23 10:19:51 1997 Andrew Cagney - - * Makefile.in (SIM_WARNINGS, SIM_ALIGNMENT, SIM_ENDIAN, - SIM_HOSTENDIAN, SIM_INLINE, SIM_RESERVED_BITS): Delete, moved to - common. - (SIM_EXTRA_CFLAGS): Update. - -Mon Sep 22 11:46:20 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Fri Sep 19 17:45:25 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Tue Sep 16 23:10:03 1997 Felix Lee - - * sim-main.h (kill): macro was missing args. - (SIGTRAP): define for MSVC. - -Mon Sep 15 17:36:15 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Mon Sep 8 20:10:43 1997 Andrew Cagney - - * cpu.h (CPU_CIA): Define. - - * sim-main.h (struct sim_state): Delete halt_ok, path_to_halt, - restart_ok, path_to_restart members. - (struct sim_state): Delete reason, siggnal members. - -Thu Sep 4 17:21:23 1997 Doug Evans - - * configure: Regenerated to track ../common/aclocal.m4 changes. - -Thu Sep 4 17:45:14 1997 Andrew Cagney - - * sim-calls.c (sim_open): Add memory before parsing arguments. - (sim_read): Delete, replace with sim-hrw. - (sim_write): Delete, replace with sim-hrw. - -Thu Sep 4 10:48:57 1997 Andrew Cagney - - * sim-calls.c (sim_open): Use sim_do_command to add memory, only - add memory if none already present. - (sim_open): Move init of registers from here. - (sim_create_inferior): To here. Init modules. - - * Makefile.in (SIM_OBJS): Add sim-memopt.o module. - - * sim-calls.c (sim_open): Add zero modulo arg to sim_core_attach. - -Mon Sep 1 11:06:30 1997 Andrew Cagney - - * sim-calls.c (sim_open): Use sim_state_alloc - (simulation): Delete. - -Sat Aug 30 09:40:47 1997 Andrew Cagney - - * insns (do_trap): Unsigned `i' for unsigned iterator. - (do_trap): Ditto for comparison with getpid. - -Wed Aug 27 18:13:22 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - * config.in: Ditto. - -Wed Aug 27 13:41:24 1997 Andrew Cagney - - * insns (do_st): Use U8_4 instead of V4_L8. - - * sim-calls.c (sim_open): Add call to sim_analyze_program, update - call to sim_config. - - * sim-calls.c (sim_kill): Delete. - (sim_create_inferior): Add ABFD argument. Initialize PC from ABFD - and not SD. - (sim_load): Delete, use sim-hload.c. - - * Makefile.in (SIM_OBJS): Add sim-hload.o module. - -Mon Aug 25 17:50:22 1997 Andrew Cagney - - * configure: Regenerated to track ../common/aclocal.m4 changes. - * config.in: Ditto. - -Mon Aug 25 16:33:29 1997 Andrew Cagney - - * sim-calls.c (sim_open): Add ABFD argument. - (sim_open): Move sim_config call to just after argument - parsing. Check return status. - -Fri Aug 8 21:52:27 1997 Mark Alexander - - * sim-calls.c (sim_store_register): Allow accumulators - other than A0 to be modified. Correct error message. - -Thu May 29 14:02:40 1997 Andrew Cagney - - * misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1, - tic80_trace_fpu2i): Pass in function prefix. - (tic80_trace_ldst): Rewrite so it calls print_one_insn directly. - - * Makefile.in (SIM_OBJS): Include sim-watch.o module. - - * sim-main.h (WITH_WATCHPOINTS): Enable watchpoints. - - * ic (bitnum): Compute bitnum from BITNUM. - * insn (bbo, bbz): Use. - - * insn: Convert long immediate instructions to igen long immediate - form. - * insn: Add disasembler information. - -Thu May 29 12:09:13 1997 Andrew Cagney - - * alu.h (IMEM_IMMED): New macro, fetch 32bit immediate operand N. - - * insns (subu i): Immediate is signed not unsigned. - -Tue May 27 13:22:13 1997 Andrew Cagney - - * sim-calls.c (sim_read): Pass NULL cpu to sim_core_read_buffer. - (sim_write): Ditto for write. - -Tue May 20 09:33:31 1997 Andrew Cagney - - * sim-calls.c (sim_load): Set STATE_LOADED_P. - - * sim-main.h: Include . - - * sim-calls.c (sim_set_callback): Delete. - (sim_open): Add/install callback argument. - (sim_size): Delete. - -Mon May 19 18:59:33 1997 Mike Meissner - - * configure.in: Check for getpid, kill functions. - * config{.in,ure}: Regenerate. - - * insns (do_trap): Add support for kill, getpid system calls. - - * sim-main.h (errno.h): Include. - (getpid,kill): Define as NOPs if the host doesn't have them. - -Mon May 19 14:58:47 1997 Andrew Cagney - - * sim-calls.c (sim_open): Set the simulator base magic number. - (sim_load): Delete prototype of sim_load_file. - (sim_open): Define sd to be &simulation. - -Fri May 16 14:35:30 1997 Andrew Cagney - - * insns (illegal, fp_unavailable): Halt instead of abort the - simulator. - - * insns: Replace calls to engine_error with sim_engine_abort. - Ditto for engine_halt V sim_engine_halt. - -Tue May 13 15:24:12 1997 Andrew Cagney - - * interp.c (engine_run_until_stop): Delete. Moved to common. - (engine_step): Ditto. - (engine_step): Ditto. - (engine_halt): Ditto. - (engine_restart): Ditto. - (engine_halt): Ditto. - (engine_error): Ditto. - - * sim-calls.c (sim_stop): Delete. Moved to common. - (sim_stop_reason): Ditto. - (sim_resume): Ditto. - - * Makefile.in (SIM_OBJS): Link in generic sim-engine, sim-run, - sim-resume, sim-reason, sim-stop modules. - -Fri May 16 11:57:49 1997 Andrew Cagney - - * ic (compute): Drop check for REG == 0, now always forced to - zero. - - * cpu.h (GPR_SET): New macro update the gpr. - * insns (do_add): Use GPR_SET to update the GPR register. - - * sim-calls.c (sim_fetch_register): Pretend that r0 is zero. - - * Makefile.in (tmp-igen): Specify zero-r0 so that every - instruction clears r0. - - * interp.c (engine_run_until_stop): Igen now generates code to - clear r0. - (engine_step): Ditto. - -Thu May 15 11:45:37 1997 Andrew Cagney - - * insns (do_shift): When rot==0 and zero/sign merge treat it as - 32. - (set_fp_reg): For interger conversion, use sim-fpu fpu2i - functions. - (do_fmpy): Perform iii and uuu using integer arithmetic. - - * Makefile.in (ENGINE_H): Assume everything depends on the fpu. - - * insns (get_fp_reg): Use sim_fpu_u32to to perform unsigned - conversion. - (do_fcmp): Update to use new fp compare functions. Make reg nr arg - instead of reg. Stops fp overflow. - (get_fp_reg): Assume val is valid when reg == 0. - (set_fp_reg): Fix double conversion. - - * misc.c (tic80_trace_fpu1): New function, trace simple fp op. - - * insns (do_frnd): Add tracing. - - * cpu.h (TRACE_FPU1): Ditto. - - * insns (do_trap): Printf formatting. - -Wed May 14 18:05:50 1997 Mike Meissner - - * misc.c (tic80_trace_fpu{3,2,2i}): Align columns with other - insns. Use %g to print floating point instead of %f in case the - numbers are real large. - -Tue May 13 18:00:10 1997 Mike Meissner - - * insns (do_trap): For system calls that are defined, but not - provided return EINVAL. Temporarily add traps 74-79 to just print - the register state. - - * interp.c (engine_{run_until_stop,step}): Before executing - instructions, make sure r0 == 0. - -Tue May 13 16:39:37 1997 Andrew Cagney - - * alu.h (IMEM): Take full cia not just IP as argument. - - * interp.c (engine_run_until_stop): Delete handling of annuled - instructions. - (engine_step): Ditto. - - * insn (do_branch): New function. - (do_bbo, do_bbz, do_bcnd, do_bsr, do_jsr): Use do_branch to handle - annuled branches. - -Mon May 12 17:15:52 1997 Mike Meissner - - * insns (do_{ld,st}): Fix tracing for ld/st. - -Mon May 12 11:12:24 1997 Andrew Cagney - - * sim-calls.c (sim_stop_reason): Restore keep_running after a - CNTRL-C, don't re-clear it. - - * interp.c (engine_error): stop rather than signal with SIGABRT - when an error. - - * insns (do_ld): For 64bit loads, always store LSW in rDest, MSW in - rDest + 1. Also done by Michael Meissner - (do_st): Converse for store. - - * misc.c (tic80_trace_fpu2i): Correct printf format for int type. - -Sun May 11 11:02:57 1997 Andrew Cagney - - * sim-calls.c (sim_stop_reason): Return a SIGINT if keep_running - was cleared. - - * interp.c (engine_step): New function. Single step the simulator - taking care of cntrl-c during a step. - - * sim-calls.c (sim_resume): Differentiate between stepping and - running so that a cntrl-c during a step is reported. - -Sun May 11 10:54:31 1997 Mark Alexander - - * sim-calls.c (sim_fetch_register): Use correct reg base. - (sim_store_register): Ditto. - -Sun May 11 10:25:14 1997 Michael Meissner - - * cpu.h (tic80_trace_shift): Add declaration. - (TRACE_SHIFT): New macro to trace shift instructions. - - * misc.c (tic80_trace_alu2): Align spacing. - (tic80_trace_shift): New function to trace shifts. - - * insns (lmo): Add missing 0b prefix to bits. - (do_shift): Use ~ (unsigned32)0, instead of -1. Use TRACE_SHIFT - instead of TRACE_ALU2. - (sl r): Use EndMask as is, instead of using Source+1 register. - (subu): Operands are unsigned, not signed. - (do_{ld,st}): Fix endian problems with ld.d/st.d. - -Sat May 10 12:35:47 1997 Michael Meissner - - * insns (and{.tt,.tf,.ft,.ff}): Immediate values are unsigned, not - signed. - -Fri May 9 15:47:36 1997 Mike Meissner - - * insns (cmp_vals,do_cmp): Produce the correct bits as specified - by the architecture. - (xor): Fix xor immediate patterns to use the correct bits. - -Fri May 9 09:55:33 1997 Andrew Cagney - - * alu.h (long_immediate): Adjust the CIA delay-pointer as well as - the NIA when a 64bit insn. - -Thu May 8 11:57:47 1997 Michael Meissner - - * insns (jsr,bsr): For non-allulled calls, set r31 so that the - return address does not reexecute the instruction in the delay - slot. - (bbo,bbz): Complement bit number to reverse the one's complement - that the assembler is required to do. - - * misc.c (tic80_trace_*): Change format slightly to accomidate - real large decimal values. - -Thu May 8 14:07:16 1997 Andrew Cagney - - * sim-calls.c (sim_do_command): Implement. - (sim_store_register): Fix typo T2H v H2T. - -Wed May 7 11:48:55 1997 Andrew Cagney - - * cpu.h (TRACE_FPU2, TRACE_FPU3, TRACE_FPU2I): Add. - * insn: Clean up fpu tracing. - - * sim-calls.c (sim_create_inferior): Start out with interrupts - enabled. - - * cpu.h (TRACE_SINK3), misc.c (tic80_trace_sink3): Three argument - sink - - * insns (rdcr, swcr, wrcr, brcr, rmo, lmo): Implement. - - * insns (do_*): Remove MY_INDEX/indx argument from support functions, - igen now handles this. - - * cpu.h (CR): New macro - access TIc80 control registers. - - * misc.c: New file. - (tic80_cr2index): New function, map control register opcode index - into the internal CR enum. - - * interp.c - (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Move from - here - * misc.c: to here. - - * Makefile.in (SIM_OBJS): Add misc.o. - -Tue May 6 15:22:58 1997 Mike Meissner - - * cpu.h ({,v}{S,D}P_FPR): Delete unused macros that won't work on - big endian hosts. - (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Declare - new functions. - (TRACE_{ALU{2,3},NOP,SINK{1,2},{,U}COND_BR,LD,ST}): New macros to - trace various instruction types. - - * insns: Modify all instructions to support semantic tracing. - - * interp.c (toplevel): Include itable.h. - (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): New - functions to provide semantic level tracing information. - -Mon May 5 11:50:43 1997 Andrew Cagney - - * alu.h: Update usage of core object to reflect recent changes in - ../common/sim-*core. - * sim-calls.c (sim_open): Ditto. - -Mon May 5 14:10:17 1997 Andrew Cagney - - * insn (cmnd): No-op cache flushes. - - * insns (do_trap): Allow writes to STDERR. - - * Makefile.in (SIM_OBJS): Link in sim-fpu.o. - (SIM_EXTRA_LIBS): Link in the math library. - - * alu.h: Add support for floating point unit using sim-alu. - - * insns (fadd, fsub, fmpy, fdiv, fcmp, frnd*): Implement. - -Fri May 2 14:57:14 1997 Andrew Cagney - - * sim-calls.c: Include sim-utils.h and sim-options.h. - - * sim-main.h (sim_state): Drop sim_events and sim_core members, - moved to simulator base type. - - * alu.h (IMEM, MEM, STORE): Update track changes in common - directory. - - * insns: Drop cia argument from functions, igen now handles this. - - * interp.c (engine_init): Include string.h/strings.h to define - memset et.al. - - * sim-main.h (sim_cia): Delcare, tracking common dir changes. - - * cpu.h (sim_cpu): Update instruction_address with sim_cia. - -Wed Apr 30 11:26:56 1997 Andrew Cagney - - * sim-main.h (signal.h): Include so that SIG* available to all - callers of sig_halt. - - * insns (do_shift): New function, implement shift operations. - (do_trap): Add handler for trap 73 - SIGTRAP. - -Tue Apr 29 10:58:48 1997 Andrew Cagney - - * alu.h (MEM, STORE): Force addresses to be correctly aligned. - - * insns (do_jsr): Fix. - (do_st, do_ld): Handle 64bit transfers. - (do_trap): Match libgloss. - (rdcr): Implement nop - Dest == r0 - variant. - - * sim-calls.c (sim_create_inferior): Initialize SP. - - * Makefile.in (ENGINE_H): Everything now depends on sim-options.h. - (support.o): Depends on ENGINE_H. - - * cpu.h: Four accumulators. - - * Makefile.in (tmp-igen): Include line number information in - generated files. - - * insns (dld, dst): Fill in. - -Mon Apr 28 13:02:26 1997 Andrew Cagney - - * insns (vld): Fix instruction format wrong. - -Thu Apr 24 16:43:09 1997 Andrew Cagney - - * dc: Add additional rules so that minor opcode files are - detected. - * insns: Enable more instructions. - - * sim-calls.c (sim_fetch_register,sim_store_register, sim_write): - Implement. - -Thu Apr 24 00:39:51 1997 Doug Evans - - * configure: Regenerated to track ../common/aclocal.m4 changes. - * Makefile.in (SIM_OBJS): Add sim-module.o, sim-profile.o. - * sim-calls.c (sim_open): Call sim_module_uninstall if argument - parsing fails. Call sim_post_argv_init. - (sim_close): Call sim_module_uninstall. - -Wed Apr 23 20:05:33 1997 Andrew Cagney - - * insns (and, bbo, bcnd, bsr, dcache, jsr, or, xor, nor): Enable. - * ic: Add fields for enabled instructions. - diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in deleted file mode 100644 index 7111a618d47..00000000000 --- a/sim/tic80/Makefile.in +++ /dev/null @@ -1,140 +0,0 @@ -# Makefile for blah ... -# Copyright blah ... - - - -## COMMON_PRE_CONFIG_FRAG - -# These variables are given default values in COMMON_PRE_CONFIG_FRAG. -# We override the ones we need to here. -# Not all of these need to be mentioned, only the necessary ones. - -# List of object files, less common parts. -SIM_OBJS = \ - $(SIM_NEW_COMMON_OBJS) \ - support.o idecode.o semantics.o itable.o misc.o \ - sim-engine.o \ - sim-calls.o \ - sim-hload.o \ - sim-hrw.o \ - sim-reason.o \ - sim-resume.o \ - sim-run.o \ - sim-stop.o \ - -# List of extra dependencies. -# Generally this consists of simulator specific files included by sim-main.h. -SIM_EXTRA_DEPS = itable.h idecode.h cpu.h alu.h - -# List of extra libraries to link with -SIM_EXTRA_LIBS = -lm - -# List of generators -SIM_GEN=tmp-igen - -# List of flags to always pass to $(CC). - -SIM_EXTRA_CFLAGS = \ - -DWITH_TARGET_WORD_MSB=31 - -# List of main object files for `run'. -SIM_RUN_OBJS = nrun.o - -# Dependency of `clean' to clean any extra files. -SIM_EXTRA_CLEAN = clean-igen - - -## COMMON_POST_CONFIG_FRAG - -# Rules need to build $(SIM_OBJS), plus whatever else the target wants. - -# ... target specific rules ... - -BUILT_SRC_FROM_IGEN = \ - icache.h \ - icache.c \ - idecode.h \ - idecode.c \ - semantics.h \ - semantics.c \ - model.h \ - model.c \ - support.h \ - support.c \ - itable.h itable.c -$(BUILT_SRC_FROM_IGEN): tmp-igen -# - -.PHONY: clean-igen -clean-igen: - rm -f $(BUILT_SRC_FROM_IGEN) - rm -f tmp-igen tmp-insns - -../igen/igen: - cd ../igen && $(MAKE) - -tmp-igen: $(srcdir)/tic80.dc $(srcdir)/tic80.igen $(srcdir)/tic80.ic ../igen/igen - cd ../igen && $(MAKE) - ../igen/igen \ - -F f \ - -G direct-access \ - -G delayed-branch \ - -G zero-r0 \ - -F short,emul \ - -B 32 -H 31 \ - -o $(srcdir)/tic80.dc \ - -k $(srcdir)/tic80.ic \ - -i $(srcdir)/tic80.igen \ - -n icache.h -hc tmp-icache.h \ - -n icache.c -c tmp-icache.c \ - -n semantics.h -hs tmp-semantics.h \ - -n semantics.c -s tmp-semantics.c \ - -n idecode.h -hd tmp-idecode.h \ - -n idecode.c -d tmp-idecode.c \ - -n model.h -hm tmp-model.h \ - -n model.c -m tmp-model.c \ - -n support.h -hf tmp-support.h \ - -n support.c -f tmp-support.c \ - -n itable.h -ht tmp-itable.h \ - -n itable.c -t tmp-itable.c - $(srcdir)/../../move-if-change tmp-icache.h icache.h - $(srcdir)/../../move-if-change tmp-icache.c icache.c - $(srcdir)/../../move-if-change tmp-idecode.h idecode.h - $(srcdir)/../../move-if-change tmp-idecode.c idecode.c - $(srcdir)/../../move-if-change tmp-semantics.h semantics.h - $(srcdir)/../../move-if-change tmp-semantics.c semantics.c - $(srcdir)/../../move-if-change tmp-model.h model.h - $(srcdir)/../../move-if-change tmp-model.c model.c - $(srcdir)/../../move-if-change tmp-support.h support.h - $(srcdir)/../../move-if-change tmp-support.c support.c - $(srcdir)/../../move-if-change tmp-itable.h itable.h - $(srcdir)/../../move-if-change tmp-itable.c itable.c - touch tmp-igen - -ENGINE_H = \ - sim-main.h \ - $(srcdir)/../common/sim-basics.h \ - config.h \ - $(srcdir)/../common/sim-config.h \ - $(srcdir)/../common/sim-inline.h \ - $(srcdir)/../common/sim-types.h \ - $(srcdir)/../common/sim-bits.h \ - $(srcdir)/../common/sim-endian.h \ - $(srcdir)/../common/sim-options.h \ - itable.h \ - idecode.h \ - cpu.h \ - alu.h \ - $(srcdir)/../common/sim-alu.h \ - $(srcdir)/../common/sim-core.h \ - $(srcdir)/../common/sim-events.h \ - $(srcdir)/../common/sim-fpu.h \ - $(srcdir)/../common/sim-engine.h \ - -idecode.o: $(ENGINE_H) -semantics.o: $(ENGINE_H) -support.o: $(ENGINE_H) -interp.o: interp.c $(ENGINE_H) -sim-calls.o: sim-calls.c $(ENGINE_H) -cpu.o: cpu.c $(ENGINE_H) -misc.o: $(ENGINE_H) \ No newline at end of file diff --git a/sim/tic80/acconfig.h b/sim/tic80/acconfig.h deleted file mode 100644 index f9b87a10c60..00000000000 --- a/sim/tic80/acconfig.h +++ /dev/null @@ -1,15 +0,0 @@ - -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have catgets and don't want to use GNU gettext. */ -#undef HAVE_CATGETS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define as 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES diff --git a/sim/tic80/alu.h b/sim/tic80/alu.h deleted file mode 100644 index b5bc7c1af31..00000000000 --- a/sim/tic80/alu.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Texas Instruments TMS320C80 (MVP) Simulator. - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB, the GNU debugger. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - - -#ifndef _TIC80_ALU_H_ -#define _TIC80_ALU_H_ - -#define ALU_CARRY 0 /* FIXME */ - -#define ALU32_END(TARG) \ -{ \ - (TARG) = ALU32_RESULT; /* FIXME */ \ -} - -#define ALU_END(TARG) ALU32_END(TARG) - -#include "sim-alu.h" - - - -/* Bring data in from the cold */ - -#define IMEM32(CIA) \ -(sim_core_read_aligned_4(STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip)) - -#define IMEM32_IMMED(CIA, N) \ -(sim_core_read_aligned_4 (STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip + 4 * (N))) - -#define MEM(SIGN, EA, NR_BYTES) \ -((SIGN##_##NR_BYTES) sim_core_read_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \ - read_map, \ - (EA))) - -#define STORE(EA, NR_BYTES, VAL) \ -do { \ - sim_core_write_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \ - write_map, \ - (EA), (VAL)); \ -} while (0) - - -#define long_immediate(VARIABLE) \ - unsigned_word VARIABLE = MEM (unsigned, nia.ip, 4); \ - cia.dp += sizeof (instruction_word); \ - nia.ip += sizeof (instruction_word); \ - nia.dp += sizeof (instruction_word); - - - -/* Floating point support */ - -#define IS_FP_AVAILABLE ((CPU)->cr[IE_CR] & IE_CR_IE) - -#include "sim-fpu.h" - - -#endif diff --git a/sim/tic80/config.in b/sim/tic80/config.in deleted file mode 100644 index fffbc5935ef..00000000000 --- a/sim/tic80/config.in +++ /dev/null @@ -1,168 +0,0 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you have alloca, as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define if you have and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define as 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the __setfpucw function. */ -#undef HAVE___SETFPUCW - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the getpid function. */ -#undef HAVE_GETPID - -/* Define if you have the getrusage function. */ -#undef HAVE_GETRUSAGE - -/* Define if you have the kill function. */ -#undef HAVE_KILL - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the sigaction function. */ -#undef HAVE_SIGACTION - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the time function. */ -#undef HAVE_TIME - -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_FPU_CONTROL_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_VALUES_H diff --git a/sim/tic80/configure b/sim/tic80/configure deleted file mode 100755 index b681188344a..00000000000 --- a/sim/tic80/configure +++ /dev/null @@ -1,4459 +0,0 @@ -#! /bin/sh - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -sim_inline="-DDEFAULT_INLINE=0" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# This file is derived from `gettext.m4'. The difference is that the -# included macros assume Cygnus-style source and build trees. - -# Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. -# -# This file file be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 3 - - - - - -# Search path for a program which passes the given test. -# Ulrich Drepper , 1996. -# -# This file file be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 1 - - - -# Check whether LC_MESSAGES is available in . -# Ulrich Drepper , 1995. -# -# This file file be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 1 - - - - - - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --disable-nls do not use Native Language Support" -ac_help="$ac_help - --with-included-gettext use the GNU gettext library included here" -ac_help="$ac_help - --enable-maintainer-mode Enable developer functionality." -ac_help="$ac_help - --enable-sim-bswap Use Host specific BSWAP instruction." -ac_help="$ac_help - --enable-sim-cflags=opts Extra CFLAGS for use in building simulator" -ac_help="$ac_help - --enable-sim-debug=opts Enable debugging flags" -ac_help="$ac_help - --enable-sim-stdio Specify whether to use stdio for console input/output." -ac_help="$ac_help - --enable-sim-trace=opts Enable tracing flags" -ac_help="$ac_help - --enable-sim-profile=opts Enable profiling flags" -ac_help="$ac_help - --enable-sim-inline=inlines Specify which functions should be inlined." -ac_help="$ac_help - --enable-sim-endian=endian Specify target byte endian orientation." -ac_help="$ac_help - --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses." -ac_help="$ac_help - --enable-sim-hostendian=end Specify host byte endian orientation." -ac_help="$ac_help - --enable-build-warnings[=LIST] Enable build-time compiler warnings" -ac_help="$ac_help - --enable-sim-reserved-bits Specify whether to check reserved bits in instruction." -ac_help="$ac_help - --enable-sim-bitsize=N Specify target bitsize (32 or 64)." - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -sitefile= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --site-file=FILE use FILE as the site file - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -site-file | --site-file | --site-fil | --site-fi | --site-f) - ac_prev=sitefile ;; - -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) - sitefile="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=Makefile.in - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$sitefile"; then - if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi - fi -else - CONFIG_SITE="$sitefile" -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:693: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:773: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:800: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi -else - echo "$ac_t""no" 1>&6 - ISC= -fi - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:821: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#include -#include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:925: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1000: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_inline=$ac_kw; break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done - -fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in - inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <&6 -echo "configure:1040: checking for off_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_off_t=yes -else - rm -rf conftest* - ac_cv_type_off_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_off_t" 1>&6 -if test $ac_cv_type_off_t = no; then - cat >> confdefs.h <<\EOF -#define off_t long -EOF - -fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1073: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_size_t=yes -else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF -#define size_t unsigned -EOF - -fi - -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1108: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:1120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA_H 1 -EOF - -fi - -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1141: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:1174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_func_alloca_works=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 -if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA 1 -EOF - -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1206: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_os_cray=yes -else - rm -rf conftest* - ac_cv_os_cray=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 -if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1236: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <&6 -fi - -done -fi - -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1291: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_stack_direction=0 -else - cat > conftest.$ac_ext < addr) ? 1 : -1; -} -main () -{ - exit (find_stack_direction() < 0); -} -EOF -if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_stack_direction=1 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <&6 -echo "configure:1343: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1382: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1435: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat > conftest.$ac_ext < -#include -#include - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif - -/* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - -int -main() -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); -} - -EOF -if { (eval echo configure:1583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_MMAP 1 -EOF - -fi - -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:1606: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1639: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes - -# autoconf.info says this should be called right after AC_INIT. - - -ac_aux_dir= -for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1718: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1739: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1757: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1801: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1831: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1882: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1914: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1925 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1956: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1961: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1989: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2032: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -# Put a plausible default for CC_FOR_BUILD in Makefile. -if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' -else - CC_FOR_BUILD=gcc -fi - - - - -AR=${AR-ar} - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2100: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -ALL_LINGUAS= - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h values.h sys/param.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2135: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - - for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ -__argz_count __argz_stringify __argz_next -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2175: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - if test "${ac_cv_func_stpcpy+set}" != "set"; then - for ac_func in stpcpy -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2232: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_STPCPY 1 -EOF - - fi - - if test $ac_cv_header_locale_h = yes; then - echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2294: checking for LC_MESSAGES" >&5 -if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -return LC_MESSAGES -; return 0; } -EOF -if { (eval echo configure:2306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - am_cv_val_LC_MESSAGES=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - am_cv_val_LC_MESSAGES=no -fi -rm -f conftest* -fi - -echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 - if test $am_cv_val_LC_MESSAGES = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_LC_MESSAGES 1 -EOF - - fi - fi - echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2327: checking whether NLS is requested" >&5 - # Check whether --enable-nls or --disable-nls was given. -if test "${enable_nls+set}" = set; then - enableval="$enable_nls" - USE_NLS=$enableval -else - USE_NLS=yes -fi - - echo "$ac_t""$USE_NLS" 1>&6 - - - USE_INCLUDED_LIBINTL=no - - if test "$USE_NLS" = "yes"; then - cat >> confdefs.h <<\EOF -#define ENABLE_NLS 1 -EOF - - echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2347: checking whether included gettext is requested" >&5 - # Check whether --with-included-gettext or --without-included-gettext was given. -if test "${with_included_gettext+set}" = set; then - withval="$with_included_gettext" - nls_cv_force_use_gnu_gettext=$withval -else - nls_cv_force_use_gnu_gettext=no -fi - - echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - nls_cv_header_intl= - nls_cv_header_libgt= - CATOBJEXT=NONE - - ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2366: checking for libintl.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:2393: checking for gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -return (int) gettext ("") -; return 0; } -EOF -if { (eval echo configure:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gettext_libc=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libc=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 - - if test "$gt_cv_func_gettext_libc" != "yes"; then - echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:2421: checking for bindtextdomain in -lintl" >&5 -ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lintl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:2456: checking for gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - gt_cv_func_gettext_libintl=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gt_cv_func_gettext_libintl=no -fi -rm -f conftest* -fi - -echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - fi - - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_GETTEXT 1 -EOF - - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2496: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - if test "$MSGFMT" != "no"; then - for ac_func in dcgettext -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2530: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2585: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2621: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - CATOBJEXT=.gmo - DATADIRNAME=share -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CATOBJEXT=.mo - DATADIRNAME=lib -fi -rm -f conftest* - INSTOBJEXT=.mo - fi - fi - -else - echo "$ac_t""no" 1>&6 -fi - - - - if test "$CATOBJEXT" = "NONE"; then - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - INTLOBJS="\$(GETTOBJS)" - # Extract the first word of "msgfmt", so it can be a program name with args. -set dummy msgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2693: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$MSGFMT" in - /*) - ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" - ;; -esac -fi -MSGFMT="$ac_cv_path_MSGFMT" -if test -n "$MSGFMT"; then - echo "$ac_t""$MSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "gmsgfmt", so it can be a program name with args. -set dummy gmsgfmt; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2727: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Extract the first word of "xgettext", so it can be a program name with args. -set dummy xgettext; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2763: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/../intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=libintl.h - nls_cv_header_libgt=libgettext.h - fi - - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6 - XGETTEXT=":" - fi - fi - - # We need to process the po/ directory. - POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=libintl.h - nls_cv_header_libgt=libgettext.h - fi - - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. - if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes - fi - - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - - - - - - - - - - - - - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:2853: checking for catalogs to be installed" >&5 - NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac - done - LINGUAS=$NEW_LINGUAS - echo "$ac_t""$LINGUAS" 1>&6 - fi - - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include " - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header . Take care yourself. */" - fi - - - if test -f $srcdir/po2tbl.sed.in; then - if test "$CATOBJEXT" = ".cat"; then - ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:2881: checking for linux/version.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - msgformat=linux -else - echo "$ac_t""no" 1>&6 -msgformat=xopen -fi - - - sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed - fi - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/po2tbl.sed.in > po2tbl.sed - fi - - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - - - - MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" - - - l= - - - if test -d $srcdir/po; then - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES - fi - - -# Check for common headers. -# FIXME: Seems to me this can cause problems for i386-windows hosts. -# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*. -for ac_hdr in stdlib.h string.h strings.h unistd.h time.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2960: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_hdr in sys/time.h sys/resource.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3000: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_hdr in fcntl.h fpu_control.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3040: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3050: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_hdr in dlfcn.h errno.h sys/stat.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3080: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in getrusage time sigaction __setfpucw -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3119: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - -# Check for socket libraries -echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6 -echo "configure:3174: checking for bind in -lsocket" >&5 -ac_lib_var=`echo socket'_'bind | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lsocket $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - -echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3221: checking for gethostbyname in -lnsl" >&5 -ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lnsl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - - -. ${srcdir}/../../bfd/configure.host - - - -USE_MAINTAINER_MODE=no -# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - case "${enableval}" in - yes) MAINT="" USE_MAINTAINER_MODE=yes ;; - no) MAINT="#" ;; - *) { echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;; -esac -if test x"$silent" != x"yes" && test x"$MAINT" = x""; then - echo "Setting maintainer mode" 6>&1 -fi -else - MAINT="#" -fi - - - -# Check whether --enable-sim-bswap or --disable-sim-bswap was given. -if test "${enable_sim_bswap+set}" = set; then - enableval="$enable_sim_bswap" - case "${enableval}" in - yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";; - no) sim_bswap="-DWITH_BSWAP=0";; - *) { echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";; -esac -if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then - echo "Setting bswap flags = $sim_bswap" 6>&1 -fi -else - sim_bswap="" -fi - - - -# Check whether --enable-sim-cflags or --disable-sim-cflags was given. -if test "${enable_sim_cflags+set}" = set; then - enableval="$enable_sim_cflags" - case "${enableval}" in - yes) sim_cflags="-O2 -fomit-frame-pointer";; - trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";; - no) sim_cflags="";; - *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then - echo "Setting sim cflags = $sim_cflags" 6>&1 -fi -else - sim_cflags="" -fi - - - -# Check whether --enable-sim-debug or --disable-sim-debug was given. -if test "${enable_sim_debug+set}" = set; then - enableval="$enable_sim_debug" - case "${enableval}" in - yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";; - no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";; - *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";; -esac -if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then - echo "Setting sim debug = $sim_debug" 6>&1 -fi -else - sim_debug="" -fi - - - -# Check whether --enable-sim-stdio or --disable-sim-stdio was given. -if test "${enable_sim_stdio+set}" = set; then - enableval="$enable_sim_stdio" - case "${enableval}" in - yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";; - no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";; - *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";; -esac -if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then - echo "Setting stdio flags = $sim_stdio" 6>&1 -fi -else - sim_stdio="" -fi - - - -# Check whether --enable-sim-trace or --disable-sim-trace was given. -if test "${enable_sim_trace+set}" = set; then - enableval="$enable_sim_trace" - case "${enableval}" in - yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; - no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; - [-0-9]*) - sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; - [a-z]*) - sim_trace="" - for x in `echo "$enableval" | sed -e "s/,/ /g"`; do - if test x"$sim_trace" = x; then - sim_trace="-DWITH_TRACE='(TRACE_$x" - else - sim_trace="${sim_trace}|TRACE_$x" - fi - done - sim_trace="$sim_trace)'" ;; -esac -if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then - echo "Setting sim trace = $sim_trace" 6>&1 -fi -else - sim_trace="" -fi - - - -# Check whether --enable-sim-profile or --disable-sim-profile was given. -if test "${enable_sim_profile+set}" = set; then - enableval="$enable_sim_profile" - case "${enableval}" in - yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";; - no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";; - [-0-9]*) - sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";; - [a-z]*) - sim_profile="" - for x in `echo "$enableval" | sed -e "s/,/ /g"`; do - if test x"$sim_profile" = x; then - sim_profile="-DWITH_PROFILE='(PROFILE_$x" - else - sim_profile="${sim_profile}|PROFILE_$x" - fi - done - sim_profile="$sim_profile)'" ;; -esac -if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then - echo "Setting sim profile = $sim_profile" 6>&1 -fi -else - sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1" -fi - - - -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3416: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -#include -#ifdef signal -#undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif - -int main() { -int i; -; return 0; } -EOF -if { (eval echo configure:3438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_type_signal=void -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_signal=int -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <&6 -echo "configure:3460: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - - -sim_link_files= -sim_link_links= - -sim_link_links=tconfig.h -if test -f ${srcdir}/tconfig.in -then - sim_link_files=tconfig.in -else - sim_link_files=../common/tconfig.in -fi - -# targ-vals.def points to the libc macro description file. -case "${target}" in -*-*-*) TARG_VALS_DEF=../common/nltvals.def ;; -esac -sim_link_files="${sim_link_files} ${TARG_VALS_DEF}" -sim_link_links="${sim_link_links} targ-vals.def" - - - - -default_sim_inline="-DDEFAULT_INLINE=0" -# Check whether --enable-sim-inline or --disable-sim-inline was given. -if test "${enable_sim_inline+set}" = set; then - enableval="$enable_sim_inline" - sim_inline="" -case "$enableval" in - no) sim_inline="-DDEFAULT_INLINE=0";; - 0) sim_inline="-DDEFAULT_INLINE=0";; - yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";; - 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";; - *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do - new_flag="" - case "$x" in - *_INLINE=*) new_flag="-D$x";; - *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; - *_INLINE) new_flag="-D$x=ALL_C_INLINE";; - *) new_flag="-D$x""_INLINE=ALL_C_INLINE";; - esac - if test x"$sim_inline" = x""; then - sim_inline="$new_flag" - else - sim_inline="$sim_inline $new_flag" - fi - done;; -esac -if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then - echo "Setting inline flags = $sim_inline" 6>&1 -fi -else - -if test "x$cross_compiling" = "xno"; then - if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then - sim_inline="${default_sim_inline}" - if test x"$silent" != x"yes"; then - echo "Setting inline flags = $sim_inline" 6>&1 - fi - else - sim_inline="" - fi -else - sim_inline="-DDEFAULT_INLINE=0" -fi -fi - - -wire_endian="LITTLE_ENDIAN" -default_endian="" -# Check whether --enable-sim-endian or --disable-sim-endian was given. -if test "${enable_sim_endian+set}" = set; then - enableval="$enable_sim_endian" - case "${enableval}" in - b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";; - l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";; - yes) if test x"$wire_endian" != x; then - sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" - else - if test x"$default_endian" != x; then - sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}" - else - echo "No hard-wired endian for target $target" 1>&6 - sim_endian="-DWITH_TARGET_BYTE_ORDER=0" - fi - fi;; - no) if test x"$default_endian" != x; then - sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" - else - if test x"$wire_endian" != x; then - sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}" - else - echo "No default endian for target $target" 1>&6 - sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0" - fi - fi;; - *) { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";; -esac -if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then - echo "Setting endian flags = $sim_endian" 6>&1 -fi -else - if test x"$default_endian" != x; then - sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" -else - if test x"$wire_endian" != x; then - sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" - else - sim_endian= - fi -fi -fi - -wire_alignment="FORCED_ALIGNMENT" -default_alignment="" - -# Check whether --enable-sim-alignment or --disable-sim-alignment was given. -if test "${enable_sim_alignment+set}" = set; then - enableval="$enable_sim_alignment" - case "${enableval}" in - strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; - nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; - forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";; - yes) if test x"$wire_alignment" != x; then - sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" - else - if test x"$default_alignment" != x; then - sim_alignment="-DWITH_ALIGNMENT=${default_alignment}" - else - echo "No hard-wired alignment for target $target" 1>&6 - sim_alignment="-DWITH_ALIGNMENT=0" - fi - fi;; - no) if test x"$default_alignment" != x; then - sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" - else - if test x"$wire_alignment" != x; then - sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}" - else - echo "No default alignment for target $target" 1>&6 - sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0" - fi - fi;; - *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-alignment"" 1>&2; exit 1; }; sim_alignment="";; -esac -if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then - echo "Setting alignment flags = $sim_alignment" 6>&1 -fi -else - if test x"$default_alignment" != x; then - sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" -else - if test x"$wire_alignment" != x; then - sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" - else - sim_alignment= - fi -fi -fi - - -# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given. -if test "${enable_sim_hostendian+set}" = set; then - enableval="$enable_sim_hostendian" - case "${enableval}" in - no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";; - b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";; - l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";; - *) { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";; -esac -if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then - echo "Setting hostendian flags = $sim_hostendian" 6>&1 -fi -else - -if test "x$cross_compiling" = "xno"; then - echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3666: checking whether byte ordering is bigendian" >&5 -if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_c_bigendian=unknown -# See if sys/param.h defines the BYTE_ORDER macro. -cat > conftest.$ac_ext < -#include -int main() { - -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif -; return 0; } -EOF -if { (eval echo configure:3684: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - # It does; now see whether it defined to BIG_ENDIAN or not. -cat > conftest.$ac_ext < -#include -int main() { - -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif -; return 0; } -EOF -if { (eval echo configure:3699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_bigendian=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_bigendian=no -fi -rm -f conftest* -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -if test $ac_cv_c_bigendian = unknown; then -if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_bigendian=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_bigendian=yes -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_c_bigendian" 1>&6 -if test $ac_cv_c_bigendian = yes; then - cat >> confdefs.h <<\EOF -#define WORDS_BIGENDIAN 1 -EOF - -fi - - if test $ac_cv_c_bigendian = yes; then - sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN" - else - sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN" - fi -else - sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" -fi -fi - - -# Check whether --enable-build-warnings or --disable-build-warnings was given. -if test "${enable_build_warnings+set}" = set; then - enableval="$enable_build_warnings" - build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" -case "${enableval}" in - yes) ;; - no) build_warnings="-w";; - ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${build_warnings} ${t}";; - *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - build_warnings="${t} ${build_warnings}";; - *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac -if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then - echo "Setting warning flags = $build_warnings" 6>&1 -fi -WARN_CFLAGS="" -WERROR_CFLAGS="" -if test "x${build_warnings}" != x -a "x$GCC" = xyes -then - # Separate out the -Werror flag as some files just cannot be - # compiled with it enabled. - for w in ${build_warnings}; do - case $w in - -Werr*) WERROR_CFLAGS=-Werror ;; - *) WARN_CFLAGS="${WARN_CFLAGS} $w" - esac - done -fi -else - build_warnings="" -fi - - -default_sim_reserved_bits="1" -# Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given. -if test "${enable_sim_reserved_bits+set}" = set; then - enableval="$enable_sim_reserved_bits" - case "${enableval}" in - yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";; - no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";; - *) { echo "configure: error: "--enable-sim-reserved-bits does not take a value"" 1>&2; exit 1; }; sim_reserved_bits="";; -esac -if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then - echo "Setting reserved flags = $sim_reserved_bits" 6>&1 -fi -else - sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}" -fi - -wire_word_bitsize="32" -wire_word_msb="31" -wire_address_bitsize="" -wire_cell_bitsize="" -# Check whether --enable-sim-bitsize or --disable-sim-bitsize was given. -if test "${enable_sim_bitsize+set}" = set; then - enableval="$enable_sim_bitsize" - sim_bitsize= -case "${enableval}" in - 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";; - 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";; - 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; - 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; - 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then - sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31" - else - sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0" - fi ;; - 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then - sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63" - else - sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0" - fi ;; - *) { echo "configure: error: "--enable-sim-bitsize was given $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;; -esac -# address bitsize -tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9]*,*//"` -case x"${tmp}" in - x ) ;; - x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;; - x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;; - * ) { echo "configure: error: "--enable-sim-bitsize was given address size $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;; -esac -# cell bitsize -tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9*]*,*[0-9]*,*//"` -case x"${tmp}" in - x ) ;; - x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;; - x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;; - * ) { echo "configure: error: "--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;; -esac -if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then - echo "Setting bitsize flags = $sim_bitsize" 6>&1 -fi -else - sim_bitsize="" -if test x"$wire_word_bitsize" != x; then - sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize" -fi -if test x"$wire_word_msb" != x; then - sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb" -fi -if test x"$wire_address_bitsize" != x; then - sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize" -fi -if test x"$wire_cell_bitsize" != x; then - sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize" -fi -fi - - -for ac_hdr in stdlib.h unistd.h string.h strings.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3881: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 -fi -done - -for ac_func in getpid kill -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3920: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -DEFS=-DHAVE_CONFIG_H - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@sim_environment@%$sim_environment%g -s%@sim_alignment@%$sim_alignment%g -s%@sim_assert@%$sim_assert%g -s%@sim_bitsize@%$sim_bitsize%g -s%@sim_endian@%$sim_endian%g -s%@sim_hostendian@%$sim_hostendian%g -s%@sim_float@%$sim_float%g -s%@sim_scache@%$sim_scache%g -s%@sim_default_model@%$sim_default_model%g -s%@sim_hw_cflags@%$sim_hw_cflags%g -s%@sim_hw_objs@%$sim_hw_objs%g -s%@sim_hw@%$sim_hw%g -s%@sim_inline@%$sim_inline%g -s%@sim_packages@%$sim_packages%g -s%@sim_regparm@%$sim_regparm%g -s%@sim_reserved_bits@%$sim_reserved_bits%g -s%@sim_smp@%$sim_smp%g -s%@sim_stdcall@%$sim_stdcall%g -s%@sim_xor_endian@%$sim_xor_endian%g -s%@WARN_CFLAGS@%$WARN_CFLAGS%g -s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@CC@%$CC%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g -s%@HDEFINES@%$HDEFINES%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CPP@%$CPP%g -s%@ALLOCA@%$ALLOCA%g -s%@USE_NLS@%$USE_NLS%g -s%@MSGFMT@%$MSGFMT%g -s%@GMSGFMT@%$GMSGFMT%g -s%@XGETTEXT@%$XGETTEXT%g -s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g -s%@CATALOGS@%$CATALOGS%g -s%@CATOBJEXT@%$CATOBJEXT%g -s%@DATADIRNAME@%$DATADIRNAME%g -s%@GMOFILES@%$GMOFILES%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@INTLDEPS@%$INTLDEPS%g -s%@INTLLIBS@%$INTLLIBS%g -s%@INTLOBJS@%$INTLOBJS%g -s%@POFILES@%$POFILES%g -s%@POSUB@%$POSUB%g -s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g -s%@GT_NO@%$GT_NO%g -s%@GT_YES@%$GT_YES%g -s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@l@%$l%g -s%@MAINT@%$MAINT%g -s%@sim_bswap@%$sim_bswap%g -s%@sim_cflags@%$sim_cflags%g -s%@sim_debug@%$sim_debug%g -s%@sim_stdio@%$sim_stdio%g -s%@sim_trace@%$sim_trace%g -s%@sim_profile@%$sim_profile%g -s%@EXEEXT@%$EXEEXT%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' -ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $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 <> $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 <> $CONFIG_STATUS <<\EOF -srcdir=$ac_given_srcdir -while test -n "$ac_sources"; do - set $ac_dests; ac_dest=$1; shift; ac_dests=$* - set $ac_sources; ac_source=$1; shift; ac_sources=$* - - echo "linking $srcdir/$ac_source to $ac_dest" - - if test ! -r $srcdir/$ac_source; then - { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } - fi - rm -f $ac_dest - - # Make relative symlinks. - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` - if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - # The dest file is in a subdirectory. - test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" - ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dest_dir_suffix. - ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dest_dir_suffix= ac_dots= - fi - - case "$srcdir" in - [/$]*) ac_rel_source="$srcdir/$ac_source" ;; - *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; - esac - - # Make a symlink if possible; otherwise try a hard link. - if ln -s $ac_rel_source $ac_dest 2>/dev/null || - ln $srcdir/$ac_source $ac_dest; then : - else - { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } - fi -done -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -case "x$CONFIG_FILES" in - xMakefile*) - echo "Merging Makefile.sim+Make-common.sim into Makefile ..." - rm -f Makesim1.tmp Makesim2.tmp Makefile - sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' Makesim1.tmp - sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' Makesim2.tmp - sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \ - -e '/^## COMMON_POST_/ r Makesim2.tmp' \ - Makefile - rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp - ;; - esac - case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - - diff --git a/sim/tic80/configure.in b/sim/tic80/configure.in deleted file mode 100644 index 730b62e6cfd..00000000000 --- a/sim/tic80/configure.in +++ /dev/null @@ -1,21 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -sinclude(../common/aclocal.m4) -AC_PREREQ(2.5)dnl -AC_INIT(Makefile.in) - -SIM_AC_COMMON - -dnl Options available in this module -SIM_AC_OPTION_INLINE(0) -SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN) -SIM_AC_OPTION_ALIGNMENT(FORCED_ALIGNMENT) -SIM_AC_OPTION_HOSTENDIAN -SIM_AC_OPTION_WARNINGS -SIM_AC_OPTION_RESERVED_BITS(1) -SIM_AC_OPTION_BITSIZE(32,31) - -dnl For UNIX emulation -AC_CHECK_HEADERS(stdlib.h unistd.h string.h strings.h) -AC_CHECK_FUNCS(getpid kill) - -SIM_AC_OUTPUT diff --git a/sim/tic80/cpu.h b/sim/tic80/cpu.h deleted file mode 100644 index 642c18103db..00000000000 --- a/sim/tic80/cpu.h +++ /dev/null @@ -1,345 +0,0 @@ -/* TIc80 Simulator. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB, the GNU debugger. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - - -/* TI C80 control registers */ - -typedef enum { - EPC_CR, - EIP_CR, - CONFIG_CR, - INTPEN_CR, - IE_CR, - FPST_CR, - PPERROR_CR, - PKTREQ_CR, - TCOUNT_CR, - TSCALE_CR, - FLTOP_CR, - FLTADR_CR, - FLTTAG_CR, - FLTDLT_CR, - FLTDTH_CR, - FLT005_CR, - FLT006_CR, - FLT007_CR, - FLT008_CR, - FLT009_CR, - FLT010_CR, - FLT011_CR, - FLT012_CR, - FLT013_CR, - FLT014_CR, - FLT015_CR, - SYSSTK_CR, - SYSTMP_CR, - MPC_CR, - MIP_CR, - ECOMCNTL_CR, - ANASTAT_CR, - BRK1_CR, - BRK2_CR, - ITAG0_CR, - ITAG1_CR, - ITAG2_CR, - ITAG3_CR, - ITAG4_CR, - ITAG5_CR, - ITAG6_CR, - ITAG7_CR, - ITAG8_CR, - ITAG9_CR, - ITAG10_CR, - ITAG11_CR, - ITAG12_CR, - ITAG13_CR, - ITAG14_CR, - ITAG15_CR, - ILRU_CR, - DTAG0_CR, - DTAG1_CR, - DTAG2_CR, - DTAG3_CR, - DTAG4_CR, - DTAG5_CR, - DTAG6_CR, - DTAG7_CR, - DTAG8_CR, - DTAG9_CR, - DTAG10_CR, - DTAG11_CR, - DTAG12_CR, - DTAG13_CR, - DTAG14_CR, - DTAG15_CR, - DLRU_CR, - IN0P_CR, - IN1P_CR, - OUTP_CR, - SCRATCH_CR, - nr_tic80_control_regs, -} tic80_control_regs; - -/* extern int tic80_cr2index (tic80_control_regs reg); */ - -/* Map an instruction CR index onto the corresponding internal cr enum - or SCRATCH_CR if the index is invalid */ - -extern tic80_control_regs tic80_index2cr (int index); - - -/* TIc80 interrupt register bits */ - -enum { - IE_CR_PE = BIT32(31), - IE_CR_X4 = BIT32(30), - IE_CR_X3 = BIT32(29), - IE_CR_BP = BIT32(28), - IE_CR_PB = BIT32(27), - IE_CR_PC = BIT32(26), - IE_CR_MI = BIT32(25), - /**/ - IE_CR_P3 = BIT32(19), - IE_CR_P2 = BIT32(18), - IE_CR_P1 = BIT32(17), - IE_CR_P0 = BIT32(16), - IE_CR_IO = BIT32(15), - IE_CR_MF = BIT32(14), - /**/ - IE_CR_X2 = BIT32(12), - IE_CR_X1 = BIT32(11), - IE_CR_TI = BIT32(10), - IE_CR_F1 = BIT32(9), - IE_CR_F0 = BIT32(8), - IE_CR_FX = BIT32(7), - IE_CR_FU = BIT32(6), - IE_CR_FO = BIT32(5), - /**/ - IE_CR_FZ = BIT32(3), - IE_CR_FI = BIT32(2), - /**/ - IE_CR_IE = BIT32(0), -}; - - - - -struct _sim_cpu { - unsigned32 reg[32]; - unsigned64 acc[4]; - unsigned32 cr[nr_tic80_control_regs]; - int is_user_mode; /* hidden mode latch */ - sim_cia cia; - sim_cpu_base base; -}; - -#define CIA_GET(CPU) ((CPU)->cia) -#define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL)) - -#define GPR(N) ((CPU)->reg[N]) -#define GPR_CLEAR(N) (GPR((N)) = 0) -#define ACC(N) ((CPU)->acc[N]) -#define CR(N) ((CPU)->cr[tic80_index2cr ((N))]) - - - -#if defined(WITH_TRACE) -extern char *tic80_trace_alu3 PARAMS ((int, unsigned32, unsigned32, unsigned32)); -extern char *tic80_trace_cmp PARAMS ((int, unsigned32, unsigned32, unsigned32)); -extern char *tic80_trace_alu2 PARAMS ((int, unsigned32, unsigned32)); -extern char *tic80_trace_shift PARAMS ((int, unsigned32, unsigned32, int, int, int, int, int)); -extern void tic80_trace_fpu3 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *, sim_fpu *)); -extern void tic80_trace_fpu2 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *)); -extern void tic80_trace_fpu1 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *)); -extern void tic80_trace_fpu2i PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *)); -extern void tic80_trace_fpu2cmp PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *)); -extern char *tic80_trace_nop PARAMS ((int)); -extern char *tic80_trace_sink1 PARAMS ((int, unsigned32)); -extern char *tic80_trace_sink2 PARAMS ((int, unsigned32, unsigned32)); -extern char *tic80_trace_sink3 PARAMS ((int, unsigned32, unsigned32, unsigned32)); -extern char *tic80_trace_cond_br PARAMS ((int, int, unsigned32, unsigned32, int, int)); -extern char *tic80_trace_ucond_br PARAMS ((int, unsigned32)); -extern void tic80_trace_ldst PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, int, int, int, unsigned32, unsigned32, unsigned32)); - -#define TRACE_ALU3(indx, result, input1, input2) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "alu", \ - tic80_trace_alu3 (indx, result, input1, input2)); \ - } \ -} while (0) - -#define TRACE_CMP(indx, result, input1, input2) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "alu", \ - tic80_trace_cmp (indx, result, input1, input2)); \ - } \ -} while (0) - -#define TRACE_ALU2(indx, result, input) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "alu", \ - tic80_trace_alu2 (indx, result, input)); \ - } \ -} while (0) - -#define TRACE_SHIFT(indx, result, input, i, n, merge, endmask, rotate) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "shift", \ - tic80_trace_shift (indx, result, input, i, n, \ - merge, endmask, rotate)); \ - } \ -} while (0) - -#define TRACE_FPU3(result, input1, input2) \ -do { \ - if (TRACE_FPU_P (CPU)) { \ - tic80_trace_fpu3 (SD, CPU, cia, MY_INDEX, \ - &result, &input1, &input2); \ - } \ -} while (0) - -#define TRACE_FPU2(result, input) \ -do { \ - if (TRACE_FPU_P (CPU)) { \ - tic80_trace_fpu2 (SD, CPU, cia, MY_INDEX, \ - &result, &input); \ - } \ -} while (0) - -#define TRACE_FPU1(result) \ -do { \ - if (TRACE_FPU_P (CPU)) { \ - tic80_trace_fpu1 (SD, CPU, cia, MY_INDEX, \ - &result); \ - } \ -} while (0) - -#define TRACE_FPU2I(result, input1, input2) \ -do { \ - if (TRACE_FPU_P (CPU)) { \ - tic80_trace_fpu2i (SD, CPU, cia, MY_INDEX, \ - result, &input1, &input2); \ - } \ -} while (0) - -#define TRACE_FPU2CMP(result, input1, input2) \ -do { \ - if (TRACE_FPU_P (CPU)) { \ - tic80_trace_fpu2cmp (SD, CPU, cia, MY_INDEX, \ - result, &input1, &input2); \ - } \ -} while (0) - -#define TRACE_NOP(indx) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "nop", \ - tic80_trace_nop (indx)); \ - } \ -} while (0) - -#define TRACE_SINK1(indx, input) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "nop", \ - tic80_trace_sink1 (indx, input)); \ - } \ -} while (0) - -#define TRACE_SINK2(indx, input1, input2) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "nop", \ - tic80_trace_sink2 (indx, input1, input2)); \ - } \ -} while (0) - -#define TRACE_SINK3(indx, input1, input2, input3) \ -do { \ - if (TRACE_ALU_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "nop", \ - tic80_trace_sink3 (indx, input1, input2, input3)); \ - } \ -} while (0) - -#define TRACE_COND_BR(indx, jump_p, cond, target, size, code) \ -do { \ - if (TRACE_BRANCH_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "branch", \ - tic80_trace_cond_br (indx, jump_p, cond, target, \ - size, code)); \ - } \ -} while (0) - -#define TRACE_UCOND_BR(indx, target) \ -do { \ - if (TRACE_BRANCH_P (CPU)) { \ - trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ - itable[indx].line_nr, "branch", \ - tic80_trace_ucond_br (indx, target)); \ - } \ -} while (0) - -#define TRACE_LD(result, m, s, addr1, addr2) \ -do { \ - if (TRACE_MEMORY_P (CPU)) { \ - tic80_trace_ldst (SD, CPU, cia, MY_INDEX, \ - 0, m, s, result, addr1, addr2); \ - } \ -} while (0) - -#define TRACE_ST(value, m, s, addr1, addr2) \ -do { \ - if (TRACE_MEMORY_P (CPU)) { \ - tic80_trace_ldst (SD, CPU, cia, MY_INDEX, \ - 1, m, s, value, addr1, addr2); \ - } \ -} while (0) - -#else -#define TRACE_ALU3(indx, result, input1, input2) -#define TRACE_ALU2(indx, result, input) -#define TRACE_FPU3(result, input1, input2) -#define TRACE_FPU2(result, input) -#define TRACE_FPU1(result) -#define TRACE_FPU2I(result, input1, input2) -#define TRACE_NOP(indx) -#define TRACE_SINK1(indx, input) -#define TRACE_SINK2(indx, input1, input2) -#define TRACE_SINK3(indx, input1, input2, input3) -#define TRACE_COND_BR(indx, jump_p, cond, target, size, code) -#define TRACE_UCOND_BR(indx, target) -#define TRACE_LD(m, s, result, addr1, addr2) -#define TRACE_ST(m, s, value, addr1, addr2) -#endif diff --git a/sim/tic80/interp.c b/sim/tic80/interp.c deleted file mode 100644 index 17f06d486c2..00000000000 --- a/sim/tic80/interp.c +++ /dev/null @@ -1,127 +0,0 @@ -/* This file is part of the GDB simulators. - - Copyright (C) 1997, Free Software Foundation - Condtributed by Cyngnus Solutions. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - - - -#include "sim-main.h" - -#include "idecode.h" -#include "itable.h" - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - - -#if 0 - -void -engine_error (SIM_DESC sd, - sim_cpu *cpu, - instruction_address cia, - const char *fmt, - ...) -{ - va_list ap; - va_start (ap, fmt); - sim_io_evprintf (sd, fmt, ap); - va_end (ap); - - sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT); -} - -void -engine_halt (SIM_DESC sd, - sim_cpu *cpu, - instruction_address cia, - enum sim_stop reason, - int siggnal) -{ - if (!sd->halt_ok) - sim_io_error (sd, "engine_halt - bad longjmp"); - sd->reason = reason; - sd->siggnal = siggnal; - sd->halt_ok = 0; - sd->restart_ok = 0; - if (cpu != NULL) - cpu->cia = cia; - longjmp (sd->path_to_halt, 1); -} - -void -engine_restart (SIM_DESC sd, - sim_cpu *cpu, - instruction_address cia) -{ - if (!sd->restart_ok) - sim_io_error (sd, "engine_restart - bad longjmp"); - sd->restart_ok = 0; - cpu->cia = cia; - longjmp(sd->path_to_restart, 1); -} - - -void -engine_run_until_stop (SIM_DESC sd, - volatile int *keep_running) -{ - if (!setjmp (sd->path_to_halt)) - { - instruction_address cia; - sim_cpu *cpu = STATE_CPU (sd, 0); - sd->halt_ok = 1; - setjmp (sd->path_to_restart); - sd->restart_ok = 1; - cia = cpu->cia; - do - { - instruction_word insn = IMEM (cia); - cia = idecode_issue (sd, insn, cia); - } - while (*keep_running); - engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGINT); - } -} - - -void -engine_step (SIM_DESC sd) -{ - if (!setjmp (sd->path_to_halt)) - { - instruction_address cia; - instruction_word insn; - sim_cpu *cpu = STATE_CPU (sd, 0); - sd->halt_ok = 1; - setjmp (sd->path_to_restart); - sd->restart_ok = 1; - cia = cpu->cia; - insn = IMEM (cia); - cia = idecode_issue (sd, insn, cia); - engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGTRAP); - } -} - -#endif diff --git a/sim/tic80/misc.c b/sim/tic80/misc.c deleted file mode 100644 index fc7fbec12b7..00000000000 --- a/sim/tic80/misc.c +++ /dev/null @@ -1,624 +0,0 @@ -/* TIc80 Simulator. - Copyright (C) 1997, 1998 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB, the GNU debugger. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#include "sim-main.h" - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - - -tic80_control_regs -tic80_index2cr (int index) -{ - switch (index) - { - case 0x0000: return EPC_CR; - case 0x0001: return EIP_CR; - case 0x0002: return CONFIG_CR; - case 0x0004: return INTPEN_CR; - case 0x0006: return IE_CR; - case 0x0008: return FPST_CR; - case 0x000A: return PPERROR_CR; - case 0x000D: return PKTREQ_CR; - case 0x000E: return TCOUNT_CR; - case 0x000F: return TSCALE_CR; - case 0x0010: return FLTOP_CR; - case 0x0011: return FLTADR_CR; - case 0x0012: return FLTTAG_CR; - case 0x0013: return FLTDLT_CR; - case 0x0014: return FLTDTH_CR; - case 0x0015: return FLT005_CR; - case 0x0016: return FLT006_CR; - case 0x0017: return FLT007_CR; - case 0x0018: return FLT008_CR; - case 0x0019: return FLT009_CR; - case 0x001a: return FLT010_CR; - case 0x001b: return FLT011_CR; - case 0x001c: return FLT012_CR; - case 0x001d: return FLT013_CR; - case 0x001e: return FLT014_CR; - case 0x001f: return FLT015_CR; - case 0x0020: return SYSSTK_CR; - case 0x0021: return SYSTMP_CR; - case 0x0030: return MPC_CR; - case 0x0031: return MIP_CR; - case 0x0033: return ECOMCNTL_CR; - case 0x0034: return ANASTAT_CR; - case 0x0039: return BRK1_CR; - case 0x003A: return BRK2_CR; - case 0x0200: return ITAG0_CR; - case 0x0201: return ITAG1_CR; - case 0x0202: return ITAG2_CR; - case 0x0203: return ITAG3_CR; - case 0x0204: return ITAG4_CR; - case 0x0205: return ITAG5_CR; - case 0x0206: return ITAG6_CR; - case 0x0207: return ITAG7_CR; - case 0x0208: return ITAG8_CR; - case 0x0209: return ITAG9_CR; - case 0x020a: return ITAG10_CR; - case 0x020b: return ITAG11_CR; - case 0x020c: return ITAG12_CR; - case 0x020d: return ITAG13_CR; - case 0x020e: return ITAG14_CR; - case 0x020f: return ITAG15_CR; - case 0x0300: return ILRU_CR; - case 0x0400: return DTAG0_CR; - case 0x0401: return DTAG1_CR; - case 0x0402: return DTAG2_CR; - case 0x0403: return DTAG3_CR; - case 0x0404: return DTAG4_CR; - case 0x0405: return DTAG5_CR; - case 0x0406: return DTAG6_CR; - case 0x0407: return DTAG7_CR; - case 0x0408: return DTAG8_CR; - case 0x0409: return DTAG9_CR; - case 0x040a: return DTAG10_CR; - case 0x040b: return DTAG11_CR; - case 0x040c: return DTAG12_CR; - case 0x040d: return DTAG13_CR; - case 0x040e: return DTAG14_CR; - case 0x040f: return DTAG15_CR; - case 0x0500: return DLRU_CR; - case 0x4000: return IN0P_CR; - case 0x4001: return IN1P_CR; - case 0x4002: return OUTP_CR; - default: return SCRATCH_CR; - } -} - - - -#if defined(WITH_TRACE) -/* Tracing support routines */ - -static char tic80_trace_buffer[1024]; -static int tic80_size_name; - -#define SIZE_HEX 8 -#define SIZE_DECIMAL 11 - -/* Initialize tracing by calculating the maximum name size */ -static void -tic80_init_trace (void) -{ - int i; - int len, max_len = 0; - - for (i = 0; i < (int)nr_itable_entries; i++) { - len = strlen (itable[i].name); - if (len > max_len) - max_len = len; - } - - tic80_size_name = max_len + sizeof(":m") - 1 + sizeof (":s") - 1; -} - -/* Given an integer which is the result of a comparison, return a string - giving which bits are set. */ - -static char * -tic80_trace_cmp_internal (unsigned32 flag) -{ - struct cmp_bits { unsigned32 bit; char *string; }; - static char buffer[32*8]; - static struct cmp_bits bits[] = - { - { BIT32(29), "hs" }, - { BIT32(28), "lo" }, - { BIT32(27), "ls" }, - { BIT32(26), "hi" }, - { BIT32(25), "ge" }, - { BIT32(24), "lt" }, - { BIT32(23), "le" }, - { BIT32(22), "gt" }, - { BIT32(21), "ne" }, - { BIT32(20), "eq" }, - - { BIT32(19), "hs.h" }, - { BIT32(18), "lo.h" }, - { BIT32(17), "ls.h" }, - { BIT32(16), "hi.h" }, - { BIT32(15), "ge.h" }, - { BIT32(14), "lt.h" }, - { BIT32(13), "le.h" }, - { BIT32(12), "gt.h" }, - { BIT32(11), "ne.h" }, - { BIT32(10), "eq.h" }, - - { BIT32( 9), "hs.b" }, - { BIT32( 8), "lo.b" }, - { BIT32( 7), "ls.b" }, - { BIT32( 6), "hi.b" }, - { BIT32( 5), "ge.b" }, - { BIT32( 4), "lt.b" }, - { BIT32( 3), "le.b" }, - { BIT32( 2), "gt.b" }, - { BIT32( 1), "ne.b" }, - { BIT32( 0), "eq.b" }, - { 0, (char *)0 }, - }; - - int i; - char *p = buffer; - - for (i = 0; bits[i].bit != 0; i++) - { - if ((flag & bits[i].bit) != 0) - { - if (p != buffer) - *p++ = ' '; - - strcpy (p, bits[i].string); - p += strlen (p); - } - } - - *p = '\0'; - return buffer; -} - -/* Trace the result of an ALU operation with 2 integer inputs and an integer output */ -char * -tic80_trace_alu3 (int indx, - unsigned32 result, - unsigned32 input1, - unsigned32 input2) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx/%*ld", - tic80_size_name, itable[indx].name, - SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, - SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, - SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); - - return tic80_trace_buffer; -} - -/* Trace the result of an ALU operation with 2 integer inputs and an integer output - that sets the bits from a compare instruction. */ -char * -tic80_trace_cmp (int indx, - unsigned32 result, - unsigned32 input1, - unsigned32 input2) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx %s", - tic80_size_name, itable[indx].name, - SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, - SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, - SIZE_HEX, result, tic80_trace_cmp_internal (result)); - - return tic80_trace_buffer; -} - -/* Trace the result of an ALU operation with 1 integer input and an integer output */ -char * -tic80_trace_alu2 (int indx, - unsigned32 result, - unsigned32 input) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s => 0x%.*lx/%*ld", - tic80_size_name, itable[indx].name, - SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input, - SIZE_HEX + SIZE_DECIMAL + 3, "", - SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); - - return tic80_trace_buffer; -} - -/* Trace the result of a shift instruction */ -char * -tic80_trace_shift (int indx, - unsigned32 result, - unsigned32 input, - int i, - int n, - int merge, - int endmask, - int rotate) -{ - const char *merge_name; - char name[40]; - char *p; - - if (!tic80_size_name) - tic80_init_trace (); - - switch (merge) - { - default: merge_name = ".??"; break; - case 0: merge_name = ".dz"; break; - case 1: merge_name = ".dm"; break; - case 2: merge_name = ".ds"; break; - case 3: merge_name = ".ez"; break; - case 4: merge_name = ".em"; break; - case 5: merge_name = ".es"; break; - case 6: merge_name = ".iz"; break; - case 7: merge_name = ".im"; break; - } - - /* Don't use itable[indx].name, which is just sl {r,i}. Instead reconstruct - the name, using the i and n fields. */ - p = strchr (itable[indx].name, ' '); - sprintf (name, "s%s%s%s%s", - (n) ? "r" : "l", - (i) ? "i" : "", - merge_name, - (p) ? p : ""); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s%2d,%2d => 0x%.*lx/%*ld", - tic80_size_name, name, - SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input, - SIZE_HEX + SIZE_DECIMAL - 2, "", - rotate, endmask, - SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); - - return tic80_trace_buffer; -} - -/* Trace the result of an FPU operation with 2 floating point inputs and a floating point output */ -void -tic80_trace_fpu3 (SIM_DESC sd, - sim_cpu *cpu, - sim_cia cia, - int indx, - sim_fpu *result, - sim_fpu *input1, - sim_fpu *input2) -{ - if (!tic80_size_name) - tic80_init_trace (); - - trace_one_insn (sd, cpu, cia.ip, 1, - itable[indx].file, itable[indx].line_nr, "fpu", - "%-*s %*g %*g => %*g", - tic80_size_name, itable[indx].name, - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1), - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2), - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (result)); -} - -/* Trace the result of an FPU operation with 1 floating point input and a floating point output */ -void -tic80_trace_fpu2 (SIM_DESC sd, - sim_cpu *cpu, - sim_cia cia, - int indx, - sim_fpu *result, - sim_fpu *input) -{ - if (!tic80_size_name) - tic80_init_trace (); - - trace_one_insn (sd, cpu, cia.ip, 1, - itable[indx].file, itable[indx].line_nr, "fpu", - "%-*s %*g %-*s => %*g", - tic80_size_name, itable[indx].name, - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input), - SIZE_HEX + SIZE_DECIMAL + 3, "", - SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result)); -} - -/* Trace the result of an FPU operation with 1 floating point input and a floating point output */ -void -tic80_trace_fpu1 (SIM_DESC sd, - sim_cpu *cpu, - sim_cia cia, - int indx, - sim_fpu *result) -{ - if (!tic80_size_name) - tic80_init_trace (); - - trace_one_insn (sd, cpu, cia.ip, 1, - itable[indx].file, itable[indx].line_nr, "fpu", - "%-*s %-*s %-*s => %*g", - tic80_size_name, itable[indx].name, - SIZE_HEX + SIZE_DECIMAL + 3, "", - SIZE_HEX + SIZE_DECIMAL + 3, "", - SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result)); -} - -/* Trace the result of an FPU operation with 2 floating point inputs and an integer output */ -void -tic80_trace_fpu2i (SIM_DESC sd, - sim_cpu *cpu, - sim_cia cia, - int indx, - unsigned32 result, - sim_fpu *input1, - sim_fpu *input2) -{ - if (!tic80_size_name) - tic80_init_trace (); - - trace_one_insn (sd, cpu, cia.ip, 1, - itable[indx].file, itable[indx].line_nr, "fpu", - "%-*s %*g %*g => 0x%.*lx %-*ld", - tic80_size_name, itable[indx].name, - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1), - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2), - SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); -} - -/* Trace the result of an FPU operation with 2 floating point inputs and an integer output - that is the result of a comparison. */ -void -tic80_trace_fpu2cmp (SIM_DESC sd, - sim_cpu *cpu, - sim_cia cia, - int indx, - unsigned32 result, - sim_fpu *input1, - sim_fpu *input2) -{ - if (!tic80_size_name) - tic80_init_trace (); - - trace_one_insn (sd, cpu, cia.ip, 1, - itable[indx].file, itable[indx].line_nr, "fpu", - "%-*s %*g %*g => 0x%.*lx %s", - tic80_size_name, itable[indx].name, - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1), - SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2), - SIZE_HEX, result, tic80_trace_cmp_internal (result)); -} - -/* Trace the result of a NOP operation */ -char * -tic80_trace_nop (int indx) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%s", itable[indx].name); - return tic80_trace_buffer; -} - -/* Trace the result of a data sink with one input */ -char * -tic80_trace_sink1 (int indx, unsigned32 input) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld", - tic80_size_name, itable[indx].name, - SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input); - - return tic80_trace_buffer; -} - -/* Trace the result of a data sink with two inputs */ -char * -tic80_trace_sink2 (int indx, unsigned32 input1, unsigned32 input2) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld", - tic80_size_name, itable[indx].name, - SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, - SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2); - - return tic80_trace_buffer; -} - -/* Trace the result of a data sink with three inputs */ -char * -tic80_trace_sink3 (int indx, unsigned32 input1, unsigned32 input2, unsigned32 input3) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld 0x%.*lx/%*ld", - tic80_size_name, itable[indx].name, - SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, - SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, - SIZE_HEX, input3, SIZE_DECIMAL, (long)(signed32)input3); - - return tic80_trace_buffer; -} - -/* Trace the result of a conditional branch operation */ -char * -tic80_trace_cond_br (int indx, - int jump_p, - unsigned32 cond, - unsigned32 target, - int size, - int code) -{ - char *suffix1, *suffix2; - - if (!tic80_size_name) - tic80_init_trace (); - - if (size >= 0 && code >= 0) - { /* BCND */ - switch (code) - { - default: suffix1 = "???"; break; - case 0: suffix1 = "nev"; break; - case 1: suffix1 = "gt0"; break; - case 2: suffix1 = "eq0"; break; - case 3: suffix1 = "ge0"; break; - case 4: suffix1 = "lt0"; break; - case 5: suffix1 = "ne0"; break; - case 6: suffix1 = "le0"; break; - case 7: suffix1 = "alw"; break; - } - - switch (size) - { - default: suffix2 = ".?"; break; - case 0: suffix2 = ".b"; break; - case 1: suffix2 = ".h"; break; - case 2: suffix2 = ".w"; break; - } - - } else { /* BBO/BBZ */ - - suffix2 = ""; - switch (cond) - { - default: suffix1 = "??.?"; break; - case 29: suffix1 = "hs.w"; break; - case 28: suffix1 = "lo.w"; break; - case 27: suffix1 = "ls.w"; break; - case 26: suffix1 = "hi.w"; break; - case 25: suffix1 = "ge.w"; break; - case 24: suffix1 = "lt.w"; break; - case 23: suffix1 = "le.w"; break; - case 22: suffix1 = "gt.w"; break; - case 21: suffix1 = "ne.w"; break; - case 20: suffix1 = "eq.w"; break; - case 19: suffix1 = "hs.h"; break; - case 18: suffix1 = "lo.h"; break; - case 17: suffix1 = "ls.h"; break; - case 16: suffix1 = "hi.h"; break; - case 15: suffix1 = "ge.h"; break; - case 14: suffix1 = "lt.h"; break; - case 13: suffix1 = "le.h"; break; - case 12: suffix1 = "gt.h"; break; - case 11: suffix1 = "ne.h"; break; - case 10: suffix1 = "eq.h"; break; - case 9: suffix1 = "hs.b"; break; - case 8: suffix1 = "lo.b"; break; - case 7: suffix1 = "ls.b"; break; - case 6: suffix1 = "hi.b"; break; - case 5: suffix1 = "ge.b"; break; - case 4: suffix1 = "lt.b"; break; - case 3: suffix1 = "le.b"; break; - case 2: suffix1 = "gt.b"; break; - case 1: suffix1 = "ne.b"; break; - case 0: suffix1 = "eq.b"; break; - } - } - - if (jump_p) - sprintf (tic80_trace_buffer, - "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => 0x%.*lx %s%s", - tic80_size_name, itable[indx].name, - SIZE_HEX, target, SIZE_DECIMAL, "", - SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond, - SIZE_HEX, target, - suffix1, suffix2); - else - sprintf (tic80_trace_buffer, - "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => %-*s %s%s", - tic80_size_name, itable[indx].name, - SIZE_HEX, target, SIZE_DECIMAL, "", - SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond, - SIZE_HEX + 2, "[no jump]", - suffix1, suffix2); - - return tic80_trace_buffer; -} - -/* Trace the result of a unconditional branch operation */ -char * -tic80_trace_ucond_br (int indx, - unsigned32 target) -{ - if (!tic80_size_name) - tic80_init_trace (); - - sprintf (tic80_trace_buffer, - "%-*s 0x%.*lx %*s => 0x%.*lx", - tic80_size_name, itable[indx].name, - SIZE_HEX, target, (SIZE_DECIMAL*2) + SIZE_HEX + 4, "", - SIZE_HEX, target); - - return tic80_trace_buffer; -} - -/* Trace the result of a load or store operation with 2 integer addresses - and an integer output or input */ -void -tic80_trace_ldst (SIM_DESC sd, - sim_cpu *cpu, - sim_cia cia, - int indx, - int st_p, - int m_p, - int s_p, - unsigned32 value, - unsigned32 input1, - unsigned32 input2) -{ - char name[40]; - - if (!tic80_size_name) - tic80_init_trace (); - - strcpy (name, itable[indx].name); - if (m_p) - strcat (name, ":m"); - - if (s_p) - strcat (name, ":s"); - - trace_one_insn (sd, cpu, cia.ip, 1, - itable[indx].file, itable[indx].line_nr, "memory", - "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld %s 0x%.*lx/%*ld", - tic80_size_name, name, - SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, - SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, - (!st_p) ? "=>" : "<=", - SIZE_HEX, value, SIZE_DECIMAL, (long)(signed32)value); -} - -#endif /* WITH_TRACE */ diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c deleted file mode 100644 index c60bd9b8d21..00000000000 --- a/sim/tic80/sim-calls.c +++ /dev/null @@ -1,203 +0,0 @@ -/* This file is part of the program psim. - - Copyright (C) 1994-1996, Andrew Cagney - Copyright (C) 1997, Free Software Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - - -#include -#include - -#include "bfd.h" -#include "sim-main.h" -#include "sim-utils.h" -#include "sim-options.h" - -#ifdef HAVE_STDLIB_H -#include -#endif - -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif - - -#define SIM_ADDR unsigned - -SIM_DESC -sim_open (SIM_OPEN_KIND kind, - host_callback *callback, - struct _bfd *abfd, - char **argv) -{ - char *buf; - SIM_DESC sd = sim_state_alloc (kind, callback); - - if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK) - return 0; - -#define TIC80_MEM_START 0x2000000 -#define TIC80_MEM_SIZE 0x100000 - - /* main memory */ - asprintf (&buf, "memory region 0x%lx,0x%lx", - TIC80_MEM_START, TIC80_MEM_SIZE); - sim_do_command (sd, buf); - free (buf); - /* interrupt memory */ - sim_do_command (sd, "memory region 0x1010000,0x1000"); - /* some memory at zero */ - sim_do_command (sd, "memory region 0,0x100000"); - - /* getopt will print the error message so we just have to exit if this fails. - FIXME: Hmmm... in the case of gdb we need getopt to call - print_filtered. */ - if (sim_parse_args (sd, argv) != SIM_RC_OK) - { - /* Uninstall the modules to avoid memory leaks, - file descriptor leaks, etc. */ - sim_module_uninstall (sd); - return 0; - } - - /* check for/establish the a reference program image */ - if (sim_analyze_program (sd, - (STATE_PROG_ARGV (sd) != NULL - ? *STATE_PROG_ARGV (sd) - : NULL), - abfd) != SIM_RC_OK) - { - sim_module_uninstall (sd); - return 0; - } - - /* establish any remaining configuration options */ - if (sim_config (sd) != SIM_RC_OK) - { - sim_module_uninstall (sd); - return 0; - } - - if (sim_post_argv_init (sd) != SIM_RC_OK) - { - /* Uninstall the modules to avoid memory leaks, - file descriptor leaks, etc. */ - sim_module_uninstall (sd); - return 0; - } - - /* FIXME: for now */ - return sd; -} - - -void -sim_close (SIM_DESC sd, int quitting) -{ - /* Uninstall the modules to avoid memory leaks, - file descriptor leaks, etc. */ - sim_module_uninstall (sd); -} - - -/* FIXME - these magic numbers need to be moved elsewhere */ - -#define SP_REGNUM 1 /* Contains address of top of stack */ -#define FP_REGNUM 31 /* Contains address of executing stack frame */ -#define PC_REGNUM 32 /* Contains program counter (FIXME?) */ -#define NPC_REGNUM 33 /* Contains the next program counter (FIXME?) */ -#define A0_REGNUM 34 /* Accumulator register 0 */ -#define A3_REGNUM 37 /* Accumulator register 1 */ - -#define R0_REGNUM 0 /* General Purpose Register 0 - for sim */ -#define Rn_REGNUM 31 /* Last General Purpose Register - for sim */ -#define An_REGNUM A3_REGNUM /* Last Accumulator register - for sim */ - -int -sim_fetch_register (SIM_DESC sd, int regnr, unsigned char *buf, int length) -{ - if (regnr == R0_REGNUM) - memset (buf, 0, sizeof (unsigned32)); - else if (regnr > R0_REGNUM && regnr <= Rn_REGNUM) - *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM]); - else if (regnr == PC_REGNUM) - *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.ip); - else if (regnr == NPC_REGNUM) - *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.dp); - else if (regnr >= A0_REGNUM && regnr <= An_REGNUM) - *(unsigned64*)buf = H2T_8 (STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM]); - else - sim_io_error (sd, "sim_fetch_register - unknown register nr %d", regnr); - return -1; -} - - -int -sim_store_register (SIM_DESC sd, int regnr, unsigned char *buf, int length) -{ - if (regnr >= R0_REGNUM && regnr <= Rn_REGNUM) - STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM] = T2H_4 (*(unsigned32*)buf); - else if (regnr == PC_REGNUM) - STATE_CPU (sd, 0)->cia.ip = T2H_4 (*(unsigned32*)buf); - else if (regnr == NPC_REGNUM) - STATE_CPU (sd, 0)->cia.dp = T2H_4 (*(unsigned32*)buf); - else if (regnr >= A0_REGNUM && regnr <= An_REGNUM) - STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM] = T2H_8 (*(unsigned64*)buf); - else - sim_io_error (sd, "sim_store_register - unknown register nr %d", regnr); - return -1; -} - - -SIM_RC -sim_create_inferior (SIM_DESC sd, - struct _bfd *abfd, - char **argv, - char **envp) -{ - /* clear all registers */ - memset (&STATE_CPU (sd, 0)->reg, 0, sizeof (STATE_CPU (sd, 0)->reg)); - memset (&STATE_CPU (sd, 0)->acc, 0, sizeof (STATE_CPU (sd, 0)->acc)); - memset (&STATE_CPU (sd, 0)->cr, 0, sizeof (STATE_CPU (sd, 0)->cr)); - STATE_CPU (sd, 0)->is_user_mode = 0; - memset (&STATE_CPU (sd, 0)->cia, 0, sizeof (STATE_CPU (sd, 0)->cia)); - /* initialize any modules */ - sim_module_init (sd); - /* set the stack-pointer/program counter */ - if (abfd != NULL) - STATE_CPU (sd, 0)->cia.ip = bfd_get_start_address (abfd); - else - STATE_CPU (sd, 0)->cia.ip = 0; - STATE_CPU (sd, 0)->cia.dp = (STATE_CPU (sd, 0)->cia.ip - + sizeof (instruction_word)); - STATE_CPU (sd, 0)->cr[IE_CR] |= IE_CR_IE; - STATE_CPU (sd, 0)->reg[1] = TIC80_MEM_START + TIC80_MEM_SIZE - 16; - return SIM_RC_OK; -} - - -void -sim_do_command (SIM_DESC sd, char *cmd) -{ - if (sim_args_command (sd, cmd) != SIM_RC_OK) - sim_io_eprintf (sd, "Unknown command `%s'\n", cmd); -} diff --git a/sim/tic80/sim-main.h b/sim/tic80/sim-main.h deleted file mode 100644 index 67db3535441..00000000000 --- a/sim/tic80/sim-main.h +++ /dev/null @@ -1,81 +0,0 @@ -/* This file is part of the program psim. - - Copyright (C) 1994-1997, Andrew Cagney - Copyright (C) 1997, Free Software Foundation - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - */ - - -#ifndef _SIM_MAIN_H_ -#define _SIM_MAIN_H_ - - -#include "sim-basics.h" -#include "sim-signal.h" - -#include /* For kill() in insns:do_trap */ - -#include -#ifdef HAVE_UNISTD_H -#include -#endif - -/* These are generated files. */ -#include "itable.h" -#include "idecode.h" -#include "idecode.h" - -typedef instruction_address sim_cia; -static const sim_cia null_cia = {0}; /* Dummy */ -#define NULL_CIA null_cia -/* FIXME: Perhaps igen should generate access macros for - `instruction_address' that we could use. */ -#define CIA_ADDR(cia) ((cia).ip) - -#define WITH_WATCHPOINTS 1 - -#include "sim-base.h" - -#include "alu.h" -#include "cpu.h" - - -struct sim_state { - - /* the processors proper */ - sim_cpu cpu; -#define STATE_CPU(sd, n) (&(sd)->cpu) - - /* The base class. */ - sim_state_base base; - -}; - -/* (re) initialize the simulator */ - -extern void engine_init -(SIM_DESC sd); - - -#ifndef HAVE_GETPID -#define getpid() 42 -#endif - -#ifndef HAVE_KILL -#define kill(sig, pid) (errno = EINVAL, -1) -#endif -#endif diff --git a/sim/tic80/tic80.dc b/sim/tic80/tic80.dc deleted file mode 100644 index 41998265864..00000000000 --- a/sim/tic80/tic80.dc +++ /dev/null @@ -1,6 +0,0 @@ -# most instructions -switch: 21: 12: 21: 12 -switch: 11: 7: 6: 12 -#switch: 21: 13: 21: 13 -#switch: 12: 7: 6: 13 -switch: 27: 27: 27: 27 diff --git a/sim/tic80/tic80.ic b/sim/tic80/tic80.ic deleted file mode 100644 index de81d14a92e..00000000000 --- a/sim/tic80/tic80.ic +++ /dev/null @@ -1,52 +0,0 @@ -cache:Dest:Dest: -cache:Dest:rDest:signed_word *:(&(CPU)->reg[Dest]) -# -cache:Source1:Source1: -cache:Source1:vSource1:signed_word:(GPR (Source1) + 0) -#cache:Source1:vSource1:signed_word:(Source1 == 0 ? 0 : (CPU)->reg[Source1]) -# -cache:Source2:Source2: -cache:Source2:vSource2:signed_word:(GPR (Source2) + 0) -#cache:Source2:vSource2:signed_word:(Source2 == 0 ? 0 : (CPU)->reg[Source2]) -# -cache:Source:Source: -cache:Source:vSource:signed_word:(GPR (Source) + 0) -#cache:Source:vSource:signed_word:(Source == 0 ? 0 : (CPU)->reg[Source]) -# -cache:IndOff:IndOff: -cache:IndOff:rIndOff:signed_word:(GPR (IndOff) + 0) -#cache:IndOff:rIndOff:signed_word:(IndOff == 0 ? 0 : (CPU)->reg[IndOff]) -# -cache:Base:Base: -cache:Base:vBase:signed_word:(GPR (Base) + 0) -cache:Base:rBase:signed_word*:(&GPR (Base)) -#cache:Base:vBase:signed_word:(Base == 0 ? 0 : (CPU)->reg[Base]) -# -cache:Link:Link: -cache:Link:rLink:signed_word*:(&(CPU)->reg[Link]) -# -# Trap Number -cache:UTN:UTN: -cache:INDTR:INDTR: -cache:INDTR:UTN:unsigned_word:(INDTR == 0 ? 0 : (CPU)->reg[INDTR]) -# -cache:A:A: -# -cache:SignedImmediate:SignedImmediate: -cache:SignedImmediate:vSource1:signed_word:SEXT (SignedImmediate, 14) -# -cache:UnsignedImmediate:UnsignedImmediate: -cache:UnsignedImmediate:vSource1:signed_word:UnsignedImmediate -# -cache:BITNUM:BITNUM: -cache:Code:Code: -cache:BITNUM:bitnum:int:(~BITNUM) & 0x1f - -# -cache:SignedOffset:SignedOffset: -cache:SignedOffset:vSignedOffset:signed_word:SEXT (SignedOffset, 14) -# -cache:UCRN:UCRN: -cache:INDCR:INDCR: -cache:INDCR:UCRN:unsigned32:(GPR (INDCR) + 0) -#cache:INDCR:UCRN:unsigned32:(INDCR == 0 ? 0 : (CPU)->reg[INDCR]) diff --git a/sim/tic80/tic80.igen b/sim/tic80/tic80.igen deleted file mode 100644 index 1595693f524..00000000000 --- a/sim/tic80/tic80.igen +++ /dev/null @@ -1,1615 +0,0 @@ -// Texas Instruments TMS320C80 (MVP) Simulator. - - -// The following is called when ever an illegal instruction is encountered. -:internal::::illegal: -{ - sim_io_eprintf (SD, "0x%lx: illegal instruction\n", (unsigned long) cia.ip); - sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGILL); -} - -// The following is called when ever an FP op is attempted with FPU disabled. -:internal::::fp_unavailable: -{ - sim_io_eprintf (SD, "0x%lx: floating-point unavailable\n", (unsigned long) cia.ip); - sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGFPE); -} - -// Handle a branch instruction -:function:::instruction_address:do_branch:int annul, address_word target, int rLink_p, unsigned32 *rLink -{ - instruction_address nia; - if (annul) - { - if (rLink_p) - *rLink = cia.dp; - nia.ip = target; - nia.dp = target + 4; - } - else - { - if (rLink_p) - *rLink = cia.dp + sizeof (instruction_word); - nia.ip = cia.dp; - nia.dp = target; - } - return nia; -} - -// Signed Integer Add - add source1, source2, dest -:function:::void:do_add:unsigned32 *rDest, signed32 source1, signed32 source2 -{ - unsigned32 result; - ALU_BEGIN (source1); - ALU_ADD (source2); - ALU_END (result); - *rDest = result; - TRACE_ALU3 (MY_INDEX, result, source1, source2); - /* FIXME - a signed add may cause an exception */ -} -31.Dest,26.Source2,21.0b101100,15.0,14.SignedImmediate::::add i -"add , r, r" -{ - do_add (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101100,13.0,12.0,11./,4.Source1::::add r -"add r, r, r" -{ - do_add (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101100,13.0,12.1,11./+LongSignedImmediate::::add l -"add 0x%08lx, r, r" -{ - do_add (_SD, rDest, LongSignedImmediate, vSource2); -} - - -// Unsigned Integer Add - addu source1, source2, dest -:function:::void:do_addu:unsigned32 *rDest, unsigned32 source1, unsigned32 source2 -{ - unsigned32 result = source1 + source2; - TRACE_ALU3 (MY_INDEX, result, source1, source2); - *rDest = result; -} - -31.Dest,26.Source2,21.0b101100,15.1,14.SignedImmediate::::addu i -"addu , r, r" -{ - do_addu (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101100,13.1,12.0,11./,4.Source1::::addu r -"addu r, r, r" -{ - do_addu (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101100,13.1,12.1,11./+LongSignedImmediate::::addu l -"addu 0x%08lx, r, r" -{ - do_addu (_SD, rDest, LongSignedImmediate, vSource2); -} - - -:function:::void:do_and:signed32 *rDest, signed32 source1, signed32 source2 -{ - unsigned32 result = source1 & source2; - TRACE_ALU3 (MY_INDEX, result, source1, source2); - *rDest = result; -} - - -// and, and.tt -31.Dest,26.Source2,21.0b0010001,14.UnsignedImmediate::::and.tt i -"and.tt , r, r" -{ - do_and (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010001,12.0,11./,4.Source1::::and.tt r -"and.tt r, r, r" -{ - do_and (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010001,12.1,11./+LongSignedImmediate::::and.tt l -"and.tt 0x%08lx, r, r" -{ - do_and (_SD, rDest, LongSignedImmediate, vSource2); - -} - -// and.ff -31.Dest,26.Source2,21.0b0011000,14.UnsignedImmediate::::and.ff i -"and.ff , r, r" -{ - do_and (_SD, rDest, ~vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110011000,12.0,11./,4.Source1::::and.ff r -"and.ff r, r, r" -{ - do_and (_SD, rDest, ~vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110011000,12.1,11./+LongSignedImmediate::::and.ff l -"and.ff 0x%08lx, r, r" -{ - do_and (_SD, rDest, ~LongSignedImmediate, ~vSource2); -} - -// and.ft -31.Dest,26.Source2,21.0b0010100,14.UnsignedImmediate::::and.ft i -"and.ft , r, r" -{ - do_and (_SD, rDest, ~vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010100,12.0,11./,4.Source1::::and.ft r -"and.ft r, r, r" -{ - do_and (_SD, rDest, ~vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010100,12.1,11./+LongSignedImmediate::::and.ft l -"and.ft 0x%08lx, r, r" -{ - do_and (_SD, rDest, ~LongSignedImmediate, vSource2); -} - -// and.tf -31.Dest,26.Source2,21.0b0010010,14.UnsignedImmediate::::and.tf i -"and.tf , r, r" -{ - do_and (_SD, rDest, vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110010010,12.0,11./,4.Source1::::and.tf r -"and.tf r, r, r" -{ - do_and (_SD, rDest, vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110010010,12.1,11./+LongSignedImmediate::::and.tf l -"and.tf 0x%08lx, r, r" -{ - do_and (_SD, rDest, LongSignedImmediate, ~vSource2); -} - -// bbo[.a] -:function:::instruction_address:do_bbo:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset -{ - int jump_p; - address_word target = cia.ip + 4 * offset; - if (MASKED32 (source, bitnum, bitnum)) - { - nia = do_branch (_SD, annul, target, 0, NULL); - jump_p = 1; - } - else - jump_p = 0; - TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1); - return nia; -} -:%s::::A:int A -{ - if (A) - return ".a"; - else - return ""; -} -31.BITNUM,26.Source,21.0b100101,15.A,14.SignedOffset::::bbo i -"bbo%s , r, " -{ - nia = do_bbo (_SD, nia, bitnum, vSource, A, vSignedOffset); -} -31.BITNUM,26.Source,21.0b11100101,13.A,12.0,11./,4.IndOff::::bbo r -"bbo%s r, r, " -{ - nia = do_bbo (_SD, nia, bitnum, vSource, A, rIndOff); -} -31.BITNUM,26.Source,21.0b11100101,13.A,12.1,11./+LongSignedImmediate::::bbo l -"bbo%s , r, " -{ - nia = do_bbo (_SD, nia, bitnum, vSource, A, LongSignedImmediate); -} - -// bbz[.a] -:function:::instruction_address:do_bbz:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset -{ - int jump_p; - address_word target = cia.ip + 4 * offset; - if (!MASKED32 (source, bitnum, bitnum)) - { - nia = do_branch (_SD, annul, target, 0, NULL); - jump_p = 1; - } - else - jump_p = 0; - TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1); - return nia; -} -31.BITNUM,26.Source,21.0b100100,15.A,14.SignedOffset::::bbz i -"bbz%s , r, " -{ - nia = do_bbz (_SD, nia, bitnum, vSource, A, vSignedOffset); -} -31.BITNUM,26.Source,21.0b11100100,13.A,12.0,11./,4.IndOff::::bbz r -"bbz%s r, r, " -{ - nia = do_bbz (_SD, nia, bitnum, vSource, A, rIndOff); -} -31.BITNUM,26.Source,21.0b11100100,13.A,12.1,11./+LongSignedImmediate::::bbz l -"bbz%s , r, " -{ - nia = do_bbz (_SD, nia, bitnum, vSource, A, LongSignedImmediate); -} - -// bcnd[.a] -:function:::instruction_address:do_bcnd:instruction_address nia, int Cond, unsigned32 source, int annul, unsigned32 offset -{ - int condition; - int size = EXTRACTED32 (Cond, 31 - 27, 30 - 27); - int code = EXTRACTED32 (Cond, 29 - 27, 27 - 27); - signed32 val = 0; - address_word target = cia.ip + 4 * offset; - switch (size) - { - case 0: val = SEXT32 (source, 7); break; - case 1: val = SEXT32 (source, 15); break; - case 2: val = source; break; - default: sim_engine_abort (SD, CPU, cia, "bcnd - reserved size"); - } - switch (code) - { - case 0: condition = 0; break; - case 1: condition = val > 0; break; - case 2: condition = val == 0; break; - case 3: condition = val >= 0; break; - case 4: condition = val < 0; break; - case 5: condition = val != 0; break; - case 6: condition = val <= 0; break; - default: condition = 1; break; - } - if (condition) - { - nia = do_branch (_SD, annul, target, 0, NULL); - } - TRACE_COND_BR(MY_INDEX, condition, val, target, size, code); - return nia; -} -31.Code,26.Source,21.0b100110,15.A,14.SignedOffset::::bcnd i -"bcnd%s , r, " -{ - nia = do_bcnd (_SD, nia, Code, vSource, A, vSignedOffset); -} -31.Code,26.Source,21.0b11100110,13.A,12.0,11./,4.IndOff::::bcnd r -"bcnd%s r, r, " -{ - nia = do_bcnd (_SD, nia, Code, vSource, A, rIndOff); -} -31.Code,26.Source,21.0b11100110,13.A,12.1,11./+LongSignedImmediate::::bcnd l -"bcnd%s , r, " -{ - nia = do_bcnd (_SD, nia, Code, vSource, A, LongSignedImmediate); -} - -// br[.a] - see bbz[.a] - - -// brcr -:function:::sim_cia:do_brcr:instruction_address nia, int cr -{ - if (cr >= 0x4000 || !(CPU)->is_user_mode) - { - unsigned32 control = CR (cr); - unsigned32 ie = control & 0x00000001; - unsigned32 pc = control & 0xfffffffc; - unsigned32 is_user_mode = control & 0x00000002; - (CPU)->is_user_mode = is_user_mode; - nia.dp = pc; - if (ie) - (CPU)->cr[IE_CR] |= IE_CR_IE; - else - (CPU)->cr[IE_CR] &= ~IE_CR_IE; - } - TRACE_UCOND_BR (MY_INDEX, nia.dp); - return nia; -} -31.//,27.0,26.//,21.0b0000110,14.UCRN::::brcr i -"brcr CR[]" -{ - nia = do_brcr (_SD, nia, UCRN); -} -31.//,27.0,26.//,21.0b110000110,12.0,11./,4.INDCR::::brcr r -"brcr CR[r]" -{ - nia = do_brcr (_SD, nia, UCRN); -} -31.//,27.0,26.//,21.0b110000110,12.1,11./+UnsignedControlRegisterNumber::::brcr l -"brcr CR[]" -{ - nia = do_brcr (_SD, nia, UnsignedControlRegisterNumber); -} - -// bsr[.a] -:function:::instruction_address:do_bsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset -{ - address_word target = cia.ip + 4 * offset; - nia = do_branch (_SD, annul, target, 1, rLink); - TRACE_UCOND_BR (MY_INDEX, target); - return nia; -} -31.Link,26./,21.0b100000,15.A,14.SignedOffset::::bsr i -"bsr%s , r" -{ - nia = do_bsr (_SD, nia, rLink, A, vSignedOffset); -} -31.Link,26./,21.0b11100000,13.A,12.0,11./,4.IndOff::::bsr r -"bsr%s r, r" -{ - nia = do_bsr (_SD, nia, rLink, A, rIndOff); -} -31.Link,26./,21.0b11100000,13.A,12.1,11./+LongSignedImmediate::::bsr l -"bsr%s , r" -{ - nia = do_bsr (_SD, nia, rLink, A, LongSignedImmediate); -} - -// cmnd -:function:::void:do_cmnd:signed32 source -{ - int Reset = EXTRACTED32 (source, 31, 31); - int Halt = EXTRACTED32 (source, 30, 30); - int Unhalt = EXTRACTED32 (source, 29, 29); - /* int ICR = EXTRACTED32 (source, 28, 28); */ - /* int DCR = EXTRACTED32 (source, 27, 27); */ - int Task = EXTRACTED32 (source, 14, 14); - int Msg = EXTRACTED32 (source, 13, 13); - int VC = EXTRACTED32 (source, 10, 10); - int TC = EXTRACTED32 (source, 9, 9); - int MP = EXTRACTED32 (source, 8, 8); - int PP = EXTRACTED32 (source, 3, 0); - /* what is implemented? */ - if (PP != 0) - sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - PPs not supported", - (unsigned long) cia.ip); - if (VC != 0) - sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - VC not supported", - (unsigned long) cia.ip); - if (TC != 0) - sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - TC not supported", - (unsigned long) cia.ip); - if (MP) - { - if (Reset || Halt) - sim_engine_halt (SD, CPU, NULL, cia, sim_exited, 0); - if (Unhalt) - sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not unhalt the MP", - (unsigned long) cia.ip); - /* if (ICR || DCR); */ - if (Task) - sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not Task the MP", - (unsigned long) cia.ip); - if (Msg) - sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Msg to MP not suported", - (unsigned long) cia.ip); - } - TRACE_SINK1 (MY_INDEX, source); -} -31./,21.0b0000010,14.UI::::cmnd i -"cmnd " -{ - do_cmnd (_SD, UI); -} -31./,21.0b110000010,12.0,11./,4.Source::::cmnd r -"cmnd r" -{ - do_cmnd (_SD, vSource); -} -31./,21.0b110000010,12.1,11./+LongUnsignedImmediate::::cmnd l -"cmnd " -{ - do_cmnd (_SD, LongUnsignedImmediate); -} - -// cmp -:function:::unsigned32:cmp_vals:signed32 s1, unsigned32 u1, signed32 s2, unsigned32 u2 -{ - unsigned32 field = 0; - if (s1 == s2) field |= 0x001; - if (s1 != s2) field |= 0x002; - if (s1 > s2) field |= 0x004; - if (s1 <= s2) field |= 0x008; - if (s1 < s2) field |= 0x010; - if (s1 >= s2) field |= 0x020; - if (u1 > u2) field |= 0x040; - if (u1 <= u2) field |= 0x080; - if (u1 < u2) field |= 0x100; - if (u1 >= u2) field |= 0x200; - return field; -} -:function:::void:do_cmp:unsigned32 *rDest, unsigned32 source1, unsigned32 source2 -{ - unsigned32 field = 0; - field |= cmp_vals (_SD, source1, source1, source2, source2) << 20; - field |= cmp_vals (_SD, (signed16)source1, (unsigned16)source1, - (signed16)source2, (unsigned16)source2) << 10; - field |= cmp_vals (_SD, (signed8)source1, (unsigned8)source1, - (signed8)source2, (unsigned8)source2); - TRACE_CMP (MY_INDEX, field, source1, source2); - *rDest = field; -} -31.Dest,26.Source2,21.0b1010000,14.SignedImmediate::::cmp i -"cmp , r, r" -{ - do_cmp (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b111010000,12.0,11./,4.Source1::::cmp r -"cmp r, r, r" -{ - do_cmp (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b111010000,12.1,11./+LongSignedImmediate::::cmp l -"cmp 0x%08lx, r, r" -{ - do_cmp (_SD, rDest, LongSignedImmediate, vSource2); -} - -// dcache -:%s::::F:int F -{ - if (F) - return "f"; - else - return "c"; -} -31./,27.F,26.Source2,21.0b0111,17.m,16.0b00,14.SignedOffset::::dcache i -"dcache%s (r%s)" -{ - TRACE_NOP (MY_INDEX); - /* NOP */ -} -31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.0,11./,4.Source1::::dcache r -"dcache%s r (r%s)" -{ - TRACE_NOP (MY_INDEX); - /* NOP */ -} -31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.1,11./+LongSignedImmediate::::dcache l -"dcache%s (r%s)" -{ - TRACE_NOP (MY_INDEX); - /* NOP */ -} - -// dld[{.b|.h|.d}] -void::function::do_dld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset -{ - do_ld (_SD, Dest, base, rBase, m, sz, S, offset); -} -31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld r -"dld%s r%s (r%s), r" -{ - do_dld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff); -} -31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld l -"dld%s 0x%08lx%s (r%s), r" -{ - do_dld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); -} - -// dld.u[{.b|.h|.d}] -void::function::do_dld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset -{ - do_ld_u (_SD, rDest, base, rBase, m, sz, S, offset); -} -31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld.u r -"dld.u%s r%s (r%s), r" -{ - do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff); -} -31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld.u l -"dld.u%s 0x%08lx%s (r%s), r" -{ - do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); -} - -// dst[{.b|.h|.d}] -void::function::do_dst:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset -{ - do_st (_SD, Source, base, rBase, m, sz, S, offset); -} -31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dst r -"dst%s r%s (r%s), r" -{ - do_dst (_SD, Source, vBase, rBase, m, sz, S, rIndOff); -} -31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dst l -"dst%s 0x%08lx%s (r%s), r" -{ - do_dst (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset); -} - -// estop -31./,21.0b1111111,14.1,13.0,12.0,11./::::estop - -// etrap -31./,27.1,26./,21.0b0000001,14.UTN::::etrap i -31./,27.1,26./,21.0b110000001,12.0,11./,4.iUTN::::etrap r -31./,27.1,26./,21.0b110000001,12.1,11./::::etrap l - - -// exts - see shift.ds - - -// extu - see shift.dz - - -sim_fpu::function::get_fp_reg:int reg, unsigned32 val, int precision -{ - sim_fpu ans; - switch (precision) - { - case 0: /* single */ - sim_fpu_32to (&ans, val); - break; - case 1: /* double */ - if (reg < 0) - sim_engine_abort (SD, CPU, cia, "DP immediate invalid"); - if (reg & 1) - sim_engine_abort (SD, CPU, cia, "DP FP register must be even"); - if (reg <= 1) - sim_engine_abort (SD, CPU, cia, "DP FP register must be >= 2"); - sim_fpu_232to (&ans, GPR (reg + 1), GPR (reg)); - break; - case 2: /* 32 bit signed integer */ - sim_fpu_i32to (&ans, val, 0); - break; - case 3: /* 32 bit unsigned integer */ - sim_fpu_u32to (&ans, val, 0); - break; - default: - sim_engine_abort (SD, CPU, cia, "Unsupported FP precision"); - } - return ans; -} -void::function::set_fp_reg:int Dest, sim_fpu val, int PD -{ - switch (PD) - { - case 0: /* single */ - { - sim_fpu_to32 (&GPR (Dest), &val); - break; - } - case 1: /* double */ - { - if (Dest & 1) - sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be even"); - if (Dest <= 1) - sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be >= 2"); - sim_fpu_to232 (&GPR (Dest + 1), &GPR (Dest + 0), &val); - break; - } - case 2: /* signed */ - { - sim_fpu_to32i (&GPR (Dest), &val, 0); - break; - } - case 3: /* unsigned */ - { - sim_fpu_to32u (&GPR (Dest), &val, 0); - break; - } - default: - sim_engine_abort (SD, CPU, cia, "Unsupported FP precision"); - } - -} -// fadd.{s|d}{s|d}{s|d} -void::function::do_fadd:int Dest, int PD, sim_fpu s1, sim_fpu s2 -{ - sim_fpu ans; - sim_fpu_add (&ans, &s1, &s2); - TRACE_FPU3 (ans, s1, s2); - set_fp_reg (_SD, Dest, ans, PD); -} -const char *::function::str_PX:int PX -{ - switch (PX) - { - case 0: return "s"; - case 1: return "d"; - case 2: return "i"; - case 3: return "u"; - default: return "?"; - } -} -31.Dest,26.Source2,21.0b111110000,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fadd r -"fadd.%s%s%s r, r, r" -{ - do_fadd (_SD, Dest, PD, - get_fp_reg (_SD, Source1, vSource1, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} -31.Dest,26.Source2,21.0b111110000,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fadd l -"fadd.%s%s%s 0x%08lx, r, r" -{ - do_fadd (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); - -} - -// fcmp.{s|d}{s|d}{s|d} -void::function::do_fcmp:unsigned32 *rDest, sim_fpu s1, sim_fpu s2 -{ - unsigned32 result = 0; - if (sim_fpu_is_nan (&s1) || sim_fpu_is_nan (&s2)) - result |= BIT32 (30); - else - { - result |= BIT32 (31); - if (sim_fpu_is_eq (&s1, &s2)) result |= BIT32(20); - if (sim_fpu_is_ne (&s1, &s2)) result |= BIT32(21); - if (sim_fpu_is_gt (&s1, &s2)) result |= BIT32(22); - if (sim_fpu_is_le (&s1, &s2)) result |= BIT32(23); - if (sim_fpu_is_lt (&s1, &s2)) result |= BIT32(24); - if (sim_fpu_is_ge (&s1, &s2)) result |= BIT32(25); - if (sim_fpu_is_lt (&s1, &sim_fpu_zero) - || sim_fpu_is_gt (&s1, &s2)) result |= BIT32(26); - if (sim_fpu_is_lt (&sim_fpu_zero, &s1) - && sim_fpu_is_lt (&s1, &s2)) result |= BIT32(27); - if (sim_fpu_is_le (&sim_fpu_zero, &s1) - && sim_fpu_is_le (&s1, &s2)) result |= BIT32(28); - if (sim_fpu_is_le (&s1, &sim_fpu_zero) - || sim_fpu_is_ge (&s1, &s2)) result |= BIT32(29); - } - *rDest = result; - TRACE_FPU2CMP (result, s1, s2); -} -31.Dest,26.Source2,21.0b111110101,12.0,11./,10.0,8.P2,6.P1,4.Source1::f::fcmp r -"fcmp.%s%s r, r, r" -{ - do_fcmp (_SD, rDest, - get_fp_reg (_SD, Source1, vSource1, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} -31.Dest,26.Source2,21.0b111110101,12.1,11./,10.0,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fcmp l -"fcmp.%s%s 0x%08lx, r, r" -{ - do_fcmp (_SD, rDest, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} - - -// fdiv.{s|d}{s|d}{s|d} -void::function::do_fdiv:int Dest, int PD, sim_fpu s1, sim_fpu s2 -{ - sim_fpu ans; - sim_fpu_div (&ans, &s1, &s2); - TRACE_FPU3 (ans, s1, s2); - set_fp_reg (_SD, Dest, ans, PD); -} -31.Dest,26.Source2,21.0b111110011,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fdiv r -"fdiv.%s%s%s r, r, r" -{ - do_fdiv (_SD, Dest, PD, - get_fp_reg (_SD, Source1, vSource1, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} -31.Dest,26.Source2,21.0b111110011,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fdiv l -"fdiv.%s%s%s 0x%08lx, r, r" -{ - do_fdiv (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} - -// fmpy.{s|d|i|u}{s|d|i|u}{s|d|i|u} -void::function::do_fmpy:int Dest, int PD, sim_fpu s1, sim_fpu s2 -{ - switch (PD) - { - case 2: /* signed */ - { - signed64 i1; - signed64 i2; - sim_fpu_to64i (&i1, &s1, 0); - sim_fpu_to64i (&i2, &s2, 0); - GPR (Dest) = i1 * i2; - TRACE_FPU2I (GPR (Dest), s1, s2); - break; - } - case 3: /* unsigned */ - { - unsigned64 u1; - unsigned64 u2; - sim_fpu_to64u (&u1, &s1, 0); - sim_fpu_to64u (&u2, &s2, 0); - GPR (Dest) = u1 * u2; - TRACE_FPU2I (GPR (Dest), s1, s2); - break; - } - default: - { - sim_fpu ans; - sim_fpu_mul (&ans, &s1, &s2); - set_fp_reg (_SD, Dest, ans, PD); - TRACE_FPU3 (ans, s1, s2); - } - } -} -31.Dest,26.Source2,21.0b111110010,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fmpy r -"fmpy.%s%s%s r, r, r" -{ - do_fmpy (_SD, Dest, PD, - get_fp_reg (_SD, Source1, vSource1, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} -31.Dest,26.Source2,21.0b111110010,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fmpy l -"fmpy.%s%s%s 0x%08lx, r, r" -{ - do_fmpy (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} - -// frndm.{s|d|i|u}{s|d|i|u} -void::function::do_frnd:int Dest, int PD, sim_fpu s1 -{ - set_fp_reg (_SD, Dest, s1, PD); - TRACE_FPU1 (s1); -} -31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b11,6.P1,4.Source::f::frndm r -"frndm.%s%s r, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, Source, vSource, P1)); -} -31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b11,6.P1,4./+SinglePrecisionFloatingPoint::f::frndm l -"frndm.%s%s 0x%08lx, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); -} - -// frndn.{s|d|i|u}{s|d|i|u} -31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b00,6.P1,4.Source::f::frndn r -"frndn.%s%s r, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, Source, vSource, P1)); -} -31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b00,6.P1,4./+SinglePrecisionFloatingPoint::f::frndn l -"frndn.%s%s 0x%08lx, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); -} - -// frndp.{s|d|i|u}{s|d|i|u} -31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b10,6.P1,4.Source::f::frndp r -"frndp.%s%s r, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, Source, vSource, P1)); -} -31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b10,6.P1,4./+SinglePrecisionFloatingPoint::f::frndp l -"frndp.%s%s 0x%08lx, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); -} - -// frndz.{s|d|i|u}{s|d|i|u} -31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b01,6.P1,4.Source::f::frndz r -"frndz.%s%s r, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, Source, vSource, P1)); -} -31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b01,6.P1,4./+SinglePrecisionFloatingPoint::f::frndz l -"frndz.%s%s 0x%08lx, r" -{ - do_frnd (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); -} - -// fsqrt.{s|d}{s|d}{s|d} -#void::function::do_fsqrt:unsigned32 *rDest, unsigned32 Source, unsigned32 Source2 -# sim_io_error ("fsqrt"); -31.Dest,26./,21.0b111110111,12.0,11./,10.PD,8.//,6.P1,4.Source::f::fsqrt r -"fsqrt.%s%s r, r" -# do_fsqrt (_SD, rDest, vSource); -31.Dest,26./,21.0b111110111,12.1,11./,10.PD,8.//,6.P1,4./+SinglePrecisionFloatingPoint::f::fsqrt l -"fsqrt.%s%s 0x%08lx, r" -# do_fsqrt (_SD, rDest, SinglePrecisionFloatingPoint); - - -// fsub.{s|d}{s|d}{s|d} -void::function::do_fsub:int Dest, int PD, sim_fpu s1, sim_fpu s2 -{ - sim_fpu ans; - sim_fpu_sub (&ans, &s1, &s2); - TRACE_FPU3 (ans, s1, s2); - set_fp_reg (_SD, Dest, ans, PD); -} -31.Dest,26.Source2,21.0b111110001,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fsub r -"fsub.%s%s%s r, r, r" -{ - do_fsub (_SD, Dest, PD, - get_fp_reg (_SD, Source1, vSource1, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} -31.Dest,26.Source2,21.0b111110001,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fsub l -"fsub.%s%s%s 0x%08lx, r, r" -{ - do_fsub (_SD, Dest, PD, - get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), - get_fp_reg (_SD, Source2, vSource2, P2)); -} - -// illop -31./,21.0b0000000,14./::::illop -"illop" -31./,21.0b111111111,12./::::illop l -"illop" - - -// ins - see sl.im - - -// jsr[.a] -instruction_address::function::do_jsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset, unsigned32 base -{ - address_word target = offset + base; - TRACE_UCOND_BR (MY_INDEX, target); - nia = do_branch (_SD, annul, target, 1, rLink); - if (nia.dp & 0x3) - sim_engine_abort (SD, CPU, cia, - "0x%lx: destination address 0x%lx misaligned", - (unsigned long) cia.ip, - (unsigned long) nia.dp); - return nia; -} -31.Link,26.Base,21.0b100010,15.A,14.SignedOffset::::jsr i -"jsr%s , r" -{ - nia = do_jsr (_SD, nia, rLink, A, vSignedOffset, vBase); -} -31.Link,26.Base,21.0b11100010,13.A,12.0,11./,4.IndOff::::jsr r -"jsr%s r, r" -{ - nia = do_jsr (_SD, nia, rLink, A, rIndOff, vBase); -} -31.Link,26.Base,21.0b11100010,13.A,12.1,11./+LongSignedImmediate::::jsr l -"jsr%s , r" -{ - nia = do_jsr (_SD, nia, rLink, A, LongSignedImmediate, vBase); -} - -// ld[{.b.h.d}] -void::function::do_ld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset -{ - unsigned32 addr; - switch (sz) - { - case 0: - addr = base + (S ? (offset << 0) : offset); - if (m) - *rBase = addr; - GPR(Dest) = MEM (signed, addr, 1); - break; - case 1: - addr = base + (S ? (offset << 1) : offset); - if (m) - *rBase = addr; - GPR(Dest) = MEM (signed, addr, 2); - break; - case 2: - addr = base + (S ? (offset << 2) : offset); - if (m) - *rBase = addr; - GPR(Dest) = MEM (signed, addr, 4); - break; - case 3: - { - signed64 val; - if (Dest & 0x1) - sim_engine_abort (SD, CPU, cia, "0x%lx: ld.d to odd register %d", - cia.ip, Dest); - addr = base + (S ? (offset << 3) : offset); - if (m) - *rBase = addr; - val = MEM (signed, addr, 8); - GPR(Dest + 1) = VH4_8 (val); - GPR(Dest + 0) = VL4_8 (val); - } - break; - default: - addr = -1; - sim_engine_abort (SD, CPU, cia, "ld - invalid sz %d", sz); - } - TRACE_LD (GPR(Dest), m, S, base, offset); -} -const char *::function::str_sz:int sz -{ - switch (sz) - { - case 0: return ".b"; - case 1: return ".h"; - case 2: return ""; - case 3: return ".d"; - default: return "?"; - } -} -const char *::function::str_m:int m -{ - if (m) - return ":m"; - else - return ""; -} -const char *::function::str_S:int S -{ - if (S) - return ":s"; - else - return ""; -} -31.Dest,26.Base,21.0b0100,17.m,16.sz,14.SignedOffset::::ld i -"ld%s (r%s), r" -{ - do_ld (_SD, Dest, vBase, rBase, m, sz, 0, vSignedOffset); -} -31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld r -"ld%s r%s (r%s), r" -{ - do_ld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff); -} -31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld l -"ld%s 0x%08lx%s (r%s), r" -{ - do_ld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); -} - -// ld.u[{.b.h.d}] -void::function::do_ld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset -{ - unsigned32 addr; - switch (sz) - { - case 0: - addr = base + (S ? (offset << 0) : offset); - *rDest = MEM (unsigned, addr, 1); - break; - case 1: - addr = base + (S ? (offset << 1) : offset); - *rDest = MEM (unsigned, addr, 2); - break; - default: - addr = -1; - sim_engine_abort (SD, CPU, cia, "ld.u - invalid sz %d", sz); - } - if (m) - *rBase = addr; - TRACE_LD (m, S, *rDest, base, offset); -} -31.Dest,26.Base,21.0b0101,17.m,16.sz,14.SignedOffset::::ld.u i -"ld.u%s (r%s), r" -{ - do_ld_u (_SD, rDest, vBase, rBase, m, sz, 0, vSignedOffset); -} -31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld.u r -"ld.u%s r%s (r%s), r" -{ - do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff); -} -31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld.u l -"ld.u%s 0x%08lx%s (r%s), r" -{ - do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); -} - -// lmo -31.Dest,26.Source,21.0b111111000,12.0,11./::::lmo -"lmo r, r" -{ - int b; - for (b = 0; b < 32; b++) - if (vSource & BIT32 (31 - b)) - break; - TRACE_ALU2 (MY_INDEX, b, vSource); - *rDest = b; -} - - -// nop - see rdcr 0, r0 - - -void::function::do_or:unsigned32 *rDest, unsigned32 Source1, unsigned32 Source2 -{ - unsigned32 result = Source1 | Source2; - TRACE_ALU3 (MY_INDEX, result, Source1, Source2); - *rDest = result; -} - -// or, or.tt -31.Dest,26.Source2,21.0b0010111,14.UnsignedImmediate::::or.tt i -"or.tt , r, r" -{ - do_or (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010111,12.0,11./,4.Source1::::or.tt r -"or.tt r, r, r" -{ - do_or (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010111,12.1,11./+LongUnsignedImmediate::::or.tt l -"or.tt 0x%08lx, r, r" -{ - do_or (_SD, rDest, LongUnsignedImmediate, vSource2); -} - -// or.ff -31.Dest,26.Source2,21.0b0011110,14.UnsignedImmediate::::or.ff i -"or.ff , r, r" -{ - do_or (_SD, rDest, ~vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110011110,12.0,11./,4.Source1::::or.ff r -"or.ff r, r, r" -{ - do_or (_SD, rDest, ~vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110011110,12.1,11./+LongUnsignedImmediate::::or.ff l -"or.ff 0x%08lx, r, r" -{ - do_or (_SD, rDest, ~LongUnsignedImmediate, ~vSource2); -} - -// or.ft -31.Dest,26.Source2,21.0b0011101,14.UnsignedImmediate::::or.ft i -"or.ft , r, r" -{ - do_or (_SD, rDest, ~vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110011101,12.0,11./,4.Source1::::or.ft r -"or.ft r, r, r" -{ - do_or (_SD, rDest, ~vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110011101,12.1,11./+LongUnsignedImmediate::::or.ft l -"or.ft 0x%08lx, r, r" -{ - do_or (_SD, rDest, ~LongUnsignedImmediate, vSource2); -} - -// or.tf -31.Dest,26.Source2,21.0b0011011,14.UnsignedImmediate::::or.tf i -"or.tf , r, r" -{ - do_or (_SD, rDest, vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110011011,12.0,11./,4.Source1::::or.tf r -"or.tf r, r, r" -{ - do_or (_SD, rDest, vSource1, ~vSource2); -} -31.Dest,26.Source2,21.0b110011011,12.1,11./+LongUnsignedImmediate::::or.tf l -"or.tf 0x%08lx, r, r" -{ - do_or (_SD, rDest, LongUnsignedImmediate, ~vSource2); -} - -// rdcr -void::function::do_rdcr:unsigned32 Dest, int cr -{ - TRACE_SINK2 (MY_INDEX, Dest, cr); - GPR (Dest) = CR (cr); -} -31.Dest,26.0,21.0b0000100,14.UCRN::::rdcr i -"rdcr CR[], r" -{ - do_rdcr (_SD, Dest, UCRN); -} -31.Dest,26.0,21.0b110000100,12.0,11./,4.INDCR::::rdcr r -"rdcr CR[r], r" -{ - do_rdcr (_SD, Dest, UCRN); -} -31.Dest,26.0,21.0b110000100,12.1,11./+UnsignedControlRegisterNumber::::rdcr l -"rdcr CR[], r" -{ - do_rdcr (_SD, Dest, UnsignedControlRegisterNumber); -} - -// rmo -31.Dest,26.Source,21.0b111111001,12.0,11./::::rmo -"rmo r, r" -{ - int b; - for (b = 0; b < 32; b++) - if (vSource & BIT32 (b)) - break; - if (b < 32) - b = 31 - b; - TRACE_ALU2 (MY_INDEX, b, vSource); - *rDest = b; -} - -// rotl - see sl.dz - - -// rotr - see sl.dz - - -// shl - see sl.iz - - -// sl.{d|e|i}{m|s|z} -void::function::do_shift:int Dest, unsigned32 source, int Merge, int i, int n, int EndMask, int Rotate -{ - /* see 10-30 for a reasonable description */ - unsigned32 input = source; - unsigned32 rotated; - unsigned32 endmask; - unsigned32 shiftmask; - unsigned32 cm; - int nRotate; - /* rotate the source */ - if (n) - { - rotated = ROTR32 (source, Rotate); - nRotate = (- Rotate) & 31; - } - else - { - rotated = ROTL32 (source, Rotate); - nRotate = Rotate; - } - /* form the end mask */ - if (EndMask == 0) - endmask = ~ (unsigned32)0; - else - endmask = (1 << EndMask) - 1; - if (i) - endmask = ~endmask; - /* form the shiftmask */ - switch (Merge) - { - case 0: case 1: case 2: - shiftmask = ~ (unsigned32)0; /* disabled */ - break; - case 3: case 5: /* enabled - 0 -> 32 */ - if (nRotate == 0) - shiftmask = ~ (unsigned32)0; - else - shiftmask = ((1 << nRotate) - 1); /* enabled - 0 -> 0 */ - break; - case 4: - shiftmask = ((1 << nRotate) - 1); /* enabled - 0 -> 0 */ - break; - case 6: case 7: - shiftmask = ~((1 << nRotate) - 1); /* inverted */ - break; - default: - sim_engine_abort (SD, CPU, cia, - "0x%lx: Invalid merge (%d) for shift", - (long) cia.ip, (int) source); - shiftmask = 0; - } - /* and the composite mask */ - cm = shiftmask & endmask; - /* and merge */ - switch (Merge) - { - case 0: case 3: case 6: /* zero */ - GPR (Dest) = rotated & cm; - break; - case 1: case 4: case 7: /* merge */ - GPR (Dest) = (rotated & cm) | (GPR (Dest) & ~cm); - break; - case 2: case 5: /* sign */ - { - int b; - GPR (Dest) = rotated & cm; - for (b = 1; b <= 31; b++) - if (!MASKED32 (cm, b, b)) - GPR (Dest) |= INSERTED32 (EXTRACTED32 (GPR (Dest), b - 1, b - 1), - b, b); - } - break; - default: - sim_engine_abort (SD, CPU, cia, - "0x%lx: Invalid merge (%d)", - (long) cia.ip, (int) source); - } - TRACE_SHIFT (MY_INDEX, GPR (Dest), input, i, n, Merge, EndMask, Rotate); -} -const char *::function::str_Merge:int Merge -{ - switch (Merge) - { - case 0: return "dz"; - case 1: return "dm"; - case 2: return "ds"; - case 3: return "ez"; - case 4: return "em"; - case 5: return "es"; - case 6: return "iz"; - case 7: return "im"; - default: return "?"; - } -} -31.Dest,26.Source,21.0b0001,17.Merge,14./,11.i,10.n,9.EndMask,4.Rotate::::sl i -"sl.%s , , r, r" -{ - do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, Rotate); -} -31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.i,10.n,9.EndMask,4.RotReg::::sl r -"sl.%s r, , r, r" -{ - do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, GPR (RotReg) & 31); -} - -// sli.{d|e|i}{m|s|z} - see shift - - -// sr.{d|e|i}{m|s|z} - see shift - - -// sra - see sr.es - see shift - - -// sri.{d|e|i}{m|s|z} - see shift - - -// srl - see sr.ez - - -// st[{.b|.h|.d}] -void::function::do_st:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset -{ - unsigned32 addr; - switch (sz) - { - case 0: - addr = base + (S ? (offset << 0) : offset); - STORE (addr, 1, GPR(Source)); - break; - case 1: - addr = base + (S ? (offset << 1) : offset); - STORE (addr, 2, GPR(Source)); - break; - case 2: - addr = base + (S ? (offset << 2) : offset); - STORE (addr, 4, GPR(Source)); - break; - case 3: - { - signed64 val; - if (Source & 0x1) - sim_engine_abort (SD, CPU, cia, - "0x%lx: st.d with odd source register %d", - cia.ip, Source); - addr = base + (S ? (offset << 3) : offset); - val = U8_4 (GPR(Source + 1), GPR(Source)); - STORE (addr, 8, val); - } - break; - default: - addr = -1; - sim_engine_abort (SD, CPU, cia, "st - invalid sz %d", sz); - } - if (m) - *rBase = addr; - TRACE_ST (Source, m, S, base, offset); -} -31.Source,26.Base,21.0b0110,17.m,16.sz,14.SignedOffset::::st i -"st%s (r%s), r" -{ - do_st (_SD, Source, vBase, rBase, m, sz, 0, vSignedOffset); -} -31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::st r -"st%s r%s (r%s), r" -{ - do_st (_SD, Source, vBase, rBase, m, sz, S, rIndOff); -} -31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::st l -"st%s 0x%08lx%s (r%s), r" -{ - do_st (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset); -} - -// sub -void::function::do_sub:signed32 *rDest, signed32 Source1, signed32 Source2 -{ - ALU_BEGIN (Source1); - ALU_SUB (Source2); - ALU_END (*rDest); - TRACE_ALU3 (MY_INDEX, *rDest, Source1, Source2); -} -31.Dest,26.Source2,21.0b101101,15.0,14.SignedImmediate::::sub i -"sub , r, r" -{ - do_sub (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101101,13.0,12.0,11./,4.Source1::::sub r -"sub r, r, r" -{ - do_sub (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101101,13.0,12.1,11./+LongSignedImmediate::::sub l -"sub 0x%08lx, r, r" -{ - do_sub (_SD, rDest, LongSignedImmediate, vSource2); -} - -// subu -void::function::do_subu:unsigned32 *rDest, unsigned32 Source1, signed32 Source2 -{ - unsigned32 result = Source1 - Source2; - TRACE_ALU3 (MY_INDEX, result, Source1, Source2); - *rDest = result; -} -// NOTE - the book has 15.1 which conflicts with subu. -31.Dest,26.Source2,21.0b101101,15.1,14.SignedImmediate::::subu i -"subu , r, r" -{ - do_subu (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101101,13.1,12.0,11./,4.Source1::::subu r -"subu r, r, r" -{ - do_subu (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b11101101,13.1,12.1,11./+LongSignedImmediate::::subu l -"subu 0x%08lx, r, r" -{ - do_subu (_SD, rDest, LongSignedImmediate, vSource2); -} - -// swcr -void::function::do_swcr:int Dest, signed32 source, signed32 cr -{ - tic80_control_regs reg = tic80_index2cr (cr); - /* cache the old CR value */ - unsigned32 old_cr = CR (cr); - /* Handle the write if allowed */ - if (cr >= 0x4000 || !(CPU)->is_user_mode) - switch (reg) - { - case INTPEN_CR: - CR (cr) &= ~source; - break; - default: - CR (cr) = source; - break; - } - /* Finish off the read */ - GPR (Dest) = old_cr; - TRACE_SINK3 (MY_INDEX, source, cr, Dest); -} -31.Dest,26.Source,21.0b000010,15.1,14.UCRN::::swcr i -"swcr CR[], r" -{ - do_swcr (_SD, Dest, vSource, UCRN); -} -31.Dest,26.Source,21.0b11000010,13.1,12.0,11./,4.INDCR::::swcr r -"swcr CR[r], r" -{ - do_swcr (_SD, Dest, vSource, UCRN); -} -31.Dest,26.Source,21.0b11000010,13.1,12.1,11./+LongUnsignedControlRegisterNumber::::swcr l -"swcr CR[], r" -{ - do_swcr (_SD, Dest, vSource, LongUnsignedControlRegisterNumber); -} - -// trap -void::function::do_trap:unsigned32 trap_number -{ - int i; - TRACE_SINK1 (MY_INDEX, trap_number); - switch (trap_number) - { - case 72: - switch (GPR(15)) - { - case 1: /* EXIT */ - { - sim_engine_halt (SD, CPU, NULL, cia, sim_exited, GPR(2)); - break; - } - case 4: /* WRITE */ - { - unsigned i; - if (GPR(2) == 1) - for (i = 0; i < GPR(6); i++) - { - char c; - c = MEM (unsigned, GPR(4) + i, 1); - sim_io_write_stdout (SD, &c, 1); - } - else if (GPR(2) == 2) - for (i = 0; i < GPR(6); i++) - { - char c; - c = MEM (unsigned, GPR(4) + i, 1); - sim_io_write_stderr (SD, &c, 1); - } - else - sim_engine_abort (SD, CPU, cia, - "0x%lx: write to invalid fid %d", - (long) cia.ip, (int) GPR(2)); - GPR(2) = GPR(6); - break; - } - case 20: /* GETPID */ - { - GPR(2) = getpid (); - break; - } - case 37: /* KILL */ - if ( GPR (2) != (unsigned) getpid ()) - { - int ret = kill (GPR(2), GPR(4)); - if (ret < 0) - ret = -errno; - GPR (2) = ret; - break; - } - else - { - sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, GPR(4)); - break; - } - default: - /* For system calls which are defined, just return EINVAL instead of trapping */ - if (GPR(15) <= 204) - { - GPR(2) = -22; /* -EINVAL */ - break; - } - sim_engine_abort (SD, CPU, cia, - "0x%lx: unknown syscall %d", - (long) cia.ip, (int) GPR(15)); - } - break; - case 73: - sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP); - - /* Add a few traps for now to print the register state */ - case 74: - case 75: - case 76: - case 77: - case 78: - case 79: - if (!TRACE_ALU_P (CPU)) - trace_one_insn (SD, CPU, cia.ip, 1, itable[MY_INDEX].file, - itable[MY_INDEX].line_nr, "trap", - "Trap %ld", (long) trap_number); - - for (i = 0; i < 32; i++) - sim_io_eprintf (SD, "%s0x%.8lx%s", ((i % 8) == 0) ? "\t" : " ", (long)GPR(i), - (((i+1) % 8) == 0) ? "\n" : ""); - sim_io_write_stderr (SD, "\n", 1); - break; - - default: - sim_engine_abort (SD, CPU, cia, - "0x%lx: unsupported trap %d", - (long) cia.ip, (int) trap_number); - } -} -31./,27.0,26./,21.0b0000001,14.UTN::::trap i -"trap " -{ - do_trap (_SD, UTN); -} -31./,27.0,26./,21.0b110000001,12.0,11./,4.INDTR::::trap r -"trap r" -{ - do_trap (_SD, UTN); -} -31./,27.0,26./,21.0b110000001,12.1,11./+UTN::::trap l -"trap 0x%08lx" -{ - do_trap (_SD, UTN); -} - -// vadd.{s|d}{s|d} -31.*,26.Dest,21.0b11110,16./,15.0b000,12.0,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd r -31.*,26.Dest,21.0b11110,16./,15.0b000,12.1,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd l - - -// vld{0|1}.{s|d} - see above - same instruction -#31.Dest,26.*,21.0b11110,16.*,10.1,9.S,8.*,6.p,7.******::f::vld - - -// vmac.ss{s|d} -#31.*, 26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmac.ss ra -31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmac.ss rr -#31.*, 26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmac.ss ia -31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmac.ss ir - - -// vmpy.{s|d}{s|d} -31.*,26.Dest,21.0b11110,16./,15.0b010,12.0,11./,10.*,8.*,7.PD,6.*,5.P1,4.Source::f::vmpy r -31.*,26.Dest,21.0b11110,16./,15.0b010,12.1,11./,10.*,8.*,7.PD,6.*,5.P1,4./::f::vmpy l - - -// vmsc.ss{s|d} -#31.*, 26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmsc.ss ra -31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmsc.ss rr -#31.*, 26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmsc.ss ia -31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmsc.ss ir - - -// vmsub.{s|d}{s|d} -31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.0,11.a1,10.*,8.Z,7.PD,6.*,5./,4.Source::f::vmsub r -31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.1,11.a1,10.*,8.Z,7.PD,6.*,5./,4./::f::vmsub l - - -// vrnd.{s|d}{s|d} -31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.0,11.a1,10.*,8.PD,6.*,5.P1,4.Source::f::vrnd f r -31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.1,11.a1,10.*,8.PD,6.*,5.P1,4./::f::vrnd f l - - -// vrnd.{i|u}{s|d} -31.*,26.Dest,21.0b11110,16./,15.0b101,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vrnd i r -31.*,26.Dest,21.0b11110,16./,15.0b101,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vrnd i l - - -// vst.{s|d} - see above - same instruction -#31.Source,26.*,21.0b11110,16.*,10.0,9.S,8.*,6.1,5.*::f::vst - - -// vsub.{i|u}{s|d} -31.*,26.Dest,21.0b11110,16./,15.0b001,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vsub r -31.*,26.Dest,21.0b11110,16./,15.0b001,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vsub l - - -// wrcr - see swcr, creg, source, r0 - - -// xnor -void::function::do_xnor:signed32 *rDest, signed32 source1, signed32 source2 -{ - unsigned32 result = ~ (source1 ^ source2); - TRACE_ALU3 (MY_INDEX, result, source1, source2); - *rDest = result; -} -31.Dest,26.Source2,21.0b0011001,14.UnsignedImmediate::::xnor i -"xnor , r, r" -{ - do_xnor (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110011001,12.0,11./,4.Source1::::xnor r -"xnor r, r, r" -{ - do_xnor (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110011001,12.1,11./+LongUnsignedImmediate::::xnor l -"xnor 0x%08lx, r, r" -{ - do_xnor (_SD, rDest, LongUnsignedImmediate, vSource2); -} - -// xor -void::function::do_xor:signed32 *rDest, signed32 source1, signed32 source2 -{ - unsigned32 result = source1 ^ source2; - TRACE_ALU3 (MY_INDEX, result, source1, source2); - *rDest = result; -} -31.Dest,26.Source2,21.0b0010110,14.UnsignedImmediate::::xor i -"xor , r, r" -{ - do_xor (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010110,12.0,11./,4.Source1::::xor r -"xor r, r, r" -{ - do_xor (_SD, rDest, vSource1, vSource2); -} -31.Dest,26.Source2,21.0b110010110,12.1,11./+LongUnsignedImmediate::::xor l -"xor 0x%08lx, r, r" -{ - do_xor (_SD, rDest, LongUnsignedImmediate, vSource2); -} diff --git a/sim/w65/ChangeLog b/sim/w65/ChangeLog index 088f8b24867..ea4ffbe3041 100644 --- a/sim/w65/ChangeLog +++ b/sim/w65/ChangeLog @@ -1,3 +1,7 @@ +2002-06-08 Andrew Cagney + + * interp.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + Tue May 23 21:39:23 2000 Andrew Cagney * configure: Regenerated to track ../common/aclocal.m4 changes. diff --git a/sim/w65/interp.c b/sim/w65/interp.c index 36c4e322c9c..a4b325a1cc7 100644 --- a/sim/w65/interp.c +++ b/sim/w65/interp.c @@ -33,8 +33,8 @@ #endif #include #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "../../newlib/libc/sys/w65/sys/syscall.h" #include "interp.h" diff --git a/sim/z8k/ChangeLog b/sim/z8k/ChangeLog index 8036fe331cf..b6f5ed8346c 100644 --- a/sim/z8k/ChangeLog +++ b/sim/z8k/ChangeLog @@ -1,3 +1,20 @@ +2002-06-09 Andrew Cagney + + * iface.c: Include "gdb/callback.h" and "gdb/remote-sim.h". + * support.c: Ditto. + +2002-06-06 Andrew Cagney + + * writecode.c (lookup_inst): Generate inverse table on-the-fly. + (z8k_inv_list): Delete global. + (DIRTY_HACK): Delete macro. + (makelist): Delete global. + (main): Delete code making a list. Delete dirty hack code. Use + lookup_inst instead of z8k_inv_list. + * list.c: Delete file. + * Makefile.in (writecode): Do not link in list.o. + (list.o): Delete target. + 2002-04-29 Nick Clifton * writecode.c (lookup_inst): Ignore CLASS_IGNORE. diff --git a/sim/z8k/Makefile.in b/sim/z8k/Makefile.in index f6432d4157a..db3f9318ac3 100644 --- a/sim/z8k/Makefile.in +++ b/sim/z8k/Makefile.in @@ -49,15 +49,12 @@ tc-gen3.h:writecode tc-genb3.h:writecode ./writecode -b3 >tc-genb3.h -writecode: writecode.o list.o bquick.o - $(CC_FOR_BUILD) -o writecode writecode.o list.o bquick.o +writecode: writecode.o bquick.o + $(CC_FOR_BUILD) -o writecode writecode.o bquick.o writecode.o: writecode.c $(CONFIG_H) $(CC_FOR_BUILD) -c $(CFLAGS) $(HDEFINES) $(CSEARCH) $(CSWITCHES) $(srcdir)/writecode.c -list.o: list.c - $(CC_FOR_BUILD) -c $(CFLAGS) $(HDEFINES) $(CSEARCH) $(CSWITCHES) $(srcdir)/list.c - # Two copies of quick.o are created. One for $build and one for $host. bquick.o: quick.c $(CC_FOR_BUILD) -c $(CFLAGS) $(HDEFINES) $(CSEARCH) $(CSWITCHES) $(srcdir)/quick.c -o bquick.o diff --git a/sim/z8k/iface.c b/sim/z8k/iface.c index 1b3883ef545..c76d63f30a6 100644 --- a/sim/z8k/iface.c +++ b/sim/z8k/iface.c @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "tm.h" #include "signal.h" #include "bfd.h" -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #ifndef NULL #define NULL 0 diff --git a/sim/z8k/support.c b/sim/z8k/support.c index 73923640628..e3cdc736e03 100644 --- a/sim/z8k/support.c +++ b/sim/z8k/support.c @@ -36,8 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include -#include "callback.h" -#include "remote-sim.h" +#include "gdb/callback.h" +#include "gdb/remote-sim.h" #include "syscall.h" static int get_now PARAMS ((void)); diff --git a/sim/z8k/writecode.c b/sim/z8k/writecode.c index b398545c04f..acff7c462f9 100644 --- a/sim/z8k/writecode.c +++ b/sim/z8k/writecode.c @@ -1,6 +1,6 @@ - /* generate instructions for Z8KSIM - Copyright (C) 1992, 1993 Free Software Foundation, Inc. + + Copyright 1992, 1993, 2002 Free Software Foundation, Inc. This file is part of Z8KSIM @@ -35,9 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -b3 tc-genb3.h same as -3 but for long pointers - -m regenerates list.c, which is an inverted list of opcodes to - pointers into the z8k dissassemble opcode table, it's just there - to makes things faster. */ /* steve chamberlain @@ -65,8 +62,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NOPS 500 -#define DIRTY_HACK 0 /* Enable if your gcc can't cope with huge tables */ -extern short z8k_inv_list[]; struct opcode_value { int n; @@ -84,7 +79,6 @@ static char *reg_names[] = #define SIZE_ADDRESS (BIG ? 8 : 4) /* number of nibbles in a ptr*/ static int file; -static int makelist; static int nibs = 0; @@ -103,7 +97,16 @@ static opcode_entry_type * lookup_inst (what) int what; { - if (makelist) + static short *z8k_inv_list = NULL; + const nr_z8k_inv_list_elements = 1 << 16; + if (z8k_inv_list == NULL) + { + /* Initialize the list to 0xff == -1 */ + z8k_inv_list = calloc (nr_z8k_inv_list_elements, sizeof (short)); + memset (z8k_inv_list, 0xff, nr_z8k_inv_list_elements * sizeof (short)); + } + /* Entry empty? Fill it in. */ + if (z8k_inv_list[what] == -1) { int nibl_index; @@ -121,6 +124,9 @@ lookup_inst (what) instr_nibbles[1] = (what >> 8) & 0xf; instr_nibbles[0] = (what >> 12) & 0xf; + /* Assume it won't be found. */ + z8k_inv_list[what] = -2; + while (ptr->name) { nibl_matched = 1; @@ -181,19 +187,15 @@ lookup_inst (what) } if (nibl_matched) { - return ptr; + z8k_inv_list[what] = ptr->idx; + break; /* while */ } ptr++; } - return 0; - } - else - { - - if (z8k_inv_list[what] < 0) - return 0; - return z8k_table + z8k_inv_list[what]; } + if (z8k_inv_list[what] >= 0) + return z8k_table + z8k_inv_list[what]; + return 0; } static char * @@ -1677,12 +1679,8 @@ main (ac, av) int i; int needcomma = 0; - makelist = 0; - for (i = 1; i < ac; i++) { - if (strcmp (av[i], "-m") == 0) - makelist = 1; if (strcmp (av[i], "-1") == 0) file = 1; if (strcmp (av[i], "-2") == 0) @@ -1696,52 +1694,6 @@ main (ac, av) } } - if (makelist) - { - - int i; - needcomma = 0; - printf ("short int z8k_inv_list[] = {\n"); - - for (i = 0; i < 1 << 16; i++) - { - opcode_entry_type *p = lookup_inst (i); - - if(needcomma) - printf(","); - if ((i & 0xf) == 0) - printf ("\n"); - -#if 0 - printf ("\n /*%04x %s */", i, p ? p->nicename : ""); -#endif - - if (!p) - { - printf ("-1"); - } - else - { - printf ("%d", p->idx); - } - - if ((i & 0x3f) == 0 && DIRTY_HACK) - { - printf ("\n#ifdef __GNUC__\n"); - printf ("};\n"); - printf("short int int_list%d[] = {\n", i); - printf ("#else\n"); - printf (",\n"); - printf ("#endif\n"); - needcomma = 0; - } - else - needcomma = 1; - - } - printf ("};\n"); - return 1; - } /* First work out which opcodes use which bit patterns, build a list of all matching bit pattens */ @@ -1776,9 +1728,7 @@ main (ac, av) { int t = quick[i]; - mangle (z8k_table + z8k_inv_list[t], - 1, - t); + mangle (lookup_inst (t), 1, t); } } if (file == 3) @@ -1809,16 +1759,6 @@ main (ac, av) printf (","); emit ("_%d\n", i); needcomma = 1; - if ((i & 0x3f) == 0 && DIRTY_HACK) - { - printf ("#ifdef __GNUC__\n"); - printf ("};\n"); - emit ("int (*(_table%d[]))() = {\n", i); - printf ("#else\n"); - printf (",\n"); - printf ("#endif\n"); - needcomma = 0; - } } emit ("};\n"); } @@ -1854,8 +1794,7 @@ main (ac, av) printf ("struct op_info op_info_table[] = {\n"); for (i = 0; i < 1 << 16; i++) { - int inv = z8k_inv_list[i]; - opcode_entry_type *p = z8k_table + inv; + opcode_entry_type *p = lookup_inst (i); if (needcomma) printf (","); @@ -1866,13 +1805,13 @@ main (ac, av) } else #endif - if (inv >= 0) + if (p != NULL) { - printf ("%d", inv); + printf ("%d", p->idx); } else printf ("400"); - if (inv >= 0) + if (p != NULL) { printf (" /* %04x %s */\n", i, p->nicename); } @@ -1881,17 +1820,6 @@ main (ac, av) printf ("\n"); } needcomma = 1; - if ((i & 0x3f) == 0 && DIRTY_HACK) - { - printf ("#ifdef __GNUC__\n"); - printf ("}; \n"); - printf ("struct op_info op_info_table%d[] = {\n", i); - printf ("#else\n"); - printf (",\n"); - - printf ("#endif\n"); - needcomma = 0; - } } printf ("};\n");